:root {
  color-scheme: light;
  --background: #f6f8fa;
  --surface: #fff;
  --surface-muted: #f6f8fa;
  --border: #d0d7de;
  --border-soft: #eaeef2;
  --text: #1f2328;
  --muted: #656d76;
  --nav: #24292f;
  --link: #0969da;
  --pass: #1a7f37;
  --pass-bg: #dafbe1;
  --fail: #cf222e;
  --fail-bg: #ffebe9;
  --blocked: #8b1a22;
  --indeterminate: #9a6700;
  --indeterminate-bg: #fff8c5;
  --not-applicable: #afb8c1;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--text); font-size: 14px; line-height: 1.45; }
button, a { font: inherit; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { min-height: 56px; padding: 0 24px; display: flex; align-items: center; background: var(--nav); color: white; }
.brand { color: inherit; display: inline-flex; align-items: center; gap: 10px; font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; background: white; color: var(--nav); font-weight: 800; }
.page { width: min(1180px, 100%); margin: 0 auto; padding: 28px 24px 64px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.loading, .error { padding: 28px; }
.error h1 { margin: 4px 0 8px; font-size: 22px; }
.crumb { margin-bottom: 16px; color: var(--muted); font-size: 13px; }
.facility-head { display: flex; justify-content: space-between; gap: 20px; }
.facility-head h1 { margin: 0 0 8px; font-size: 28px; line-height: 1.2; }
.muted { color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-content: flex-start; }
.button { padding: 7px 11px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-muted); color: var(--text); cursor: pointer; font-weight: 600; }
.button:hover { background: #eef1f4; text-decoration: none; }
.summary-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; margin: 20px 0; }
.summary-card { padding: 16px; }
.eyebrow { margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.summary-date { margin-top: 4px; font-size: 18px; font-weight: 700; }
.status-chips { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.chip, .group-status, .legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin-top: 10px; }
.fact-label { color: var(--muted); font-size: 12px; }
.fact-value { font-weight: 600; overflow-wrap: anywhere; }
.section-title { margin: 24px 0 10px; font-size: 18px; }
.checks-head { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 16px; }
.selected-run { color: var(--muted); font-size: 13px; text-align: right; }
.group { border-top: 1px solid var(--border); }
.group:first-child { border-top: 0; }
.group.nested { margin-left: 30px; border-left: 2px solid #d8dee4; border-top-color: var(--border-soft); }
.group-toggle { width: 100%; padding: 13px 14px; border: 0; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; align-items: center; background: var(--surface); color: var(--text); cursor: pointer; text-align: left; }
.group.nested > .group-toggle { padding: 10px 14px 10px 16px; }
.group-toggle:hover, .rule:hover { background: var(--surface-muted); }
.chevron { color: var(--muted); transition: transform .12s; }
.group-toggle[aria-expanded="true"] .chevron { transform: rotate(90deg); }
.group-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.authority { color: #57606a; font: 600 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.group-name, .rule-name { font-weight: 650; }
.group-content[hidden], .rule-detail[hidden] { display: none; }
.rule { width: 100%; padding: 10px 14px 10px 46px; border: 0; border-top: 1px solid var(--border-soft); display: grid; grid-template-columns: 22px 190px minmax(0, 1fr) 120px; gap: 10px; align-items: center; background: var(--surface); color: var(--text); cursor: pointer; text-align: left; }
.rule-status { text-align: right; font-weight: 650; }
.rule-detail { grid-column: 2 / -1; margin: 2px 0 8px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-muted); cursor: text; }
.rule-detail p { margin: 0 0 6px; }
.rule-detail p:last-child { margin-bottom: 0; }
.dot, .icon, .swatch { flex: 0 0 auto; display: inline-grid; place-items: center; }
.dot { width: 11px; height: 11px; border-radius: 50%; }
.icon { width: 16px; height: 16px; border-radius: 50%; color: white; font-size: 10px; font-weight: 800; }
.swatch { width: 14px; height: 14px; border: 1px solid var(--border); border-radius: 3px; }
.dot.pass, .icon.pass { background: var(--pass); }
.dot.fail, .icon.fail { background: var(--fail); }
.dot.blocked, .icon.blocked { border: 1px solid #a21a24; background: repeating-linear-gradient(135deg, var(--fail) 0 3px, var(--fail-bg) 3px 6px); }
.dot.not-applicable, .icon.not-applicable { background: var(--not-applicable); }
.dot.indeterminate, .icon.indeterminate { background: var(--indeterminate); }
.rule-status.pass { color: var(--pass); }
.rule-status.fail { color: var(--fail); }
.rule-status.blocked { color: var(--blocked); }
.rule-status.not-applicable { color: #57606a; }
.rule-status.indeterminate { color: var(--indeterminate); }
.history { padding: 14px; }
.history-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 12px; }
.history-scroller { overflow-x: auto; }
.heatmap { display: grid; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; min-width: 780px; }
.heat-label, .heat-date, .heat-cell { min-height: 36px; border-right: 1px solid #eef1f4; border-bottom: 1px solid #eef1f4; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.heat-date { background: var(--surface-muted); color: var(--muted); font-weight: 600; }
.heat-label { position: sticky; left: 0; z-index: 1; justify-content: flex-start; gap: 6px; padding: 0 10px; background: var(--surface); font-weight: 600; }
.heat-cell { border-top: 0; border-left: 0; background: var(--surface); cursor: pointer; }
.heat-cell.pass, .swatch.pass { background: var(--pass-bg); }
.heat-cell.fail, .swatch.fail { background: var(--fail-bg); }
.heat-cell.blocked, .swatch.blocked { background: repeating-linear-gradient(135deg, var(--fail-bg) 0 6px, var(--fail) 6px 8px, var(--fail-bg) 8px 14px); }
.heat-cell.not-applicable, .swatch.not-applicable { background: #f0f2f4; }
.heat-cell.indeterminate, .swatch.indeterminate { border-color: #d4a72c; background: var(--indeterminate-bg); }
.heat-cell.selected { outline: 2px solid var(--link); outline-offset: -3px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; }
.small-card { margin-top: 18px; padding: 13px 15px; }
.small-card h3 { margin: 0 0 4px; font-size: 14px; }
.footer { margin-top: 28px; color: var(--muted); font-size: 12px; }

@media (max-width: 850px) {
  .facility-head { flex-direction: column; }
  .summary-grid { grid-template-columns: 1fr; }
  .rule { grid-template-columns: 22px minmax(0, 1fr) 105px; padding-left: 30px; }
  .rule .authority, .rule-name { grid-column: 2; }
  .rule-status { grid-column: 3; grid-row: 1 / 3; }
  .rule-detail { grid-column: 2 / -1; }
  .group.nested { margin-left: 16px; }
}

@media (max-width: 560px) {
  .page { padding: 20px 14px 48px; }
  .topbar { padding: 0 14px; }
  .facility-head h1 { font-size: 24px; }
  .facts { grid-template-columns: 1fr; }
  .checks-head { flex-direction: column; }
  .selected-run { text-align: left; }
  .group-status { font-size: 12px; }
}
