:root {
  color: oklch(28% 0.015 255);
  background: oklch(97.8% 0.006 255);
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  font-synthesis: none;
  --canvas: oklch(97.8% 0.006 255);
  --surface: oklch(99.2% 0.004 255);
  --surface-muted: oklch(95.8% 0.009 255);
  --surface-selected: oklch(94.5% 0.025 265);
  --line: oklch(89% 0.012 255);
  --line-strong: oklch(80% 0.018 255);
  --ink: oklch(25% 0.018 255);
  --muted: oklch(51% 0.018 255);
  --quiet: oklch(66% 0.015 255);
  --accent: oklch(53% 0.16 267);
  --accent-soft: oklch(93% 0.04 267);
  --success: oklch(50% 0.14 153);
  --success-soft: oklch(94% 0.035 153);
  --danger: oklch(54% 0.19 27);
  --danger-soft: oklch(94.5% 0.045 27);
  --warning: oklch(59% 0.13 72);
  --warning-soft: oklch(95% 0.04 72);
  --tool: oklch(50% 0.09 230);
  --tool-soft: oklch(94% 0.03 230);
  --shadow: 0 12px 36px oklch(30% 0.02 255 / 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  background: var(--canvas);
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button,
select {
  cursor: pointer;
}

a {
  color: var(--accent);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: oklch(99.2% 0.004 255 / 0.96);
}

.brand,
.topbar-actions,
.summary-result,
.test-row-top,
.detail-meta,
.event-row,
.judge-heading {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  background: var(--ink);
  color: var(--surface);
  font-size: 0.9rem;
  font-weight: 760;
}

.brand div {
  display: grid;
  gap: 2px;
}

.brand strong {
  font-size: 0.94rem;
  letter-spacing: -0.01em;
}

.brand span:last-child,
.summary-result span,
.result-count,
.detail-kicker,
.detail-meta,
.message-role,
.event-label,
.advanced-grid dt,
.empty-evidence p {
  color: var(--muted);
  font-size: 0.76rem;
}

.topbar-actions {
  gap: 14px;
}

.run-state,
.status-badge,
.score-badge,
.category-badge,
.confirmed-badge,
.retry-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 680;
}

.run-state {
  gap: 7px;
  padding: 6px 9px;
  background: var(--surface-muted);
}

.run-state::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--quiet);
  content: '';
}

.run-state.passed::before {
  background: var(--success);
}

.run-state.failed::before {
  background: var(--danger);
}

.run-state.warning::before {
  background: var(--warning);
}

.raw-link {
  font-size: 0.78rem;
  font-weight: 650;
  text-decoration: none;
}

.raw-link:hover {
  text-decoration: underline;
}

.summary {
  display: flex;
  min-height: 102px;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.summary-result {
  min-width: 260px;
  gap: 12px;
}

.summary-result > div {
  display: grid;
  gap: 4px;
}

.summary-result strong {
  font-size: 1.03rem;
  letter-spacing: -0.015em;
}

#summary-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.self-judge-disclosure {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px 3px 4px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 0.68rem;
  font-weight: 680;
  letter-spacing: 0;
  white-space: nowrap;
}

.self-judge-disclosure::before {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  content: 'i';
  font-size: 0.67rem;
  font-weight: 800;
  line-height: 1;
}

.status-icon {
  position: relative;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-muted);
}

.status-icon.passed {
  background: var(--success-soft);
}

.status-icon.passed::after {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 13px;
  height: 7px;
  border-bottom: 2px solid var(--success);
  border-left: 2px solid var(--success);
  content: '';
  transform: rotate(-45deg);
}

.status-icon.warning {
  background: var(--warning-soft);
}

/* Positioned like the passed/failed marks rather than left inline: a glyph
   sized to the circle overflows it once the inherited line-height applies. */
.status-icon.warning::after {
  position: absolute;
  display: grid;
  inset: 0;
  place-items: center;
  color: var(--warning);
  content: '!';
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1;
}

.status-icon.failed {
  background: var(--danger-soft);
}

.status-icon.failed::before,
.status-icon.failed::after {
  position: absolute;
  top: 8px;
  left: 15px;
  width: 2px;
  height: 16px;
  background: var(--danger);
  content: '';
  transform: rotate(45deg);
}

.status-icon.failed::after {
  transform: rotate(-45deg);
}

.summary-metrics {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
}

.summary-metrics > div {
  min-width: 92px;
  padding: 2px 22px;
  border-left: 1px solid var(--line);
}

.summary-metrics dt {
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.summary-metrics dd {
  margin: 6px 0 0;
  font-size: 0.96rem;
  font-weight: 720;
}

.workspace {
  display: grid;
  min-height: calc(100vh - 171px);
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
}

.test-browser {
  position: sticky;
  top: 171px;
  height: calc(100vh - 171px);
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.browser-controls {
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.search-field {
  position: relative;
  display: block;
}

.search-field svg {
  position: absolute;
  top: 10px;
  left: 11px;
  width: 17px;
  fill: var(--quiet);
}

.search-field input,
.category-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: var(--canvas);
  font-size: 0.8rem;
}

.search-field input {
  height: 38px;
  padding: 0 12px 0 36px;
}

.search-field input:focus,
.category-field select:focus,
.status-filter button:focus-visible,
.test-row:focus-visible,
summary:focus-visible,
.raw-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 8px;
  margin-top: 10px;
}

.status-filter {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 3px;
  border-radius: 9px;
  background: var(--surface-muted);
}

.status-filter button {
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 630;
}

.status-filter button[aria-pressed='true'] {
  background: var(--surface);
  box-shadow: 0 1px 4px oklch(30% 0.02 255 / 0.1);
  color: var(--ink);
}

.category-field select {
  height: 36px;
  padding: 0 28px 0 9px;
}

.result-count {
  margin: 11px 2px 0;
}

.test-list {
  height: calc(100% - 135px);
  overflow-y: auto;
  padding: 7px;
}

.story-heading {
  position: sticky;
  z-index: 1;
  top: -7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 5px 4px;
  padding: 13px 7px 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.67rem;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.story-heading span {
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-muted);
  font-size: 0.65rem;
  font-variant-numeric: tabular-nums;
}

.test-row {
  display: block;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  transition:
    background 160ms cubic-bezier(0.16, 1, 0.3, 1),
    color 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.test-row:hover {
  background: var(--surface-muted);
}

.test-row.selected {
  background: var(--surface-selected);
}

.test-row + .test-row {
  margin-top: 2px;
}

.test-row-top {
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--quiet);
}

.status-dot.passed {
  background: var(--success);
}

.status-dot.failed {
  background: var(--danger);
}

.test-row-title {
  overflow: hidden;
  flex: 1;
  font-size: 0.79rem;
  font-weight: 620;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.test-duration,
.test-score {
  color: var(--muted);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.test-score {
  color: var(--accent);
  font-weight: 700;
}

/* No judge ran — the case is decided by exact assertions, not a score. */
.test-score.muted {
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.test-row-bottom {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  margin: 5px 0 0 16px;
}

.test-row-group {
  display: block;
  overflow: hidden;
  min-width: 0;
  flex: 1;
  color: var(--muted);
  font-size: 0.69rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.retry-badge {
  flex: none;
  padding: 4px 7px;
  background: var(--warning-soft);
  color: var(--warning);
}

.test-detail {
  min-width: 0;
  padding: 32px clamp(28px, 5vw, 76px) 72px;
}

.detail-header {
  max-width: 860px;
  margin-inline: auto;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.detail-kicker {
  margin: 0 0 8px;
  font-weight: 680;
  letter-spacing: 0.025em;
}

.detail-header h1 {
  max-width: 30ch;
  margin: 0;
  font-size: clamp(1.4rem, 2vw, 1.85rem);
  line-height: 1.22;
  letter-spacing: -0.03em;
}

.detail-meta {
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 15px;
}

.status-badge,
.score-badge,
.category-badge {
  padding: 5px 8px;
}

.status-badge.passed {
  background: var(--success-soft);
  color: var(--success);
}

.status-badge.failed {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-badge.skipped,
.category-badge {
  background: var(--surface-muted);
  color: var(--muted);
}

.score-badge {
  background: var(--accent-soft);
  color: var(--accent);
}

.confirmed-badge {
  padding: 5px 8px;
  background: var(--success-soft);
  color: var(--success);
}

.conversation {
  max-width: 860px;
  margin-inline: auto;
  padding-top: 26px;
}

.scenario-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 24px;
  padding: 11px 12px;
  border: 1px solid oklch(85% 0.035 230);
  border-radius: 10px;
  background: var(--tool-soft);
  color: var(--tool);
}

.scenario-note-copy {
  display: grid;
  gap: 3px;
}

.scenario-note-copy strong {
  font-size: 0.76rem;
}

.scenario-note-copy p {
  max-width: 72ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
}

.evidence-section + .evidence-section {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.evidence-section h2 {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 720;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chat-message {
  display: flex;
  max-width: min(680px, 88%);
  align-items: flex-start;
  gap: 9px;
  margin: 14px 0;
}

.chat-message.user {
  margin-left: auto;
  flex-direction: row-reverse;
}

.message-avatar {
  display: grid;
  width: 28px;
  height: 28px;
  flex: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 750;
}

.chat-message.user .message-avatar {
  border-color: transparent;
  background: var(--accent);
  color: var(--surface);
}

.message-content {
  display: grid;
  gap: 5px;
}

.chat-message.user .message-content {
  justify-items: end;
}

.message-bubble {
  margin: 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 4px 14px 14px;
  background: var(--surface);
  box-shadow: 0 5px 15px oklch(30% 0.02 255 / 0.04);
  font-size: 0.87rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.chat-message.user .message-bubble {
  border-color: oklch(83% 0.055 267);
  border-radius: 14px 4px 14px 14px;
  background: var(--accent-soft);
}

.event-row {
  width: fit-content;
  max-width: 100%;
  gap: 10px;
  margin: 10px 0 10px 37px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.74rem;
}

.event-row + .payload-details {
  max-width: calc(100% - 37px);
  margin-left: 37px;
}

.event-note {
  max-width: calc(100% - 37px);
  margin: -4px 0 10px 37px;
  color: var(--muted);
  font-size: 0.71rem;
  line-height: 1.5;
}

.event-row.tool {
  border-color: oklch(85% 0.035 230);
  background: var(--tool-soft);
  color: var(--tool);
}

.event-row.pending {
  border-color: oklch(84% 0.04 72);
  background: var(--warning-soft);
  color: var(--warning);
}

.event-row.success {
  border-color: oklch(83% 0.045 153);
  background: var(--success-soft);
  color: var(--success);
}

.event-icon {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: oklch(99% 0.004 255 / 0.8);
  font-size: 0.68rem;
  font-weight: 760;
}

.event-row code {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.71rem;
}

.judge-block {
  margin: 18px 0;
  padding: 15px 16px;
  border: 1px solid oklch(85% 0.035 267);
  border-radius: 11px;
  background: var(--accent-soft);
}

.judge-heading {
  justify-content: space-between;
  gap: 12px;
}

.judge-heading strong {
  font-size: 0.8rem;
}

.judge-block p {
  max-width: 72ch;
  margin: 9px 0 0;
  color: oklch(35% 0.035 267);
  font-size: 0.82rem;
  line-height: 1.55;
}

details {
  margin-top: 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

summary {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 660;
  list-style-position: inside;
  user-select: none;
}

details[open] summary {
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.details-body {
  padding: 12px;
}

.payload {
  max-height: 320px;
  overflow: auto;
  margin: 0;
  padding: 11px;
  border-radius: 7px;
  background: var(--surface-muted);
  color: oklch(34% 0.03 255);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.advanced-grid {
  display: grid;
  grid-template-columns: minmax(110px, 0.28fr) 1fr;
  gap: 9px 18px;
  margin: 0;
}

.advanced-grid dt {
  font-weight: 660;
}

.advanced-grid dd {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.error-block {
  max-width: 860px;
  margin: 22px auto;
  padding: 15px;
  border: 1px solid oklch(82% 0.06 27);
  border-radius: 10px;
  background: var(--danger-soft);
}

.error-block h2 {
  margin: 0 0 8px;
  color: var(--danger);
  font-size: 0.82rem;
}

.error-block pre {
  overflow: auto;
  margin: 0;
  color: oklch(35% 0.08 27);
  font-size: 0.72rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.empty-evidence {
  max-width: 620px;
  margin: 32px auto 0;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.empty-evidence strong {
  font-size: 0.9rem;
}

.empty-evidence p {
  max-width: 60ch;
  line-height: 1.55;
}

.empty-list {
  padding: 30px 18px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.detail-loading {
  display: grid;
  gap: 14px;
  max-width: 620px;
  margin-inline: auto;
}

.loading-line {
  height: 14px;
  border-radius: 6px;
  background: var(--surface-muted);
}

.loading-line.long {
  width: 78%;
  height: 28px;
}

.loading-line.medium {
  width: 52%;
}

.loading-line.short {
  width: 31%;
}

@media (max-width: 980px) {
  .summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .summary-metrics {
    width: 100%;
  }

  .summary-metrics > div:first-child {
    padding-left: 0;
    border-left: 0;
  }

  .workspace {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .test-browser {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .test-list {
    max-height: 360px;
  }
}

@media (max-width: 640px) {
  .topbar,
  .summary {
    padding-right: 16px;
    padding-left: 16px;
  }

  .brand span:last-child,
  .run-state,
  .raw-link {
    display: none;
  }

  .summary-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    row-gap: 18px;
  }

  .summary-metrics > div {
    min-width: 0;
    padding: 0 12px;
  }

  .summary-metrics > div:nth-child(4) {
    padding-left: 0;
    border-left: 0;
  }

  .filter-row {
    grid-template-columns: 1fr;
  }

  .test-detail {
    padding: 27px 18px 56px;
  }

  .chat-message {
    max-width: 96%;
  }

  .advanced-grid {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.given-note {
  margin: 0 0 14px;
}

.error-note {
  max-width: 78ch;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

.list-legend {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.55;
}

.list-legend strong {
  color: var(--ink);
  font-weight: 600;
}
