/* gocov design system — tokens + components. No build step; served embedded. */
:root {
  --bg: #f6f8fa; --surface: #ffffff; --surface2: #f6f8fa;
  --border: #d0d7de; --border-soft: #e6e9ed;
  --text: #1f2328; --text-2: #59636e; --text-3: #8b949e;
  --accent: #0e7a9e; --accent-strong: #0b6786; --accent-soft: #e3f2f8;
  --green: #1a7f37; --green-soft: #dafbe1;
  --yellow: #9a6700; --yellow-soft: #fff8c5;
  --red: #cf222e; --red-soft: #ffebe9;
  --nav: #1c2733; --nav-text: #cdd9e5;
  --radius: 8px; --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(31, 35, 40, .08);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117; --surface: #161b22; --surface2: #1c2128;
    --border: #30363d; --border-soft: #262c34;
    --text: #e6edf3; --text-2: #9198a1; --text-3: #6e7681;
    --accent: #58b7d6; --accent-strong: #7cc7e0; --accent-soft: #12303c;
    --green: #3fb950; --green-soft: #12271c;
    --yellow: #d29922; --yellow-soft: #2e2712;
    --red: #f85149; --red-soft: #331c1e;
    --nav: #010409; --nav-text: #9198a1;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* top navigation */
.nav { background: var(--nav); color: var(--nav-text); display: flex; align-items: center;
  gap: 20px; padding: 0 20px; height: 52px; }
.nav .logo { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 600; font-size: 15px; }
.nav .logo .mark { width: 22px; height: 22px; display: block; }
.nav a.item { color: var(--nav-text); font-size: 13.5px; padding: 4px 2px; }
.nav a.item.active { color: #fff; font-weight: 600; }
.nav .spacer { flex: 1; }
.nav .nav-user { color: var(--nav-text); font-size: 13px; }
.nav .nav-logout { margin: 0; }
.nav .nav-logout .btn { background: transparent; color: var(--nav-text); border-color: var(--nav-text);
  padding: 4px 10px; font-size: 12.5px; }
.crumbs { color: var(--text-2); font-size: 13px; margin: 18px 0 6px; }
.crumbs code { font-family: var(--mono); }

/* open-UI notice shown while sign-in is not configured */
.banner { display: flex; align-items: baseline; gap: 12px; padding: 9px 20px; font-size: 13px;
  background: var(--yellow-soft); color: var(--yellow); border-bottom: 1px solid var(--border); }
.banner code { font-family: var(--mono); font-size: 12px; }
.banner-close { margin-left: auto; background: none; border: none; color: inherit;
  font-size: 16px; line-height: 1; cursor: pointer; padding: 0 2px; }

/* login page */
.login { display: flex; justify-content: center; padding: 9vh 0 6vh; }
.login-card { max-width: 400px; width: 100%; padding: 30px 32px 26px; }
.login-mark { display: block; width: 32px; height: 32px; margin-bottom: 18px; }
.login-card h1 { margin: 0 0 6px; font-size: 20px; }
.login-card .sub { margin: 0 0 22px; font-size: 13.5px; }
.login-card .notice { margin: 0 0 18px; }
.providers { display: grid; gap: 8px; }
.btn.provider { width: 100%; justify-content: flex-start; gap: 10px; padding: 10px 13px; font-size: 14px; }
.btn.provider:hover { background: var(--surface2); border-color: var(--text-3); }
.btn.provider .pmark { flex: none; width: 20px; height: 20px; border-radius: 5px; display: grid;
  place-items: center; font-family: var(--mono); font-size: 9.5px; font-weight: 700; color: #fff; }
.btn.provider .pmark svg { width: 13px; height: 13px; display: block; fill: currentColor; }
.pmark { background: var(--text-3); }
.pmark-github { background: var(--nav); }
.pmark-bitbucket { background: var(--accent); }
.pmark-gitlab { background: var(--yellow); }
.login-foot { margin: 22px 0 0; padding-top: 16px; border-top: 1px solid var(--border-soft);
  color: var(--text-2); font-size: 12.5px; }
.login-workspaces { margin-top: 18px; }
.notice { border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; text-align: left; }
.notice.fail { background: var(--red-soft); color: var(--red); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 8px 20px 48px; }
h1 { font-size: 22px; margin: 14px 0 4px; }
h1 small { color: var(--text-2); font-weight: 400; font-size: 14px; }
h2 { font-size: 16px; margin: 26px 0 10px; }
.sub { color: var(--text-2); margin: 0 0 18px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow-x: auto; }
/* prose cards (workspace settings, onboarding): padded content, stacked
   with breathing room */
.card.pad { padding: 2px 20px 18px; margin-bottom: 16px; }
.card.pad h2:first-child { margin-top: 20px; }

/* stat summary row */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.stat .k { color: var(--text-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 22px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; font-weight: 400; color: var(--text-2); }
.stat .v.chips { font-size: 15px; padding-top: 6px; }

/* tables */
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th { text-align: left; color: var(--text-2); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--border); }
td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td code, .mono { font-family: var(--mono); font-size: 12.5px; }
/* Profile paths can be arbitrarily long with no natural break points
   (CI temp dirs, nuget caches); let them wrap anywhere so the table
   never forces the card wider than the page. The path column keeps a
   floor so narrow screens scroll the card instead of crushing the
   path into a one-character-per-line strip. The floor is scoped to
   path cells — other first columns (commit SHA, repo slug, workspace)
   are short and were being padded to 220px for no reason, pushing the
   table wider than the card and making it scroll sideways. */
td code, td .mono, td.mono { overflow-wrap: anywhere; }
td.path { min-width: 220px; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.empty { color: var(--text-2); padding: 28px; text-align: center; }

/* coverage bar */
.cov { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.cov .track { flex: 1; display: block; height: 8px; border-radius: 4px; background: var(--border-soft); overflow: hidden; }
.cov .fill { display: block; height: 100%; border-radius: 4px; }
.cov .pct { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; min-width: 48px; text-align: right; }
.fill.good { background: var(--green); } .fill.warn { background: var(--yellow); } .fill.bad { background: var(--red); }
.pct.good { color: var(--green); } .pct.warn { color: var(--yellow); } .pct.bad { color: var(--red); }

/* repo detail head: title + branch selector + settings, on one baseline */
.repohead { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 4px 0 18px; }
.repohead h1 { margin: 6px 0 2px; letter-spacing: -.01em; }
.repohead h1 .mono { font-family: var(--mono); }
.repohead .sub { margin: 0; font-size: 13px; }
.repohead .spacer { flex: 1; }

/* trend chart */
.trend-card { margin-bottom: 14px; padding: 8px 6px 2px; }
.trend { display: block; width: 100%; height: auto; }
.trend .line { fill: none; stroke: var(--accent); stroke-width: 2;
  stroke-linejoin: round; stroke-linecap: round; }
.trend .grid { stroke: var(--border-soft); stroke-dasharray: 3 4; }
.trend .thresh { stroke: var(--yellow); stroke-width: 1.5; stroke-dasharray: 6 4; opacity: .8; }
.trend .thresh-lbl { fill: var(--yellow); font-weight: 600; }
.trend .pt { fill: var(--accent); }
.trend .pt.fail { fill: var(--red); }
.trend a:hover .pt { stroke: var(--accent-strong); stroke-width: 3; }
.trend a:hover .pt.fail { stroke: var(--red); }
.trend .lbl { fill: var(--text-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.trend .cur { fill: var(--text); font-weight: 600; font-size: 12px; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px;
  font-size: 12px; font-weight: 600; padding: 2px 10px; line-height: 18px;
  white-space: nowrap; }
.chip.pass { background: var(--green-soft); color: var(--green); }
.chip.fail { background: var(--red-soft); color: var(--red); }
.chip.info { background: var(--accent-soft); color: var(--accent); }
.chip.plain { background: var(--surface2); color: var(--text-2); border: 1px solid var(--border-soft); }
.delta { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12.5px; }
.delta.up { color: var(--green); } .delta.down { color: var(--red); } .delta.flat { color: var(--text-3); }

/* controls */
.toolbar { display: flex; align-items: center; gap: 10px; margin: 16px 0; }
.toolbar .spacer { flex: 1; }
.input, select.input { background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 12px; font-size: 13.5px; min-width: 220px; }
select.input { min-width: 160px; }
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 14px; font-size: 13.5px;
  font-weight: 550; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination { display: flex; gap: 6px; justify-content: flex-end; margin-top: 14px; }
.pagination .btn { padding: 5px 11px; font-size: 12.5px; }
.pagination .btn[disabled] { opacity: .45; cursor: default; }

/* badge embed box */
.badgebox { display: flex; align-items: center; gap: 12px; background: var(--surface2);
  border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 10px 14px;
  font-family: var(--mono); font-size: 12px; }

/* uncovered ranges */
.uncov { font-family: var(--mono); font-size: 12px; color: var(--red); }

.htmx-request { opacity: .55; transition: opacity .15s; }

/* source view */
.filehead { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 8px 0 14px; }
.filehead h1 { font-size: 19px; margin: 0 0 3px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.filehead h1 .dir { color: var(--text-3); font-weight: 400; }
.filehead .sub { margin: 0; font-size: 13px; }
.filehead .spacer { flex: 1; }
.filehead .figure { text-align: right; }
.filehead .figure .k { color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.filehead .figure .v { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; letter-spacing: -.01em; }
.filehead .figure .v.good { color: var(--green); }
.filehead .figure .v.warn { color: var(--yellow); }
.filehead .figure .v.bad { color: var(--red); }
@media (max-width: 720px) { .filehead .figure { text-align: left; } }

.source-toolbar { flex-wrap: wrap; }
.source-toolbar .count { color: var(--text-2); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.source-toolbar .hint { color: var(--text-3); font-size: 12.5px; }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.seg button { background: none; border: none; border-left: 1px solid var(--border); padding: 5px 11px;
  font: inherit; font-size: 12.5px; font-weight: 550; color: var(--text-2); cursor: pointer; }
.seg button:first-child { border-left: none; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.seg button[disabled] { opacity: .45; cursor: default; }

.panel { display: grid; grid-template-columns: 26px minmax(0, 1fr); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.map { position: relative; background: var(--surface2); border-right: 1px solid var(--border-soft); }
.map .seg-miss { position: absolute; left: 7px; width: 12px; min-height: 3px; background: var(--red);
  border-radius: 2px; opacity: .85; border: none; padding: 0; cursor: pointer; }
.map .seg-miss:hover { opacity: 1; outline: 2px solid var(--red-soft); }

.code { font-family: var(--mono); font-size: 12.5px; line-height: 1.7; overflow: auto; max-height: 620px; padding: 8px 0; }
.codeline { display: grid; grid-template-columns: 56px 46px minmax(0, 1fr); scroll-margin-top: 60px; }
.codeline .ln { text-align: right; padding-right: 12px; color: var(--text-3); user-select: none; }
.codeline .hits { text-align: right; padding-right: 10px; font-size: 11px; color: var(--text-3); user-select: none; }
.codeline pre { margin: 0; padding: 0 14px 0 10px; white-space: pre; }
.codeline.hit { background: color-mix(in srgb, var(--green) 9%, transparent); box-shadow: inset 3px 0 var(--green); }
.codeline.hit .hits { color: var(--green); font-weight: 600; }
.codeline.miss { background: color-mix(in srgb, var(--red) 10%, transparent); box-shadow: inset 3px 0 var(--red); }
.codeline.miss .hits { color: var(--red); font-weight: 700; }
.codeline.focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.codeline[data-new] { box-shadow: inset 3px 0 var(--red), inset 0 -1px 0 color-mix(in srgb, var(--red) 25%, transparent); }
.codeline[data-new] .ln::before { content: "\25CF"; color: var(--red); font-size: 8px; vertical-align: middle; margin-right: 5px; }
.codeline[data-folded] { display: none; }
.newmiss { color: var(--red); font-weight: 600; }
.fold { display: grid; grid-template-columns: 56px minmax(0, 1fr); background: var(--surface2);
  border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft);
  color: var(--text-3); font-size: 12px; padding: 5px 0; user-select: none; }
.fold .l { text-align: right; padding-right: 12px; }
.fold .t { padding-left: 10px; }
body[data-only="miss"] .codeline:not(.miss) { display: none; }
body[data-only="miss"] .fold { display: none; }

.legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 10px; color: var(--text-3); font-size: 12.5px; }
.legend .s { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend .sw.hit { background: color-mix(in srgb, var(--green) 30%, transparent); box-shadow: inset 3px 0 var(--green); }
.legend .sw.miss { background: color-mix(in srgb, var(--red) 30%, transparent); box-shadow: inset 3px 0 var(--red); }
.legend .sw.none { background: var(--surface2); border: 1px solid var(--border-soft); }
.legend .sw.new { background: var(--red); opacity: .85; }

/* onboarding wizard — a fixed three-stage rail whose Workspace step is filled
   differently per forge (see templates/onboarding.html). Scoped under .wiz
   so the shared component classes (.card/.btn/.chip/.notice) are reused. */
.wiz { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 44px;
  align-items: start; padding-top: 8px; }
.wiz .head { grid-column: 1 / -1; margin-bottom: 2px; }
.wiz .head h1 { margin: 0 0 4px; }
.wiz .head .sub { margin: 0; }
.wiz #panels, .wiz .panel, .wiz .card { min-width: 0; }
/* The wizard step wrapper reuses the class name .panel, which the source view
   styles as a two-column grid card. Keep it a plain transparent block here so
   the inner .card.pad is the visible card (otherwise the content collapses into
   the grid's 26px first column). */
.wiz .panel { display: block; background: none; border: none; border-radius: 0;
  box-shadow: none; overflow: visible; }
/* Snippet blocks: a boxed code area (the source view keeps its own .codeline
   pre styling, so scope this to the wizard). */
.wiz code { font-family: var(--mono); font-size: 12.5px; }
.wiz pre { background: var(--surface2); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 10px; overflow-x: auto; }
.wiz pre code { font-size: 12.5px; line-height: 1.65; }

.rail { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 2px;
  border-left: 1px solid var(--border); }
.rail .step { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start;
  padding: 10px 12px 10px 14px; margin-left: -1px; border-left: 2px solid transparent;
  color: var(--text-2); text-align: left; text-decoration: none; }
.rail a.step:hover { text-decoration: none; background: var(--surface2); }
.rail .step .dot { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 11.5px; font-weight: 600;
  font-variant-numeric: tabular-nums; background: var(--surface); color: var(--text-3); }
.rail .step .t { font-size: 13.5px; line-height: 22px; }
.rail .step .st { display: block; font-size: 11.5px; line-height: 1.3; color: var(--text-3); }
.rail .step[data-state="active"] { border-left-color: var(--accent); color: var(--text); }
.rail .step[data-state="active"] .t { font-weight: 600; }
.rail .step[data-state="active"] .dot { border-color: var(--accent); background: var(--accent); color: #fff; }
.rail .step[data-state="done"] .dot { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.rail .step[data-state="done"] .t { color: var(--text-2); }

.wiz .foot { display: flex; align-items: center; gap: 10px; margin-top: 20px; }
.wiz .foot .spacer { flex: 1; }
.wiz .notice { display: flex; gap: 10px; align-items: center; }
.notice.wait { background: var(--yellow-soft); color: var(--yellow); }
.notice.ok { background: var(--green-soft); color: var(--green); }
.spin { width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: sp .7s linear infinite; flex: none; }
@keyframes sp { to { transform: rotate(360deg); } }

/* step 2 — workspace picker */
.optlist { display: flex; flex-direction: column; border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden; margin: 4px 0 12px; }
.opt { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 14px; border: none; border-bottom: 1px solid var(--border-soft);
  background: var(--surface); text-align: left; width: 100%; }
.opt:last-child { border-bottom: none; }
.opt .av { width: 26px; height: 26px; border-radius: 5px; background: var(--surface2);
  border: 1px solid var(--border-soft); display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: var(--text-2); }
.opt .n { font-weight: 600; font-size: 13.5px; }
.opt .m { color: var(--text-2); font-size: 12.5px; }
.opt form { margin: 0; }

/* step 3 — secret + identity */
.secret { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin: 4px 0 16px; }
.secret-hd { display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  background: var(--surface2); border-bottom: 1px solid var(--border-soft); }
.secret-hd .name { font-family: var(--mono); font-size: 12.5px; font-weight: 600; }
.secret-hd .spacer { flex: 1; }
.secret-bd { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.secret-bd .v { flex: 1; min-width: 0; font-family: var(--mono); font-size: 13px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.secret-bd .v[data-shown] { overflow-wrap: anywhere; white-space: normal; }
.hint { color: var(--text-3); font-size: 12.5px; }

/* reporting capability card (Workspace step) — connect-only, two states */
.cap { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin: 4px 0; }
.cap-hd { display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--surface2); border-bottom: 1px solid var(--border-soft); }
.cap-hd .t { font-weight: 600; font-size: 13.5px; }
.cap-hd .spacer { flex: 1; }
.cap-bd { padding: 14px; }
.cap-bd p { margin: 0 0 14px; }
.chip.warn { background: var(--yellow-soft); color: var(--yellow); }
.who { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 14px;
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--surface2); }
.who:last-child { margin-bottom: 0; }
.who .face { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff; background: #2f4353; text-transform: uppercase; }
.who .face.bot { border-radius: 6px; background: var(--accent); text-transform: none; }
.who .id { font-family: var(--mono); font-size: 12.5px; font-weight: 600; }
.who .m { color: var(--text-2); font-size: 12.5px; }
.who .spacer { flex: 1; }

/* first report — the onboarding success bar is always green; scope these to
   .mini so they don't override the threshold colors on other coverage bars */
.mini { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin: 4px 0 16px; }
.mini .hd { background: var(--surface2); padding: 8px 14px; font-size: 12px; font-weight: 600;
  color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border-soft); }
.mini table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.mini td { padding: 10px 14px; border-bottom: 1px solid var(--border-soft); }
.mini tr:last-child td { border-bottom: none; }
.mini td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--green); }
.mini .cov { display: inline-flex; align-items: center; gap: 10px; min-width: 180px; }
.mini .cov .track { flex: 1; display: block; height: 8px; border-radius: 4px; background: var(--border-soft); overflow: hidden; }
.mini .cov .fill { display: block; height: 100%; border-radius: 4px; background: var(--green); }
.mini .cov .pct { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; color: var(--green); }

/* narrow screens */
@media (max-width: 760px) {
  .wiz { grid-template-columns: 1fr; gap: 22px; }
  .rail { position: static; flex-direction: row; overflow-x: auto; border-left: none;
    border-bottom: 1px solid var(--border); }
  .rail .step { border-left: none; border-bottom: 2px solid transparent; margin: 0 0 -1px; white-space: nowrap; }
  .rail .step[data-state="active"] { border-left-color: transparent; border-bottom-color: var(--accent); }
  .rail .step .st { display: none; }
}
@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .cov { min-width: 120px; }
  .badgebox { flex-wrap: wrap; }
}

/* workspace settings (v2): sidebar rail + structured cards */
.ws { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 32px; align-items: start; }
.ws-head { grid-column: 1 / -1; }
.ws-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ws-main { min-width: 0; }
/* plain .card carries no bottom margin (only .card.pad did); the settings
   cards stack, so space them here — including the two wrapped in the
   gates/defaults <form>. */
.ws-main .card { margin-bottom: 16px; }
.ws-main form { margin: 0; }
.side { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 1px; }
.side a { display: block; padding: 7px 12px; border-radius: var(--radius-sm); color: var(--text-2); font-size: 13.5px; }
.side a:hover { background: var(--surface2); text-decoration: none; color: var(--text); }
.side a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding: 14px 12px 4px; }

.card-hd { display: flex; align-items: center; gap: 10px; padding: 14px 20px 0; flex-wrap: wrap; }
.card-hd h2 { font-size: 16px; margin: 0; letter-spacing: -.005em; }
.card-hd .spacer, .card-ft .spacer { flex: 1; }
.card-bd { padding: 6px 20px 18px; }
.card-bd p { color: var(--text-2); margin: 0 0 14px; max-width: 66ch; }
.card-bd p:last-child { margin-bottom: 0; }
.card-ft { display: flex; align-items: center; gap: 10px; padding: 12px 20px; background: var(--surface2);
  border-top: 1px solid var(--border-soft); flex-wrap: wrap; }
.card-ft form { margin: 0; }

.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
.btn.danger:hover { background: var(--red-soft); }
.danger-card { border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
.danger-card .card-ft { background: var(--red-soft); border-top-color: color-mix(in srgb, var(--red) 45%, var(--border)); }

.gate { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 14px;
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm); margin-bottom: 10px; }
.gate:last-of-type { margin-bottom: 0; }
.gate .n { font-weight: 600; font-size: 13.5px; }
.gate .m { color: var(--text-2); font-size: 12.5px; }
.gate .ctl { display: flex; align-items: center; gap: 8px; }
.gate .ctl .input { width: 82px; text-align: right; font-variant-numeric: tabular-nums; }
.gate[data-off] .ctl .input { opacity: .4; }
.gate[data-off] .n, .gate[data-off] .m { color: var(--text-3); }
.tg { position: relative; width: 36px; height: 20px; border-radius: 999px; background: var(--border);
  border: none; cursor: pointer; flex: none; transition: background .12s; }
.tg::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .12s; }
.tg[aria-pressed="true"] { background: var(--accent); }
.tg[aria-pressed="true"]::after { transform: translateX(16px); }

.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 18px; }
.fields .f label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; }
.fields .f .h { display: block; color: var(--text-3); font-size: 12px; font-weight: 400; margin-top: 4px; }
.fields .f .input { width: 100%; }

@media (max-width: 820px) {
  .ws { grid-template-columns: 1fr; gap: 16px; }
  .side { position: static; flex-direction: row; overflow-x: auto; gap: 4px; }
  .side .grp { display: none; }
}

/* upload detail (v2): verdict card, before -> after table, provenance */
.uphead { margin: 6px 0 4px; }
.uphead h1 { font-size: 20px; margin: 10px 0 3px; letter-spacing: -.01em; }
.uphead .sub { margin: 0; font-size: 13px; }

/* section header: heading with a right-aligned note or action */
.sec { display: flex; align-items: baseline; gap: 12px; margin: 28px 0 10px; flex-wrap: wrap; }
.sec h2 { margin: 0; }
.sec .spacer { flex: 1; }
.sec .note { color: var(--text-3); font-size: 12.5px; }

.stats.cols-3 { grid-template-columns: repeat(3, 1fr); }

/* verdict — the one reading this page is for */
.verdict { display: grid; grid-template-columns: minmax(0, 1fr) 220px; background: var(--surface);
  border: 1px solid var(--border); border-left: 3px solid var(--green); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin: 14px 0 4px; }
.verdict.fail { border-left-color: var(--red); }
.verdict.neutral { border-left-color: var(--text-3); }
.verdict .main { padding: 18px 22px; min-width: 0; }
.verdict .t { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px;
  letter-spacing: .02em; text-transform: uppercase; color: var(--green); }
.verdict.fail .t { color: var(--red); }
.verdict.neutral .t { color: var(--text-2); }
.verdict .big { display: flex; align-items: baseline; gap: 10px; font-size: 34px; font-weight: 600;
  font-variant-numeric: tabular-nums; line-height: 1.15; margin: 4px 0 6px; letter-spacing: -.02em; }
.verdict .big .pct { font-size: inherit; }
.verdict .big .d { font-size: 13px; font-weight: 600; }
.verdict .r { color: var(--text-2); font-size: 13.5px; max-width: 62ch; margin: 0; text-wrap: pretty; }
.verdict .meta { border-left: 1px solid var(--border-soft); padding: 16px 20px; display: flex;
  flex-direction: column; gap: 11px; }
.verdict .meta .k { color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.verdict .meta .v { font-size: 13px; font-variant-numeric: tabular-nums; }

/* files table: hide unchanged rows until "show all" */
table.files-collapsed tbody tr.xtra { display: none; }

/* before -> after cell */
td .path .dir, td a.path .dir { color: var(--text-3); }
.ba { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ba .from { color: var(--text-3); font-size: 12.5px; }
.ba .arw { color: var(--text-3); }
.ba .to { font-weight: 600; font-size: 13px; }
.ba .to.good { color: var(--green); } .ba .to.warn { color: var(--yellow); } .ba .to.bad { color: var(--red); }

/* provenance — what you check when a number looks wrong */
.prov { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.prov .row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; padding: 11px 18px;
  border-bottom: 1px solid var(--border-soft); font-size: 13px; align-items: baseline; }
.prov .row:nth-child(odd) { border-right: 1px solid var(--border-soft); }
.prov .k { color: var(--text-2); font-size: 12.5px; }
.prov .v { overflow-wrap: anywhere; }

@media (max-width: 820px) {
  .verdict { grid-template-columns: 1fr; }
  .verdict .meta { border-left: none; border-top: 1px solid var(--border-soft); }
  .prov { grid-template-columns: 1fr; }
  .prov .row:nth-child(odd) { border-right: none; }
}
@media (max-width: 720px) {
  .stats.cols-3 { grid-template-columns: repeat(2, 1fr); }
}

/* dashboard (v2): workspace-scoped head with a switcher, needs-attention,
   repo table with sparklines and instant filter/search/sort */
.head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 20px 0 16px; }
.head > div { min-width: 0; }
.head h1 { font-size: 22px; margin: 0 0 3px; letter-spacing: -.01em; display: flex; align-items: center;
  gap: 10px; flex-wrap: wrap; }
.head h1 .mono { font-family: var(--mono); font-size: 21px; }
.head .sub { color: var(--text-2); margin: 0; font-size: 13px; }
.head .spacer { flex: 1; }
.head h1 .car { color: var(--text-3); font-size: 11px; }

/* workspace switcher */
.wsw { position: relative; }
.wsw > .trg { display: inline-flex; align-items: center; gap: 8px; background: none;
  border: 1px solid transparent; border-radius: var(--radius-sm); margin: -4px -8px; padding: 4px 8px;
  font: inherit; color: inherit; cursor: pointer; }
.wsw > .trg:hover { background: var(--surface); border-color: var(--border); }
.wsw[data-open] > .trg { background: var(--surface); border-color: var(--border); }
.pop { display: none; position: absolute; z-index: 20; top: calc(100% + 6px); left: -8px; width: 340px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(31, 35, 40, .14); overflow: hidden; }
.wsw[data-open] .pop { display: block; }
.pop .srch { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); }
.pop .srch .input { width: 100%; min-width: 0; }
.pop .lst { max-height: 296px; overflow-y: auto; padding: 6px; }
.pop .gl { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-3); padding: 8px 10px 4px; }
.wsi { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  width: 100%; text-align: left; background: none; border: none; border-radius: var(--radius-sm);
  padding: 8px 10px; font: inherit; cursor: pointer; color: var(--text); }
.wsi:hover { background: var(--surface2); text-decoration: none; }
.wsi .av { width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center;
  font-size: 10px; font-weight: 700; color: #fff; background: var(--text-3); }
/* forge tint matches the login page's provider marks (.pmark-*) */
.wsi .av.gh { background: var(--nav); } .wsi .av.bb { background: var(--accent); } .wsi .av.gl { background: var(--yellow); }
.wsi .av svg { width: 12px; height: 12px; display: block; fill: currentColor; }
/* GitLab's mark is airier than the octocat/bucket — thin flames over a solid
   base — so at 12px only the base reads and it looks bottom-heavy. Size it up
   so the whole tanuki is legible and optically matches the denser marks. */
.wsi .av.gl svg { width: 18px; height: 18px; }
/* forge brand mark in the workspace title chip */
.chip.forge svg { width: 12px; height: 12px; display: block; fill: currentColor; }
.chip.forge.gl svg { width: 15px; height: 15px; }
.wsi > span:nth-child(2) { display: block; min-width: 0; }
.wsi .n { display: block; font-family: var(--mono); font-size: 13px; font-weight: 550; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.wsi .m { display: block; color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.wsi .r { display: flex; align-items: center; gap: 8px; }
.wsi .pct { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12.5px; }
.wsi[aria-current="true"] { background: var(--accent-soft); }
.wsi[aria-current="true"] .n { color: var(--accent); }
.wsi .tick { color: var(--accent); font-size: 12px; font-weight: 700; }
.pop .ft { border-top: 1px solid var(--border-soft); background: var(--surface2); padding: 8px 6px; }
.pop .ft .wsi .av { background: none; border: 1px dashed var(--border); color: var(--text-3); font-weight: 600; }

/* needs attention */
.attn { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--yellow);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.attn .row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 12px 18px; border-bottom: 1px solid var(--border-soft); }
.attn .row:last-child { border-bottom: none; }
.attn .ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #fff; background: var(--yellow); }
.attn .ic.bad { background: var(--red); }
.attn .ic.info { background: var(--text-3); }
.attn .t { font-size: 13.5px; }
.attn .t .mono { font-family: var(--mono); font-weight: 600; }
.attn .m { color: var(--text-2); font-size: 12.5px; text-wrap: pretty; }

/* repo table extras */
td .repo { font-family: var(--mono); font-size: 13px; font-weight: 550; overflow-wrap: anywhere; }
.seg .n, .seg button .n { font-variant-numeric: tabular-nums; opacity: .7; margin-left: 4px; }

/* coverage sparkline */
.spark { display: block; width: 76px; height: 22px; overflow: visible; }
.spark path { fill: none; stroke: var(--text-3); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark path.up { stroke: var(--green); } .spark path.down { stroke: var(--red); }

/* client-side filter tabs hide non-matching rows */
body[data-filter="failing"] #repo-table tr[data-state]:not([data-state~="failing"]) { display: none; }
body[data-filter="stale"] #repo-table tr[data-state]:not([data-state~="stale"]) { display: none; }
body[data-filter="nogate"] #repo-table tr[data-state]:not([data-state~="nogate"]) { display: none; }

@media (max-width: 820px) { .spark { display: none; } }

/* not-found (404) page — scoped so generic names never touch code/panel views */
.notfound { max-width: 600px; margin: 0 auto; padding: 48px 0 40px; }
.notfound .nf-code { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono);
  font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--text-3);
  text-transform: uppercase; margin-bottom: 16px; }
.notfound .nf-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--yellow); }
.notfound .nf-title { font-size: 27px; line-height: 1.25; margin: 0 0 10px; letter-spacing: -.015em; }
.notfound .nf-lede { color: var(--text-2); font-size: 15px; margin: 0 0 22px; text-wrap: pretty; max-width: 46ch; }
.notfound .nf-path { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 14px; display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.notfound .nf-k { color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.notfound .nf-path code { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; color: var(--text); }
.notfound .nf-h2 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-2); margin: 0 0 8px; }
.notfound .nf-causes { list-style: none; margin: 0 0 26px; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.notfound .nf-causes li { position: relative; padding-left: 18px; font-size: 13.5px; color: var(--text-2); text-wrap: pretty; }
.notfound .nf-causes li::before { content: ""; position: absolute; left: 4px; top: 8px; width: 5px; height: 5px;
  border-radius: 50%; background: var(--text-3); }
.notfound .nf-mono { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.notfound .nf-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

@media (max-width: 600px) {
  .notfound .nf-title { font-size: 23px; }
  .notfound .nf-path { flex-direction: column; align-items: flex-start; gap: 4px; }
}
