:root {
  --bg: #fbfbfc; --surface: #ffffff; --fg: #1c1f23; --muted: #6a737d; --line: #e3e6ea;
  --accent: #2f5fb3; --neutral: #f0f2f4; --target: #e8effb;
  --hit: #2e8540; --partial: #b7791f; --miss: #c2362f;
  --miss-soft: #fdecea; --unrun-soft: #f7d4d0;
  --sans: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a; --surface: #1b1e22; --fg: #e4e7eb; --muted: #8f98a3; --line: #2a2f35;
    --accent: #7aa2ec; --neutral: #24282d; --target: #1f2a3d;
    --hit: #5cbf72; --partial: #e0a84a; --miss: #ef6b63;
    --miss-soft: #3a1f1e; --unrun-soft: #5c2623;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
/* Rows set their own display, which would otherwise win over the attribute. */
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--sans); }
a { color: var(--accent); }

.page-header {
  position: sticky; top: 0; z-index: 2;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 16px; padding: 16px 24px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.site-heading { min-width: 0; overflow-wrap: anywhere; }
.site-title { display: inline; margin: 0; font-size: 18px; font-weight: 600; }
.run { margin-left: 12px; color: var(--muted); font: 12px var(--mono); }
.tabs { display: flex; flex-wrap: nowrap; gap: 4px; }
.tabs a {
  padding: 6px 12px; border-radius: 8px;
  color: var(--muted); text-decoration: none; white-space: nowrap;
}
.tabs a[aria-current="page"] { color: var(--fg); background: var(--neutral); font-weight: 600; }
.page-header > .totals, .page-header > .path { flex-basis: 100%; }
.page-header .path { margin: 0; padding: 6px 0; font: 13px var(--mono); overflow-wrap: anywhere; }
.page-header .totals { padding: 6px 0; }
.totals { margin: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.percent { font-weight: 600; }
.percent.high { color: var(--hit); }
.percent.medium { color: var(--partial); }
.percent.low { color: var(--miss); }

/* Wide lines scroll inside main, never the page; the right padding keeps code
   clear of the minimap. */
.source-page main { overflow-x: auto; padding-right: 12px; }
.source { border-collapse: collapse; font: 12.5px/1.6 var(--mono); min-width: 100%; }
.source td { padding: 0; vertical-align: top; }
.source td.number, .source td.count {
  width: 1%; text-align: right; white-space: nowrap; user-select: none;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.source td.number { padding-left: 16px; padding-right: 10px; }
.source td.number a { color: inherit; text-decoration: none; }
.source td.count { padding-right: 8px; border-right: 3px solid transparent; }
.source td.code { padding-left: 12px; white-space: pre; }
/* --header-height is set by the page script; the header wraps on narrow screens. */
.source tr { scroll-margin-top: calc(var(--header-height, 3rem) + 24px); }
.source tr.covered td.count { border-right-color: var(--hit); }
.source tr.partly td.count { border-right-color: var(--partial); }
.source tr.missed td.count { border-right-color: var(--miss); }
.source tr.missed td.code { background: var(--miss-soft); }
.source tr:target td { background: var(--target); }
.unrun {
  background: var(--unrun-soft);
  text-decoration: underline wavy var(--miss) 1px; text-underline-offset: 3px;
}

/* Above the sticky header, so every mark stays reachable. */
.minimap {
  position: fixed; top: 0; bottom: 0; right: 0; z-index: 3; width: 10px;
  background: var(--surface); border-left: 1px solid var(--line);
}
.minimap .mark { position: absolute; left: 1px; right: 1px; min-height: 3px; }
.minimap .mark.missed { background: var(--miss); }
.minimap .mark.partly { background: var(--partial); }

.index-page main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }
.coverage-trend { display: block; width: 100%; max-width: 40rem; }
.card .coverage-trend { width: 7.5rem; margin-top: .5rem; }
.coverage-trend polyline { fill: none; stroke-width: 2; }
.trend-lines { stroke: var(--hit); fill: var(--hit); }
.trend-branches { stroke: var(--partial); fill: var(--partial); }
.trend-conditions { stroke: var(--fg); fill: var(--fg); }
.trend-unavailable { fill: var(--miss); }
.cards { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.cards.secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.card h2 { margin: 0 0 8px; font-size: 12px; color: var(--muted); font-weight: 500; }
.card .value { margin: 0; font: 600 28px/1.2 var(--mono); }
.card .detail { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.legend, .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.legend { margin: 0; padding: 0 16px 10px; color: var(--muted); font-size: 13px; }
.legend .key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: -8px; }
.key.high, .fill.high { background: var(--hit); }
.key.medium, .fill.medium { background: var(--partial); }
.key.low, .fill.low { background: var(--miss); }
.toolbar { padding: 0 16px 12px; }
#filter {
  width: min(320px, 100%); padding: 6px 10px; font: inherit;
  color: var(--fg); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px;
}
#filter:focus-visible, .columns button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

/* One grid for the header, module and file rows, so their columns line up. */
.row {
  display: grid; align-items: center; gap: 12px;
  grid-template-columns:
    minmax(0, 1fr) 100px 64px 64px var(--change-column,)
    var(--branches-column,) var(--conditions-column,);
  padding: 6px 16px; font-variant-numeric: tabular-nums;
}
.row > :not(.name):not(.bar) { text-align: right; }
.row .name { overflow-wrap: anywhere; }
.columns { border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.columns button {
  padding: 0; font: inherit; color: inherit; background: none; border: 0; cursor: pointer;
}
/* Buttons keep their own width in a grid cell, so they are placed, not aligned. */
.columns button { justify-self: end; }
.columns button[data-sort="name"] { justify-self: start; }
.columns button[data-direction="ascending"]::after { content: " ↑"; }
.columns button[data-direction="descending"]::after { content: " ↓"; }
.module { border-bottom: 1px solid var(--line); }
.module > summary { cursor: pointer; list-style: none; font-weight: 600; }
.module > summary::-webkit-details-marker, .suite > summary::-webkit-details-marker {
  display: none;
}
.module > summary .name::before, .suite > summary::before {
  content: "▸"; display: inline-block; width: 1em; color: var(--muted);
  transition: transform 0.15s;
}
.module[open] > summary .name::before, .suite[open] > summary::before {
  transform: rotate(90deg);
}
.row.file { color: var(--fg); text-decoration: none; font-size: 13px; }
.row.file .name { padding-left: 1em; font-family: var(--mono); font-size: 12.5px; }
.module > summary:hover, .row.file:hover { background: var(--target); }
.bar { height: 6px; border-radius: 3px; overflow: hidden; background: var(--line); }
.columns .bar { background: none; }
.fill { display: block; height: 100%; }
@media (prefers-reduced-motion: reduce) { .module > summary .name::before, .suite > summary::before { transition: none; } }
.history-page main, .unavailable-page main { max-width: 1100px; margin: 0 auto; padding: 12px 16px 48px; }
.history { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.history th { padding: 4px 12px 6px 0; text-align: left; color: var(--muted); font: 12px var(--sans); }
.history td { padding: 6px 12px 6px 0; border-top: 1px solid var(--line); vertical-align: top; }
.history .unavailable, .unavailable-page .reason { color: var(--muted); }
.unavailable-page .notice { margin: 0 0 4px; font-weight: 600; }
.unavailable-page .reason { margin: 0; overflow-wrap: anywhere; }
.history .commit { font-family: var(--mono); }
.history .date { white-space: nowrap; color: var(--muted); }
.history .subject { overflow-wrap: anywhere; }
.history .lines, .history .branches, .history .conditions { white-space: nowrap; }
.history .unavailable { white-space: normal; }
.history-chart { margin-bottom: 24px; }
.history-chart .coverage-trend { width: 100%; height: auto; }
.trend-legend { color: var(--muted); font-size: 12px; }
.tests-page main { max-width: 1100px; margin: 0 auto; padding: 24px; }
.failures h2 { margin: 0 0 8px; font-size: 15px; color: var(--miss); }
.failure { margin-bottom: 12px; padding: 8px 12px; border-left: 3px solid var(--miss);
  background: var(--miss-soft); }
.failure h3 { margin: 0; font: 600 13px var(--mono); overflow-wrap: anywhere; }
.failure p { margin: 4px 0 0; }
.failure pre { margin: 6px 0 0; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; }
.suite { border-bottom: 1px solid var(--line); }
.suite > summary {
  padding: 6px 0; cursor: pointer; list-style: none; font-family: var(--mono);
}
.suite .count, .suite .time, .suite .reason { color: var(--muted); }
.suite ul { margin: 0 0 8px; padding-left: 1.5em; font: 12.5px/1.6 var(--mono); }
.suite li { overflow-wrap: anywhere; }
.suite li.failed { color: var(--miss); }
.suite li.skipped { color: var(--muted); }
/* Optional columns are tracks only on the pages that have them; an unset one
   is an empty fallback, so it adds no track and no gap. */
.has-baseline { --change-column: 56px; }
.has-branches { --branches-column: 112px; }
.has-conditions { --conditions-column: 112px; }
/* The change since the baseline: the sign carries the meaning, colour only echoes it. */
.change.up { color: var(--hit); }
.change.down { color: var(--miss); }
.change.flat, .change.new { color: var(--muted); }
/* Phones retain file names, line coverage and the optional change. */
@media (max-width: 560px) {
  .page-header { padding: 12px 16px; }
  .tabs a { padding: 6px 8px; }
  .tests-page main { padding: 16px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card { padding: 14px; }
  .card .value { font-size: 24px; }
  .row { grid-template-columns: minmax(0, 1fr) 64px; gap: 8px; padding: 8px; }
  .has-baseline .row { grid-template-columns: minmax(0, 1fr) 64px 48px; }
  .row .bar, .row .missed, .columns [data-sort="missed"], .row .branches, .row .conditions { display: none; }
  .history .date, .history .branches, .history .conditions { display: none; }
}