:root {
  --cb-link: #6f4e37;
  --cb-link-hover: #543a29;
  --cb-rule: rgba(0, 0, 0, 0.1);
  --cb-rule-strong: rgba(0, 0, 0, 0.18);
  --cb-muted: rgba(0, 0, 0, 0.6);
  --cb-bg: #fafafa;
  --cb-card: #ffffff;
  --cb-sidebar: #f4efe9;
  --cb-pos: #047857;
  --cb-neg: #b91c1c;
  --cb-active: #fff;
  --cb-sb-width: 280px;
  /* Single content-column width for the whole page (header → data),
     so left/right margins line up top to bottom (~1/3 of a wide screen is margin). */
  --cb-page-w: 960px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cb-bg);
  color: rgba(0, 0, 0, 0.85);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

code, .cb-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

/* ============================ Top bar (brand + resources) ============================ */
.cb-topbar {
  background: transparent;
}
.cb-topbar-inner {
  max-width: var(--cb-page-w);
  margin: 0 auto;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.cb-brand { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cb-brand-row { display: flex; align-items: center; gap: 9px; }
.cb-brand-icon {
  font-size: 20px;
  line-height: 1;
  flex: 0 0 auto;
}
.cb-brand-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
/* Thin divider between the wordmark and the "Trajectories" qualifier */
.cb-brand-sub {
  font-weight: 400;
  color: var(--cb-muted);
}
.cb-brand-sub::before {
  content: "";
  display: inline-block;
  width: 1px;
  height: 13px;
  background: var(--cb-rule-strong);
  margin: 0 10px;
  vertical-align: -1px;
}
.cb-brand-byline {
  margin: 0;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--cb-muted);
}
.cb-resources {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cb-resources a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--cb-muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.cb-resources a:hover {
  background: var(--cb-sidebar);
  color: var(--cb-link-hover);
  border-color: rgba(111, 78, 55, 0.2);
}
.cb-resources a:hover .cb-icon { color: var(--cb-link-hover); }
.cb-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  display: block;
}
/* Official arXiv logomark (Cornell red) — narrower than line icons since
   the official mark is a vertical X shape (~75:100). */
.cb-icon-arxiv {
  width: 12px;
  height: 16px;
  flex: 0 0 12px;
}

/* ============================ Toolbar (model + seed selectors) ============================ */
/* ===================== Cross-model summary band ===================== */
.cb-summary-band {
  background: transparent;
}
.cb-summary-inner {
  max-width: var(--cb-page-w);
  margin: 0 auto;
  padding: 22px 32px 18px 32px;
}
/* The summary is a normal left-aligned, full-column section — same width and
   alignment as the data sections (Final results, Timeseries) below it. */
.cb-summary-heading {
  margin: 0 0 4px 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.cb-overview-desc {
  margin: 6px 0 0 0;
  max-width: 760px;
  font-size: 13.5px;
  line-height: 1.6;
  color: rgba(0, 0, 0, 0.72);
}
.cb-overview-figure {
  margin: 18px 0 0 0;
}
.cb-overview-figure img {
  width: 100%;
  max-width: 640px;
  height: auto;
}
.cb-overview-figure figcaption {
  margin: 10px 0 0 0;
  max-width: 640px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--cb-muted);
}
/* Keep the evaluation chart the same width as the overview figure (left-aligned). */
#cb-summary-charts {
  max-width: 640px;
}

.cb-toolbar {
  background: transparent;
}
.cb-toolbar-row {
  max-width: var(--cb-page-w);
  margin: 0 auto;
  padding: 8px 32px;
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Section separators: drawn as pseudo-element rules inset by the 32px content
   gutter, so every line aligns with the data tables/charts (no margin overflow). */
.cb-topbar-inner,
.cb-summary-inner,
.cb-toolbar-row { position: relative; }
.cb-topbar-inner::after,
.cb-summary-inner::after,
.cb-toolbar-row:last-child::after,
.cb-toolbar-row + .cb-toolbar-row::before {
  content: "";
  position: absolute;
  left: 32px;
  right: 32px;
  height: 1px;
  background: var(--cb-rule);
}
.cb-topbar-inner::after,
.cb-summary-inner::after,
.cb-toolbar-row:last-child::after { bottom: 0; }
.cb-toolbar-row + .cb-toolbar-row::before { top: 0; }
.cb-toolbar-label {
  flex: 0 0 60px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--cb-muted);
}
.cb-runs {
  display: flex;
  gap: 6px;
  flex: 1;
  flex-wrap: wrap;
}
.cb-run-option {
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  padding: 4px 11px;
  background: #fff;
  border: 1px solid var(--cb-rule);
  border-radius: 999px;
  cursor: pointer;
  color: rgba(0, 0, 0, 0.78);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  white-space: nowrap;
}
.cb-run-option:hover { background: #f1e9df; border-color: rgba(111, 78, 55, 0.3); }
.cb-run-option.active {
  background: var(--cb-link);
  border-color: var(--cb-link);
  color: #fff;
  /* No bold on active: it would change the pill width and reflow the wrap. */
}
.cb-run-meta {
  font-size: 11px;
  color: var(--cb-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.cb-run-option.active .cb-run-meta { color: rgba(255, 255, 255, 0.8); }
.cb-run-meta-multi {
  font-size: 10.5px;
  color: var(--cb-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.35;
  white-space: pre;
}
.cb-run-option.active .cb-run-meta-multi { color: rgba(255, 255, 255, 0.85); }

.cb-seeds {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.cb-seed-option {
  font: inherit;
  font-size: 12.5px;
  padding: 4px 12px;
  background: #fff;
  border: 1px solid var(--cb-rule);
  border-radius: 999px;
  cursor: pointer;
  color: rgba(0, 0, 0, 0.7);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.cb-seed-option:hover:not(.disabled) { background: #f1e9df; border-color: rgba(111, 78, 55, 0.3); }
.cb-seed-option.active {
  background: var(--cb-link);
  border-color: var(--cb-link);
  color: #fff;
}
.cb-seed-option.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================ Main ============================ */
.cb-main {
  max-width: var(--cb-page-w);
  margin: 0 auto;
  padding: 24px 32px 60px 32px;
}
/* Citation footer at the very bottom of the page */
.cb-cite-footer {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--cb-rule);
}
.cb-cite {
  margin: 12px 0 0 0;
  max-width: 760px;
  overflow-x: auto;
  background: var(--cb-card);
  border: 1px solid var(--cb-rule);
  border-radius: 6px;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  color: rgba(0, 0, 0, 0.8);
}
.cb-main.loading::before {
  content: "Loading…";
  display: block;
  padding: 60px;
  color: var(--cb-muted);
  text-align: center;
  font-size: 16px;
}

/* ============================ Header ============================ */
.cb-header {
  background: var(--cb-card);
  border: 1px solid var(--cb-rule);
  border-radius: 6px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.cb-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.cb-header-title h2 {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 600;
}
.cb-header-title p {
  margin: 0;
  font-size: 11.5px;
  color: var(--cb-muted);
}
/* ============================ Run summary stat chips ============================ */
.cb-run-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 18px 0;
}
.cb-run-summary:empty { display: none; }
.cb-stat {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 11px;
  background: var(--cb-card);
  border: 1px solid var(--cb-rule);
  border-radius: 5px;
  min-width: 110px;
}
.cb-stat-label {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--cb-muted);
}
.cb-stat-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: rgba(0, 0, 0, 0.85);
}
.cb-stat.cb-stat-pos .cb-stat-value { color: var(--cb-pos); }
.cb-stat.cb-stat-neg .cb-stat-value { color: var(--cb-neg); }
.cb-stat.cb-stat-pos { border-color: rgba(4, 120, 87, 0.25); background: rgba(4, 120, 87, 0.04); }
.cb-stat.cb-stat-neg { border-color: rgba(185, 28, 28, 0.25); background: rgba(185, 28, 28, 0.04); }

/* ============================ Tabs ============================ */
.cb-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--cb-rule);
  background: var(--cb-bg);
  position: sticky;
  top: 0;
  z-index: 5;
}
.cb-tab {
  font: inherit;
  font-size: 14px;
  padding: 10px 18px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--cb-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.1s, border-color 0.1s;
}
.cb-tab:hover { color: rgba(0, 0, 0, 0.85); }
.cb-tab.active {
  color: var(--cb-link);
  font-weight: 600;
  border-bottom-color: var(--cb-link);
}

.cb-tab-panel { display: none; }
.cb-tab-panel.active { display: block; }

.cb-section { margin: 0 0 28px 0; }
.cb-section-title {
  margin: 0 0 12px 0;
  font-size: 17px;
  font-weight: 600;
}
.cb-section-subtitle {
  margin: 18px 0 8px 0;
  font-size: 14px;
  font-weight: 600;
}
.cb-caption {
  margin: 6px 0 0 0;
  font-size: 12px;
  color: var(--cb-muted);
}
/* Explanatory paragraph under a section title */
.cb-section-desc {
  margin: -4px 0 16px 0;
  max-width: 760px;
  line-height: 1.55;
}
.cb-chart-caption {
  margin: 0 0 6px 0;
  font-size: 12.5px;
  color: var(--cb-muted);
  font-weight: 500;
}

/* ============================ Tables ============================ */
.cb-table-wrap { overflow-x: auto; border: 1px solid var(--cb-rule); border-radius: 4px; background: #fff; }
.cb-table {
  width: 100%;
  border-collapse: collapse;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}
.cb-table th, .cb-table td {
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid var(--cb-rule);
  white-space: nowrap;
}
.cb-table th {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 600;
  font-size: 11.5px;
  text-align: center;
  color: var(--cb-muted);
  background: #faf7f3;
  position: sticky;
  top: 0;
}
/* Sentence case: capitalise only the first letter (headers are lowercase in markup) */
.cb-table th::first-letter { text-transform: uppercase; }
.cb-table tbody tr:last-child td { border-bottom: none; }
/* Numeric values right-aligned, but their headers stay left-aligned. */
.cb-table td.num { text-align: right; }
.cb-table tbody tr.dnf td { color: var(--cb-neg); }
.cb-table tbody tr.selected td { background: #f8f3ec; }
.cb-table tbody tr.row-clickable { cursor: pointer; }
.cb-table tbody tr.row-clickable:hover td { background: #f8f3ec; }
.cb-table.cb-msg-table { font-size: 12.5px; }
.cb-table.cb-msg-table td { white-space: normal; }

/* ============================ KPI cards ============================ */
.cb-kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.cb-kpi {
  background: var(--cb-card);
  border: 1px solid var(--cb-rule);
  border-radius: 6px;
  padding: 12px 14px;
}
.cb-kpi-name {
  margin: 0 0 4px 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cb-muted);
  font-weight: 600;
}
.cb-kpi-value {
  margin: 0 0 4px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.cb-kpi-delta {
  margin: 0 0 6px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--cb-muted);
}
.cb-kpi-foot {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  color: var(--cb-muted);
  line-height: 1.5;
}

/* ============================ Chart cells ============================ */
.cb-chart-cell {
  position: relative;
  height: 220px;
  background: var(--cb-card);
  border: 1px solid var(--cb-rule);
  border-radius: 4px;
  padding: 8px 10px;
}
.cb-chart-cell canvas { width: 100% !important; height: 100% !important; }

.cb-chart-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.cb-chart-grid-per-item {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.cb-chart-grid-per-item:empty { display: none; }

/* ============================ Sub-tabs (per-agent / B2B / tools) ============================ */
.cb-subtabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--cb-rule);
}
.cb-subtab {
  font: inherit;
  font-size: 13px;
  padding: 7px 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--cb-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.cb-subtab.active {
  color: var(--cb-link);
  font-weight: 600;
  border-bottom-color: var(--cb-link);
}

/* Tool-call expanders inside a per-agent panel */
.cb-tool-step {
  border: 1px solid var(--cb-rule);
  border-radius: 4px;
  margin-bottom: 6px;
  background: var(--cb-card);
}
.cb-tool-step > summary {
  cursor: pointer;
  padding: 8px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: rgba(0, 0, 0, 0.85);
  user-select: none;
  list-style: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cb-tool-step > summary::-webkit-details-marker { display: none; }
.cb-tool-step > summary::before { content: "▸ "; color: var(--cb-muted); }
.cb-tool-step[open] > summary::before { content: "▾ "; }
.cb-tool-step .cb-tool-body {
  padding: 0 14px 12px 14px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.cb-tool-section-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cb-muted);
  margin: 2px 0 4px 0;
}
.cb-tool-pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  background: var(--cb-bg);
  border: 1px solid var(--cb-rule);
  border-radius: 3px;
  padding: 8px 10px;
  max-height: 320px;
  overflow: auto;
  margin: 0;
}
.cb-tool-thought {
  background: #f8f3ec;
  border-color: rgba(111, 78, 55, 0.2);
}

/* ============================ Messages ============================ */
.cb-msg-controls {
  display: flex;
  gap: 22px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 12px 0;
  padding: 10px 14px;
  background: var(--cb-card);
  border: 1px solid var(--cb-rule);
  border-radius: 4px;
}
.cb-msg-controls label, .cb-tools-controls label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--cb-muted);
}
.cb-msg-controls select, .cb-msg-controls input,
.cb-tools-controls input {
  font: inherit;
  padding: 4px 6px;
  border: 1px solid var(--cb-rule);
  border-radius: 3px;
  background: #fff;
  color: rgba(0, 0, 0, 0.85);
}
.cb-msg-controls select { min-width: 220px; min-height: 60px; }
.cb-msg-table-wrap { max-height: 420px; overflow-y: auto; }
.cb-msg-table td.preview { color: var(--cb-muted); max-width: 600px; overflow: hidden; text-overflow: ellipsis; }
.cb-tools-controls {
  margin: 0 0 12px 0;
  padding: 10px 14px;
  background: var(--cb-card);
  border: 1px solid var(--cb-rule);
  border-radius: 4px;
}
#cb-msg-detail {
  margin-top: 14px;
  padding: 14px 18px;
  background: var(--cb-card);
  border: 1px solid var(--cb-rule);
  border-radius: 4px;
}
#cb-msg-detail .cb-msg-meta {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: rgba(0, 0, 0, 0.7);
  margin: 0 0 6px 0;
}
#cb-msg-detail .cb-msg-title {
  margin: 0 0 10px 0;
  font-size: 14.5px;
  font-weight: 600;
}
#cb-msg-detail pre {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  background: var(--cb-bg);
  border: 1px solid var(--cb-rule);
  border-radius: 3px;
  padding: 10px 12px;
  max-height: 420px;
  overflow: auto;
}

/* ============================ Responsive ============================ */
@media (max-width: 1100px) {
  .cb-kpi-row { grid-template-columns: repeat(3, 1fr); }
  .cb-chart-grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .cb-topbar-inner { padding: 14px 16px; }
  .cb-summary-inner { padding: 16px 16px 14px 16px; }
  .cb-toolbar-row { padding: 8px 16px; flex-wrap: wrap; }
  .cb-toolbar-label { flex: 0 0 auto; }
  .cb-main { padding: 16px; }
  /* Match the separator inset to the smaller mobile gutter */
  .cb-topbar-inner::after,
  .cb-summary-inner::after,
  .cb-toolbar-row:last-child::after,
  .cb-toolbar-row + .cb-toolbar-row::before { left: 16px; right: 16px; }
  .cb-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .cb-tabs { overflow-x: auto; }
  .cb-resources { gap: 0; }
  .cb-resources a { padding: 6px 8px; font-size: 12px; }
}
