/* Tender design system and dashboard.
 *
 * Strictly monochrome. Status is carried by glyphs, labels, and weight, never
 * by hue. Shared by the local dashboard, the static replay, and the public
 * landing page (which adds demo/styles.css for its own layout).
 */

/* ---------------------------------------------------------------- tokens */

:root {
  /* Light is the primary theme and the default for every new visitor. */
  color-scheme: light;
  --bg: #ffffff;
  --surface: #fafafa;
  --surface-2: #f3f3f3;
  --border: #e5e5e5;
  --border-strong: #d0d0d0;
  --text: #111111;
  --text-2: #444444;
  --text-3: #666666;
  --inverse-bg: #111111;
  --inverse-text: #ffffff;
  --diff-add: #f0f0f0;
  --diff-del-stripe: #f3f3f3;
  --diff-hunk: #f5f5f5;
  --chart-1: #111111;
  --chart-2: #8c8c8c;
  --chart-3: #c9c9c9;
  --grid: #ededed;
  --shadow: 0 1px 2px rgb(0 0 0 / 4%), 0 6px 20px rgb(0 0 0 / 6%);
  --scrim: rgb(255 255 255 / 70%);

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

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;
  --radius: 4px;
  --radius-lg: 6px;
  --measure: 68ch;
  --page: 1280px;
  --dur: 160ms;
  --dur-slow: 220ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --row: 40px;
}

/* Dark is an explicit choice only (theme toggle), never inferred from the OS. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #171717;
  --surface-2: #1f1f1f;
  --border: #303030;
  --border-strong: #404040;
  --text: #f5f5f5;
  --text-2: #cfcfcf;
  --text-3: #a3a3a3;
  --inverse-bg: #f5f5f5;
  --inverse-text: #0d0d0d;
  --diff-add: #242424;
  --diff-del-stripe: #1b1b1b;
  --diff-hunk: #171717;
  --chart-1: #f5f5f5;
  --chart-2: #8f8f8f;
  --chart-3: #4a4a4a;
  --grid: #262626;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 6px 20px rgb(0 0 0 / 45%);
  --scrim: rgb(0 0 0 / 62%);
}

/* ------------------------------------------------------------------ base */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font-sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur) var(--ease);
}

a:hover {
  text-decoration-color: currentColor;
}

code,
kbd,
pre,
.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

code {
  overflow-wrap: anywhere;
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 var(--s1);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 3px;
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

pre {
  margin: 0;
  white-space: pre;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

::selection {
  background: var(--inverse-bg);
  color: var(--inverse-text);
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: absolute;
  left: var(--s4);
  top: -100px;
  z-index: 100;
  padding: var(--s2) var(--s3);
  background: var(--inverse-bg);
  color: var(--inverse-text);
}

.skip-link:focus {
  top: var(--s2);
}

/* --------------------------------------------------------------- controls */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 32px;
  padding: 0 var(--s3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: 500 13px/1 var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    color var(--dur) var(--ease);
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--text-3);
}

.btn:active {
  background: var(--border);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  color: var(--text-3);
  border-color: var(--border);
  background: var(--bg);
  cursor: not-allowed;
}

.btn.primary {
  background: var(--inverse-bg);
  border-color: var(--inverse-bg);
  color: var(--inverse-text);
}

.btn.primary:hover {
  background: var(--text-2);
  border-color: var(--text-2);
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
}

.btn.ghost:hover {
  background: var(--surface-2);
}

.btn.small {
  min-height: 28px;
  padding: 0 var(--s2);
  font-size: 12px;
}

.btn.icon {
  width: 32px;
  padding: 0;
}

.input,
.select {
  min-height: 32px;
  padding: 0 var(--s3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: 400 13px/1 var(--font-sans);
  transition: border-color var(--dur) var(--ease);
}

.input:hover,
.select:hover {
  border-color: var(--text-3);
}

.input::placeholder {
  color: var(--text-3);
}

.select {
  padding-right: var(--s6);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 15px) 50%,
    calc(100% - 10px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.segmented button {
  min-height: 30px;
  padding: 0 var(--s3);
  border: 0;
  border-right: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-2);
  font: 500 12px/1 var(--font-sans);
  cursor: pointer;
  transition:
    background-color var(--dur) var(--ease),
    color var(--dur) var(--ease);
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button:hover {
  background: var(--surface-2);
  color: var(--text);
}

.segmented button[aria-pressed="true"] {
  background: var(--inverse-bg);
  color: var(--inverse-text);
}

.segmented .count {
  margin-left: var(--s1);
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.75;
}

/* ------------------------------------------------- labels and status marks */

.label {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 0 7px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  color: var(--text-2);
  font: 500 12px/1.6 var(--font-sans);
  letter-spacing: 0;
  white-space: nowrap;
}

.label.verified {
  background: var(--inverse-bg);
  border-color: var(--inverse-bg);
  color: var(--inverse-text);
}

.label.recorded {
  border-style: solid;
  color: var(--text);
}

.label.derived {
  border-style: dashed;
}

.label.unknown {
  border-style: dotted;
  color: var(--text-3);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-weight: 500;
  white-space: nowrap;
}

.status .mark {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font: 700 9px/1 var(--font-mono);
  flex: none;
}

.status.passed .mark,
.status.accepted .mark {
  background: var(--inverse-bg);
  border-color: var(--inverse-bg);
  color: var(--inverse-text);
}

.status.failed .mark,
.status.rejected .mark {
  border-radius: 3px;
}

.status.queued .mark,
.status.cancelled .mark,
.status.inconclusive .mark,
.status.not_run .mark,
.status.not_configured .mark,
.status.not_checked .mark,
.status.unknown .mark {
  border-style: dashed;
  color: var(--text-3);
}

.status.running .mark,
.status.awaiting_approval .mark,
.status.pending_approval .mark {
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

.status.error .mark {
  border-radius: 2px;
  transform: rotate(45deg) scale(0.85);
}

.status .text {
  font-size: 13px;
}

.status.muted .text {
  color: var(--text-3);
}

/* ------------------------------------------------------------- app layout */

.app {
  min-height: 100vh;
  display: grid;
  /* minmax(0, 1fr): wide tables scroll inside their wrapper instead of
     stretching the page past the viewport. */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto 1fr auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.topbar-inner {
  max-width: var(--page);
  margin: 0 auto;
  min-height: 52px;
  padding: 0 var(--s5);
  display: flex;
  align-items: center;
  gap: var(--s5);
}

.wordmark {
  font: 600 17px/1 var(--font-sans);
  letter-spacing: -0.03em;
  text-decoration: none;
  white-space: nowrap;
}

.wordmark small {
  margin-left: var(--s2);
  color: var(--text-3);
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0;
  vertical-align: 2px;
}

.nav {
  display: flex;
  gap: var(--s1);
}

.nav a,
.nav button {
  position: relative;
  padding: var(--s2) var(--s3);
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--text-2);
  font: 500 13px/1 var(--font-sans);
  text-decoration: none;
  cursor: pointer;
  transition:
    color var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}

.nav a:hover,
.nav button:hover {
  color: var(--text);
  background: var(--surface);
}

.nav [aria-current="page"] {
  color: var(--text);
}

.nav [aria-current="page"]::after {
  content: "";
  position: absolute;
  left: var(--s3);
  right: var(--s3);
  bottom: -11px;
  height: 2px;
  background: var(--text);
}

.topbar .spacer {
  flex: 1;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.connection {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  color: var(--text-3);
  font: 500 12px/1 var(--font-mono);
  white-space: nowrap;
}

.connection .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
}

.connection.ok .dot {
  background: currentColor;
}

.connection.ok {
  color: var(--text-2);
}

.notice {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.notice-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: var(--s3) var(--s5);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s2) var(--s4);
  color: var(--text-2);
  font-size: 13px;
}

.notice-inner strong {
  color: var(--text);
  font-weight: 500;
}

.notice.alert {
  background: var(--inverse-bg);
  color: var(--inverse-text);
}

.notice.alert .notice-inner,
.notice.alert strong {
  color: var(--inverse-text);
}

.main {
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: var(--s5) var(--s5) var(--s7);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s4);
}

.page-head h1 {
  font-size: 20px;
}

.page-head p {
  color: var(--text-3);
  font-size: 13px;
}

/* ----------------------------------------------------------- summary strip */

.summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 0 0 var(--s5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.summary > div {
  padding: var(--s3) var(--s4);
  border-right: 1px solid var(--border);
  min-width: 0;
}

.summary > div:last-child {
  border-right: 0;
}

.summary dt {
  color: var(--text-3);
  font-size: 12px;
}

.summary dd {
  margin: var(--s1) 0 0;
  font: 500 20px/1.2 var(--font-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.summary .foot {
  display: block;
  margin-top: 2px;
  color: var(--text-3);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------- outcomes and models */

.breakdown {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s5);
  margin: 0 0 var(--s5);
}

.breakdown-panel {
  min-width: 0;
  padding: var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.breakdown-panel h2 {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: 14px;
  font-weight: 600;
}

.breakdown-panel .hint {
  margin: 2px 0 var(--s3);
  color: var(--text-3);
  font-size: 12.5px;
}

.bar-list {
  display: grid;
  gap: 2px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 13em) minmax(40px, 1fr) 4em;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 32px;
  padding: 0 var(--s2);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--text);
  font: 400 13px/1.3 var(--font-sans);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}

.bar-row:hover {
  background: var(--surface-2);
}

.bar-row.active {
  border-color: var(--text);
}

.bar-row .name {
  overflow-wrap: anywhere;
}

.bar-row .count {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.mini-bar {
  width: 100%;
  height: 8px;
}

.mini-bar .track {
  fill: var(--surface-2);
}

.mini-bar .fill {
  fill: var(--text);
}

.link-button {
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--text);
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.link-button[aria-pressed="true"] {
  font-weight: 600;
  text-decoration-color: currentColor;
}

/* ------------------------------------------------------------------ toolbar */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s3);
}

.search {
  position: relative;
  flex: 1 1 260px;
  max-width: 420px;
}

.search .input {
  width: 100%;
  padding-left: 30px;
  padding-right: 34px;
}

.search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.search kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
}

.filters .select {
  max-width: 190px;
}

.filters-toggle {
  display: none;
}

.toolbar .grow {
  flex: 1;
}

.view-count {
  color: var(--text-3);
  font: 400 12px/1.5 var(--font-mono);
}

.toolbar .view-count {
  white-space: nowrap;
}

.compare-bar {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s3);
  padding: var(--s2) var(--s3);
  border: 1px solid var(--text);
  border-radius: var(--radius);
  font-size: 13px;
  animation: rise var(--dur) var(--ease);
}

.compare-bar .grow {
  flex: 1;
}

/* --------------------------------------------------------------- run table */

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.runs {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.runs th {
  position: sticky;
  top: 0;
  padding: 0 var(--s3);
  height: 36px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-3);
  font: 500 11.5px/1 var(--font-sans);
  letter-spacing: 0.02em;
  text-align: left;
  white-space: nowrap;
}

.runs td {
  height: var(--row);
  padding: var(--s2) var(--s3);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}

.runs tr:last-child td {
  border-bottom: 0;
}

.runs tbody tr {
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}

.runs tbody tr:hover,
.runs tbody tr.selected {
  background: var(--surface);
}

.runs tbody tr.selected td:first-child {
  box-shadow: inset 2px 0 0 var(--text);
}

.runs .num {
  text-align: right;
}

.runs .task {
  max-width: 360px;
  white-space: normal;
}

.runs .task .title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.runs .task .sub {
  display: block;
  margin-top: 2px;
  color: var(--text-3);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runs .muted {
  color: var(--text-3);
}

.runs input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--text);
  cursor: pointer;
}

.runs .pick-cell {
  width: 36px;
  padding-right: 0;
}

.pick-cell label {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  cursor: pointer;
}

.load-more {
  display: flex;
  justify-content: center;
  padding: var(--s4) 0 0;
}

.empty {
  padding: var(--s7) var(--s5);
  text-align: center;
}

.empty h2 {
  font-size: 16px;
  margin-bottom: var(--s2);
}

.empty p {
  max-width: 52ch;
  margin: 0 auto var(--s4);
  color: var(--text-2);
}

.empty .actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s2);
}

.skeleton-row td::after {
  content: "";
  display: block;
  height: 10px;
  border-radius: 2px;
  background: var(--surface-2);
}

/* ---------------------------------------------------------------- overlays */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--scrim);
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease);
}

.scrim.open {
  opacity: 1;
}

.inspector {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  width: min(820px, 100vw);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--bg);
  box-shadow: var(--shadow);
  transform: translateX(16px);
  opacity: 0;
  transition:
    transform var(--dur-slow) var(--ease),
    opacity var(--dur-slow) var(--ease);
}

.inspector.open {
  transform: none;
  opacity: 1;
}

.inspector-head {
  padding: var(--s4) var(--s5) 0;
  border-bottom: 1px solid var(--border);
}

.inspector-head .row {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
}

.inspector-head h2 {
  flex: 1;
  min-width: 0;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.inspector-head .meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  margin: var(--s2) 0 var(--s3);
  color: var(--text-3);
  font-size: 12.5px;
}

.tabs {
  display: flex;
  gap: var(--s1);
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 calc(var(--s2) * -1);
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tabs [role="tab"] {
  position: relative;
  flex: none;
  padding: var(--s2) var(--s3) var(--s3);
  border: 0;
  background: none;
  color: var(--text-3);
  font: 500 13px/1 var(--font-sans);
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}

.tabs [role="tab"]:hover {
  color: var(--text);
}

.tabs [role="tab"][aria-selected="true"] {
  color: var(--text);
}

.tabs [role="tab"][aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: var(--s3);
  right: var(--s3);
  bottom: -1px;
  height: 2px;
  background: var(--text);
}

.inspector-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--s5);
}

.panel-enter {
  animation: rise var(--dur) var(--ease);
}

.section {
  margin-bottom: var(--s6);
}

.section:last-child {
  margin-bottom: 0;
}

.section > h3 {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s3);
  font-size: 13px;
  font-weight: 500;
}

.section > h3 .hint {
  color: var(--text-3);
  font-weight: 400;
}

.section > p,
.prose {
  max-width: var(--measure);
  color: var(--text-2);
  overflow-wrap: anywhere; /* long test IDs and paths must not widen the page */
}

.callout,
.tests li span {
  overflow-wrap: anywhere;
}

.check-head .what {
  overflow-wrap: break-word;
}

@media (max-width: 480px) {
  .check-head .facts-inline {
    flex-basis: 100%;
    padding-left: 24px;
    line-height: 1.4;
  }
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--border);
}

.facts > div {
  display: grid;
  grid-template-columns: minmax(110px, 38%) 1fr;
  gap: var(--s3);
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.facts > div:nth-child(odd) {
  padding-right: var(--s4);
}

.facts > div:nth-child(even) {
  padding-left: var(--s4);
  border-left: 1px solid var(--border);
}

.facts dt {
  color: var(--text-3);
  font-size: 12.5px;
}

.facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.facts dd .label {
  margin-left: var(--s1);
}

.outcomes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.outcomes > div {
  padding: var(--s3);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.outcomes > div:nth-child(4n) {
  border-right: 0;
}

.outcomes > div:nth-last-child(-n + 4) {
  border-bottom: 0;
}

.outcomes .name {
  display: block;
  margin-bottom: var(--s2);
  color: var(--text-3);
  font-size: 12px;
}

.verdict {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s4);
  padding: var(--s4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
}

.verdict.accepted {
  border-color: var(--text);
  box-shadow: inset 3px 0 0 var(--text);
}

.verdict .status .text {
  font-size: 15px;
}

.verdict p {
  flex-basis: 100%;
  color: var(--text-2);
}

.callout {
  margin: var(--s3) 0;
  padding: var(--s3) var(--s4);
  border-left: 2px solid var(--text);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

/* ------------------------------------------------------------- timeline */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li {
  display: grid;
  grid-template-columns: 76px 16px minmax(0, 1fr);
  gap: var(--s3);
  padding: 0;
  transition: opacity var(--dur) var(--ease);
}

.timeline li.dim {
  opacity: 0.35;
}

.timeline .at {
  padding-top: 9px;
  color: var(--text-3);
  font: 400 11.5px/1.4 var(--font-mono);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.timeline .rail {
  position: relative;
}

.timeline .rail::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border-strong);
}

.timeline li:first-child .rail::before {
  top: 14px;
}

.timeline li:last-child .rail::before {
  bottom: calc(100% - 14px);
}

.timeline .rail::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 10px;
  width: 9px;
  height: 9px;
  border: 1.5px solid var(--text-2);
  border-radius: 50%;
  background: var(--bg);
}

.timeline li.state .rail::after {
  background: var(--text);
  border-color: var(--text);
}

.timeline li.active .rail::after {
  box-shadow: 0 0 0 3px var(--surface-2);
}

.timeline .body {
  padding: var(--s2) 0 var(--s3);
  min-width: 0;
}

.timeline .name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  font: 500 12.5px/1.4 var(--font-mono);
}

.timeline .detail {
  margin-top: 2px;
  color: var(--text-2);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.timeline details {
  margin-top: var(--s1);
}

.timeline summary {
  color: var(--text-3);
  font-size: 12px;
  cursor: pointer;
}

.json {
  margin-top: var(--s2);
  padding: var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font: 400 12px/1.5 var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 320px;
  overflow: auto;
}

.playback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s4);
}

.playback .progress {
  flex: 1 1 120px;
  height: 2px;
  border: 0;
  background: var(--border);
  appearance: none;
}

.playback .progress::-webkit-progress-bar {
  background: var(--border);
}

.playback .progress::-webkit-progress-value {
  background: var(--text);
  transition: width var(--dur) var(--ease);
}

.playback .progress::-moz-progress-bar {
  background: var(--text);
}

.inspector-actions {
  margin-bottom: var(--s3);
}

/* ---------------------------------------------------------- diff viewer */

.diff-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s4);
  margin-bottom: var(--s3);
  color: var(--text-2);
  font-size: 12.5px;
}

.diff-file {
  margin-bottom: var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.diff-file-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 38px;
  padding: var(--s1) var(--s2) var(--s1) var(--s3);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.diff-file-head .path {
  flex: 1;
  min-width: 0;
  font: 500 12.5px/1.4 var(--font-mono);
  overflow-wrap: anywhere;
}

.diff-file-head .stat {
  color: var(--text-3);
  font: 400 12px/1 var(--font-mono);
  white-space: nowrap;
}

.diff-scroll {
  overflow-x: auto;
}

.diff-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font: 400 12.5px/1.6 var(--font-mono);
  tab-size: 4;
}

.diff-table td {
  padding: 0 var(--s2);
  vertical-align: top;
  white-space: pre;
}

.diff-table .ln {
  width: 44px;
  min-width: 44px;
  color: var(--text-3);
  text-align: right;
  user-select: none;
  border-right: 1px solid var(--border);
}

.diff-table .sign {
  width: 18px;
  padding-right: 0;
  color: var(--text-2);
  font-weight: 700;
  user-select: none;
}

.diff-table .code {
  padding-right: var(--s5);
}

.diff-table tr.add {
  background: var(--diff-add);
}

.diff-table tr.add .sign,
.diff-table tr.del .sign {
  color: var(--text);
}

.diff-table tr.del {
  background: repeating-linear-gradient(
    135deg,
    var(--bg) 0,
    var(--bg) 6px,
    var(--diff-del-stripe) 6px,
    var(--diff-del-stripe) 8px
  );
}

.diff-table tr.del .code {
  color: var(--text-2);
}

.diff-table tr.hunk td {
  padding-top: 2px;
  padding-bottom: 2px;
  background: var(--diff-hunk);
  color: var(--text-3);
}

.diff-table tr.note td {
  color: var(--text-3);
  font-style: italic;
}

/* ------------------------------------------------------------ checks */

.checks {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.check {
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--border);
}

.check:last-child {
  border-bottom: 0;
}

.check-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s3);
}

.check-head .what {
  flex: 1;
  min-width: 0;
  font-weight: 500;
}

.check-head .facts-inline {
  color: var(--text-3);
  font: 400 12px/1 var(--font-mono);
}

.check code.command {
  display: block;
  margin-top: var(--s2);
  padding: var(--s2) var(--s3);
  border-radius: var(--radius);
  background: var(--surface);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.check .output {
  margin-top: var(--s2);
  padding: var(--s2) var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: 400 12px/1.5 var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 240px;
  overflow: auto;
}

.tests {
  list-style: none;
  margin: var(--s2) 0 0;
  padding: 0;
  font: 400 12.5px/1.5 var(--font-mono);
}

.tests li {
  display: flex;
  gap: var(--s2);
  padding: 2px 0;
}

.tests li .status .text {
  font-family: var(--font-mono);
  font-size: 12px;
}

.kv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.kv-table th,
.kv-table td {
  padding: var(--s2) var(--s3) var(--s2) 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.kv-table th {
  color: var(--text-3);
  font-weight: 400;
  font-size: 12.5px;
  white-space: nowrap;
}

.kv-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.kv-table .diff-value {
  font-weight: 600;
}

/* --------------------------------------------------------------- dialogs */

.dialog {
  position: fixed;
  left: 50%;
  top: 8vh;
  z-index: 41;
  width: min(640px, calc(100vw - 32px));
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg);
  box-shadow: var(--shadow);
  transform: translate(-50%, 8px);
  opacity: 0;
  transition:
    transform var(--dur) var(--ease),
    opacity var(--dur) var(--ease);
}

.dialog.open {
  transform: translate(-50%, 0);
  opacity: 1;
}

.dialog.wide {
  width: min(1040px, calc(100vw - 32px));
}

.dialog-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--border);
}

.dialog-head h2 {
  flex: 1;
  font-size: 15px;
}

.dialog-body {
  padding: var(--s5);
  overflow: auto;
}

.dialog-body h3 {
  margin: var(--s5) 0 var(--s2);
  font-size: 13px;
}

.dialog-body h3:first-child {
  margin-top: 0;
}

.dialog-body pre {
  padding: var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
}

.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--s2);
  padding: var(--s3) var(--s5);
  border-top: 1px solid var(--border);
}

.shortcuts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 var(--s5);
}

.shortcuts div {
  display: flex;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.palette {
  top: 14vh;
  width: min(560px, calc(100vw - 32px));
}

.palette input {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--s4);
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: 400 15px/1 var(--font-sans);
}

.palette input:focus {
  outline: none;
}

.palette-list {
  max-height: 50vh;
  overflow-y: auto;
  padding: var(--s1);
}

.palette-group {
  padding: var(--s2) var(--s3) var(--s1);
  color: var(--text-3);
  font: 500 11px/1 var(--font-mono);
  letter-spacing: 0;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 36px;
  padding: 0 var(--s3);
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--text);
  font: 400 13px/1.3 var(--font-sans);
  text-align: left;
  cursor: pointer;
}

.palette-item .hint {
  margin-left: auto;
  color: var(--text-3);
  font-size: 12px;
  white-space: nowrap;
}

.palette-item[aria-selected="true"] {
  background: var(--surface-2);
}

.palette-foot {
  display: flex;
  gap: var(--s4);
  padding: var(--s2) var(--s4);
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12px;
}

/* ---------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  right: var(--s4);
  bottom: var(--s4);
  z-index: 60;
  display: grid;
  gap: var(--s2);
  max-width: min(380px, calc(100vw - 32px));
}

.toast {
  padding: var(--s3) var(--s4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: rise var(--dur) var(--ease);
}

.toast.error {
  background: var(--inverse-bg);
  border-color: var(--inverse-bg);
  color: var(--inverse-text);
}

/* --------------------------------------------------------------- reports */

.report-list {
  display: grid;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.report-row {
  display: grid;
  grid-template-columns: minmax(150px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s4);
  padding: var(--s3) var(--s4);
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}

.report-row:last-child {
  border-bottom: 0;
}

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

.report-row .title {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.report-row .sub {
  display: block;
  color: var(--text-3);
  font-size: 12px;
}

.flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  counter-reset: step;
}

.flow > div {
  padding: var(--s3) var(--s4);
  border-right: 1px solid var(--border);
}

.flow > div:last-child {
  border-right: 0;
}

.flow .step {
  display: block;
  color: var(--text-3);
  font: 500 11px/1 var(--font-mono);
  margin-bottom: var(--s2);
}

.footer {
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: var(--s4) var(--s5);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s5);
  color: var(--text-3);
  font-size: 12.5px;
}

.footer-inner .grow {
  flex: 1;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border-strong);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

/* ---------------------------------------------------------------- motion */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

/* ------------------------------------------------------------ responsive */

@media (max-width: 1024px) {
  .breakdown {
    grid-template-columns: minmax(0, 1fr);
  }

  .summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .summary > div:nth-child(3n) {
    border-right: 0;
  }

  .summary > div:nth-child(-n + 3) {
    border-bottom: 1px solid var(--border);
  }

  .runs .col-tokens,
  .runs .col-created {
    display: none;
  }

  .top-actions .connection {
    display: none;
  }
}

@media (max-width: 768px) {
  .topbar-inner {
    padding: 0 var(--s4);
    gap: var(--s3);
  }

  .wordmark small {
    display: none;
  }

  .connection .label-text {
    display: none;
  }

  .main {
    padding: var(--s4) var(--s4) var(--s6);
  }

  .notice-inner,
  .footer-inner {
    padding-left: var(--s4);
    padding-right: var(--s4);
  }

  .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary > div {
    border-bottom: 1px solid var(--border);
  }

  .summary > div:nth-child(3n) {
    border-right: 1px solid var(--border);
  }

  .summary > div:nth-child(2n) {
    border-right: 0;
  }

  .summary > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .search {
    max-width: none;
    flex-basis: 100%;
    order: -1;
  }

  .filters-toggle {
    display: inline-flex;
  }

  .filters {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    padding: var(--s3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    animation: rise var(--dur) var(--ease);
  }

  .filters.open {
    display: flex;
  }

  .filters .segmented {
    flex-wrap: wrap;
  }

  .filters .segmented button {
    flex: 1 1 auto;
    min-height: 36px;
  }

  .filters .select {
    min-height: 40px;
  }

  /* Rows become readable stacked items rather than a squeezed table. */
  #run-list .table-wrap {
    border: 0;
    overflow: visible;
  }

  .runs thead {
    display: none;
  }

  .runs,
  .runs tbody,
  .runs tr,
  .runs td {
    display: block;
    width: 100%;
  }

  .runs tbody tr {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--s1) var(--s3);
    padding: var(--s3) var(--s3) var(--s3) 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--s2);
  }

  .runs td {
    height: auto;
    padding: 0;
    border: 0;
    white-space: normal;
  }

  .runs .pick-cell {
    position: absolute;
    left: 8px;
    top: 10px;
    width: auto;
  }

  .runs .pick-cell label {
    width: 32px;
    height: 32px;
  }

  .runs .task {
    grid-column: 1 / -1;
    max-width: none;
  }

  .runs .task .title {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .runs .col-status {
    grid-column: 1;
  }

  .runs .col-duration {
    grid-column: 2;
    text-align: right;
  }

  .runs .col-model,
  .runs .col-attempts,
  .runs .col-cost,
  .runs .col-verify,
  .runs .col-created {
    display: none;
  }

  .runs .mobile-meta {
    display: block !important;
    grid-column: 1 / -1;
    color: var(--text-3);
    font-size: 12px;
  }

  .inspector {
    width: 100vw;
    border-left: 0;
  }

  .inspector-head,
  .inspector-body {
    padding-left: var(--s4);
    padding-right: var(--s4);
  }

  .facts {
    grid-template-columns: 1fr;
  }

  .facts > div:nth-child(odd),
  .facts > div:nth-child(even) {
    padding-left: 0;
    padding-right: 0;
    border-left: 0;
  }

  .outcomes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .outcomes > div:nth-child(4n) {
    border-right: 1px solid var(--border);
  }

  .outcomes > div:nth-child(2n) {
    border-right: 0;
  }

  .outcomes > div:nth-last-child(-n + 4) {
    border-bottom: 1px solid var(--border);
  }

  .outcomes > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .timeline li {
    grid-template-columns: 56px 16px minmax(0, 1fr);
    gap: var(--s2);
  }

  .dialog {
    top: auto;
    bottom: 0;
    width: 100vw;
    max-height: 88vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translate(-50%, 16px);
  }

  .dialog.open {
    transform: translate(-50%, 0);
  }

  .shortcuts {
    grid-template-columns: 1fr;
  }

  .report-row {
    grid-template-columns: 1fr;
    gap: var(--s2);
  }

  .flow > div {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 480px) {
  .topbar-inner {
    gap: var(--s2);
  }

  .nav a,
  .nav button {
    padding: var(--s2);
  }

  .top-actions {
    gap: 0;
  }

  .top-actions .hide-xs {
    display: none;
  }
}

.mobile-meta {
  display: none;
}
