@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --bg: #06080f;
  --bg2: #0b0e18;
  --surface: #10141f;
  --surface2: #161b28;
  --line: rgba(255,255,255,0.06);
  --line2: rgba(255,255,255,0.1);
  --text: #f2f4f8;
  --muted: #9aa3b5;
  --faint: #6b7385;
  --green: #3dffb5;
  --green-dim: rgba(61,255,181,0.12);
  --red: #ff6b8a;
  --red-dim: rgba(255,107,138,0.12);
  --amber: #ffc14a;
  --blue: #7aa2ff;
  --blue-dim: rgba(122,162,255,0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Inter', system-ui, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --shadow: 0 20px 50px rgba(0,0,0,0.45);
  --glow-green: 0 0 0 1px rgba(61,255,181,0.25), 0 8px 30px rgba(61,255,181,0.12);
  --glow-red: 0 0 0 1px rgba(255,107,138,0.25), 0 8px 30px rgba(255,107,138,0.12);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -20%, rgba(122,162,255,0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(61,255,181,0.06), transparent);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
h1, h2, h3 { font-family: var(--font-display); }

/* Keyboard focus must always be visible — mouse clicks don't get the ring */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Shell */
.shell { max-width: 1200px; margin: 0 auto; padding: 0 20px 120px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 80;
  backdrop-filter: blur(20px);
  background: rgba(6,8,15,0.85);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg, var(--green), var(--blue));
  color: #061018; font-weight: 800; font-size: 13px;
  display: grid; place-items: center; font-family: var(--mono);
  box-shadow: 0 0 30px rgba(61,255,181,0.25);
}
.brand-mark.lg {
  width: 64px; height: 64px; border-radius: 18px; font-size: 22px;
  margin: 0 auto 20px;
}
.brand h1 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.02em; font-family: var(--font-display); }
.brand p { margin: 0; font-size: 11px; color: var(--faint); font-family: var(--mono); letter-spacing: 0.02em; }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-pill {
  display: flex; gap: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 4px 4px 14px;
}
.search-pill input {
  border: none; background: transparent; color: var(--text);
  font-family: var(--mono); font-size: 13px; width: 100px; outline: none;
  text-transform: uppercase;
}
.search-pill button { border-radius: 999px; padding: 7px 14px; }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px 4px 4px; cursor: pointer;
}
.user-chip .av {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--blue-dim); color: var(--blue);
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
}
.user-chip .nm { font-size: 12px; font-weight: 600; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

button {
  font-family: var(--font); cursor: pointer; border-radius: 10px;
  border: 1px solid var(--line2); background: var(--surface2);
  color: var(--text); padding: 8px 14px; font-size: 13px; font-weight: 600;
}
button:hover { border-color: rgba(255,255,255,0.18); }
button.primary {
  background: linear-gradient(135deg, #3dffb5, #2ec4b6);
  border: none; color: #061018; font-weight: 700;
}
button.ghost { background: transparent; color: var(--muted); border-color: transparent; }
button.ghost:hover { color: var(--text); background: var(--surface); }
button.lg { padding: 12px 18px; font-size: 14px; }
button.block { width: 100%; }

/* Nav */
.nav-pills {
  max-width: 1200px; margin: 0 auto; padding: 10px 20px 0;
  display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line);
}
.nav-pills .nav-btn {
  background: transparent; border: none; color: var(--faint);
  font-size: 12px; font-weight: 600; padding: 10px 14px;
  border-radius: 10px 10px 0 0; white-space: nowrap;
}
.nav-pills .nav-btn:hover { color: var(--text); }
.nav-pills .nav-btn.active {
  color: var(--green); background: rgba(61,255,181,0.06);
  box-shadow: inset 0 -2px 0 var(--green);
}

.nav-bottom {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
  background: rgba(11,14,24,0.96); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
  justify-content: space-around;
}
.nav-bottom .nav-btn {
  flex: 1; background: transparent; border: none; color: var(--faint);
  font-size: 9px; font-weight: 700; text-transform: uppercase; padding: 8px 2px;
}
.nav-bottom .nav-btn.active { color: var(--green); }

/* Status strip */
.strip {
  max-width: 1200px; margin: 0 auto; padding: 8px 20px;
  display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center;
  font-family: var(--mono); font-size: 10px; color: var(--faint);
}
.strip .ok { color: var(--green); }
.strip .warn { color: var(--amber); }

.trust-banner {
  max-width: 1200px; margin: 8px auto; padding: 10px 16px;
  background: var(--red-dim); border: 1px solid var(--red);
  border-radius: var(--radius-sm); display: flex; justify-content: space-between;
  align-items: center; font-size: 13px;
}
.trust-banner[hidden] { display: none !important; }

/* ── Signature: the live tape marquee ──
   FlowDesk's whole premise is "read the options tape" — so the page opens
   with an actual scrolling tape, not a static banner. Real content only
   (symbol + composite score), never decorative. Pauses on hover so it can
   be read, and freezes for prefers-reduced-motion instead of just slowing. */
.tape-marquee {
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
  overflow: hidden;
  white-space: nowrap;
  position: relative;
}
.tape-marquee::before, .tape-marquee::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 40px; z-index: 2; pointer-events: none;
}
.tape-marquee::before { left: 0; background: linear-gradient(90deg, var(--bg2), transparent); }
.tape-marquee::after { right: 0; background: linear-gradient(-90deg, var(--bg2), transparent); }
.tape-track {
  display: inline-flex; align-items: center; gap: 28px;
  padding: 7px 0;
  animation: tape-scroll 45s linear infinite;
  will-change: transform;
}
.tape-marquee:hover .tape-track { animation-play-state: paused; }
@keyframes tape-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.tape-item {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  color: var(--muted); display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; padding: 0 2px;
}
.tape-item:hover { color: var(--text); }
.tape-item .tape-sym { color: var(--text); font-weight: 700; }
.tape-item.bull .tape-score { color: var(--green); }
.tape-item.bear .tape-score { color: var(--red); }
.tape-item .tape-score::before { content: ''; }
.tape-item.bull .tape-score::before { content: '▲ '; }
.tape-item.bear .tape-score::before { content: '▼ '; }
.tape-item.status { color: var(--faint); cursor: default; }
@media (prefers-reduced-motion: reduce) {
  .tape-track { animation: none; overflow-x: auto; }
}

/* Views */
.view { display: none; animation: up 0.25s ease; }
.view.active { display: block; }
@keyframes up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.page-head { margin: 20px 0 16px; }
.page-head h2 {
  margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.035em;
  font-family: var(--font-display);
}
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; max-width: 520px; }

/* Cards */
.glass {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.brief-card {
  background: linear-gradient(145deg, rgba(61,255,181,0.08), var(--surface));
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 18px;
}
.brief-card h3 {
  margin: 0 0 10px; font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--green);
}
.brief-body { font-size: 15px; line-height: 1.55; }
.brief-meta { margin-top: 12px; font-family: var(--mono); font-size: 10px; color: var(--faint); }

.filter-bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  padding: 14px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.filter-bar label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--faint); display: flex; flex-direction: column; gap: 5px;
}
.filter-bar select, .earnings-toolbar input, .earnings-toolbar select,
.auth-form input, .field input, .field select, .pe-filter select {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  padding: 9px 12px; border-radius: 10px; font-size: 13px; font-family: var(--mono);
}
.earnings-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.earnings-toolbar input { flex: 1; min-width: 120px; }

.idea-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.idea-card {
  position: relative; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  overflow: hidden;
}
.idea-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--faint);
}
.idea-card.bull::before { background: var(--green); }
.idea-card.bear::before { background: var(--red); }
.idea-card:hover {
  transform: translateY(-3px); border-color: var(--line2);
  box-shadow: var(--shadow);
}
.idea-card.bull:hover { box-shadow: var(--glow-green); }
.idea-card.bear:hover { box-shadow: var(--glow-red); }
.idea-card .sym { font-family: var(--mono); font-size: 16px; font-weight: 700; margin: 6px 0; }
.idea-card .score {
  font-family: var(--mono); font-size: 26px; font-weight: 700;
  color: var(--green); letter-spacing: -0.03em;
}
.idea-card.bear .score { color: var(--red); }
.idea-card .gauge {
  position: relative; height: 4px; border-radius: 2px; margin: 8px 0 2px;
  background: var(--surface2); overflow: hidden;
}
.idea-card .gauge::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: 50%;
  width: 1px; background: var(--line2);
}
.idea-card .gauge-fill {
  position: absolute; top: 0; bottom: 0;
  background: var(--green);
}
.idea-card.bear .gauge-fill { background: var(--red); }
.idea-card .meta { font-size: 11px; color: var(--muted); margin-top: 8px; }
.idea-card .metrics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.metric-pill {
  font-size: 10px; font-family: var(--mono); padding: 3px 8px; border-radius: 20px;
  background: var(--surface2); border: 1px solid var(--line); color: var(--muted);
}
.metric-pill strong { color: var(--text); }
.badge {
  font-size: 9px; font-weight: 700; font-family: var(--mono);
  padding: 3px 8px; border-radius: 20px; text-transform: uppercase;
}
.badge.bull { background: var(--green-dim); color: var(--green); }
.badge.bear { background: var(--red-dim); color: var(--red); }
.badge.neutral { background: var(--surface2); color: var(--muted); }
.badge.warn { background: rgba(255,193,74,0.15); color: var(--amber); }
.bull { color: var(--green); }
.bear { color: var(--red); }

.portfolio-panel, .conclusions-panel, .analytics-card, .card, .block, .news-card, .discover-card, .account-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.portfolio-panel { padding: 18px; margin-bottom: 16px; }
.portfolio-hero {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 14px;
}
.ph-stat .k { font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); }
.ph-stat .v { font-family: var(--mono); font-size: 20px; font-weight: 700; margin-top: 4px; }
.factor-warn {
  margin: 12px 0; padding: 12px 14px;
  background: rgba(255,193,74,0.08); border: 1px solid rgba(255,193,74,0.3);
  border-radius: 12px; font-size: 12px; line-height: 1.45;
}
.factor-warn strong { color: var(--amber); }
.portfolio-table { font-family: var(--mono); font-size: 11px; margin-top: 12px; overflow-x: auto; }
.pt-head, .pt-row {
  display: grid; grid-template-columns: 0.8fr 0.5fr 0.5fr 0.6fr 0.7fr 0.7fr 0.7fr;
  gap: 6px; padding: 8px 4px; border-bottom: 1px solid var(--line); align-items: center;
  min-width: 480px;
}
.pt-head { color: var(--faint); font-size: 9px; text-transform: uppercase; }
.pt-row .sym { font-weight: 700; cursor: pointer; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card-head { display: flex; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ticker-name { font-family: var(--mono); font-weight: 700; }
.card-body { padding: 12px 14px; }
.gauge-row { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.gauge {
  width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--green);
  display: grid; place-items: center; font-family: var(--mono); font-weight: 700;
  font-size: 14px; background: var(--bg2); flex-shrink: 0;
}
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat {
  background: var(--surface2); border-radius: 10px; padding: 8px 10px; border: 1px solid var(--line);
}
.stat .k { font-size: 9px; text-transform: uppercase; color: var(--faint); }
.stat .v { font-family: var(--mono); font-size: 14px; font-weight: 600; }
.block { padding: 14px; }
.block h4 {
  margin: 0 0 10px; font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--green);
}
.row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.row:last-child { border-bottom: none; }
.row .lbl { color: var(--muted); }
.row .val { font-family: var(--mono); text-align: right; }
.status { font-family: var(--mono); font-size: 11px; color: var(--faint); padding: 6px 0; }
.status.err { color: var(--red); }
.empty {
  text-align: center; padding: 48px 20px; border: 1px dashed var(--line);
  border-radius: var(--radius); color: var(--muted); margin-bottom: 12px; background: var(--surface);
}
.empty h3 { margin: 0 0 8px; color: var(--text); }

.day-label {
  font-size: 12px; font-weight: 700; color: var(--green); margin: 14px 0 8px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.cal-row {
  display: flex; justify-content: space-between; padding: 12px 14px; margin-bottom: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
}
.cal-row .sym { font-family: var(--mono); font-weight: 700; }

/* Modal / Explore — flex column so header never overlaps body */
.modal {
  position: fixed;
  inset: 0;
  z-index: 500; /* above sticky topbar (80) */
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.modal.open { display: flex !important; align-items: flex-end; justify-content: center; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  z-index: 0;
}
.modal-panel,
.modal-panel.explore-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 540px;
  max-height: min(94vh, 920px);
  height: min(94vh, 920px);
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  overflow: hidden; /* clip children — no sticky overlap */
}
.modal-head,
.modal-head.explore-sticky {
  position: relative; /* NOT sticky — parent is already fixed panel */
  top: auto;
  z-index: auto;
  flex: 0 0 auto;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg2);
  border-radius: 20px 20px 0 0;
}
.modal-sym { font-family: var(--mono); font-size: 18px; font-weight: 700; line-height: 1.2; }
.modal-sub {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  margin-top: 4px;
  line-height: 1.35;
  max-width: 100%;
  word-break: break-word;
}
.explore-tabs {
  flex: 0 0 auto;
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
  -webkit-overflow-scrolling: touch;
}
.explore-tabs .tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--faint);
  padding: 11px 13px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border-radius: 0;
  flex-shrink: 0;
}
.explore-tabs .tab.active { color: var(--green); border-bottom-color: var(--green); }
.modal-body {
  flex: 1 1 auto;
  min-height: 0; /* critical for flex scroll */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 18px;
  -webkit-overflow-scrolling: touch;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.modal-notes {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  background: var(--bg2);
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}
.modal-notes textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px;
  font-family: var(--font);
  resize: vertical;
  max-height: 80px;
}
.modal-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.path-chart-wrap {
  background: var(--bg2); border-radius: 12px; padding: 8px; margin-bottom: 10px;
  border: 1px solid var(--line);
}

.conclusions-panel { padding: 16px 18px; margin-top: 20px; }
.conclusions-panel h3 {
  margin: 0 0 8px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--green);
}
.conclusion-row { padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.cr-sum { font-size: 12px; color: var(--muted); }
.cr-meta { font-family: var(--mono); font-size: 10px; color: var(--faint); margin-top: 4px; }

.news-results { display: flex; flex-direction: column; gap: 10px; }
.news-card { padding: 16px; }
.news-card a { color: var(--blue); text-decoration: none; font-weight: 600; }
.discover-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px;
}
.discover-card { padding: 14px; cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.discover-card:hover { border-color: var(--green); transform: translateY(-2px); }
.discover-card .sym { font-family: var(--mono); font-weight: 700; }

.analytics-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px;
}
.analytics-card { padding: 16px; }
.analytics-card h3 {
  margin: 0 0 8px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--green);
}
.analytics-card .big { font-family: var(--mono); font-size: 32px; font-weight: 700; }

/* Auth modal */
.auth-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(4,6,12,0.88); backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.auth-overlay[hidden] { display: none !important; }
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--surface); border: 1px solid var(--line2);
  border-top: 3px solid; border-image: linear-gradient(90deg, var(--red), var(--amber), var(--green)) 1;
  border-radius: 20px; padding: 28px; box-shadow: var(--shadow);
}
.auth-card h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.02em; }
.auth-card .lead { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.auth-tabs button {
  flex: 1; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line);
}
.auth-tabs button.on {
  background: var(--green-dim); border-color: var(--green); color: var(--green);
}
.auth-form label {
  display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--faint); margin-bottom: 12px;
}
.auth-form input {
  display: block; width: 100%; margin-top: 6px;
}
.auth-error {
  background: var(--red-dim); color: var(--red); padding: 10px 12px;
  border-radius: 10px; font-size: 13px; margin-bottom: 12px; display: none;
}
.auth-error.show { display: block; }
.auth-foot { margin-top: 14px; font-size: 12px; color: var(--faint); text-align: center; }

/* Account page */
.account-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
@media (max-width: 720px) { .account-grid { grid-template-columns: 1fr; } }
.account-card { padding: 20px; }
.account-card h3 { margin: 0 0 12px; font-size: 15px; }
.field { display: block; margin-bottom: 12px; font-size: 12px; color: var(--muted); }
.field input { display: block; width: 100%; margin-top: 6px; }
.guest-prompt {
  text-align: center; padding: 40px 20px;
  background: var(--surface); border: 1px dashed var(--line2); border-radius: var(--radius);
}
.guest-prompt h3 { margin: 0 0 8px; }

/* Welcome */
.welcome {
  position: fixed; inset: 0; z-index: 190;
  background: rgba(4,6,12,0.92); display: flex; align-items: center;
  justify-content: center; padding: 20px;
}
.welcome[hidden] { display: none !important; }
.welcome-card {
  max-width: 440px; width: 100%; background: var(--surface);
  border: 1px solid var(--line2);
  border-top: 3px solid; border-image: linear-gradient(90deg, var(--red), var(--amber), var(--green)) 1;
  border-radius: 20px; padding: 32px; box-shadow: var(--shadow);
  text-align: center;
}
.welcome-card h1 {
  font-family: var(--font-display); font-size: 28px; letter-spacing: -0.03em; margin: 0 0 10px;
}
.welcome-card .welcome-points,
.welcome-card .welcome-lead { text-align: left; }
.welcome-lead { color: var(--muted); line-height: 1.55; }
.welcome-points { padding-left: 18px; font-size: 13px; }
.welcome-points li { margin-bottom: 8px; }

.drawer {
  position: fixed; inset: 0; z-index: 150; pointer-events: none;
}
.drawer.open { pointer-events: auto; }
.drawer-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,0.5); opacity: 0; transition: opacity 0.2s;
}
.drawer.open .drawer-backdrop { opacity: 1; }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(380px, 100%);
  background: var(--surface); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform 0.25s; display: flex; flex-direction: column;
}
.drawer.open .drawer-panel { transform: translateX(0); }
.drawer-head {
  padding: 16px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.drawer-body { padding: 16px; overflow-y: auto; }
.hint { font-size: 11px; color: var(--faint); line-height: 1.45; }
.sep { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; margin-bottom: 10px; }

.site-footer {
  max-width: 1200px; margin: 40px auto 100px; padding: 24px 20px;
  border-top: 1px solid var(--line); font-size: 11px; color: var(--faint);
}
.footer-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px;
}
.site-footer strong {
  color: var(--muted); display: block; margin-bottom: 4px;
  text-transform: uppercase; font-size: 10px; letter-spacing: 0.08em;
}

.remove { background: none; border: none; color: var(--faint); font-size: 16px; cursor: pointer; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.subhead {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--faint); margin: 16px 0 10px; font-weight: 600;
}

@media (max-width: 800px) {
  .nav-pills { display: none; }
  .nav-bottom { display: flex; }
  .search-pill input { width: 70px; }
  body { padding-bottom: 70px; }
}

/* ── Consistency fixes / missing classes ── */
body.desk { min-height: 100vh; }
.header-inner, .topbar-inner { /* alias */ }
.search-bar { display: flex; gap: 6px; align-items: center; }
.icon-btn { padding: 8px 10px !important; line-height: 1; }
.view-lead { color: var(--muted); font-size: 14px; margin: 0 0 16px; max-width: 560px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-title h2, .page-head h2 { margin: 0; }
.page-head.section-title { margin: 20px 0 16px; }
.page-head.section-title span { font-family: var(--mono); font-size: 11px; color: var(--faint); }

.explore-sheet { /* same as modal-panel */ }
.explore-sticky { position: relative; top: auto; z-index: auto; }
.earnings-full { min-height: 40px; }
.session-group { margin: 10px 0 12px 4px; }
.session-label { font-size: 11px; color: var(--faint); font-family: var(--mono); margin-bottom: 6px; }

.rank { font-size: 10px; font-family: var(--mono); color: var(--faint); }
.liq { font-size: 11px; font-family: var(--mono); color: var(--faint); }
.score-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.gauge-label { font-size: 14px; font-weight: 600; }
.gauge-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.price { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.chain-table { font-family: var(--mono); font-size: 11px; }
.chain-row {
  display: grid; grid-template-columns: 1.4fr 0.7fr 0.7fr 0.7fr;
  gap: 6px; padding: 5px 0; border-bottom: 1px solid var(--line);
}
.chain-head { color: var(--faint); font-size: 10px; text-transform: uppercase; }
.forecast-line {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  margin: 10px 0; padding: 10px 12px; background: var(--surface2);
  border-radius: 10px; border: 1px solid var(--line);
}
.news-item { padding: 8px 0; border-bottom: 1px solid var(--line); }
.news-item a { color: var(--blue); text-decoration: none; font-size: 13px; }
.news-item .when { font-size: 10px; color: var(--faint); margin-top: 3px; }
.news-sum { margin: 8px 0 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.sym-link { color: var(--green); cursor: pointer; font-family: var(--mono); }
.cr-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.cr-rank { font-family: var(--mono); color: var(--faint); font-size: 12px; }
.list-row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 12px;
}
.list-row:last-child { border-bottom: none; }

.filter-bar.compact { padding: 10px 12px; }
.check.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.pe-filter {
  font-size: 10px; text-transform: uppercase; color: var(--faint);
  display: flex; flex-direction: column; gap: 4px;
}

.nav-rail { /* alias for nav-pills */ }
.data-bar { /* alias for strip */ }

/* Auth tabs active state */
.auth-tabs button.on {
  background: var(--green-dim) !important;
  border-color: var(--green) !important;
  color: var(--green) !important;
}

/* Footer spacing */
.footer { max-width: 1200px; margin: 40px auto 100px; padding: 24px 20px; }

/* Ensure buttons don't stretch oddly */
button.primary.lg { padding: 12px 18px; font-size: 14px; }
button.ghost.block, button.primary.block { width: 100%; }

/* User chip when visible */
#userChip:not([hidden]) { display: flex; }

/* Modal open flex */
.modal.open { display: flex !important; align-items: flex-end; justify-content: center; }

/* Calendar session */
.day-group { margin-bottom: 18px; }

/* Share inputs in portfolio */
.share-input {
  width: 72px; background: var(--bg2); border: 1px solid var(--line);
  color: var(--text); padding: 4px 6px; border-radius: 6px;
  font-family: var(--mono); font-size: 12px;
}

/* Fix dual shell padding */
.shell.app-shell { padding: 0 20px 120px; max-width: 1200px; margin: 0 auto; }
.shell.app-shell .page { padding: 0; max-width: none; margin: 0; }

/* Welcome points */
.welcome-note { font-size: 11px; color: var(--faint); margin-bottom: 14px; }
.welcome-points { padding-left: 18px; font-size: 13px; margin: 0 0 14px; }
.welcome-points li { margin-bottom: 8px; }

/* Drawer field labels */
.drawer-body .field { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.drawer-body .field input,
.drawer-body .field select {
  display: block; width: 100%; margin-top: 6px;
  background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  padding: 10px; border-radius: 10px;
}

/* Status bar buttons */
.strip button, .data-bar button { padding: 4px 10px; font-size: 11px; }

/* Cache source hint in news */
.cache-hint {
  font-family: var(--mono); font-size: 10px; color: var(--faint); margin-bottom: 8px;
}

/* === CRITICAL FIXES (auth + layout) === */
[hidden] { display: none !important; }

.auth-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  background: rgba(4, 6, 12, 0.9) !important;
  backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-overlay:not([hidden]) {
  display: flex !important;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: #10141f !important;
  border: 1px solid rgba(255,255,255,0.1);
  border-top: 3px solid;
  border-image: linear-gradient(90deg, #ff6b8a, #ffc14a, #3dffb5) 1;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  color: #f2f4f8;
}
.auth-card h1, .auth-card h2 { color: #f2f4f8; }
.auth-form input {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: #0b0e18 !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  color: #f2f4f8 !important;
  padding: 10px 12px !important;
  border-radius: 10px !important;
  font-size: 14px !important;
  box-sizing: border-box;
}
.auth-error.show {
  display: block !important;
  background: rgba(255,107,138,0.15);
  color: #ff6b8a;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}

/* Top bar always visible */
.topbar {
  position: sticky !important;
  top: 0 !important;
  z-index: 80 !important;
  background: rgba(6,8,15,0.92) !important;
}

/* Views */
.view { display: none !important; }
.view.active { display: block !important; }

/* Nav pills */
.nav-pills, .nav-rail {
  display: flex !important;
  gap: 4px;
  overflow-x: auto;
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
@media (max-width: 800px) {
  .nav-pills, .nav-rail { display: none !important; }
  .nav-bottom { display: flex !important; }
}

/* Prevent page collapse */
.shell, .app-shell, .page {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}
.idea-grid, .card-grid, .discover-grid, .analytics-grid, .account-grid {
  display: grid !important;
}
.idea-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.card-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }


/* === EXPLORE OVERLAP FIX (final) === */
#exploreModal {
  z-index: 500 !important;
}
#exploreModal .modal-panel.explore-sheet {
  display: flex !important;
  flex-direction: column !important;
  height: min(94vh, 920px) !important;
  max-height: min(94vh, 920px) !important;
  overflow: hidden !important;
}
#exploreModal .modal-head,
#exploreModal .modal-head.explore-sticky {
  position: relative !important;
  flex: 0 0 auto !important;
  z-index: 1 !important;
}
#exploreModal .explore-tabs {
  flex: 0 0 auto !important;
  z-index: 1 !important;
}
#exploreModal .modal-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  position: relative !important;
  z-index: 0 !important;
}
#exploreModal .modal-notes {
  flex: 0 0 auto !important;
  position: relative !important;
  z-index: 1 !important;
}
