/* ---- Theme: Light (default) / Dark ----
   "Aurora" look: deep midnight + electric indigo/violet/cyan, glass surfaces,
   a floating dock nav. Two modes, toggled by #theme-toggle-btn (theme.js).
   Keep the color tokens as plain hex: app.js reads --text/--muted/--border/
   --accent/--accent2/--neutral/--risk/--bearish via getComputedStyle and hands
   them to Chart.js, which can't parse color-mix()/gradients. */
:root,
:root[data-theme="light"] {
  /* Status colours are deep enough for WCAG AA (4.5:1) as text on white
     and inside their tinted pills (checked 2026-10-05). */
  --bg: #eceffa;
  --panel: #ffffff;
  --panel-alt: #f3f4fb;
  --border: #dde1ef;
  --text: #0f1222;
  --muted: #586079;
  --bullish: #166534;
  --bearish: #991b1b;
  --neutral: #92400e;
  --risk: #9a3412;
  --accent: #4f46e5;
  --accent-contrast: #ffffff;
  --accent2: #155e75;
  --violet: #7c3aed;
  --header-bg: #0b0d18;
  --header-text: #eef0fa;
  --header-border: #1f2338;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(15, 18, 34, 0.08);
  --aurora-1: rgba(79, 70, 229, 0.20);
  --aurora-2: rgba(124, 58, 237, 0.14);
  --aurora-3: rgba(6, 182, 212, 0.14);
  --grid-line: rgba(15, 18, 34, 0.05);
  --shadow-card: 0 1px 2px rgba(15, 18, 34, 0.04), 0 12px 32px -8px rgba(15, 18, 34, 0.10);
  --shadow-lift: 0 2px 4px rgba(15, 18, 34, 0.05), 0 24px 48px -12px rgba(49, 46, 129, 0.22);
  --shadow-accent: 0 8px 24px -6px rgba(79, 70, 229, 0.45);
}

:root[data-theme="dark"] {
  --bg: #07080f;
  --panel: #0f1220;
  --panel-alt: #161a2d;
  --border: #242a44;
  --text: #e9ebf7;
  --muted: #959cb8;
  --bullish: #34d399;
  --bearish: #fb7185;
  --neutral: #fbbf24;
  --risk: #fb923c;
  --accent: #818cf8;
  --accent-contrast: #0b0d18;
  --accent2: #22d3ee;
  --violet: #a78bfa;
  --header-bg: #05060c;
  --header-text: #e9ebf7;
  --header-border: #1a1e32;
  --glass: rgba(15, 18, 32, 0.66);
  --glass-border: rgba(255, 255, 255, 0.08);
  --aurora-1: rgba(99, 102, 241, 0.28);
  --aurora-2: rgba(139, 92, 246, 0.20);
  --aurora-3: rgba(34, 211, 238, 0.14);
  --grid-line: rgba(255, 255, 255, 0.035);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -12px rgba(0, 0, 0, 0.6);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.3), 0 28px 56px -12px rgba(0, 0, 0, 0.75);
  --shadow-accent: 0 8px 28px -6px rgba(129, 140, 248, 0.55);
}

:root {
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-heading: 'Sora', var(--font-body);
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 18px;
  --radius-sm: 11px;
  --grad-accent: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #9333ea 100%);
  --grad-text: linear-gradient(100deg, #6366f1 0%, #8b5cf6 40%, #06b6d4 100%);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

/* Generic utility -- overrides any component's own `display` (e.g. .btn's
   inline-flex) regardless of selector order. The older scoped rules like
   .overlay.hidden below are redundant with this but kept for clarity. */
.hidden { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

a { color: var(--accent); text-underline-offset: 3px; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---- Header: dark glass bar, sticky, on every in-app page ---- */
header {
  position: sticky;
  top: 0;
  z-index: 70;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--header-bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  color: var(--header-text);
  border-bottom: 1px solid color-mix(in srgb, var(--header-text) 9%, transparent);
}
header .muted { color: color-mix(in srgb, var(--header-text) 60%, transparent); }
header a { color: inherit; }

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

h1, h2, h3 { font-family: var(--font-heading); letter-spacing: -0.02em; }
h1 { font-size: 17px; margin: 0; display: flex; align-items: center; gap: 10px; font-weight: 700; }

/* Brand mark: gradient tile with the pulse icon. Used in <header> and in
   .auth-topbar's .wordmark. */
.logo-mark {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: var(--grad-accent);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 6px 18px -4px rgba(99, 102, 241, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.logo-mark .icon { width: 17px; height: 17px; }
.brand-link { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }

.theme-toggle-btn {
  background: color-mix(in srgb, var(--header-text) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--header-text) 16%, transparent);
  color: var(--header-text);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.3s var(--ease);
}
.theme-toggle-btn:hover { background: color-mix(in srgb, var(--header-text) 14%, transparent); transform: rotate(-15deg); }
/* On pages without a dark header (auth/legal cards on the body background),
   this class swaps to text-colored so it stays visible. */
.theme-toggle-btn.on-body { color: var(--muted); border-color: var(--border); background: var(--glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.theme-toggle-btn.on-body:hover { background: var(--panel); color: var(--text); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge.open { color: var(--bullish); border-color: var(--bullish); }
.badge.closed { color: var(--muted); }
.badge.realtime { color: var(--bullish); border-color: var(--bullish); }
.badge.delayed { color: var(--risk); border-color: var(--risk); }
/* Badges sit on the always-dark header regardless of light/dark mode --
   give them their own subtle-on-dark treatment instead of var(--panel-alt). */
header .badge {
  background: color-mix(in srgb, var(--header-text) 7%, transparent);
  border-color: color-mix(in srgb, var(--header-text) 14%, transparent);
  color: color-mix(in srgb, var(--header-text) 85%, transparent);
}
header .badge.open, header .badge.realtime { color: #4ade80; border-color: rgba(74, 222, 128, 0.4); background: rgba(74, 222, 128, 0.08); }
header .badge.delayed { color: #fb923c; border-color: rgba(251, 146, 60, 0.4); background: rgba(251, 146, 60, 0.08); }
header .badge.closed { color: color-mix(in srgb, var(--header-text) 70%, transparent); }
/* Live dot on "open"/"real-time" badges. */
header .badge.open::before, header .badge.realtime::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: live-pulse 2s infinite;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); }
  70% { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.muted { color: var(--muted); font-size: 12px; }

/* Icon system: inline SVGs everywhere instead of emoji. currentColor means
   every icon automatically matches its surrounding text color/theme. */
.icon { width: 16px; height: 16px; flex-shrink: 0; vertical-align: -3px; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }
.icon-inline { display: inline-flex; }
.icon-star { fill: none; }
.watch-btn.active .icon-star { fill: currentColor; }

/* ---- Buttons ---- */
.btn {
  position: relative;
  background: var(--grad-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
  letter-spacing: 0.005em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: var(--shadow-accent), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  font-family: var(--font-body);
  text-decoration: none;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), filter 0.2s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.08); box-shadow: 0 12px 32px -6px rgba(99, 102, 241, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.btn:active { transform: translateY(0); filter: brightness(0.96); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.btn-secondary:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.15); filter: none; }
/* Secondary buttons on the dark header need a dark-glass treatment. */
header .btn-secondary {
  background: color-mix(in srgb, var(--header-text) 7%, transparent);
  color: var(--header-text);
  border-color: color-mix(in srgb, var(--header-text) 16%, transparent);
}
header .btn-secondary:hover { background: color-mix(in srgb, var(--header-text) 14%, transparent); }
.btn-lg { padding: 14px 24px; font-size: 15px; border-radius: 13px; }
.btn-danger { background: var(--bearish); box-shadow: none; }
.btn-danger:hover { box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--bearish) 60%, transparent); }
.section-title.danger-title { color: var(--bearish); }

/* Utility: center a standalone button or button row (form submits, a lone
   card action) instead of leaving it left-aligned by document flow. Not
   applied to toolbars/nav groups, which need their own alignment. */
.btn-row-center { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* ---- Voice / alert banners (scanner) ---- */
.voice-banner {
  position: relative;
  margin: 18px 24px 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  animation: rise-in 0.5s var(--ease);
}
.voice-banner::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 2px;
  background: var(--grad-text);
}
.voice-banner.hidden { display: none; }

.alert-banner { border: 1px solid var(--border); border-left: 4px solid var(--accent); animation: alert-pop 0.35s var(--ease); }
.alert-banner::before { display: none; }
.alert-banner.alert-bullish { border-left-color: var(--bullish); box-shadow: var(--shadow-card), 0 0 0 1px color-mix(in srgb, var(--bullish) 20%, transparent); }
.alert-banner.alert-bearish { border-left-color: var(--bearish); box-shadow: var(--shadow-card), 0 0 0 1px color-mix(in srgb, var(--bearish) 20%, transparent); }
@keyframes alert-pop {
  from { transform: scale(0.97) translateY(6px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes rise-in {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.voice-title { font-family: var(--font-heading); font-weight: 700; font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.voice-title .icon { color: var(--accent); }

.voice-row {
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 8px;
  border-left: 3px solid transparent;
}
.voice-bullish { background: color-mix(in srgb, var(--bullish) 8%, transparent); border-left-color: var(--bullish); }
.voice-bearish { background: color-mix(in srgb, var(--bearish) 8%, transparent); border-left-color: var(--bearish); }

.voice-row-header { font-weight: 700; font-size: 14px; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.voice-bullish .voice-row-header span { color: var(--bullish); font-family: var(--font-mono); }
.voice-bearish .voice-row-header span { color: var(--bearish); font-family: var(--font-mono); }

.voice-reason { font-size: 13px; color: var(--muted); line-height: 1.55; }
.voice-headline { font-size: 12px; color: var(--text); font-style: italic; margin-top: 6px; opacity: 0.85; }

/* Kept in the DOM (the narration logic still reads its own copy of this
   text independently) but visually removed from the top-signals banner,
   which shows a sparkline chart in its place instead. */
.hidden-reason { display: none; }

.mini-chart { margin-top: 6px; }
.sparkline-svg { width: 100%; height: 44px; display: block; }
.sparkline-meta { display: flex; justify-content: space-between; font-size: 11px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.sparkline-meta .muted { font-size: 11px; }

.voice-close {
  position: absolute;
  top: 12px; right: 14px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 8px;
}
.voice-close .icon { width: 18px; height: 18px; }
.voice-close:hover { color: var(--text); background: var(--panel-alt); }

.voice-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.voice-replay { margin: 0; }
.voice-select-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.voice-select {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  max-width: 220px;
}

/* ---- Scanner toolbar ---- */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px 14px;
  flex-wrap: wrap;
  gap: 12px;
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: 14px;
  box-shadow: var(--shadow-card);
}
.tab {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  transition: color 0.2s, background 0.2s;
}
.tab:hover { color: var(--text); background: var(--panel-alt); }
.tab.active { background: var(--grad-accent); color: #fff; font-weight: 700; box-shadow: var(--shadow-accent); }

.filters { display: flex; gap: 8px; align-items: center; }
.filters select, .filters input {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-body);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.filters select:focus, .filters input:focus,
.auth-field input:focus, .subscribe-card input[type="tel"]:focus, .trade-form input:focus, .trade-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.ticker-search-wrap { position: relative; }
.ticker-search-wrap input { width: 240px; }
.ticker-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: var(--shadow-lift);
}
.ticker-suggestions.hidden { display: none; }
.suggestion-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover, .suggestion-item.active { background: var(--panel-alt); }
.suggestion-item.active { box-shadow: inset 3px 0 0 var(--accent); }
.suggestion-symbol { font-weight: 700; color: var(--accent); flex-shrink: 0; font-family: var(--font-mono); }
.suggestion-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { padding: 0 24px 40px; }

/* Keyboard users can jump past the header straight to the table. */
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 200;
  background: var(--panel); color: var(--text); border: 2px solid var(--accent);
  padding: 8px 14px; border-radius: 10px; font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---- Scan table ---- */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--panel-alt);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}
thead th:hover { color: var(--text); }
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, var(--panel)); cursor: pointer; }
tbody tr:hover .ticker-cell { color: var(--accent); }
tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }
thead th:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; color: var(--text); }
#scan-table:focus { outline: none; }
.loading-row { text-align: center; color: var(--muted); padding: 48px !important; cursor: default; }

.ticker-cell { font-weight: 700; font-family: var(--font-mono); letter-spacing: -0.01em; transition: color 0.15s; }
.crypto-badge {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent2) 16%, transparent);
  color: var(--accent2);
  vertical-align: middle;
  margin-left: 4px;
  letter-spacing: 0.02em;
}
.pos { color: var(--bullish); font-weight: 600; }
.neg { color: var(--bearish); font-weight: 600; }

.score-pill {
  display: inline-block;
  min-width: 46px;
  text-align: center;
  padding: 3px 11px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  font-family: var(--font-mono);
}
.score-strong-bull { background: color-mix(in srgb, var(--bullish) 22%, transparent); color: var(--bullish); box-shadow: 0 0 16px -4px color-mix(in srgb, var(--bullish) 60%, transparent); }
.score-bull { background: color-mix(in srgb, var(--bullish) 11%, transparent); color: var(--bullish); }
.score-neutral { background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); }
.score-bear { background: color-mix(in srgb, var(--bearish) 11%, transparent); color: var(--bearish); }
.score-strong-bear { background: color-mix(in srgb, var(--bearish) 22%, transparent); color: var(--bearish); box-shadow: 0 0 16px -4px color-mix(in srgb, var(--bearish) 60%, transparent); }

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  margin: 1px 3px 1px 0;
  white-space: nowrap;
  font-weight: 600;
}
.tag-bullish { background: color-mix(in srgb, var(--bullish) 13%, transparent); color: var(--bullish); }
.tag-bearish { background: color-mix(in srgb, var(--bearish) 13%, transparent); color: var(--bearish); }
.tag-neutral { background: color-mix(in srgb, var(--neutral) 14%, transparent); color: var(--neutral); }
.tag-risk { background: color-mix(in srgb, var(--risk) 14%, transparent); color: var(--risk); }

.watch-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-body);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s var(--ease);
}
.watch-btn:hover { color: var(--accent); border-color: var(--accent); }
.watch-btn.active { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }

/* ---- Modals ---- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(5, 6, 14, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: fade-in 0.2s ease-out;
}
.overlay.hidden { display: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.detail-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  width: 92%;
  max-width: 920px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
  box-shadow: var(--shadow-lift);
  animation: alert-pop 0.3s var(--ease);
}
.detail-header h2, .detail-panel h1, .detail-panel h2 { font-family: var(--font-heading); }

.close-btn {
  position: absolute;
  top: 16px; right: 18px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 10px;
  transition: all 0.2s;
}
.close-btn .icon { width: 18px; height: 18px; }
.close-btn:hover { color: var(--text); transform: rotate(90deg); }

.detail-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; flex-wrap: wrap; gap: 8px; padding-right: 44px; }
.detail-header h2 { margin: 0; font-size: 28px; font-family: var(--font-mono); letter-spacing: -0.03em; }
.detail-price { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 18px 0; }
.stat-box { background: var(--panel-alt); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.stat-box .label { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: 0.02em; }
.stat-box .value { font-size: 16px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }

.chart-wrap { margin: 20px 0; background: var(--panel-alt); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.chart-wrap canvas { max-height: 260px; }

.section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin: 22px 0 10px; }

.news-item { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.news-item:last-child { border-bottom: none; }
.news-item a { color: var(--text); text-decoration: none; font-weight: 600; }
.news-item a:hover { color: var(--accent); }
.news-meta { color: var(--muted); font-size: 11px; margin-top: 3px; }
.sentiment-chip { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--bearish);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.badge-count.hidden { display: none; }

/* Alert notification settings (#alerts-overlay) */
.alerts-panel { max-width: 560px; }
.alerts-panel h2 { margin: 0 0 6px; padding-right: 44px; }
.alerts-choices { border: 0; padding: 0; margin: 16px 0 0; }
.alerts-choices legend { padding: 0; }
.alerts-choice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--panel-alt); cursor: pointer; font-size: 14px;
}
.alerts-choice input { margin-top: 3px; accent-color: var(--accent); }
.alerts-choice:has(input:checked) { border-color: var(--accent); }
.alerts-choice:has(input:disabled) { cursor: not-allowed; opacity: 0.75; }
.alerts-note {
  margin-top: 14px; padding: 12px 14px; border-radius: 12px; font-size: 13px;
  background: color-mix(in srgb, var(--neutral) 10%, var(--panel)); border: 1px solid color-mix(in srgb, var(--neutral) 35%, var(--border));
}
#alerts-btn.alerts-active::after {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: #4ade80; margin-left: 2px;
}

.pending-trade-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 10px;
  background: var(--panel-alt);
}
.pending-trade-main { display: flex; flex-direction: column; gap: 3px; }
.pending-trade-actions { display: flex; gap: 8px; flex-shrink: 0; }

.trade-panel { background: var(--panel-alt); border-radius: 14px; padding: 18px; }
.trade-panel-top { margin: 14px 0 20px; border: 1px solid var(--border); }
.trade-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.trade-form input, .trade-form select {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: 100px;
  font-family: var(--font-body);
}
.trade-result { margin-top: 10px; font-size: 13px; }
.trade-error { color: var(--bearish); }
.trade-success { color: var(--bullish); }

footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 18px 24px 36px;
}

/* ---- Mobile / phone layout ---- */
@media (max-width: 720px) {
  /* Stacked header is tall on phones -- let it scroll away instead of pinning a third of the screen. */
  header { position: static; flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 16px; }
  header.lp-header { position: sticky; }
  .header-left, .header-right { flex-wrap: wrap; }
  .header-right { justify-content: flex-start; }
  .voice-banner { margin: 12px 12px 0; padding: 16px; }
  .toolbar { padding: 14px 16px; flex-direction: column; align-items: stretch; }
  .tabs { justify-content: stretch; }
  .tabs .tab { flex: 1; text-align: center; padding: 8px 10px; }
  .filters { flex-direction: column; align-items: stretch; }
  .ticker-search-wrap, .ticker-search-wrap input, .filters select { width: 100%; }

  main { padding: 0 12px 32px; }

  /* Scan table becomes a stack of cards: each row is a block, each cell a
     labeled line, instead of a horizontally-scrolling table. */
  table, thead, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  #scan-table { border-radius: 16px; }
  tbody tr {
    border-bottom: 1px solid var(--border);
    padding: 12px 4px;
  }
  tbody tr:last-child { border-bottom: none; }
  tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 12px;
    border-bottom: none;
    gap: 10px;
  }
  tbody td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
  }
  tbody td.ticker-cell { font-size: 17px; }
  tbody td[data-label="Signals"] {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 4px 6px;
  }
  tbody td[data-label="Signals"] .tag { white-space: normal; }

  .detail-panel { width: 100%; max-width: none; height: 100%; max-height: 100%; border-radius: 0; padding: 18px; }
  .overlay { padding: 0; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .trade-form { flex-direction: column; align-items: stretch; }
  .trade-form input, .trade-form select, .trade-form .btn { width: 100%; }
  .pending-trade-row { flex-direction: column; align-items: stretch; }
  .pending-trade-actions .btn { flex: 1; }
}

/* ---- Aurora backdrop (landing, auth, legal, subscribe pages) ----
   Soft glowing color fields + a faint grid, fixed behind the content. The
   original market-bg.svg artwork sits underneath at low opacity. */
.hero-bg {
  background-color: var(--bg);
  position: relative;
  isolation: isolate;
}
.hero-bg::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 600px at 12% -8%, var(--aurora-1), transparent 60%),
    radial-gradient(700px 520px at 92% 6%, var(--aurora-2), transparent 60%),
    radial-gradient(800px 600px at 60% 108%, var(--aurora-3), transparent 60%),
    linear-gradient(color-mix(in srgb, var(--bg) 94%, transparent), var(--bg)),
    url('/static/market-bg.svg') center top / cover no-repeat;
  pointer-events: none;
}
.hero-bg::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  pointer-events: none;
}

.auth-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
  max-width: 1200px;
  margin: 0 auto;
}
.auth-topbar .wordmark { display: flex; align-items: center; gap: 10px; font-family: var(--font-heading); font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }

.subscribe-wrap {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 40px;
}
/* Glass card with a thin gradient rim. */
.subscribe-card {
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
  backdrop-filter: saturate(160%) blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 36px 32px 32px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lift);
  animation: rise-in 0.6s var(--ease);
}
.subscribe-card::before {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 55%, transparent), transparent 40%, transparent 70%, color-mix(in srgb, var(--accent2) 40%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.subscribe-card h1 { font-size: 26px; font-family: var(--font-heading); display: flex; align-items: center; gap: 8px; margin: 0 0 8px; letter-spacing: -0.03em; }
.subscribe-card > p.muted, .subscribe-card > div > p.muted { font-size: 14px; }
.subscribe-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.subscribe-card label { font-size: 13px; font-weight: 600; }
.subscribe-card input[type="tel"] {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 15px;
  width: 100%;
  font-family: var(--font-body);
}
.subscribe-card .btn[type="submit"] { padding: 13px 20px; font-size: 14px; }
.consent-row { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 12px; color: var(--muted); line-height: 1.55; }
.consent-row input { margin-top: 3px; flex-shrink: 0; accent-color: var(--accent); width: 16px; height: 16px; }
.subscribe-result { min-height: 20px; font-size: 13px; }
.footnote { margin-top: 18px; font-size: 12px; text-align: center; }
.footnote a { color: var(--accent); }

.policy-card { max-width: 720px; text-align: left; }
.policy-card h1 { font-family: var(--font-heading); }
.policy-card h2 { font-size: 16px; margin: 26px 0 6px; font-family: var(--font-heading); }
.policy-card p { font-size: 14px; line-height: 1.7; color: var(--text); margin: 0 0 6px; }
.policy-card a { color: var(--accent); }
.policy-card ul { font-size: 14px; line-height: 1.7; margin: 0 0 8px; padding-left: 20px; }
.policy-card li { margin-bottom: 6px; }
.policy-card code { font-family: var(--font-mono); font-size: 12px; background: var(--panel-alt); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }

.qr-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.qr-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 36px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lift);
}
.qr-card h1 { font-size: 20px; margin: 0 0 6px; font-family: var(--font-heading); justify-content: center; }
#qr-canvas-wrap {
  display: flex;
  justify-content: center;
  margin: 22px 0;
  padding: 18px;
  background: #ffffff;
  border-radius: 16px;
}
.qr-url { font-size: 12px; color: var(--muted); word-break: break-all; margin-top: 8px; font-family: var(--font-mono); }

/* ---- Floating dock nav (every public/account page) ---- */
body { padding-bottom: 92px; } /* keep content clear of the fixed dock */
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  gap: 2px;
  max-width: calc(100vw - 24px);
  background: color-mix(in srgb, var(--header-bg) 80%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  backdrop-filter: saturate(160%) blur(18px);
  border: 1px solid color-mix(in srgb, var(--header-text) 12%, transparent);
  border-radius: 999px;
  padding: 6px;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  z-index: 60;
}
.bottom-nav-item {
  color: color-mix(in srgb, var(--header-text) 62%, transparent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
}
.bottom-nav-item:hover { background: color-mix(in srgb, var(--header-text) 10%, transparent); color: var(--header-text); }
.bottom-nav-item.active { color: #fff; background: var(--grad-accent); box-shadow: 0 6px 16px -6px rgba(99, 102, 241, 0.7); }
@media (max-width: 480px) {
  .bottom-nav-item { padding: 8px 11px; font-size: 12px; }
}

/* ---- Auth / account pages ---- */
.auth-error { color: var(--bearish); font-size: 13px; margin-top: 4px; }
.auth-success { color: var(--bullish); font-size: 13px; margin-top: 4px; }
.auth-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.auth-field label { font-size: 13px; font-weight: 600; }
.auth-field input {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 15px;
  font-family: var(--font-body);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-switch { margin-top: 16px; font-size: 13px; text-align: center; color: var(--muted); }
.auth-switch a { font-weight: 600; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* ---- Landing page (index.html) ----
   Deliberately short: hero + preview, three features, text-alert opt-in,
   footer. Keep it simple; resist adding sections. */
.lp-container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

.lp-hero { padding: 72px 0 56px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px; align-items: center; }
.lp-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 14px 5px 6px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.lp-eyebrow .dot-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--bullish) 14%, transparent);
  color: var(--bullish); font-size: 12px; font-weight: 700;
}
.lp-eyebrow .dot-chip::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  animation: live-pulse 2s infinite;
}
.lp-eyebrow .dot-chip.is-closed { background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); }
.lp-eyebrow .dot-chip.is-closed::before { animation: none; }

.lp-title {
  display: block;
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.04;
  letter-spacing: -0.045em;
  font-weight: 800;
  margin: 22px 0 18px;
}
.grad-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* The default gradient's cyan end is too faint on the light page (2.1:1);
   these stops all stay above 3:1 for large text on --bg (light). */
:root:not([data-theme="dark"]) .grad-text {
  background: linear-gradient(100deg, #4f46e5 0%, #7c3aed 45%, #0e7490 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
.lp-sub { font-size: 18px; line-height: 1.6; color: var(--muted); max-width: 520px; margin: 0 0 30px; }
.lp-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.lp-note { margin-top: 18px; font-size: 13px; color: var(--muted); }

/* Animated halftone backdrop behind the hero (drawn by static/halftone.js).
   Fades out toward the bottom and the left so the headline stays readable. */
#halftone-bg {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: min(100vh, 860px);
  z-index: -1;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 35%, transparent 95%), linear-gradient(to right, rgba(0,0,0,0.35), #000 55%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to bottom, #000 35%, transparent 95%), linear-gradient(to right, rgba(0,0,0,0.35), #000 55%);
  mask-composite: intersect;
}

/* Product preview card */
.lp-preview-wrap { position: relative; }
.lp-preview-wrap::before {
  content: "";
  position: absolute; inset: 10% 8% 0 8%;
  background: var(--grad-accent);
  filter: blur(70px);
  opacity: 0.28;
  border-radius: 40px;
  z-index: -1;
}
.lp-preview {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lift);
  padding: 18px;
}
.lp-spark-card {
  border-radius: 14px;
  padding: 14px 16px 8px;
  background: color-mix(in srgb, var(--bullish) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--bullish) 20%, transparent);
  margin-bottom: 10px;
}
.lp-spark-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; font-weight: 700; }
.lp-spark-head b { font-family: var(--font-mono); color: var(--bullish); font-size: 15px; }
.lp-spark { width: 100%; height: 64px; display: block; margin-top: 6px; }
.lp-spark path.line { stroke-dasharray: 600; stroke-dashoffset: 600; animation: draw 2.2s 0.3s var(--ease) forwards; }
.lp-spark path.fill { opacity: 0; animation: fade-in 1s 1.4s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.lp-row {
  display: grid;
  grid-template-columns: 1fr auto 64px;
  align-items: center;
  gap: 12px;
  padding: 11px 6px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  animation: rise-in 0.6s var(--ease) forwards;
}
.lp-row:last-child { border-bottom: none; }
.lp-row:nth-child(2) { animation-delay: 0.45s; }
.lp-row:nth-child(3) { animation-delay: 0.6s; }
.lp-row:nth-child(4) { animation-delay: 0.75s; }
.lp-row .t { font-family: var(--font-mono); font-weight: 700; }
.lp-row .chg { text-align: right; }
.lp-caption { text-align: center; font-size: 11px; color: var(--muted); margin-top: 12px; }

/* Three features */
.lp-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; padding: 8px 0 64px; }
.lp-feature {
  padding: 26px;
  border-radius: var(--radius);
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-card);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.lp-feature:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.lp-feature .ic {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: var(--accent);
  margin-bottom: 16px;
}
.lp-feature .ic .icon { width: 20px; height: 20px; }
.lp-feature h3 { margin: 0 0 6px; font-size: 17px; }
.lp-feature p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

/* Text-alert opt-in */
.lp-optin {
  display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center;
  padding: 40px;
  margin-bottom: 48px;
  border-radius: 24px;
  background:
    radial-gradient(520px 260px at 0% 0%, var(--aurora-1), transparent 70%),
    var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lift);
}
.lp-optin h2 { font-size: clamp(26px, 3.4vw, 34px); letter-spacing: -0.035em; margin: 0 0 10px; }
.lp-optin > div > p { color: var(--muted); font-size: 15px; line-height: 1.6; margin: 0; }
.lp-optin form { display: flex; flex-direction: column; gap: 14px; }
.lp-optin .auth-field { margin-bottom: 0; }

.lp-footer { padding: 24px 0 8px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); text-align: center; line-height: 1.6; }
.lp-footer nav { margin-bottom: 10px; }
.lp-footer nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 13px; margin: 0 10px; }
.lp-footer nav a:hover { color: var(--text); }

@media (max-width: 900px) {
  .lp-hero { grid-template-columns: 1fr; gap: 44px; padding: 44px 0 40px; }
  .lp-features { grid-template-columns: 1fr; }
  .lp-optin { grid-template-columns: 1fr; gap: 24px; padding: 26px; }
}
@media (max-width: 720px) {
  .lp-container { padding: 0 16px; }
  header.lp-header { flex-direction: row; align-items: center; }
  .lp-hide-sm { display: none !important; }
  .subscribe-card { padding: 28px 22px 24px; }
}

/* Respect users who ask for less motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .lp-row { opacity: 1; }
  .lp-spark path.line { stroke-dashoffset: 0; }
  .lp-spark path.fill { opacity: 1; }
}
