/* ══════════════════════════════════════════════════════════════════════
   JEDI AI — Production Stylesheet
   Organized: Reset → Variables → Typography → Layout → Navigation →
              Cards → Badges → Buttons → Forms → Tables → Utilities →
              Hero → Stats → Features → Charts → Carousel → Signals →
              App Shell → Strategy Page → Pricing → Auth → Components
   ══════════════════════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────────────────────── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 15px;
  line-height: 1.6;
}

/* ── CSS Custom Properties ─────────────────────────────────────────── */
:root {
  --bg:       #0f172a;
  --bg-card:  #1e293b;
  --border:   #334155;
  --accent:   #3b82f6;
  --accent2:  #2563eb;
  --green:    #22c55e;
  --red:      #ef4444;
  --yellow:   #f59e0b;
  --txt:      #f1f5f9;
  --txt2:     #94a3b8;
  --txt3:     #64748b;
}

/* ── Typography ────────────────────────────────────────────────────── */
h1 { font-size: 2.6rem; font-weight: 800; line-height: 1.15; }
h2 { font-size: 1.75rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }

/* ── Layout ────────────────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 28px; }
.page { display: none; min-height: 100vh; }
.page.active { display: block; }
.section { padding: 56px 0; }
.sect-alt { background: rgba(30, 41, 59, 0.45); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── Navigation — Public ───────────────────────────────────────────── */
.pub-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 23, 42, .93);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.logo { font-size: 1.65rem; font-weight: 800; cursor: pointer; }
.logo span { color: var(--accent); }
.logo em { color: var(--green); font-style: normal; }

.pub-nav-links { display: flex; align-items: center; gap: 32px; }
.pub-nav-links a {
  color: var(--txt2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color .15s;
  cursor: pointer;
}
.pub-nav-links a:hover { color: var(--txt); }
.pub-nav-actions { display: flex; align-items: center; gap: 10px; }

/* Logo variants */
.logo-tagline {
  font-size: 8.5px;
  font-weight: 400;
  letter-spacing: 0.04em;
  font-style: italic;
  color: var(--txt3);
  opacity: 0.7;
  line-height: 1;
  margin-top: 3px;
  padding-left: 46px; /* align under text: 38px icon + 8px gap */
  white-space: nowrap;
  text-transform: none;
}
.logo-wrap { display: flex; flex-direction: column; cursor: pointer; }
.logo-wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1;
}
.logo-wordmark .l-name { color: var(--txt); letter-spacing: -0.5px; }
.logo-wordmark .l-ai {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--green);
  background: rgba(34, 197, 94, .15);
  border-radius: 4px;
  padding: 2px 6px;
  letter-spacing: .5px;
  vertical-align: middle;
}

/* ── Cards ─────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.card-sm { border-radius: 10px; padding: 18px; }

/* ── Badges ────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.b-green  { background: rgba(34, 197, 94, .15);  color: var(--green); }
.b-red    { background: rgba(239, 68, 68, .15);  color: var(--red); }
.b-blue   { background: rgba(59, 130, 246, .15); color: var(--accent); }
.b-yellow { background: rgba(245, 158, 11, .15); color: var(--yellow); }
.b-grey   { background: rgba(100, 116, 139, .15); color: var(--txt2); }

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); }
.btn-outline { background: transparent; border: 1.5px solid #475569; color: var(--txt); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost  { background: transparent; color: var(--txt2); }
.btn-ghost:hover { color: var(--txt); background: rgba(51, 65, 85, .4); }
.btn-danger { background: rgba(239, 68, 68, .1); color: var(--red); border: 1px solid rgba(239, 68, 68, .3); }
.btn-lg { padding: 14px 32px; font-size: 16px; border-radius: 10px; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 6px; }

/* ── Forms ─────────────────────────────────────────────────────────── */
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--txt2);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.form-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--txt);
  outline: none;
  transition: border-color .15s;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--txt3); }
.form-group { margin-bottom: 18px; }

/* ── Tables ────────────────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  padding: 9px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--txt3);
  border-bottom: 1px solid var(--border);
}
.tbl td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(51, 65, 85, .4);
  color: var(--txt2);
  vertical-align: middle;
}
.tbl tr:hover td { background: rgba(51, 65, 85, .25); }
.tbl .sym { font-weight: 700; color: var(--txt); }
.mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 11px; }

/* ── Utilities ─────────────────────────────────────────────────────── */
.sep    { border-top: 1px solid var(--border); margin: 22px 0; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.flex   { display: flex; }
.flex-c { display: flex; align-items: center; }
.flex-b { display: flex; justify-content: space-between; align-items: center; }
.mt-2   { margin-top: 8px; }
.mt-4   { margin-top: 16px; }
.mt-6   { margin-top: 24px; }
.mt-8   { margin-top: 32px; }
.mb-2   { margin-bottom: 8px; }
.mb-4   { margin-bottom: 16px; }
.mb-6   { margin-bottom: 24px; }
.mb-8   { margin-bottom: 32px; }
.g      { color: var(--green); }
.r      { color: var(--red); }
.txt2   { color: var(--txt2); }
.txt3   { color: var(--txt3); }
.fw7    { font-weight: 700; }
.fw8    { font-weight: 800; }
.fs12   { font-size: 12px; }
.fs13   { font-size: 13px; }
.fs11   { font-size: 11px; }
.fs14   { font-size: 14px; }
.w100   { width: 100%; }
.ta-c   { text-align: center; }
.hl {
  background: linear-gradient(125deg, #3b82f6 0%, #22c55e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.disclaimer {
  background: rgba(245, 158, 11, .07);
  border: 1px solid rgba(245, 158, 11, .25);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 12px;
  color: var(--txt3);
  line-height: 1.7;
}

.tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--txt3);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .15s;
}
.tab:hover { color: var(--txt); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Hero ──────────────────────────────────────────────────────────── */
.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px 0 48px;
  background:
    radial-gradient(ellipse 60% 60% at 25% 50%, rgba(59, 130, 246, .12) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 75% 20%, rgba(34, 197, 94, .07) 0%, transparent 60%);
}
.hero-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
  text-align: center;
}
.hero h1 { margin-bottom: 22px; max-width: 680px; text-align: center; margin-left: auto; margin-right: auto; }
.hero-sub {
  font-size: 1.05rem;
  color: var(--txt2);
  max-width: 520px;
  margin-bottom: 38px;
  line-height: 1.75;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}
.hero-actions { display: flex; gap: 14px; align-items: center; justify-content: center; }

/* Metric info tooltip */
.metric-tip {
  position: relative;
  cursor: help;
  white-space: nowrap;
}
.metric-tip .tip-icon {
  display: inline-block;
  width: 13px;
  height: 13px;
  line-height: 13px;
  font-size: 8px;
  font-weight: 700;
  font-style: normal;
  text-align: center;
  border-radius: 50%;
  border: 1px solid rgba(100, 116, 139, .5);
  color: #64748b;
  margin-left: 3px;
  vertical-align: middle;
}
.metric-tip .tip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(51, 65, 85, .7);
  white-space: nowrap;
  z-index: 10;
  transition: opacity .15s;
  pointer-events: none;
}
.metric-tip:hover .tip-text {
  visibility: visible;
  opacity: 1;
}

/* ── Stats Bar ─────────────────────────────────────────────────────── */
.stats-bar {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.stats-inner { display: flex; }
.stat {
  flex: 1;
  padding: 22px 0;
  text-align: center;
  border-right: 1px solid var(--border);
}
.stat:last-child { border-right: none; }
.stat-val { font-size: 2rem; font-weight: 800; }
.stat-lbl { font-size: 11px; color: var(--txt3); margin-top: 3px; letter-spacing: .4px; }

/* ── Feature Cards ─────────────────────────────────────────────────── */
.feat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 26px;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.feat-card:hover {
  transform: translateY(-4px);
  border-color: rgba(120, 160, 255, .35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.feat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(70, 120, 255, .15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
  transition: transform 200ms ease;
}
.feat-card:hover .feat-icon {
  transform: rotate(6deg);
}

/* ── Performance Chart Tabs ────────────────────────────────────────── */
.chart-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.chart-tab {
  padding: 10px 22px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--txt3);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  margin-bottom: -1px;
}
.chart-tab.active { color: #93bbfd; border-bottom: 3px solid var(--accent); }
.chart-tab:hover:not(.active) { color: var(--txt); }
.chart-panels-wrap { display: grid; height: 250px; overflow: hidden; position: relative; }
.chart-panel { grid-column: 1; grid-row: 1; height: 250px; opacity: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: flex-end; transition: opacity 180ms ease; }
.chart-panel.active { opacity: 1; pointer-events: auto; }
.svg-chart { width: 100%; overflow: visible; }
.chart-note { font-size: 11px; color: var(--txt3); margin-top: 8px; }

/* ── Bar Chart ─────────────────────────────────────────────────────── */
.bar-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 150px;
  margin-bottom: 0;
  border-bottom: 1px solid rgba(51,65,85,.5);
}
.yr-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-width: 0;
  position: relative;
  cursor: pointer;
}
.yr-bar .pos {
  background: rgba(34, 197, 94, .65);
  border-radius: 3px 3px 0 0;
  margin-top: auto;
}
.yr-bar .neg {
  background: rgba(239, 68, 68, .65);
  border-radius: 3px 3px 0 0;
  margin-top: auto;
}
.yr-bar::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15,23,42,.95);
  border: 1px solid rgba(51,65,85,.5);
  color: #e2e8f0;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
  margin-bottom: 4px;
}
.yr-bar:hover::after { opacity: 1; }
.yr-bar:hover .pos { background: rgba(34, 197, 94, .85); }
.yr-bar:hover .neg { background: rgba(239, 68, 68, .85); }
.bar-labels {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 16px;
}
.bar-labels .lbl {
  flex: 1;
  font-size: 10px;
  color: var(--txt3);
  text-align: center;
  min-width: 0;
  line-height: 1.4;
}

/* ── Algorithm Carousel ────────────────────────────────────────────── */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--txt);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all .15s;
  line-height: 1;
}
.carousel-btn:hover { border-color: var(--accent); color: var(--accent); }
.algo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: all .2s;
  display: inline-block;
}
.algo-dot.active { background: var(--accent); transform: scale(1.3); }
#algo-card { min-height: 840px; display: flex; flex-direction: column; }

/* ── Signal Preview ────────────────────────────────────────────────── */
.signal-blur { filter: blur(5px); pointer-events: none; padding: 20px; }
.signal-gate {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(2px);
  border-radius: 12px;
}
.signal-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

/* ── Strategy / Algorithm Detail Page ─────────────────────────────── */
.page-hero {
  padding: 64px 0 48px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.regime-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.results-tbl { width: 100%; border-collapse: collapse; }
.results-tbl th {
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--txt3);
  background: rgba(51, 65, 85, .3);
}
.results-tbl td {
  padding: 9px 14px;
  border-bottom: 1px solid rgba(51, 65, 85, .4);
  font-size: 13px;
}
.results-tbl tr:hover td { background: rgba(51, 65, 85, .25); }

/* ── Pricing Page ──────────────────────────────────────────────────── */
.price-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  text-align: center;
  position: relative;
}
.price-card.featured {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(59, 130, 246, .06) 0%, var(--bg-card) 100%);
}
.price-card .price { font-size: 2.6rem; font-weight: 800; margin: 14px 0 4px; }
.price-card .period { font-size: 13px; color: var(--txt3); margin-bottom: 22px; }
.price-card ul { text-align: left; list-style: none; margin-bottom: 26px; }
.price-card ul li { padding: 5px 0; font-size: 13px; color: var(--txt2); }
.price-card ul li::before { content: '✓ '; color: var(--green); font-weight: 700; }
.rec-tag {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 14px;
  border-radius: 20px;
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* ── Auth Pages ────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: calc(100vh - 74px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
}
.auth-logo { font-size: 1.5rem; font-weight: 800; margin-bottom: 4px; cursor: pointer; }
.auth-logo span { color: var(--accent); }
.auth-logo-wrap { margin-bottom: 28px; }
.auth-card h2 { margin-bottom: 6px; }
.auth-sub { color: var(--txt2); font-size: 13px; margin-bottom: 28px; }
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--txt3);
  font-size: 12px;
}
.divider::before,
.divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── App Shell — Authenticated ─────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 224px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sb-logo {
  padding: 20px 20px 16px;
  font-size: 1.3rem;
  font-weight: 800;
  border-bottom: 1px solid var(--border);
}
.sb-logo span { color: var(--accent); }
.sb-tagline {
  padding: 0 20px 14px;
  font-size: 7.5px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 1.2px;
  color: var(--txt3);
  opacity: 0.7;
  border-bottom: 1px solid var(--border);
}
.sb-nav { flex: 1; padding: 10px; }
.sb-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--txt2);
  cursor: pointer;
  transition: all .15s;
  margin-bottom: 2px;
}
.sb-item:hover { background: rgba(51, 65, 85, .5); color: var(--txt); }
.sb-item.active { background: rgba(59, 130, 246, .12); color: var(--accent); }
.sb-icon { width: 20px; text-align: center; font-size: 16px; }
.sb-footer { padding: 16px; border-top: 1px solid var(--border); }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #22c55e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.app-main { flex: 1; overflow-y: auto; }
.topbar {
  height: 60px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}
.app-view { padding: 28px; }

/* ── Metric Cards ──────────────────────────────────────────────────── */
.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.metric-lbl {
  font-size: 11px;
  color: var(--txt3);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 10px;
}
.metric-val { font-size: 1.65rem; font-weight: 800; }
.metric-chg { font-size: 12px; margin-top: 4px; }

/* ── Signal Card ───────────────────────────────────────────────────── */
.signal-card {
  background: linear-gradient(135deg, #152847, #1e293b);
  border: 1px solid #3b82f6;
  border-radius: 12px;
  padding: 22px;
}

/* ── Donut Chart ───────────────────────────────────────────────────── */
.donut-wrap { display: grid; grid-template-columns: 160px 1fr; gap: 20px; align-items: center; }
.alloc-item { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 10px; }
.alloc-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* ── Toggle Switch ─────────────────────────────────────────────────── */
.toggle { position: relative; display: inline-block; width: 42px; height: 22px; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 22px;
  transition: .2s;
}
.slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
}
.toggle input:checked + .slider { background: var(--accent); }
.toggle input:checked + .slider::before { transform: translateX(20px); }

/* ── Settings ──────────────────────────────────────────────────────── */
.settings-section h3 {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.notif-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(51, 65, 85, .4);
}
.notif-row:last-child { border-bottom: none; }

/* ── Connection Status ─────────────────────────────────────────────── */
.conn-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.conn-dot.live { background: var(--green); box-shadow: 0 0 6px var(--green); }
.conn-dot.off  { background: var(--txt3); }

/* ── Skip-to-content ───────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -48px;
  left: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 8px 0;
  z-index: 9999;
  transition: top .15s;
}
.skip-link:focus { top: 0; }

/* ── Accessibility ─────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Reduced Motion ────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ── Nav Dropdown ────────────────────────────────────────────────── */
.nav-dropdown { position: relative; }
.nav-dropdown > a { display: flex; align-items: center; gap: 5px; }
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  min-width: 170px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  display: none;
  z-index: 200;
}
/* Invisible bridge so hover doesn't break across the 10px gap */
.nav-dropdown-menu::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--txt2);
  text-decoration: none;
  cursor: pointer;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.nav-dropdown-menu a:hover { background: rgba(255,255,255,.06); color: var(--txt); }
.nav-caret { font-size: 9px; opacity: .5; transition: transform .15s; }
.nav-dropdown:hover .nav-caret { transform: rotate(180deg); }

/* ── Content gate overlay ─────────────────────────────────────────── */
.gate-card {
  background: var(--bg-card);
  border: 1px solid rgba(59,130,246,.3);
  border-radius: 14px;
  padding: 28px 32px;
  text-align: center;
  max-width: 400px;
  width: 100%;
  margin: 0 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
}

/* ── Print Styles ──────────────────────────────────────────────────── */
@media print {
  body {
    background: #fff;
    color: #000;
  }
  .pub-nav,
  .sidebar,
  .topbar,
  .btn,
  .hero-actions,
  .signal-gate,
  footer {
    display: none !important;
  }
  .page { display: block !important; }
  .card {
    border: 1px solid #ccc;
    background: #fff;
    break-inside: avoid;
  }
  .txt2, .txt3 { color: #555; }
  .g { color: #16a34a; }
  .r { color: #dc2626; }
}

/* ══════════════════════════════════════════════════════════════════════
   RESPONSIVE — Hamburger Base + Table Scroll + Breakpoints
   ══════════════════════════════════════════════════════════════════════ */

/* ── Hamburger button (hidden on desktop) ─────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  z-index: 210;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--txt);
  border-radius: 2px;
  transition: transform .25s, opacity .2s;
}
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Nav overlay (hidden on desktop) ──────────────────────────────── */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 99;
  opacity: 0;
  transition: opacity .25s;
}
.nav-overlay.active {
  display: block;
  opacity: 1;
}

/* ── Table scroll wrapper ─────────────────────────────────────────── */
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ══════════════════════════════════════════════════════════════════════
   TABLET — max-width: 1024px
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  h1 { font-size: 2.1rem; }
  h2 { font-size: 1.5rem; }

  .container { padding: 0 20px; }
  .section { padding: 40px 0; }
  .page-hero { padding: 48px 0 36px; }

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

  /* Hero stats: 5-col → 3-col */
  .hero-stats-grid { grid-template-columns: repeat(3, 1fr) !important; }

  /* Backtest summary: 6-col → 3-col */
  .backtest-summary-grid { grid-template-columns: repeat(3, 1fr) !important; }

  /* Algo featured card: side-by-side → stacked */
  .algo-featured-grid { grid-template-columns: 1fr !important; }
  .algo-featured-stats { min-width: unset !important; }

  /* Pricing cards */
  .price-card { padding: 28px; }
  .price-card .price { font-size: 2.2rem; }

  /* Pub nav: tighten link gaps */
  .pub-nav-links { gap: 22px; }
  .pub-nav { padding: 0 20px; }
}

/* ══════════════════════════════════════════════════════════════════════
   MOBILE — max-width: 768px
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.35rem; }
  h3 { font-size: 1rem; }

  .container { padding: 0 16px; }
  .section { padding: 32px 0; }
  .page-hero { padding: 36px 0 28px; }

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

  /* Prevent horizontal scroll from off-screen nav drawer */
  html, body { overflow-x: hidden; }

  /* ── Hamburger visible, nav becomes drawer ─── */
  .hamburger { display: flex; }

  .pub-nav {
    height: 60px;
    padding: 0 16px;
  }

  .pub-nav-links {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    padding: 72px 20px 20px;
    z-index: 200;
    overflow-y: auto;
    transition: right .3s ease;
  }
  .pub-nav-links.open { right: 0; }
  .pub-nav-links a {
    display: block;
    padding: 12px 0;
    font-size: 15px;
    border-bottom: 1px solid rgba(51,65,85,.3);
  }

  /* Dropdown in mobile nav: inline expand */
  .nav-dropdown-menu {
    position: static !important;
    transform: none !important;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0 0 0 16px;
    min-width: unset;
    display: block !important;
  }
  .nav-dropdown-menu::before { display: none; }
  .nav-dropdown-menu a {
    padding: 10px 0;
    font-size: 14px;
    border-bottom: 1px solid rgba(51,65,85,.2);
  }
  .nav-caret { display: none; }

  /* Nav actions: bottom of drawer */
  .pub-nav-actions {
    position: fixed;
    bottom: 0;
    right: -280px;
    width: 280px;
    flex-direction: column;
    padding: 16px 20px;
    gap: 10px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 201;
    transition: right .3s ease;
  }
  .pub-nav-actions.open { right: 0; }
  .pub-nav-actions .btn { width: 100%; justify-content: center; }

  /* Logo tagline: hide on mobile */
  .logo-tagline { display: none; }

  /* Hero stats: 5-col → 2-col */
  .hero-stats-grid { grid-template-columns: 1fr 1fr !important; }
  /* Remove vertical dividers that don't make sense at 2-col */
  .hero-stats-grid > div { border-right: none !important; border-bottom: 1px solid rgba(51,65,85,.3); }

  /* Backtest summary: 6-col → 2-col */
  .backtest-summary-grid { grid-template-columns: 1fr 1fr !important; }

  /* Algo featured card */
  .algo-featured-grid { grid-template-columns: 1fr !important; }
  .algo-featured-stats {
    grid-template-columns: 1fr 1fr !important;
    min-width: unset !important;
    padding: 16px 0 0 !important;
    border-top: 1px solid var(--border);
  }

  /* Carousel: hide arrow buttons, no side padding */
  .carousel-btn { display: none; }
  .carousel-wrap { padding: 0 !important; }
  #algo-card { min-height: auto; }

  /* Carousel stats grid */
  .carousel-stats-grid { grid-template-columns: 1fr 1fr !important; }

  /* Roadmap grid */
  .roadmap-grid { grid-template-columns: 1fr !important; }

  /* Signup name grid */
  .signup-name-grid { grid-template-columns: 1fr !important; }

  /* Stats bar: wrap */
  .stats-inner { flex-wrap: wrap; }
  .stat { min-width: 50%; border-bottom: 1px solid var(--border); }
  .stat-val { font-size: 1.5rem; }

  /* Auth cards */
  .auth-wrap { padding: 20px 16px; }
  .auth-card { padding: 28px 20px; }

  /* Pricing */
  .price-card { padding: 24px; }
  .price-card .price { font-size: 2rem; }

  /* Cards: tighter padding */
  .card { padding: 20px; }
  .disclaimer { padding: 12px 14px; font-size: 11px; }

  /* Hero: compact */
  .hero { padding: 40px 0 32px; }
  .hero h1 { margin-bottom: 16px; }
  .hero-sub { font-size: 0.95rem; margin-bottom: 28px; }
  .hero-actions { flex-direction: column; gap: 10px; }
  .hero-actions .btn { width: 100%; justify-content: center; }

  /* Sidebar (authenticated app): off-screen drawer */
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    height: 100vh;
    z-index: 150;
    transition: left .3s ease;
  }
  .sidebar.open { left: 0; }

  /* Feature cards: reduce padding */
  .feat-card { padding: 20px; }

  /* Gate card */
  .gate-card { padding: 22px 20px; }

  /* Buttons */
  .btn-lg { padding: 12px 24px; font-size: 15px; }

  /* Bar chart / chart panels */
  .chart-panels-wrap { height: 200px; }
  .chart-panel { height: 200px; }
  .bar-row { height: 120px; }

  /* Metric cards */
  .metric-val { font-size: 1.4rem; }
}

/* ══════════════════════════════════════════════════════════════════════
   SMALL MOBILE — max-width: 480px
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  body { font-size: 14px; }
  h1 { font-size: 1.45rem; }
  h2 { font-size: 1.2rem; }

  .container { padding: 0 12px; }

  /* All stat grids → 1 col */
  .hero-stats-grid { grid-template-columns: 1fr !important; }
  .backtest-summary-grid { grid-template-columns: 1fr !important; }
  .carousel-stats-grid { grid-template-columns: 1fr !important; }
  .algo-featured-stats { grid-template-columns: 1fr !important; }

  /* Mobile nav drawer: full width */
  .pub-nav-links { width: 100vw; right: -100vw; }
  .pub-nav-links.open { right: 0; }
  .pub-nav-actions { width: 100vw; right: -100vw; }
  .pub-nav-actions.open { right: 0; }

  /* Stats bar: 1-col */
  .stat { min-width: 100%; }

  /* Hero */
  .hero { padding: 32px 0 24px; }
  .hero-sub { font-size: 0.9rem; }

  /* Auth */
  .auth-wrap { padding: 16px 12px; }
  .auth-card { padding: 24px 16px; border-radius: 12px; }

  /* Card */
  .card { padding: 16px; border-radius: 10px; }
  .price-card { padding: 20px; border-radius: 12px; }
  .price-card .price { font-size: 1.8rem; }

  /* Buttons: full width */
  .btn-primary, .btn-outline { width: 100%; justify-content: center; }
}
