/* Stratara shared theme dark (default) and light */
:root,
[data-theme="dark"] {
  --bg: #080c10;
  --surface: #121a24;
  --surface2: #1a2535;
  --border: #2a384d;
  --text: #eef2f7;
  --muted: #8494a7;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent2: #22d3ee;
  --green: #4ade80;
  --green-bg: #052e16;
  --green-border: #166534;
  --red: #f87171;
  --red-bg: #450a0a;
  --red-border: #991b1b;
  --amber: #fbbf24;
  --amber-bg: #422006;
  --amber-border: #92400e;
  --blue-bg: #1e1b4b22;
  --teal-bg: #042f2e22;
  --code-bg: #0a0f14;
  --shadow: rgba(0, 0, 0, 0.35);
  --topbar-bg: var(--surface);
  --pill-active-bg: #312e81;
  --journey-hover: #475569;
  --gold-text: #1a1a1a;
}

[data-theme="light"] {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface2: #eef2f7;
  --border: #d4dce8;
  --text: #1a2332;
  --muted: #5c6b7f;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent2: #0891b2;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --green-border: #86efac;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --red-border: #fca5a5;
  --amber: #d97706;
  --amber-bg: #fef3c7;
  --amber-border: #fcd34d;
  --blue-bg: #eef2ff;
  --teal-bg: #ecfeff;
  --code-bg: #f1f5f9;
  --shadow: rgba(15, 23, 42, 0.08);
  --topbar-bg: var(--surface);
  --pill-active-bg: #e0e7ff;
  --journey-hover: #94a3b8;
  --gold-text: #1a1a1a;
}

[data-theme="light"] .btn-gold {
  color: var(--gold-text);
}

[data-theme="light"] .step-pill.done {
  color: var(--green);
}

[data-theme="light"] .step-pill.fail {
  color: var(--red);
}

[data-theme="light"] .badge.on {
  background: var(--green-bg);
  color: var(--green);
}

[data-theme="light"] .badge.off {
  background: var(--red-bg);
  color: var(--red);
}

[data-theme="light"] .journey-card .pick-badge {
  background: #e0e7ff;
  color: var(--accent);
}

[data-theme="light"] .insight-list li {
  color: var(--text);
}

[data-theme="light"] .start-step {
  color: var(--muted);
}

.theme-toggle {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  line-height: 1;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

.help-menu {
  position: relative;
  display: inline-block;
}

.help-menu-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px var(--shadow);
  padding: 0.35rem;
  z-index: 200;
}

.help-menu.open .help-menu-panel {
  display: block;
}

.help-menu-panel a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.82rem;
}

.help-menu-panel a:hover {
  background: var(--surface2);
}

.help-menu-panel a small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  margin-top: 0.1rem;
}

.help-menu-panel hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.25rem 0;
}

.brand-logo {
  height: 32px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.brand-logo-lg {
  height: 40px;
  margin-bottom: 0.75rem;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.topbar-brand a {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-tagline {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .brand-tagline { display: none; }
}

/* Insight data visualization */
.insight-layout { display: flex; flex-direction: column; gap: 0.85rem; }
.insight-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.75rem; }
.insight-headline { font-size: 1.1rem; font-weight: 700; color: var(--accent2); margin: 0; line-height: 1.3; }
.insight-value { font-size: 0.82rem; color: var(--muted); margin: 0; }
.verdict-banner.compact { margin-bottom: 0; padding: 0.7rem 0.85rem; }
.verdict-banner.compact p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 0.5rem;
  flex: 1; min-width: min(100%, 280px);
}
.stat-card {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.55rem 0.65rem; text-align: center;
}
.stat-card .stat-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.stat-card .stat-val { font-size: 1.05rem; font-weight: 700; color: var(--accent2); margin-top: 0.15rem; }

.insight-section { margin-top: 0.15rem; }
.insight-section-title {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin: 0 0 0.45rem;
}
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.data-table th {
  text-align: left; padding: 0.45rem 0.65rem; background: var(--surface2);
  color: var(--muted); font-weight: 600; font-size: 0.68rem; text-transform: uppercase;
  letter-spacing: 0.04em; border-bottom: 1px solid var(--border);
}
.data-table td { padding: 0.45rem 0.65rem; border-bottom: 1px solid var(--border); color: var(--text); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:nth-child(even) td { background: rgba(255,255,255,0.02); }
[data-theme="light"] .data-table tbody tr:nth-child(even) td { background: rgba(0,0,0,0.02); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .pos { color: var(--green); }
.data-table .neg { color: var(--red); }
.data-table .buy { color: var(--green); font-weight: 600; }
.data-table .sell { color: var(--red); font-weight: 600; }

.bar-chart { display: flex; flex-direction: column; gap: 0.4rem; }
.bar-row { display: grid; grid-template-columns: 4.5rem 1fr 3.5rem; gap: 0.5rem; align-items: center; font-size: 0.78rem; }
.bar-label { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; background: var(--surface2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 999px; min-width: 2px; }
.bar-fill.neg { background: linear-gradient(90deg, var(--red), #fb923c); }
.bar-fill.target { background: var(--border); opacity: 0.85; }
.bar-val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.72rem; }

.weight-chart .bar-row { grid-template-columns: 4.5rem 1fr 5.5rem; }
.weight-chart .bar-dual { display: flex; flex-direction: column; gap: 3px; }
.weight-chart .bar-track { height: 6px; }

.compare-chart { display: flex; flex-direction: column; gap: 0.65rem; }
.compare-row { display: grid; grid-template-columns: 5rem 1fr; gap: 0.5rem; align-items: center; font-size: 0.78rem; }
.compare-metric { color: var(--muted); font-weight: 600; }
.compare-bars { display: flex; flex-direction: column; gap: 0.3rem; }
.compare-bar-line { display: grid; grid-template-columns: 4rem 1fr 3rem; gap: 0.4rem; align-items: center; }
.compare-bar-line .lbl { font-size: 0.68rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-bar-line .val { text-align: right; font-size: 0.72rem; font-variant-numeric: tabular-nums; }

.insight-tip {
  padding: 0.6rem 0.75rem; background: var(--surface2); border-radius: 8px;
  border-left: 3px solid var(--accent); font-size: 0.8rem; color: var(--muted); line-height: 1.45;
}
.insight-tip strong { color: var(--accent2); }

details.raw-json { font-size: 0.75rem; margin-top: 0.25rem; }
details.raw-json summary { cursor: pointer; color: var(--muted); user-select: none; padding: 0.35rem 0; }
details.raw-json pre {
  margin-top: 0.35rem; padding: 0.65rem; background: var(--code-bg); border-radius: 6px;
  overflow: auto; max-height: 180px; font-family: Consolas, monospace; font-size: 0.68rem;
}

/* Journey summary tabs */
.summary-tabs { display: flex; gap: 0.25rem; margin-bottom: 1rem; flex-wrap: wrap; }
.summary-tab {
  background: var(--surface2); border: 1px solid var(--border); color: var(--muted);
  padding: 0.4rem 0.75rem; border-radius: 8px; font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
.summary-tab.active { background: var(--pill-active-bg); border-color: var(--accent); color: var(--text); }
.summary-tab-panel { display: none; }
.summary-tab-panel.active { display: block; }

.summary-step details { margin-top: 0.35rem; }
.summary-step details summary { cursor: pointer; font-size: 0.78rem; color: var(--accent2); user-select: none; }
.summary-step-compact .summary-step-headline { margin-bottom: 0; }

/* Demo layout: focus mode after journey starts */
.layout.demo-focus .hero,
.layout.demo-focus .getting-started,
.layout.demo-focus .stats { display: none; }
.layout.demo-focus .provider-banner { margin-bottom: 0.75rem; }
.layout.demo-focus .page-intro { display: none; }

.session-rail details { border: none; }
.session-rail summary {
  cursor: pointer; font-size: 0.85rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.06em; list-style: none; display: flex; align-items: center; gap: 0.35rem;
}
.session-rail summary::-webkit-details-marker { display: none; }
.session-rail summary::before { content: "▸"; font-size: 0.7rem; }
.session-rail details[open] summary::before { content: "▾"; }
.session-rail .session-chips { margin-top: 0.65rem; }

.getting-started details summary {
  cursor: pointer; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin-bottom: 0.75rem; list-style: none;
}
.getting-started details summary::-webkit-details-marker { display: none; }
