:root {
  --bg: #ffffff;
  --fg: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --brand: #0f172a;
  --brand-ink: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --accent: #2563eb;
  --shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px 0 rgba(0,0,0,0.06);
  --radius: 6px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.6;
}
.nav-bar {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-container {
  max-width: 1100px;
  margin: auto;
  padding: 0 20px;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: flex-end;
  gap: 16px;
}
.brand-group {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  text-decoration: none !important;
}
.brand-group img {
  display: block; /* avoids baseline/descender extra bottom space */
  height: 100px;
  width: auto;
}
.brand-text {
  font-weight: 700;
  color: var(--brand);
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.nav-menu {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  min-width: 0;
}

.nav-actions {
  display: inline-flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-link {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
}
.nav-link:hover { color: var(--brand); }

.version-badge {
  display: none; /* keep hidden on demos (shown on landing/index.html) */
  font-size: 0.75rem;
  font-weight: 700;
  color: #059669;
  background: #ecfdf5;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid #a7f3d0;
  white-space: nowrap;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: var(--brand-ink);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
  border: 1px solid var(--brand);
}
.cta:hover { filter: brightness(1.05); }

.cta.nav {
  padding: 8px 14px;
}

@media (max-width: 920px) {
  .nav-container { flex-wrap: wrap; align-items: flex-start; }
  .nav-right { align-items: flex-start; }
  .nav-menu { align-items: flex-start; }
}
.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 6px;
  background: #e2e8f0;
  color: #334155;
  text-decoration: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  font-weight: 600;
}
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}
.hero {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.hero h1 { margin: 0 0 8px; color: var(--brand); }
.hero p { margin: 0; color: var(--muted); }
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.section h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  color: var(--brand);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
input, textarea {
  width: 100%;
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--fg);
  background: var(--surface);
}
textarea { min-height: 120px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}
.btn.primary {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: var(--brand);
}
.btn.accent {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.status { font-size: 0.85rem; color: var(--muted); }
.log {
  background: #0b1220;
  color: #d1d5db;
  border-radius: var(--radius);
  padding: 12px;
  min-height: 200px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  overflow: auto;
  white-space: pre-wrap;
}
.step {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface-2);
}
.step h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--brand);
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.tab-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}
.tab-btn.active {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: var(--brand);
}
.panel {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.panel.active { display: block; }
.note {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-top: 10px;
}
.info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: help;
}
.param-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.param-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.75rem;
  color: var(--muted);
  cursor: help;
}
.response {
  min-height: 90px;
}

.chart-card {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.chart-head {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.chart-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.pie-wrap {
  width: 180px;
  height: 130px;
  position: relative;
  perspective: 700px;
  flex: 0 0 auto;
}

.pie {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  position: absolute;
  top: -22px;
  left: 10px;
  transform: rotateX(54deg);
  transform-origin: center center;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.14);
}

.pie::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  transform: translateY(11px);
  background: rgba(15, 23, 42, 0.10);
  z-index: -1;
}

.pie::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, rgba(255,255,255,0.35), rgba(255,255,255,0) 45%);
  pointer-events: none;
}

.legend {
  display: grid;
  gap: 6px;
  flex: 1 1 260px;
}

.metrics-grid {
  display: grid;
  gap: 10px;
  width: 100%;
}

.metric-row {
  display: grid;
  gap: 6px;
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  min-width: 0;
}

.metric-key {
  color: var(--muted);
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-val {
  color: var(--fg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  flex: 0 0 auto;
}

.metric-bar-bg {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}

.metric-bar {
  height: 100%;
  border-radius: 999px;
}

.legend-item {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--fg);
  border-bottom: 1px dashed rgba(100, 116, 139, 0.25);
  padding-bottom: 4px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.legend-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-value {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.predict-explain {
  margin-top: 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 10px;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}

.predict-explain strong {
  color: var(--fg);
}

.predict-timeline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 10px;
}

.timeline-step {
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-arrow {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.timeline-more {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.75rem;
  font-weight: 700;
}

