/* =====================================================================
   Daemon · BrainBoostAI demo — stylesheet
   ===================================================================== */

:root {
  --bg: #F7F8FB;
  --surface: #FFFFFF;
  --ink: #0F172A;
  --ink-2: #1E293B;
  --muted: #64748B;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;

  --accent: #6E54E1;
  --accent-hover: #5840C0;
  --accent-blue: #2563EB;
  --accent-pink: #F61067;
  --accent-magenta: #B8198F;

  --gradient: linear-gradient(135deg, #F61067 0%, #B8198F 25%, #6E54E1 60%, #2563EB 100%);
  --gradient-soft: linear-gradient(90deg, rgba(110, 84, 225, 0.08), rgba(37, 99, 235, 0.04));
  --gradient-tint: linear-gradient(135deg, rgba(246, 16, 103, 0.06) 0%, rgba(110, 84, 225, 0.06) 60%, rgba(37, 99, 235, 0.06) 100%);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.08);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 14px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-size: 0.9em; }

h1, h2, h3, h4 {
  margin: 0 0 0.4em;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.25;
}
h1 { font-size: 28px; letter-spacing: -0.01em; }
h2 { font-size: 22px; letter-spacing: -0.005em; }
h3 { font-size: 17px; }
h4 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }

p { margin: 0 0 0.8em; }

/* ---------------------------------------------------------------------
   Header
   --------------------------------------------------------------------- */
.site-header {
  background: var(--ink);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.18);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 28px 8px;
  display: flex;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
}
.brand-icon {
  height: 36px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(246, 16, 103, 0.25));
}
.brand-text {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 17px;
  letter-spacing: -0.005em;
}
.brand-name {
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sep { color: rgba(255,255,255,0.35); font-weight: 300; }
.brand-product { color: #fff; font-weight: 500; }

/* Tabs — full-width row below the brand. Wraps to a second line on narrow
   screens so every tab is visible at all viewport widths. */
.tabs {
  max-width: 1280px;
  margin: 0 auto;
  padding: 4px 18px 0;
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  align-items: flex-end;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.tab {
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.7);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  padding: 10px 14px 12px;
  cursor: pointer;
  position: relative;
  border-radius: 6px 6px 0 0;
  transition: color 120ms ease, background 120ms ease;
  white-space: nowrap;
}
.tab:hover { color: #fff; background: rgba(255, 255, 255, 0.04); }
.tab.is-active { color: #fff; }
.tab.is-active::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 3px;
  border-radius: 2px;
  background: var(--gradient);
}

/* ---------------------------------------------------------------------
   Main / views
   --------------------------------------------------------------------- */
main#views {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 28px 64px;
}

.view { display: none; }
.view.is-active { display: block; }

/* ---------------------------------------------------------------------
   Hero (overview)
   --------------------------------------------------------------------- */
.hero {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gradient-tint);
  pointer-events: none;
}
.hero-inner { position: relative; display: flex; gap: 28px; align-items: center; }
.hero-icon {
  height: 64px;
  width: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 12px rgba(110, 84, 225, 0.25));
}
.hero-text { flex: 1; min-width: 0; }
.hero-eyebrow {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.hero h1 { font-size: 30px; margin-bottom: 8px; }
.hero p {
  font-size: 16px;
  color: var(--ink-2);
  margin: 0;
  max-width: 80ch;
}

/* ---------------------------------------------------------------------
   Section + cards
   --------------------------------------------------------------------- */
.section { margin-bottom: 36px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.section-head h2 { margin: 0; }
.section-sub { color: var(--muted); font-size: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

/* Winner stat cards (overview) */
.winners-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.winner-card {
  position: relative;
  border-radius: var(--radius);
  padding: 3px;
  background: var(--gradient);
  box-shadow: var(--shadow-md);
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.winner-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.winner-card-inner {
  background: #fff;
  border-radius: 10px;
  padding: 18px 20px;
  height: 100%;
}
.winner-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.winner-label .icon { font-size: 16px; }
.winner-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.1;
  margin-bottom: 8px;
}
.winner-meta {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.45;
}
.winner-meta strong { color: var(--ink); font-weight: 600; }
.winner-meta .exp {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Smaller per-experiment winner cards */
.mini-winners {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.mini-winner {
  position: relative;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 14px 20px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.mini-winner::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--gradient);
}
.mini-winner h4 { margin: 0 0 6px; font-size: 11px; }
.mini-winner-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.mini-winner-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

/* ---------------------------------------------------------------------
   Insights
   --------------------------------------------------------------------- */
.insights {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px 20px 28px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.insights::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--gradient);
}
.insights h3 { margin-top: 0; }
.insights ul { margin: 0; padding-left: 18px; }
.insights li { margin-bottom: 8px; color: var(--ink-2); }
.insights li:last-child { margin-bottom: 0; }
.insights li strong { color: var(--ink); }

.callout {
  background: var(--gradient-soft);
  border-radius: var(--radius);
  padding: 14px 18px;
  border: 1px solid var(--border);
  font-size: 14px;
  color: var(--ink-2);
  margin-bottom: 18px;
}
.callout strong { color: var(--ink); }

.conclusion-section .section-head { margin-bottom: 12px; }
.conclusion-section h3 { margin: 0; font-size: 18px; color: var(--ink); }
.conclusion-list {
  list-style: none;
  margin: 0;
  padding: 18px 22px;
  background: var(--gradient-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--ink-2);
}
.conclusion-list li {
  position: relative;
  padding: 6px 0 6px 22px;
  line-height: 1.55;
}
.conclusion-list li + li { border-top: 1px dashed var(--border); margin-top: 4px; padding-top: 10px; }
.conclusion-list li::before {
  content: "•";
  position: absolute;
  left: 4px;
  top: 6px;
  color: var(--accent, #F61067);
  font-weight: 700;
}
.conclusion-list strong { color: var(--ink); }

.note-warn {
  background: #FFF7ED;
  border: 1px solid #FED7AA;
  color: #9A3412;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
}

/* ---------------------------------------------------------------------
   Chips
   --------------------------------------------------------------------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #EEF2FF;
  color: var(--accent);
  border: 1px solid #E0E7FF;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12.5px;
  font-weight: 500;
  font-family: var(--font-mono);
}
.chip-key { color: var(--muted); font-weight: 500; }
.chip-val { color: var(--ink); }

/* ---------------------------------------------------------------------
   Tables
   --------------------------------------------------------------------- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
table.exec {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.exec th, table.exec td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.exec th {
  background: #F8FAFC;
  font-weight: 600;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
table.exec tbody tr:last-child td { border-bottom: 0; }
table.exec tbody tr:hover { background: #F8FAFC; }
table.exec td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.exec td.approach,
table.exec td.model { font-weight: 500; }
table.exec td.approach { text-transform: capitalize; }

/* Winner row */
table.exec tr.winner-row td { background: var(--gradient-soft); }
table.exec tr.winner-row td:first-child {
  position: relative;
}
table.exec tr.winner-row td:first-child::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--gradient);
}
table.exec tr.winner-row td:first-child {
  padding-left: 18px;
  font-weight: 600;
}
.trophy {
  display: inline-block;
  margin-left: 6px;
  font-size: 13px;
}

/* Approach pill in tables */
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pill-textract { background: rgba(37, 99, 235, 0.1); color: #1D4ED8; }
.pill-bda { background: rgba(246, 16, 103, 0.1); color: #BE123C; }

/* ---------------------------------------------------------------------
   Charts
   --------------------------------------------------------------------- */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 12px;
  box-shadow: var(--shadow-sm);
}
.chart-card h3 { margin: 0 0 4px; }
.chart-card .sub { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.chart-wrap {
  position: relative;
  height: 320px;
}
.chart-wrap.tall { height: 380px; }
.chart-wrap.xl { height: 570px; }

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 980px) {
  .chart-grid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------
   Phase 1 mini card
   --------------------------------------------------------------------- */
.phase1-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.phase1-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.phase1-card .approach-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.phase1-card .approach-head h4 { margin: 0; color: var(--ink); font-size: 13px; text-transform: none; letter-spacing: 0; }
.phase1-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.metric {
  display: flex;
  flex-direction: column;
}
.metric .label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.metric .value {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------------
   Buttons / toggles
   --------------------------------------------------------------------- */
.btn-group {
  display: inline-flex;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.btn-group button {
  background: transparent;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.btn-group button:hover { color: var(--ink); }
.btn-group button.is-active {
  background: var(--gradient);
  color: #fff;
}

.link-out {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--accent);
}
.link-out:hover { color: var(--accent-hover); }

/* ---------------------------------------------------------------------
   Two-column layout helpers
   --------------------------------------------------------------------- */
.two-col {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 20px;
}
@media (max-width: 980px) {
  .two-col { grid-template-columns: 1fr; }
}

.exp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.exp-meta .meta-item strong { color: var(--ink); font-weight: 500; }

/* ---------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 40px;
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 28px;
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------------------------------------------------------------------
   Glossary view
   --------------------------------------------------------------------- */
.glossary-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.glossary-section h3 {
  margin: 0 0 14px 0;
  font-size: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.glossary-list {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 3fr;
  gap: 10px 28px;
  align-items: baseline;
}
.glossary-list dt {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  position: relative;
  padding-left: 14px;
}
.glossary-list dt::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 4px;
  background: var(--gradient);
  border-radius: 4px;
}
.glossary-list dd {
  margin: 0;
}
.glossary-short {
  margin: 0 0 4px 0;
  font-weight: 600;
  color: var(--ink);
  font-size: 14px;
}
.glossary-body {
  margin: 0;
  color: var(--ink-2, var(--muted));
  font-size: 13.5px;
  line-height: 1.55;
}
@media (max-width: 800px) {
  .glossary-list {
    grid-template-columns: 1fr;
    gap: 4px 0;
  }
  .glossary-list dt { margin-top: 14px; }
  .glossary-list dt:first-child { margin-top: 0; }
}

/* ---------------------------------------------------------------------
   Per-question heatmap
   --------------------------------------------------------------------- */
.heatmap-section .callout { margin-bottom: 14px; }

.heatmap-host {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.heatmap-wrap {
  max-height: 70vh;
  overflow: auto;
  position: relative;
}

table.heatmap-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
table.heatmap-table thead th {
  position: sticky;
  top: 0;
  background: #F8FAFC;
  z-index: 3;
  font-family: var(--font);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  white-space: nowrap;
}
table.heatmap-table thead th.q-col {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 4;
  background: #F8FAFC;
  border-right: 1px solid var(--border);
  min-width: 90px;
}
table.heatmap-table tbody th.q-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #FFFFFF;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 8px 12px;
  font-family: var(--font);
  font-weight: 600;
  color: var(--ink);
  min-width: 90px;
  white-space: nowrap;
}
table.heatmap-table tbody td.heatmap-cell {
  width: 62px;
  min-width: 62px;
  max-width: 62px;
  padding: 8px 4px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid rgba(226, 232, 240, 0.6);
  transition: filter 100ms ease, transform 100ms ease;
  user-select: none;
}
table.heatmap-table tbody td.heatmap-cell.heatmap-green {
  background: #DCFCE7;
  color: #166534;
}
table.heatmap-table tbody td.heatmap-cell.heatmap-amber {
  background: #FEF9C3;
  color: #854D0E;
}
table.heatmap-table tbody td.heatmap-cell.heatmap-red {
  background: #FEE2E2;
  color: #991B1B;
}
table.heatmap-table tbody td.heatmap-cell.heatmap-empty {
  background: #F8FAFC;
  color: var(--muted);
  cursor: default;
}
table.heatmap-table tbody td.heatmap-cell:not(.heatmap-empty):hover {
  filter: brightness(0.94);
}

/* Row + column hover overlay */
table.heatmap-table .is-hov-row { background-image: linear-gradient(rgba(110, 84, 225, 0.06), rgba(110, 84, 225, 0.06)); }
table.heatmap-table .is-hov-col { box-shadow: inset 0 0 0 9999px rgba(110, 84, 225, 0.06); }

/* ---------------------------------------------------------------------
   Lightbox
   --------------------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  z-index: 200;
  overflow-y: auto;
}
.lightbox.is-open { display: flex; }
.lightbox-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 980px;
  width: 100%;
  padding: 22px 26px 26px;
}
.lightbox-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: transparent;
  border: 0;
  font-size: 26px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 999px;
  transition: background 120ms ease, color 120ms ease;
}
.lightbox-close:hover { background: #F1F5F9; color: var(--ink); }
.lightbox-head { padding-right: 40px; margin-bottom: 14px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.lightbox-title { margin: 0 0 4px; font-size: 18px; }
.lightbox-sub { font-size: 13px; }
.lightbox-body { display: flex; flex-direction: column; gap: 18px; }
.lightbox-figure { margin: 0; }
.lightbox-figure img {
  display: block;
  max-width: 920px;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}
.lightbox-figure figcaption {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}
.lightbox-empty {
  padding: 14px 16px;
  background: #F8FAFC;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13.5px;
}

/* Border-image legend block at the top of the lightbox modal —
   explains the colour code so the client can read a bordered page. */
.legend-card {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
}
.legend-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  margin-bottom: 8px;
}
.legend-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1.5px solid rgba(15, 23, 42, 0.18);
  flex-shrink: 0;
}
.legend-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.legend-explainer {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}

/* ---------------------------------------------------------------------
   Experiment-filter pill row (above the cost-vs-F1 scatter)
   --------------------------------------------------------------------- */
.expfilter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 6px 0 14px;
  padding: 10px 12px;
  background: #FAFBFD;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.expfilter-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 6px;
}
.expfilter-pill {
  appearance: none;
  border: 1.5px solid var(--border-strong);
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.expfilter-pill:hover { border-color: var(--accent); color: var(--ink); }
.expfilter-pill.is-on {
  background: var(--gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 1px 4px rgba(110, 84, 225, 0.3);
}
.expfilter-action {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  padding: 6px 8px;
  margin-left: 4px;
}
.expfilter-action:hover { color: var(--accent-hover); }

/* ---------------------------------------------------------------------
   Compare-two-sweeps section (embedded inside Comparison view)
   --------------------------------------------------------------------- */
.compare-two-host {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px dashed var(--border-strong);
}
.compare-two-host h2 {
  font-size: 22px;
  margin-bottom: 4px;
}
.compare-two-host h3 {
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 24px 0 4px;
  font-weight: 600;
}
.compare-two-host h3::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 14px;
  background: var(--gradient);
  border-radius: 4px;
  margin-right: 10px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}
.compare-selectors {
  display: flex;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}
.compare-selector {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.compare-selector-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.compare-select {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: 14px;
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'><path d='M3 5l4 4 4-4' stroke='%2364748B' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>")
    no-repeat right 10px center;
  color: var(--ink);
  min-width: 240px;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.compare-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(110, 84, 225, 0.18);
}
.compare-vs {
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  padding-bottom: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.compare-toolbar {
  display: flex;
  gap: 16px;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* Diff tables — fixed column widths so A / B / Δ stay vertically aligned
   regardless of the value's character count. Tabular numeric figures
   keep digits aligned within each cell. Base rule does NOT set width;
   each wrapper context (.pq-diff-wrap, .exec-diff-wrap) sets it. */
table.diff-table {
  border-collapse: collapse;
  font-size: 13.5px;
  table-layout: fixed;
}
table.diff-table th,
table.diff-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
table.diff-table thead th {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #FAFBFD;
}
table.diff-table th.small { font-size: 11px; padding: 6px 8px; }
table.diff-table th.diff-group-head {
  text-align: center;
  border-bottom: 2px solid var(--border-strong);
  color: var(--ink);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  background: #F1F4FB;
}
table.diff-table tr.subhead th {
  background: #FAFBFD;
  border-bottom: 1px solid var(--border-strong);
  text-align: center;
  font-size: 10.5px;
}
table.diff-table tbody tr:nth-child(even) td { background: #FCFCFE; }
table.diff-table tbody tr:hover td { background: rgba(110, 84, 225, 0.05); }

/* Vertical separators between metric groups in the exec diff so the
   A | B | Δ triplets read as discrete blocks instead of one long row. */
.exec-diff-wrap table.diff-table thead th.diff-group-head,
.exec-diff-wrap table.diff-table tbody td.delta-good,
.exec-diff-wrap table.diff-table tbody td.delta-bad,
.exec-diff-wrap table.diff-table tbody td.delta-zero,
.exec-diff-wrap table.diff-table thead tr.subhead th:nth-child(3n+2) {
  border-right: 1px solid var(--border);
}

table.diff-table td.num,
table.diff-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
table.diff-table td.num {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
}
table.diff-table td.qcell {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink);
}

/* Δ cells: stronger colour, subtle background tint to draw the eye. */
table.diff-table td.delta-good {
  color: #15803D;
  font-weight: 700;
  background: rgba(34, 197, 94, 0.08) !important;
}
table.diff-table td.delta-bad {
  color: #B91C1C;
  font-weight: 700;
  background: rgba(239, 68, 68, 0.08) !important;
}
table.diff-table td.delta-zero {
  color: var(--muted);
  font-weight: 500;
}
/* Phase 1 diff: two cards side by side (textract + bda). Wider than the
   default so numeric cells (e.g. "$0.4204", "+18.7 pp") have room to breathe. */
.phase1-diff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 18px;
  max-width: 980px;
}
.phase1-diff-block {
  margin-bottom: 0; /* override the stacked default */
  padding: 18px 20px;
}
.phase1-diff-block table.diff-table { width: 100%; }
.phase1-diff-block col.col-metric-label { width: 42%; }
.phase1-diff-block col.col-num          { width: 19.33%; }
/* Slightly tighter horizontal padding on numeric cells gives the value
   inside more visible width without changing the overall column width. */
.phase1-diff-block table.diff-table td.num,
.phase1-diff-block table.diff-table th.num {
  padding-left: 6px;
  padding-right: 8px;
}
.phase1-diff-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.phase1-diff-sub {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* Per-question diff: 4 columns — Question | A % | B % | Δ pp.
   Container caps the visible width; the table fills it. */
.pq-diff-wrap {
  width: 100%;
  max-width: 560px;
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.pq-diff-wrap table.diff-table { width: 100%; }
.pq-diff-wrap col.col-q   { width: 35%; }
.pq-diff-wrap col.col-num { width: 21.66%; }

/* Executive summary diff: 2 label cols + 5 × (A | B | Δ) = 17 columns.
   Use an explicit pixel width so each fixed-pixel <col> declaration is honoured;
   the wrapper provides horizontal scroll on narrow viewports. */
.exec-diff-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
/* 110 + 110 + (15 × 80) = 1420 px total. */
.exec-diff-wrap table.diff-table { width: 1420px; min-width: 100%; }
.exec-diff-wrap col.col-approach { width: 110px; }
.exec-diff-wrap col.col-model    { width: 110px; }
.exec-diff-wrap col.col-metric   { width: 80px; }
.phase1-diff-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.phase1-diff-head { margin-bottom: 8px; }
.pq-diff-wrap {
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.pq-diff-wrap table.diff-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #FAFBFD;
}

/* ---------------------------------------------------------------------
   Responsive tweaks
   --------------------------------------------------------------------- */
@media (max-width: 800px) {
  .header-inner { padding: 12px 16px 0; }
  main#views { padding: 20px 16px 48px; }
  .hero { padding: 22px; }
  .hero-inner { flex-direction: column; align-items: flex-start; gap: 14px; }
  .hero h1 { font-size: 24px; }
}
