/* Tests (/safety) and Status (/dashboard). Shared tokens and header live in ui.css. */
[hidden] { display: none !important; }
h1 { line-height: 1.2; }
h2 { font-size: 20px; margin: 0 0 10px; }
h3 { font-size: 16px; margin: 0; }
h4 { font-size: 12px; font-weight: 600; color: var(--muted); margin: 14px 0 0; }
h1, h2, h3 { text-wrap: balance; }
p { margin: 8px 0 16px; max-width: 75ch; }
section, [id] { scroll-margin-top: 24px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.message { margin: 14px 0 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.message:empty { margin: 0; }
.message.error, .form-error { color: var(--fail); }
.form-error:empty { display: none; }
input, textarea, select { width: 100%; border: 1px solid #c4c9cf; padding: 9px 10px; background: #fff; margin-block: 6px 0; }
textarea { font-family: ui-monospace, Consolas, monospace; font-size: 13px; resize: vertical; }
pre { margin: 6px 0 0; overflow: auto; max-height: 300px; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
code, pre { font-family: ui-monospace, Consolas, monospace; }
summary { cursor: pointer; color: var(--blue); padding: 8px 0; }

/* Empty state: one title, one sentence, one action. */
.blankslate { max-width: 640px; margin: 40px auto; padding: 36px; text-align: center; border: 1px solid var(--line); border-radius: 10px; }
.blankslate p { margin-inline: auto; color: var(--muted); }
.blankslate .connect-guide { text-align: left; margin-top: 20px; }

/* Tests view. */
.view { padding-top: 24px; }
.test-toolbar { display: grid; grid-template-columns: minmax(0, 1.4fr) 160px minmax(0, 1fr) auto; align-items: end; gap: 12px; }
.test-toolbar label { font-size: 13px; font-weight: 600; }
.add-menu { position: relative; }
.add-menu > summary { list-style: none; color: var(--ink); min-height: 40px; border: 1px solid var(--line); }
.add-menu > summary::-webkit-details-marker { display: none; }
.add-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 4; width: min(440px, calc(100vw - 40px)); display: grid; gap: 4px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgb(30 34 39 / 14%); }
.add-option { display: grid; gap: 10px; padding: 12px; border-radius: 6px; }
.add-option + .add-option { border-top: 1px solid var(--line); border-radius: 0; }
.add-option h3 { font-size: 15px; }
.add-option p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.add-option > button, .import-form > button { justify-self: start; }
.import-form { margin: 0; }
.case-list { display: grid; gap: 12px; margin-top: 16px; }
.empty-tests { padding: 24px; background: var(--surface); border-radius: 8px; text-align: center; }
.test-case { padding: 18px 20px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.test-case.pending { border-color: var(--warn-line); background: var(--warn-soft); }
.test-case.rejected { background: var(--surface); }
.case-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.case-facts { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 16px; margin: 14px 0 0; font-size: 14px; }
.case-facts dt { color: var(--muted); }
.case-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.case-facts code { background: var(--surface); padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.check-list { margin: 0; padding: 0; list-style: none; }
.check-list li { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.review-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.case-more { margin-top: 8px; font-size: 14px; }

/* Runs view. */
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.run-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.runs-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 32px; align-items: start; margin-top: 16px; }
.history { display: grid; gap: 4px; }
.history-link { display: grid; position: relative; padding: 10px 12px 10px 30px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.history-link::before { content: ""; position: absolute; left: 12px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.history-link:hover { background: var(--surface); color: var(--ink); }
.history-link.pass::before { background: var(--pass); }
.history-link.fail::before { background: var(--fail); }
.history-link.inconclusive::before { background: var(--warn); }
.history-link[aria-current="true"] { background: var(--surface); }
.run-section h2 { font-size: 22px; }
.run-section h2:focus { outline: none; }
.run-verdict { padding: 16px 20px; margin-block: 0 16px; border-radius: 10px; border: 1px solid var(--warn-line); background: var(--warn-soft); }
.run-verdict.pass { border-color: var(--pass-line); background: var(--pass-soft); }
.run-verdict.fail { border-color: var(--fail-line); background: var(--fail-soft); }
.run-verdict p { margin: 0; }
.result { padding: 16px 18px; margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; }
.result.fail { border-color: var(--fail-line); }
.result-heading { display: flex; gap: 14px; justify-content: space-between; align-items: start; }
.table-scroll { max-width: 100%; overflow-x: auto; margin-block: 12px 0; }
.assertion-table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
.assertion-table th { font-weight: 600; color: var(--muted); }
.assertion-table td, .assertion-table th { border-bottom: 1px solid var(--line); padding: 8px 10px; overflow-wrap: anywhere; }
.assertion-table td { font-family: ui-monospace, Consolas, monospace; font-variant-numeric: tabular-nums; }
.assertion-table tr.failed td { color: var(--fail); }
.run-tools { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; justify-items: start; gap: 4px; }
.run-tools p { margin: 0; }
.compare-form { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; max-width: 560px; margin: 0; }
.compare-form label { flex: 1 1 260px; font-size: 13px; font-weight: 600; }
.change-list { padding-left: 20px; margin: 10px 0 0; }
.change-list li { margin-bottom: 4px; overflow-wrap: anywhere; }

/* Requirements view. */
.suite-summary { display: flex; gap: 36px; margin: 8px 0 20px; }
.suite-summary div { display: flex; flex-direction: column; }
.suite-summary strong { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
.suite-summary span { font-size: 13px; color: var(--muted); }
.requirement-list { margin: 0; border-top: 1px solid var(--line); }
.requirement-list dt { padding-top: 14px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--muted); }
.requirement-list dd { display: grid; gap: 2px; margin: 2px 0 0; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.gap { color: var(--fail); font-weight: 600; }

#edit-dialog { border: 1px solid var(--line); border-radius: 10px; width: min(650px, calc(100% - 32px)); max-height: 90vh; overflow: auto; padding: 24px; overscroll-behavior: contain; }
#edit-dialog::backdrop { background: rgb(30 34 39 / 45%); }
#edit-form label { display: block; margin-top: 12px; font-size: 13px; font-weight: 600; }

/* Status page. */
#verdict { margin-top: 24px; padding: 20px 24px; }
#verdict h2 { font-size: clamp(20px, 2.2vw, 26px); margin: 0 0 4px; }
.drift { margin: 10px 0 0; padding-left: 20px; }
.drift:empty { display: none; }
.drift li { margin-top: 4px; font-weight: 600; }
.status-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 0 24px; align-items: start; margin-top: 4px; }
.status-section { border-top: 1px solid var(--line); margin-top: 32px; padding-top: 24px; }
.status-side section + section { margin-top: 32px; }
.status-side h2 { font-size: 17px; }
.coverage-table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 14px; text-align: left; }
.coverage-table th, .coverage-table td { border-bottom: 1px solid var(--line); padding: 10px; vertical-align: top; }
.coverage-table thead th { font-weight: 600; color: var(--muted); font-size: 13px; }
.coverage-table tbody th { font-weight: 400; }
.coverage-table tbody th strong { display: block; font-size: 13px; font-family: ui-monospace, Consolas, monospace; font-weight: 500; color: var(--muted); }
.coverage-table td { font-variant-numeric: tabular-nums; }
.coverage-table td .badge { margin-left: 8px; }
.unprotected { background: var(--fail-soft); }
.queue dt { font-size: 15px; font-weight: 600; }
.queue dd { margin: 2px 0 12px; font-size: 13px; color: var(--muted); }
.version-group { margin-top: 12px; }
.version-group p { margin: 0 0 6px; font-family: ui-monospace, Consolas, monospace; }
.run-marks { display: flex; flex-wrap: wrap; gap: 6px; }
.run-mark { display: block; width: 20px; height: 20px; border-radius: 4px; border: 2px solid var(--warn); background: var(--warn); }
.run-mark.pass { border-color: var(--pass); background: var(--pass); }
.run-mark.fail { border-color: var(--fail); background: var(--fail); }
.run-mark.experimental { background: transparent; }
.run-mark:hover { outline: 2px solid var(--ink); outline-offset: 2px; }

@media (max-width: 900px) {
  .test-toolbar { grid-template-columns: 1fr 1fr; }
  .runs-layout, .status-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .history { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}
@media (max-width: 560px) {
  .test-toolbar { grid-template-columns: 1fr; }
  .add-panel { left: 0; right: auto; }
  .case-facts { grid-template-columns: 1fr; gap: 2px; }
  .case-facts dd + dt { margin-top: 8px; }
  .test-case { padding: 16px; }
  .blankslate { padding: 24px 18px; margin-top: 24px; }
  .suite-summary { gap: 20px; }
}
.blankslate pre { text-align: left; }

/* Public page: the two setup commands, copyable. */
.setup-commands { display: grid; justify-items: center; gap: 10px; margin: 18px 0; padding: 0; list-style: none; }
.pattern-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; }
.pattern-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: white; }
.pattern-list h4 { margin: 0; font-size: 14px; }
.pattern-list p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.pattern-list .in-suite { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Training runs (/training). */
.training-controls { display: flex; gap: 10px; align-items: center; }
.training-controls label, #samples-title + label { display: inline-flex; align-items: center; margin: 0; font-size: 13px; font-weight: 400; color: var(--muted); }
.training-controls select, #sample-filter { margin-left: 6px; padding: 6px 8px; border: 1px solid #c4c9cf; border-radius: 6px; background: #fff; font: inherit; color: var(--ink); max-width: 320px; }
.stat-strip .stat-note { margin: 2px 0 0; }
#samples td:last-child { font-variant-numeric: normal; white-space: nowrap; }
#sample .run-meta summary { font-size: 13px; }
#sample .back-link { display: inline-block; font-size: 13px; margin-bottom: 10px; }
#sample .back-link::before { content: "\2190\00a0"; }
#sample h3 { margin: 20px 0 6px; font-size: 14px; }
#samples th.num a { font-weight: 600; }
@media (max-width: 760px) { .training-controls { flex-wrap: wrap; } }
.table-scroll.rollouts { max-height: 560px; overflow-y: auto; }
.table-scroll.rollouts thead th { position: sticky; top: 0; z-index: 1; }
