/* The test-harness web view: a quiet evidence browser. System fonts, one accent, status said in words first and
   colour second. Light and dark follow the reader's setting. */

:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #1a1e24;
  --ink-2: #3c434d;
  --muted: #646d79;
  --rule: #e1e4e9;
  --rule-strong: #c9ced6;
  --accent: #2b5d8c;
  --accent-soft: #e6eef6;
  --pass: #17693f;
  --pass-soft: #e3f2ea;
  --fail: #a8261b;
  --fail-soft: #fbe9e7;
  --warn: #8a5a00;
  --warn-soft: #fbf1dc;
  --plain-soft: #eef0f3;
  --code-bg: #f1f3f6;
  --series-run: #2b5d8c;
  --series-base: #a7afba;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #101317;
    --surface: #171b21;
    --ink: #e4e8ee;
    --ink-2: #c3cad4;
    --muted: #949eab;
    --rule: #272d35;
    --rule-strong: #384049;
    --accent: #8fb8e2;
    --accent-soft: #1c2a38;
    --pass: #5fc893;
    --pass-soft: #13281d;
    --fail: #f2877b;
    --fail-soft: #331a17;
    --warn: #e2b55a;
    --warn-soft: #2e2512;
    --plain-soft: #222830;
    --code-bg: #1d222a;
    --series-run: #8fb8e2;
    --series-base: #56606c;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px / 1.5 var(--sans);
  font-feature-settings: "tnum" 1;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

code,
pre {
  font-family: var(--mono);
  font-size: 12.5px;
}
code {
  background: var(--code-bg);
  border-radius: 3px;
  padding: 0 3px;
  overflow-wrap: anywhere;
}

/* Header */
.top {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.bar {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.brand {
  color: var(--ink);
  font-weight: 650;
  letter-spacing: -0.01em;
}
.readonly {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  padding: 0 5px;
}
.lookup {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.lookup input {
  font: 13px var(--mono);
  width: 22em;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
}
.lookup-hint {
  color: var(--warn);
  font-size: 12px;
}

/* Page */
main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 16px 64px;
}
h1 {
  font-size: 24px;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.015em;
  margin: 4px 0 6px;
  overflow-wrap: anywhere;
}
h1 code {
  font-size: 0.85em;
  background: none;
  padding: 0;
}
h2 {
  font-size: 13px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  margin: 0 0 10px;
}
h3 {
  font-size: 15px;
  font-weight: 650;
  margin: 18px 0 6px;
}
section {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}
p {
  margin: 4px 0;
}
.lede {
  font-size: 15px;
  color: var(--ink-2);
  max-width: 70ch;
  margin: 4px 0 8px;
}
.crumbs {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12.5px;
}
.big {
  font-size: 20px;
  font-weight: 650;
  color: var(--ink);
}
.num {
  font-variant-numeric: tabular-nums;
}
.empty {
  color: var(--muted);
  font-style: italic;
}
.loading {
  color: var(--muted);
}

/* Status marks: word first, colour second */
.mark {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 18px;
  padding: 0 6px;
  border-radius: 3px;
  white-space: nowrap;
  vertical-align: 1px;
  background: var(--plain-soft);
  color: var(--ink-2);
}
h1 .mark {
  font-size: 13px;
  line-height: 22px;
  vertical-align: 4px;
}
.mark.pass {
  background: var(--pass-soft);
  color: var(--pass);
}
.mark.fail {
  background: var(--fail-soft);
  color: var(--fail);
}
.mark.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

/* Applications */
.apps {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.app {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 14px 16px;
}
.app h2 {
  font-size: 17px;
  text-transform: none;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.env {
  color: var(--ink-2);
}

/* Facts */
.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 3px 18px;
  margin: 12px 0 0;
}
.facts dt {
  color: var(--muted);
}
.facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
}
table {
  border-collapse: collapse;
  width: 100%;
}
th,
td {
  text-align: left;
  vertical-align: top;
  padding: 6px 10px;
  border-bottom: 1px solid var(--rule);
}
th {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
tr:last-child td {
  border-bottom: 0;
}

/* Criteria */
.feature h3 {
  margin-top: 16px;
}
.criteria {
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.criterion {
  display: grid;
  grid-template-columns: 6.5em 7.5em minmax(0, 1fr) minmax(0, 15em) minmax(0, 17em);
  gap: 4px 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}
.criterion:last-child {
  border-bottom: 0;
}
.isc {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.crit-text {
  margin: 0;
}
.crit-scenarios {
  font-size: 12.5px;
  overflow-wrap: anywhere;
}
.crit-scenarios p {
  margin: 2px 0 0;
}
.scenario-summary .mark {
  white-space: normal;
}
.feature-hint {
  font-size: 12.5px;
  font-weight: 400;
}
.next-step {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}
.feature-line {
  margin: 10px 0 0;
}
.reasons {
  margin: 2px 0 0;
  padding-left: 16px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.pointer {
  font-size: 12.5px;
}
.pointer .when {
  display: block;
}
a.id {
  font-family: var(--mono);
  font-size: 12.5px;
}

/* Executions */
.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.chart {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 10px 12px 8px;
  min-width: 0;
}
.chart figcaption {
  font-size: 12.5px;
}
.chart-title {
  font-weight: 650;
}
.chart svg {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 6px;
  font-family: var(--sans);
  font-size: 10.5px;
}
.chart .grid line {
  stroke: var(--rule);
  stroke-width: 1;
}
.chart .axis line {
  stroke: var(--rule-strong);
  stroke-width: 1;
}
.chart .axis text {
  fill: var(--muted);
}
.chart .axis .unit {
  fill: var(--ink-2);
  font-weight: 600;
}
.chart .bar.run rect {
  fill: var(--series-run);
}
.chart .bar.baseline rect {
  fill: var(--series-base);
}
.chart .bar.flagged rect {
  fill: var(--fail);
}
.chart .value {
  fill: var(--ink-2);
  font-size: 10px;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.key::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: 0;
}
.key.run::before {
  background: var(--series-run);
}
.key.baseline::before {
  background: var(--series-base);
}
.delta.flagged,
.flagged-text {
  color: var(--fail);
}

/* A result's screenshots (ISC-178): thumbnails that open full size, each with its path; never wider than the page. */
.shots {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 0 0;
}
.shots .shot {
  margin: 0;
  max-width: 100%;
  min-width: 0;
}
.shots figcaption {
  overflow-wrap: anywhere;
  max-width: 240px;
}
.shot-img {
  display: block;
  max-width: min(240px, 100%);
  max-height: 180px;
  height: auto;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  background: var(--code-bg);
}

.failures,
.results,
.steps,
.notes {
  list-style: none;
  padding: 0;
  margin: 0;
}
.failure,
.result {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--rule-strong);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  min-width: 0;
}
.failure,
.result.failed {
  border-left-color: var(--fail);
}
.result.passed {
  border-left-color: var(--pass);
}
.result-head {
  margin: 0 0 2px;
}
.test-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.steps {
  margin-top: 8px;
  border-top: 1px solid var(--rule);
}
.step {
  padding: 8px 0 4px;
  border-bottom: 1px dashed var(--rule);
}
.step:last-child {
  border-bottom: 0;
}
.step-head {
  margin: 0 0 4px;
}
.step-name {
  font-weight: 600;
}
.diff {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 6px 0;
}
.diff-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 2px;
}
.verbatim {
  margin: 0;
  padding: 6px 8px;
  background: var(--code-bg);
  border-radius: 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 22em;
  overflow: auto;
}
.problems {
  margin-top: 6px;
  background: var(--fail-soft);
  color: var(--ink);
}
.notes li {
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
}
.notes li:last-child {
  border-bottom: 0;
}
.note-head {
  margin: 0 0 4px;
  font-size: 12.5px;
}
.note-kind {
  font-weight: 600;
}
.note-text {
  background: var(--surface);
  border: 1px solid var(--rule);
}

@media (max-width: 760px) {
  body {
    font-size: 15px;
  }
  .lookup {
    margin-left: 0;
    width: 100%;
  }
  .lookup input {
    width: 100%;
  }
  .criterion {
    grid-template-columns: auto auto minmax(0, 1fr);
  }
  .crit-body,
  .crit-scenarios,
  .crit-latest {
    grid-column: 1 / -1;
  }
  .diff {
    grid-template-columns: minmax(0, 1fr);
  }
  .facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .facts dd {
    margin-bottom: 6px;
  }
}

/* Ids, hashes and URLs inside a table keep their shape; the table scrolls inside itself instead. */
td code {
  overflow-wrap: normal;
  white-space: nowrap;
}
.key.flagged::before {
  background: var(--fail);
}

/* Narrow screens: a table row becomes a block of label and value lines, so no cell is clipped at the card edge and
   nothing needs a sideways scroll to be read. */
@media (max-width: 760px) {
  .table-wrap {
    overflow-x: visible;
  }
  .table-wrap table,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td {
    display: block;
    width: 100%;
  }
  .table-wrap thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .table-wrap tr {
    padding: 8px 12px;
    border-bottom: 1px solid var(--rule);
  }
  .table-wrap tr:last-child {
    border-bottom: 0;
  }
  .table-wrap td {
    display: grid;
    grid-template-columns: 7.5em minmax(0, 1fr);
    gap: 10px;
    padding: 2px 0;
    border: 0;
    overflow-wrap: anywhere;
  }
  .table-wrap td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12.5px;
  }
  .table-wrap td[data-label=""] {
    grid-template-columns: minmax(0, 1fr);
  }
  .table-wrap td[data-label=""]::before {
    content: none;
  }
  td code {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}
.cell {
  min-width: 0;
}

/* The feature page (ISC-147): what is missing first, each criterion a card; then what is proven. */
.tally {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0 0 6px;
}
.tally-item {
  white-space: nowrap;
}
.gap-group h3 {
  margin: 18px 0 2px;
}
.approve-hint {
  margin: 6px 0 8px;
  padding: 8px 12px;
  border-left: 3px solid var(--warn);
  background: var(--warn-soft);
  border-radius: 0 4px 4px 0;
  overflow-wrap: anywhere;
}
.gaps {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.gap {
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  min-width: 0;
}
.gap:last-child {
  border-bottom: 0;
}
.gap-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
}
.isa-place {
  margin-left: auto;
  font-size: 12.5px;
  overflow-wrap: anywhere;
}
.gap .crit-text {
  margin: 4px 0 2px;
  max-width: 80ch;
}
.scenario-lists .label {
  margin: 8px 0 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.tests {
  list-style: none;
  padding: 0;
  margin: 0;
}
.test {
  padding: 2px 0;
  overflow-wrap: anywhere;
}
.test .test-name {
  color: var(--ink-2);
}
.red-green {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 18px;
  margin-top: 6px;
}
.gap .verbatim {
  margin: 6px 0 0;
}
.feature-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  font-size: 13px;
}
.feature-list li {
  white-space: nowrap;
}
.feature-list a {
  font-family: var(--mono);
  font-weight: 600;
}
@media (max-width: 760px) {
  .isa-place {
    margin-left: 0;
    flex-basis: 100%;
  }
}

/* Sign-in, sign-out and the approval page (ISC-151). */
.sign-in-button,
.sign-out,
.approve-button {
  font: 600 14px var(--sans);
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--surface);
  cursor: pointer;
}
.sign-out {
  font-size: 12px;
  padding: 3px 10px;
  background: transparent;
  color: var(--accent);
}
.approve-button:disabled,
.sign-in-button:disabled,
.sign-out:disabled {
  opacity: 0.55;
  cursor: default;
}
.notice {
  padding: 10px 14px;
  border-radius: 6px;
  border-left: 3px solid var(--muted);
  background: var(--plain-soft);
  overflow-wrap: anywhere;
}
.notice.pass {
  border-left-color: var(--pass);
  background: var(--pass-soft);
}
.notice.fail {
  border-left-color: var(--fail);
  background: var(--fail-soft);
}
.notice.warn {
  border-left-color: var(--warn);
  background: var(--warn-soft);
}
.approval-facts .fingerprint {
  overflow-wrap: anywhere;
  word-break: break-all;
}
.approval-items {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  gap: 12px;
}
.approval-item {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 12px 16px;
  min-width: 0;
}
.approval-item.flagged {
  border-color: var(--fail);
  box-shadow: inset 3px 0 0 var(--fail);
}
.approval-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
}
.approval-id {
  font: 600 14px var(--mono);
}
.approval-author {
  margin-left: auto;
}
.wording {
  margin-top: 10px;
}
.wording-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.wording-text {
  margin: 2px 0 0;
  max-width: 72ch;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.wording.context {
  border-top: 1px dashed var(--rule);
  padding-top: 8px;
}
.scenario-list {
  margin: 4px 0 0;
  padding-left: 18px;
  overflow-wrap: anywhere;
}
ins[data-diff="added"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  background: var(--pass-soft);
  color: var(--ink);
}
del[data-diff="removed"] {
  background: var(--fail-soft);
  color: var(--ink-2);
}
.hidden-char {
  font: 600 12px var(--mono);
  color: var(--fail);
  background: var(--fail-soft);
  border: 1px solid var(--fail);
  border-radius: 3px;
  padding: 0 2px;
  white-space: nowrap;
}
.hidden-warning,
.hidden-banner {
  margin: 8px 0 0;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--fail-soft);
  color: var(--ink);
  border-left: 3px solid var(--fail);
  overflow-wrap: anywhere;
}
.approve-box {
  margin: 24px 0 8px;
  padding: 14px 16px;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--surface);
  display: grid;
  gap: 10px;
  overflow-wrap: anywhere;
}
.approve-box p {
  margin: 0;
}
.confirm-label input {
  font: 14px var(--mono);
  width: 8em;
  padding: 5px 8px;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
}
@media (max-width: 760px) {
  .approval-author {
    margin-left: 0;
    flex-basis: 100%;
  }
  .approve-button {
    width: 100%;
  }
}

/* The feature review page (ISC-163): the approval page's cards and box, plus script hashes and a reason. */
.review-name {
  font: 600 14px var(--mono);
  overflow-wrap: anywhere;
}
.review-file,
.review-hash {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}
.script-hash {
  overflow-wrap: anywhere;
  word-break: break-all;
}
.reason-label {
  display: grid;
  gap: 4px;
}
.reason-label textarea {
  font: 14px var(--sans);
  width: 100%;
  max-width: 60ch;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
}
.reject-button {
  background: transparent;
  color: var(--fail);
  border-color: var(--fail);
}
