/* Bench UI. Colours, sizes and spacing follow the design mockups. */

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --sunken: #eeeeea;
  --border: #e4e4e0;
  --rule: #eeeeea;
  --control: #d4d4d0;
  --text: #18181b;
  --text-2: #3f3f46;
  --code: #27272a;
  --muted: #52525b;
  --faint: #71717a;
  --grey-dot: #a1a1aa;
  --grey-band: #d4d4d8;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #dbeafe;
  --accent-band: #93c5fd;
  --accent-ink: #1e40af;
  --accent-ink-2: #1e3a8a;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --good: #15803d;
  --good-soft: #dcfce7;
  --warn-soft: #ffedd5;
  --warn-ink: #9a3412;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  overflow-y: scroll;
}
a { color: var(--muted); text-decoration: none; }
a:hover { color: var(--text); }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.55; }
h1, h2, h3 { margin: 0; }
h1 { font-size: 24px; font-weight: 600; }
h2 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre;
  overflow: auto;
}
code, .mono { font-family: var(--mono); font-size: 13px; }
pre, code, .mono, kbd { font-variant-ligatures: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 8px; top: -48px; z-index: 10; background: var(--surface); padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); }
.skip-link:focus { top: 8px; }
.noscript { max-width: 1240px; margin: 0 auto; padding: 32px; }

/* ---- Header ------------------------------------------------------------ */

.app-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner {
  max-width: 1240px; margin: 0 auto; padding: 0 32px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 32px; min-height: 56px;
}
.brand { font-weight: 600; font-size: 15px; color: var(--text); }
.nav { display: flex; flex-wrap: wrap; gap: 4px 24px; font-size: 14px; }
.nav a { padding: 18px 0; }
.nav a[aria-current="page"] { color: var(--text); font-weight: 500; box-shadow: inset 0 -2px 0 var(--accent); }

/* Pipeline control: small, right-aligned in the header bar. */
.pipeline {
  margin-left: auto; position: relative;
  display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted);
  min-height: 32px;
}
.pipeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--grey-dot); flex: none; }
.pipeline-dot.on { background: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .pipeline-dot.on { animation: none; } }
.pipeline-status { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pipeline-errors { position: relative; }
.pipeline-errors > summary {
  list-style: none; cursor: pointer; color: var(--bad); font-weight: 500;
  padding: 4px 6px; border-radius: 6px; white-space: nowrap;
}
.pipeline-errors > summary::-webkit-details-marker { display: none; }
.pipeline-errors > summary:hover { background: var(--bad-soft); }
.pipeline-errors ol {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  width: min(440px, calc(100vw - 32px)); max-height: 320px; overflow: auto;
  margin: 0; padding: 8px 8px 8px 28px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  font-family: var(--mono); font-size: 12px; color: var(--text-2); line-height: 1.5;
}
.pipeline-errors li { padding: 4px 0; border-bottom: 1px solid var(--rule); white-space: pre-wrap; word-break: break-word; }
.pipeline-errors li:last-child { border-bottom: 0; }

/* Account: "Sign in" link or the login name with a small menu. */
.account { display: flex; align-items: center; font-size: 13px; }
.account-signin { font-weight: 500; color: var(--accent); padding: 8px 0; }
.account-signin:hover { color: var(--accent-hover); }
.account-menu { position: relative; }
.account-menu > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 0 8px; border-radius: 6px; color: var(--text); font-weight: 500;
}
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:hover { background: var(--sunken); }
.account-menu .chev { color: var(--muted); font-size: 11px; }
.account-login { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu .menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 180px;
  display: flex; flex-direction: column; padding: 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.account-menu .menu button {
  text-align: left; border: 0; background: transparent; color: var(--text); font-size: 14px;
  min-height: 40px; padding: 0 10px; border-radius: 6px;
}
.account-menu .menu button:hover { background: var(--sunken); }

/* ---- Page layout ------------------------------------------------------- */

.page { max-width: 1240px; margin: 0 auto; padding: 32px; outline: none; }
.view { display: flex; flex-direction: column; gap: 24px; min-height: 60vh; }
.view.tight { gap: 20px; }
.banners:empty { display: none; }
.banners { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.banner {
  display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px 10px 14px;
  border-radius: 8px; font-size: 13px; line-height: 1.5;
  background: var(--bad-soft); color: #7f1d1d; border: 1px solid #fecaca;
}
.banner.info { background: var(--accent-soft); color: var(--accent-ink-2); border-color: #bfdbfe; }
.banner-text { flex: 1; min-width: 0; word-break: break-word; }
.banner button { border: 0; background: transparent; color: inherit; padding: 0 4px; font-size: 16px; line-height: 1.2; border-radius: 4px; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head.center { align-items: center; }
.title-block { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.sub { font-size: 13px; color: var(--muted); min-height: 1.4em; }
.sub a { color: var(--muted); }
.sub a:hover { color: var(--text); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 24px; align-items: stretch; }
.row-wrap.top { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nums { font-variant-numeric: tabular-nums; }
.save-state { font-size: 13px; color: var(--muted); min-width: 4em; }

/* ---- Cards ------------------------------------------------------------- */

.card { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.card.pad { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.card.pad.g10 { gap: 10px; }
.card.pad.g14 { gap: 14px; }
.card.scroll, .scroll { overflow-x: auto; position: relative; }
th.axis, td.axis { min-width: 170px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-head.baseline { align-items: baseline; }
.card-head .hint { font-size: 12px; color: var(--muted); }
.card-title-icon { display: flex; align-items: center; gap: 8px; }

.empty { padding: 48px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty h2 { font-size: 16px; }
.empty p { font-size: 14px; color: var(--muted); max-width: 52ch; line-height: 1.55; }
.empty .actions { justify-content: center; margin-top: 6px; }
.loading { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---- Buttons ----------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; min-height: 44px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--control); border-radius: 8px; color: var(--text);
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #f4f4f2; color: var(--text); }
.btn:active { background: var(--sunken); }
.btn-primary { font-weight: 500; padding: 0 16px; background: var(--accent); border-color: var(--accent); color: #ffffff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #ffffff; }
.btn-primary:active { background: var(--accent-ink-2); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; font-weight: 500; border-radius: 6px; }
.btn-xs { min-height: 28px; padding: 0 10px; font-size: 12px; font-weight: 500; border-radius: 6px; }
.btn-link {
  align-self: flex-start; font-size: 14px; min-height: 44px; padding: 0 12px;
  background: transparent; border: 0; color: var(--accent); font-weight: 500; border-radius: 8px;
}
.btn-link:hover { background: var(--accent-soft); }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; min-height: 44px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--muted);
}
.btn-icon:hover { background: var(--sunken); color: var(--text); }
.link-accent { font-size: 13px; color: var(--accent); font-weight: 500; }
.link-accent:hover { color: var(--accent-hover); text-decoration: underline; }

/* Select styled as the mock's "Task type" button. The native select covers the
   whole control so it keeps native keyboard and screen-reader behaviour. */
.select-btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; min-height: 44px; padding: 0 12px 0 14px;
  background: var(--surface); border: 1px solid var(--control); border-radius: 8px; color: var(--text);
}
.select-btn:hover { background: #f4f4f2; }
.select-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.select-btn .label { color: var(--muted); }
.select-btn .value { font-weight: 500; }
.select-btn select {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
  font: inherit; border: 0; appearance: none;
}

/* Segmented control (Audit: Random / Targeted). */
.segmented { display: flex; background: var(--sunken); border-radius: 8px; padding: 3px; }
.segmented a, .segmented button {
  display: inline-flex; align-items: center;
  min-height: 38px; padding: 0 14px; font-size: 14px;
  background: transparent; border: 0; border-radius: 6px; color: var(--muted);
}
.segmented a:hover { color: var(--text); }
.segmented [aria-current="page"], .segmented [aria-pressed="true"] {
  font-weight: 500; background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* Big choice buttons (Audit rulings). */
.choice {
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 20px;
  font-size: 15px; font-weight: 500; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--control); color: var(--text);
}
.choice:hover { background: #f4f4f2; }
.choice:active, .choice[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #ffffff; }
.choice-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.choice-row .skip { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.choice-row .skip a, .choice-row .skip button { font-size: 14px; padding: 12px 4px; background: none; border: 0; color: var(--muted); }
.choice-row .skip a:hover, .choice-row .skip button:hover { color: var(--text); }
.kbd-hint { font-size: 12px; color: var(--faint); }
.kbd-hint kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: var(--surface); color: var(--text-2); }
@media (max-width: 640px) { .kbd-hint { display: none; } }

/* ---- Chips and pills --------------------------------------------------- */

.chip {
  display: inline-block; font-size: 12px; font-weight: 500; color: var(--text-2);
  background: var(--sunken); border-radius: 6px; padding: 3px 8px; white-space: nowrap; line-height: 1.35;
}
.chip.blue { background: var(--accent-soft); color: var(--accent-ink); }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill { font-size: 13px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); border-radius: 6px; padding: 3px 10px; }
.pill.tie { color: var(--text-2); background: var(--sunken); }

/* ---- Tables ------------------------------------------------------------ */

table { border-collapse: collapse; width: 100%; }
th {
  font-weight: 500; font-size: 12px; color: var(--muted); text-align: left;
  padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 14px 16px; border-bottom: 1px solid var(--rule); font-size: 14px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.dense td { padding: 12px 16px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.num.left { text-align: left; }
td.rank { color: var(--muted); }
td.strong, .strong { font-weight: 500; }
td.wrap { white-space: normal; min-width: 180px; }
.ci { color: var(--muted); font-size: 12px; }
.axis-labels { display: flex; justify-content: space-between; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
td a.row-link { color: var(--text); font-weight: 500; }
td a.row-link:hover { color: var(--accent); }

/* Interval whisker (ratings and paradigm accuracy). */
.whisker-track { position: relative; height: 16px; background: linear-gradient(var(--border), var(--border)) center / 100% 1px no-repeat; }
.whisker-band { position: absolute; top: 6px; height: 4px; border-radius: 2px; background: var(--accent-band); }
.whisker-dot { position: absolute; top: 2px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--accent); }
.whisker-tick { position: absolute; top: 0; width: 1px; height: 16px; background: var(--grey-dot); }
.whisker-track.grey .whisker-band { background: var(--grey-band); }
.whisker-track.grey .whisker-dot { background: var(--grey-dot); }

/* ---- Leaderboard ------------------------------------------------------- */

.chart-card { flex: 999 1 560px; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.legend-line { width: 16px; height: 2px; background: var(--accent); }
.chart { width: 100%; height: auto; font-family: var(--font); display: block; aspect-ratio: 760 / 300; }
.chart .halo { opacity: 0; transition: opacity 0.12s; }
.chart .halo.on { opacity: 1; }
.chart text.on { font-weight: 600; }
.models-card { flex: 1 1 260px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.models-card h2 { padding: 8px 8px 10px; }
.model-row {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 8px;
  border: 0; border-radius: 8px; font-size: 14px; text-align: left; color: var(--text); background: transparent;
}
.model-row:hover, .model-row:focus-visible, .model-row.on { background: var(--accent-soft); color: var(--text); }
.model-row .r { width: 16px; color: var(--muted); font-variant-numeric: tabular-nums; }
.model-row .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-row .rating { margin-left: auto; font-variant-numeric: tabular-nums; }
.model-row .cost { width: 44px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.marker { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.marker.hollow { background: var(--surface); border: 1.5px solid var(--faint); }

.matrix { width: auto; min-width: 100%; }
.matrix th { padding: 8px; min-width: 88px; }
.matrix th.corner, .matrix .rowname { position: sticky; left: 0; background: var(--surface); min-width: 120px; }
.matrix th.rowname { padding: 10px 8px; font-size: 13px; font-weight: 500; color: var(--text); border-bottom: 1px solid var(--rule); box-shadow: inset -1px 0 0 var(--rule); }
.matrix tr:last-child th.rowname { border-bottom: 0; }
.matrix td.cell { padding: 10px 8px; font-size: 13px; }
.matrix td.cell.win { font-weight: 600; color: var(--text); }
.matrix td.cell.loss { color: var(--text-2); }
.matrix td.cell.self { background: var(--bg); }

/* ---- Forms ------------------------------------------------------------- */

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); min-width: 0; }
.field-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
input[type="text"], input[type="number"], input[type="url"], input[type="password"], input:not([type]), textarea, select.input {
  font: inherit; font-size: 14px; font-weight: 400; color: var(--text);
  background: var(--surface); border: 1px solid var(--control); border-radius: 8px;
  padding: 10px 12px; min-height: 44px; width: 100%;
}
input.mono, textarea.mono { font-family: var(--mono); font-size: 13px; }
input:read-only { background: var(--surface-2); }
textarea { line-height: 1.55; resize: vertical; }
input::placeholder, textarea::placeholder { color: #a1a1aa; }
.hint-text { font-size: 12px; font-weight: 400; color: var(--muted); line-height: 1.45; }
.field-row { display: flex; flex-wrap: wrap; gap: 16px; }
.field-row > * { flex: 1 1 240px; }
.budget-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; }
.checks { display: flex; flex-direction: column; gap: 8px; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-bottom: 8px; border-bottom: 1px solid var(--rule); }
.check-row .c-name { flex: 1 1 90px; }
.check-row .c-cmd { flex: 3 1 180px; }
.check-row .c-when { flex: 1 1 100px; }
.check-row .c-num { flex: none; width: 1.4em; font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.note {
  font-size: 13px; color: var(--accent-ink-2); background: var(--accent-soft); border-radius: 8px;
  padding: 10px 12px; line-height: 1.5;
}
.check-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); min-height: 44px; }
.check-inline input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters label.field { flex: 0 1 220px; }
.filters select.input { padding-right: 32px; }

/* Dialogs */
dialog {
  border: 1px solid var(--border); border-radius: 14px; padding: 0; color: var(--text);
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  box-shadow: 0 24px 64px rgba(0,0,0,0.18);
}
dialog::backdrop { background: rgba(24,24,27,0.35); }
dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 50px); }
.dialog-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--rule); display: flex; flex-direction: column; gap: 4px; }
.dialog-head h2 { font-size: 16px; }
.dialog-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.dialog-foot { padding: 14px 20px; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; align-items: center; }
.dialog-foot .err { margin-right: auto; color: var(--bad); font-size: 13px; }
.dialog-small { width: min(440px, calc(100vw - 32px)); }

/* ---- File tree and viewer (Audit, Run detail) -------------------------- */

.run-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
@media (max-width: 420px) { .run-grid { grid-template-columns: minmax(0, 1fr); } }
.run-card { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; }
.run-card-head { padding: 14px 20px; border-bottom: 1px solid var(--rule); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.run-card-head .summary { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.browser { display: flex; flex-wrap: wrap; min-height: 300px; }
.tree {
  flex: 1 0 190px; max-width: 100%; padding: 10px 8px; background: var(--surface-2);
  border-right: 1px solid var(--rule); display: flex; flex-direction: column; gap: 1px; overflow-y: auto; max-height: 520px;
}
.tree-dir { display: flex; align-items: center; gap: 6px; padding: 6px 8px; font-size: 13px; color: var(--muted); }
.tree-dir svg { flex: none; }
.tree-file {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 0 8px;
  border: 0; border-radius: 6px; font-size: 13px; text-align: left; background: transparent; color: var(--code);
}
.tree-file:hover { background: var(--sunken); }
.tree-file[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink-2); font-weight: 500; }
.tree-file .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-file.deleted .fname { text-decoration: line-through; color: var(--faint); }
.tree-file .delta { margin-left: auto; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; opacity: 0.8; }
.tree-empty { padding: 8px; font-size: 13px; color: var(--muted); }
.viewer { flex: 999 1 280px; min-width: 0; display: flex; flex-direction: column; }
.viewer-path { padding: 9px 16px; border-bottom: 1px solid var(--rule); font-size: 12px; color: var(--muted); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 37px; }
.viewer pre { flex: 1; padding: 14px 16px; color: var(--code); max-height: 260px; }
.viewer.tall pre { max-height: 560px; }
.viewer .viewer-msg { padding: 14px 16px; font-size: 13px; color: var(--muted); }
.run-card-foot { margin-top: auto; padding: 14px 20px; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 13px; color: var(--muted); }
.run-card-foot strong { color: var(--text); font-weight: 600; }
.run-card-foot strong.fail { color: var(--bad); }

.verdict-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.verdict-row .order { font-size: 13px; color: var(--muted); }
.rationale { font-size: 14px; line-height: 1.6; color: var(--text-2); max-width: 80ch; white-space: pre-wrap; }

/* ---- Run detail -------------------------------------------------------- */

.meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px 24px; margin: 0; }
.meta div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.meta dt { font-size: 12px; color: var(--muted); }
.meta dd { margin: 0; font-size: 14px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.error-box { font-family: var(--mono); font-size: 12.5px; color: #7f1d1d; background: var(--bad-soft); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; }
details.output > summary { cursor: pointer; font-size: 12px; color: var(--accent); font-weight: 500; padding: 4px 0; }
details.output pre { margin-top: 6px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--rule); border-radius: 8px; max-height: 320px; white-space: pre-wrap; word-break: break-word; }
.diff { padding: 12px 0; max-height: 640px; }
.diff span { display: block; padding: 0 16px; min-height: 1.6em; }
.diff .add { background: #ecfdf3; color: #14532d; }
.diff .del { background: #fef2f2; color: #7f1d1d; }
.diff .hunk { color: var(--accent-ink); background: #f1f5ff; }
.diff .meta-line { color: var(--muted); font-weight: 500; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 52px 150px minmax(0, 1fr); gap: 4px 12px; padding: 10px 20px; border-top: 1px solid var(--rule); font-size: 13px; }
.timeline li:first-child { border-top: 0; }
.timeline .seq { color: var(--faint); font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12px; padding-top: 2px; }
.timeline .etype { font-family: var(--mono); font-size: 12px; color: var(--muted); padding-top: 2px; overflow-wrap: anywhere; }
.timeline .etype.user { color: var(--accent-ink); }
.timeline .etype.assistant { color: var(--text); font-weight: 500; }
.timeline .etype.tool { color: #6d28d9; }
.timeline .etype.err { color: var(--bad); }
.timeline .body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.timeline .text { white-space: pre-wrap; word-break: break-word; line-height: 1.55; color: var(--text-2); }
.timeline .code { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; color: var(--code); background: var(--surface-2); border-radius: 6px; padding: 6px 8px; }
.timeline .code.err { background: var(--bad-soft); color: #7f1d1d; }
.timeline .more { align-self: flex-start; border: 0; background: none; color: var(--accent); font-size: 12px; font-weight: 500; padding: 2px 0; }
@media (max-width: 640px) {
  .timeline li { grid-template-columns: 40px minmax(0, 1fr); }
  .timeline .body { grid-column: 1 / -1; }
}

/* ---- Responsive -------------------------------------------------------- */

@media (max-width: 640px) {
  .header-inner { padding: 0 16px; gap: 0 16px; }
  .brand { order: 0; padding-top: 12px; }
  .account { order: 1; margin-left: auto; padding-top: 8px; }
  .nav { order: 2; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; gap: 0 16px; scrollbar-width: none; }
  .nav a { padding: 12px 0 14px; white-space: nowrap; }
  .pipeline { order: 3; margin-left: 0; flex: 1 1 auto; padding-bottom: 8px; }
  .page { padding: 20px 16px; }
  .card.pad { padding: 16px; }
}

/* ---- Sign in ----------------------------------------------------------- */

.login-wrap { display: flex; justify-content: center; padding: 48px 0 24px; }
.login-card { width: min(400px, 100%); padding: 28px; gap: 18px; }
.login-card .btn-primary { width: 100%; }
.form-error { min-height: 1.4em; margin: -6px 0 -6px; font-size: 13px; color: var(--bad); }
.form-error:empty { min-height: 0; margin: 0; }

/* ---- Users and secrets ------------------------------------------------- */

.row-actions { display: inline-flex; gap: 8px; justify-content: flex-end; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: #fecaca; }
.secret { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
.secret-value { flex: 1; min-width: 0; font-size: 15px; overflow-wrap: anywhere; user-select: all; }

/* ---- Tasks repository -------------------------------------------------- */

.repo-card { padding: 16px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.repo-card h2 { flex: none; }
.clone { flex: 1 1 320px; min-width: 0; display: flex; align-items: center; gap: 8px; }
.clone code {
  flex: 1; min-width: 0; padding: 7px 10px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; overflow-x: auto; white-space: nowrap; user-select: all;
}
.repo-card .hint-text { flex: 1 1 100%; }
tr.archived td { color: var(--faint); }
tr.archived td a.row-link { color: var(--faint); }
.slug { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }
.commit { font-family: var(--mono); font-size: 12px; color: var(--muted); font-variant-ligatures: none; }
.version-select { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.version-select select.input { min-height: 32px; padding: 4px 28px 4px 8px; width: auto; font-size: 13px; }
.note.warn { background: var(--warn-soft); color: var(--warn-ink); }
.save-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.save-group input { width: 260px; max-width: 100%; }

/* Read-only file listings (start/, grader/, reference/). */
.files-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.files-head { display: flex; align-items: baseline; gap: 8px; }
.files-head .count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.files-box { border: 1px solid var(--control); border-radius: 8px; background: var(--surface-2); min-height: 44px; }
.files-box > summary { cursor: pointer; padding: 11px 12px; font-size: 14px; color: var(--text-2); }
.files-box > summary:hover { color: var(--text); }
.files-box ul {
  list-style: none; margin: 0; padding: 8px 12px 10px; border-top: 1px solid var(--rule);
  max-height: 220px; overflow: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.7; color: var(--code);
}
.files-box li { white-space: nowrap; }
.files-none { padding: 11px 12px; font-size: 14px; color: var(--muted); }
.hint-text code { font-size: 12px; }
