@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --bg: light-dark(#ffffff, #1c1917);
  --on-ink: light-dark(#ffffff, #1c1917);
  --ink: light-dark(#1c1917, #fafaf9);
  --ink-2: light-dark(#44403c, #e7e5e4);
  --ink-3: light-dark(#57534e, #d6d3d1);
  --muted: light-dark(#78716c, #a8a29e);
  --faint: light-dark(#a8a29e, #78716c);
  --line: light-dark(#e7e5e4, #34302d);
  --line-soft: light-dark(#f0efed, #292524);
  --input-line: light-dark(#d6d3d1, #57534e);
  --surface: light-dark(#fafaf9, #151311);
  --chip: light-dark(#f5f5f4, #292524);
  --pass: light-dark(#047857, #34d399);
  --fail: light-dark(#b91c1c, #f87171);
  --sans: "Geist", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/20px var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.mono { font-family: var(--mono); }
.none { color: var(--faint); font-size: 13px; }
.small { font-size: 13px; }
.empty { color: var(--muted); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Layout: sidebar on wide screens, top bar on phones. */

.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.shell {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.shell-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.brand:hover { text-decoration: none; }
.mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 11px;
  font-weight: 600;
}
.brand-text { display: flex; flex-direction: column; }
.brand-text strong { font-size: 15px; font-weight: 600; }
.brand-text span { color: var(--muted); font-size: 12px; line-height: 16px; }

.icon-button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.icon-button:hover { background: var(--line-soft); color: var(--ink); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a, .theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink-3);
  font-weight: 500;
}
.nav a:hover, .theme-toggle:hover { text-decoration: none; background: var(--bg); }
.nav .icon, .theme-toggle .icon { color: var(--muted); flex: none; }
.theme-toggle { width: 100%; margin-top: auto; background: none; font: inherit; font-weight: 500; text-align: left; cursor: pointer; }
.nav a[aria-current="page"] { background: var(--bg); border-color: var(--line); color: var(--ink); }
.nav a[aria-current="page"] .icon { color: var(--ink); }

.data-status {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.data-status .status-snapshot { order: -1; }
.data-status dt { color: var(--faint); font-size: 11px; font-weight: 500; line-height: 14px; text-transform: uppercase; letter-spacing: 0.04em; }
.data-status dd { font-size: 13px; line-height: 18px; }

.main {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 32px 40px 48px;
  min-width: 0;
}

/* Shared page parts. */

.page-header { display: flex; align-items: flex-start; gap: 16px; }
.page-header > div { flex: 1; display: flex; flex-direction: column; gap: 4px; }
h1 { font-size: 28px; line-height: 36px; font-weight: 600; }
.lead { color: var(--muted); }
.back { color: var(--ink-3); font-size: 13px; font-weight: 500; line-height: 18px; }
.cli-hint { flex: none; padding: 6px 10px; border-radius: 8px; background: var(--chip); color: var(--ink-3); font-size: 12px; line-height: 18px; }

.section { display: flex; flex-direction: column; gap: 12px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
h2 { font-size: 15px; line-height: 20px; font-weight: 600; }
.meta { color: var(--muted); font-size: 13px; line-height: 18px; }
.scroll-hint { display: none; }

.card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; }

.badge {
  --badge-bg: var(--chip);
  --badge-line: var(--line);
  --badge-dot: var(--faint);
  --badge-text: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid var(--badge-line);
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font: 500 12px/18px var(--sans);
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--badge-dot); }
.badge-success { --badge-bg: light-dark(#ecfdf5, #0f2a1f); --badge-line: light-dark(#a7f3d0, #1d5c43); --badge-dot: #10b981; --badge-text: var(--pass); }
.badge-danger { --badge-bg: light-dark(#fef2f2, #3b1515); --badge-line: light-dark(#fecaca, #7f1d1d); --badge-dot: #ef4444; --badge-text: var(--fail); }
.badge-warning { --badge-bg: light-dark(#fffbeb, #3a2408); --badge-line: light-dark(#fde68a, #78350f); --badge-dot: #f59e0b; --badge-text: light-dark(#b45309, #fcd34d); }
  .badge-danger { --badge-bg: #3b1515; --badge-line: #7f1d1d; }
  .badge-warning { --badge-bg: #3a2408; --badge-line: #78350f; --badge-text: #fcd34d; }
}

.button {
  display: inline-flex;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: 500 13px/18px var(--sans);
}
.button:hover { text-decoration: none; background: var(--surface); }
.button[aria-disabled="true"] { color: var(--faint); }

.table-frame { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 8px; text-align: left; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
thead th {
  padding-top: 10px;
  padding-bottom: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 14px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
tbody tr { border-top: 1px solid var(--line-soft); }

/* Evals. */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: 12px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 500; line-height: 16px; }
.stat-value { font-size: 24px; font-weight: 600; line-height: 32px; }
.stat-value .ratio.full { color: var(--ink); font-weight: 600; }
.stat-note { color: var(--muted); font-size: 12px; line-height: 16px; }

.runs { min-width: 1088px; }
.runs .col-run > * { min-width: 240px; }
.runs td { white-space: nowrap; }
.runs thead th { min-width: 56px; }
.runs .col-run { width: 304px; white-space: normal; font-weight: 400; }
.runs tbody .col-run { position: sticky; left: 0; z-index: 1; background: inherit; }
.runs thead .col-run { position: sticky; left: 0; z-index: 2; }
.runs tbody tr { background: var(--bg); }
.runs tbody tr.row-child { background: var(--surface); }
.group:not(:has(details[open])) .row-child { display: none; }
.run-name { display: block; font-size: 13px; font-weight: 500; line-height: 18px; overflow-wrap: anywhere; }
.dataset { display: block; color: var(--muted); font-size: 11px; line-height: 16px; }
.row-child .run-name { padding-left: 18px; color: var(--ink-3); font-weight: 400; }
.ratio.full { color: var(--pass); font-weight: 500; }
.commit { color: var(--ink-3); font-size: 12px; }
.date { color: var(--ink-3); }

summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
.runs summary { display: flex; align-items: flex-start; gap: 6px; }
.runs summary::before {
  content: "";
  flex: none;
  width: 12px;
  height: 18px;
  background: url("icons/chevron-right.svg") center / 12px no-repeat;
  transition: transform 0.15s;
}
.runs details[open] summary::before { transform: rotate(90deg); }

.failed-list { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.failed-list li {
  display: grid;
  grid-template-columns: 300px 190px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
}
.failed-list li + li { border-top: 1px solid var(--line-soft); }
.failed-list .case { font-size: 13px; font-weight: 500; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.failed-list .detail { color: var(--ink-2); overflow-wrap: anywhere; }

/* History. */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.search {
  flex: 0 1 320px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--input-line);
  border-radius: 8px;
  color: var(--faint);
}
.search:focus-within { border-color: var(--ink); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; padding: 0; background: none; color: var(--ink); font: inherit; }
.search input::placeholder { color: var(--faint); }
.chip select {
  appearance: none;
  max-width: 260px;
  padding: 7px 30px 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg) url("icons/chevron-down.svg") right 10px center / 14px no-repeat;
  color: var(--ink-2);
  font: 500 13px/18px var(--sans);
  text-overflow: ellipsis;
  field-sizing: content;
  cursor: pointer;
}
.chip select:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.count { margin-left: auto; color: var(--muted); font-size: 13px; line-height: 18px; }

.results { display: flex; flex-direction: column; gap: 16px; }
.history { table-layout: fixed; }
.history td { padding-top: 13px; padding-bottom: 13px; }
.history th.col-asked { width: 136px; }
.history th.col-run { width: 224px; }
.history th.col-tools { width: 216px; }
.history th.col-status { width: 116px; }
.history th.col-trace { width: 104px; }
.history td.col-asked { color: var(--ink-3); font-size: 13px; }
.history td.col-question,
.history td.col-run,
.history td.col-tools { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history td.col-run, .history td.col-trace { color: var(--ink-3); font-size: 12px; }
.history td.col-tools { color: var(--ink-2); font-size: 12px; }

.pagination { display: flex; align-items: center; gap: 8px; }
.pagination p { margin-right: auto; color: var(--muted); font-size: 13px; line-height: 18px; }

/* Answer. */

.question-card { display: flex; flex-direction: column; gap: 16px; }
.card-label { color: var(--muted); font-size: 12px; font-weight: 500; line-height: 16px; }
.question-text { padding: 12px 14px; border-radius: 8px; background: var(--surface); font-size: 15px; line-height: 24px; overflow-wrap: anywhere; }

.result { display: grid; grid-template-columns: minmax(0, 1fr) 380px; align-items: start; gap: 24px; }
.answer-card { padding: 20px 24px 24px; }
.answer-head { display: flex; align-items: center; gap: 10px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.trace { margin-left: auto; color: var(--ink-3); font-size: 12px; line-height: 16px; }

.markdown { font-size: 15px; line-height: 24px; overflow-wrap: anywhere; }
.markdown > * + * { margin-top: 8px; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { margin-top: 16px; font-size: 14px; line-height: 20px; font-weight: 600; }
.markdown ul, .markdown ol { padding-left: 20px; list-style: revert; font-size: 14px; line-height: 22px; }
.markdown li + li { margin-top: 4px; }
.markdown code { padding: 1px 4px; border-radius: 4px; background: var(--chip); font: 13px var(--mono); }
.markdown pre { overflow-x: auto; padding: 10px 12px; border-radius: 8px; background: var(--chip); }
.markdown pre code { padding: 0; background: none; }
.markdown table { font-size: 13px; line-height: 18px; display: block; overflow-x: auto; }
.markdown th, .markdown td { padding: 6px 10px; border: 1px solid var(--line); white-space: nowrap; }
.markdown th { background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; text-transform: none; letter-spacing: 0; }
.markdown hr { border: 0; border-top: 1px solid var(--line); }
.markdown blockquote { margin: 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--ink-3); }

.side { display: flex; flex-direction: column; gap: 16px; }
.side .card { display: flex; flex-direction: column; gap: 12px; }
.side h2 { font-size: 13px; line-height: 18px; }
.side h3 { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted); }
.details-card { background: var(--surface); }
.details { display: flex; flex-direction: column; gap: 12px; }
.details > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; line-height: 18px; }
.details dt { color: var(--muted); }
.details dd { font-weight: 500; text-align: right; }
.details dd.mono { font-weight: 400; }
.details .stacked { flex-direction: column; align-items: flex-start; gap: 4px; }
.details .stacked dd { text-align: left; font-size: 12px; overflow-wrap: anywhere; }

.checks { display: flex; flex-direction: column; gap: 12px; }
.check-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--ink-2); font-size: 13px; line-height: 18px; }
.check-detail { margin-top: 2px; color: var(--fail); font-size: 12px; line-height: 16px; overflow-wrap: anywhere; }
.review-note { color: var(--muted); font-size: 12px; line-height: 18px; white-space: pre-line; overflow-wrap: anywhere; }

.tool-call { display: flex; flex-direction: column; gap: 10px; }
.tool-call + .tool-call { padding-top: 12px; border-top: 1px solid var(--line-soft); }
.tool-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tool-name { font-size: 13px; font-weight: 500; line-height: 18px; overflow-wrap: anywhere; }
.code { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--chip); color: var(--ink-2); font: 12px/18px var(--mono); overflow-x: auto; }
.result-details { display: flex; flex-direction: column; gap: 8px; }
.result-details summary { color: var(--muted); font-size: 12px; line-height: 18px; }
.result-details .link { color: var(--ink-3); font-weight: 500; text-decoration: underline; }
.result-details[open] .code { margin-top: 8px; max-height: 480px; overflow: auto; }

/* Phones. */

@media (min-width: 768px) {
  [data-sidebar="collapsed"] .layout { grid-template-columns: 64px minmax(0, 1fr); }
  [data-sidebar="collapsed"] .shell { padding-inline: 12px; }
  [data-sidebar="collapsed"] .shell-head { flex-direction: column; gap: 12px; }
  [data-sidebar="collapsed"] .brand-text,
  [data-sidebar="collapsed"] .data-status { display: none; }
  [data-sidebar="collapsed"] .nav a,
  [data-sidebar="collapsed"] .theme-toggle { justify-content: center; }
  [data-sidebar="collapsed"] .shell .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

@media (max-width: 767px) {
  .layout { display: block; }
  .shell {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand status status" "nav nav theme";
    gap: 12px;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .shell-head { grid-area: brand; padding: 0; }
  .brand { padding: 0; }
  .sidebar-toggle { display: none; }
  .theme-toggle { grid-area: theme; width: 42px; justify-content: center; margin: 0; padding: 0; border: 0; border-radius: 10px; background: var(--line-soft); }
  .theme-toggle .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .nav { grid-area: nav; flex-direction: row; gap: 3px; padding: 3px; border-radius: 10px; background: var(--line-soft); }
  .nav a { flex: 1; justify-content: center; gap: 8px; }
  .nav a:hover { background: transparent; }
  .nav a[aria-current="page"] { background: var(--bg); }
  .data-status { grid-area: status; margin: 0; gap: 1px; padding: 0; border: 0; background: none; text-align: right; }
  .data-status .status-snapshot { order: 0; }
  .data-status .status-model dt { display: none; }
  .data-status .status-model dd { font-size: 12px; line-height: 16px; }
  .data-status .status-snapshot dt,
  .data-status .status-snapshot dd { display: inline; color: var(--muted); font-size: 11px; line-height: 14px; text-transform: none; letter-spacing: 0; }

  .main { gap: 24px; padding: 20px 16px 32px; }
  h1 { font-size: 24px; line-height: 32px; }
  .cli-hint { display: none; }
  .section-head { flex-direction: column; align-items: flex-start; }

  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }

  .scroll-hint { display: block; }
  .scrolls::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(to right, transparent, var(--bg));
    pointer-events: none;
  }
  .runs .col-run { width: 192px; }
  .runs .col-run > * { min-width: 160px; }
  .runs .dataset { overflow-wrap: anywhere; }

  .failed-list li { grid-template-columns: minmax(0, 1fr); gap: 8px; }

  .search { flex-basis: 100%; }
  .count { display: none; }
  .history, .history tbody { display: block; }
  .history thead { display: none; }
  .history tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 12px 16px; }
  .history td, .history td:first-child, .history td:last-child { display: block; padding: 0; }
  .history td.col-asked { flex: 1; }
  .history td.col-question {
    order: 1;
    flex-basis: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
  }
  .history td.col-run { order: 2; font-size: 11px; }
  .history td.col-tools { order: 3; color: var(--muted); font-size: 11px; }
  .history td.col-trace { display: none; }

  .result { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .answer-card { padding: 16px 16px 20px; }
}
