/* Theme: H2LooP Hertz (edge-platform/website). Light only, zinc neutrals, cyan accent. */
:root {
  color-scheme: light;
  --h-bg: #fafafa;
  --h-bg-2: #f4f4f5;
  --h-surface: #ffffff;
  --h-surface-2: #fafafa;
  --h-border: #e4e4e7;
  --h-border-2: #d4d4d8;
  --h-border-strong: #a1a1aa;
  --h-ink: #18181b;
  --h-ink-2: #27272a;
  --h-muted: #71717a;
  --h-muted-2: #a1a1aa;
  --h-accent: #00b4d8;
  --h-accent-2: #0099bb;
  --h-accent-soft: #e0f8fd;
  --h-success: #1f7a3d;
  --h-success-soft: #e6f5ec;
  --h-warning: #b25e09;
  --h-warning-soft: #fdf3e7;
  --h-danger: #b91c1c;
  --h-danger-soft: #fdecec;
  --h-purple: #7c3aed;
  --h-purple-soft: #f5f3ff;
  --h-radius: 10px;
  --h-shadow: 0 1px 2px rgba(28, 25, 23, 0.03);
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  /* chart series: Hertz's NPU/CPU hues lead; validated as a set on #ffffff
     (adjacent CVD ΔE ≥ 16.3, normal ≥ 19.6; yellow/pink < 3:1 → every bar is value-labelled + table view) */
  --s1: #7c3aed; --s2: #eb6834; --s3: #0891b2; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #2a78d6; --s8: #e34948;
  --grid: var(--h-border);
  --axis: var(--h-border-2);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; color: var(--h-ink);
  background:
    radial-gradient(1200px 400px at 20% -10%, rgba(0, 180, 216, 0.07), transparent 60%),
    radial-gradient(900px 320px at 90% 0%, rgba(0, 180, 216, 0.05), transparent 60%),
    var(--h-bg);
  min-height: 100vh;
}
a { color: var(--h-accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono, code { font-family: var(--mono); letter-spacing: -0.01em; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.25; letter-spacing: -0.02em; color: var(--h-ink); }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 .8em; }
.sub { color: var(--h-muted); }
.muted { color: var(--h-muted); }
.small { font-size: 12px; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 32px; border-bottom: 1px solid var(--h-border);
  background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--h-ink); text-decoration: none !important; }
.brand-logo { height: 40px; width: auto; display: block; }
.brand-sep { width: 1px; height: 16px; background: var(--h-border-2); }
.brand-sub-stack { display: flex; flex-direction: column; gap: 1px; }
.brand-sub { font-size: 14px; color: var(--h-muted); font-weight: 500; line-height: 1.3; }
.brand-version { font-family: var(--mono); font-size: 10px; color: var(--h-muted-2); line-height: 1.3; }
.session { font-size: 11px; color: var(--h-muted); }

/* ---------- layout + sidebar ---------- */
.layout { max-width: 1400px; margin: 0 auto; padding: 40px 32px 96px; display: flex; align-items: flex-start; gap: 32px; }
.sidebar { flex: 0 0 264px; width: 264px; min-width: 0; position: sticky; top: 88px; display: flex; flex-direction: column; gap: 4px; max-height: calc(100vh - 104px); }
.sidenav { display: flex; flex-direction: column; gap: 4px; }
.sidebar-link {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--h-border); background: var(--h-surface); color: var(--h-ink-2);
  font-size: 13px; font-weight: 600; box-shadow: var(--h-shadow); text-decoration: none !important;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.sidebar-link svg { flex: none; width: 16px; height: 16px; stroke: currentColor; }
.sidebar-link:hover { border-color: var(--h-border-strong); color: var(--h-ink); }
.sidebar-link.on { background: var(--h-accent-soft); border-color: var(--h-accent); color: var(--h-accent-2); }
.sidebar-link .count { margin-left: auto; font-family: var(--mono); font-size: 10.5px; background: var(--h-accent); color: #fff; border-radius: 100px; padding: 0 7px; line-height: 17px; }
#side-extra { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
#side-extra > .tree { flex: 0 1 auto; }
#side-extra:not(:empty)::before { content: ""; display: block; height: 1px; background: var(--h-border); margin: 10px 4px; flex: none; }
main { flex: 1 1 auto; min-width: 0; outline: none; }

/* ---------- common blocks ---------- */
.page-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.page-h h1 { margin: 0; }
.card { background: var(--h-surface); border: 1px solid var(--h-border); border-radius: var(--h-radius); padding: 24px; box-shadow: var(--h-shadow); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.section { margin-top: 32px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.board-h h3, .card > h3 { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--h-muted); margin: 0 0 12px; }
.board-h h3 { margin: 0; }

.stats { display: grid; gap: 10px; }
.stats6 { grid-template-columns: repeat(6, 1fr); }
.stats4 { grid-template-columns: repeat(4, 1fr); }
.stat { background: var(--h-surface); border: 1px solid var(--h-border); border-radius: var(--h-radius); padding: 14px 16px; box-shadow: var(--h-shadow); }
.stat .v { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.stat .l { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--h-muted); margin-top: 4px; }
.stats4 .stat .v { font-size: 19px; }
.stats4 .stat .l { text-transform: none; letter-spacing: 0; }

/* buttons (Hertz) */
.btn {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; border-radius: 8px;
  padding: 9px 18px; cursor: pointer; background: transparent; border: 1px solid var(--h-border-2); color: var(--h-ink-2);
  text-decoration: none !important; transition: transform .1s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--h-border-strong); }
.btn.primary {
  background: linear-gradient(135deg, var(--h-accent), var(--h-accent-2)); color: #fff; border-color: transparent;
  box-shadow: 0 1px 2px rgba(0, 180, 216, .25), 0 4px 12px rgba(0, 180, 216, .18);
}
.btn.primary:hover { transform: translateY(-1px); }
.btn.sm { padding: 6px 13px; font-size: 12px; }

/* status badges (Hertz .badge) */
.st {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 9px;
  border-radius: 100px; white-space: nowrap; font-family: var(--mono); letter-spacing: 0;
}
.st svg { flex: none; }
.st.ok, .st.exact, .st.pass { background: var(--h-success-soft); color: var(--h-success); }
.st.fail, .st.failed { background: var(--h-danger-soft); color: var(--h-danger); }
.st.check, .st.vendor_hidden { background: var(--h-warning-soft); color: var(--h-warning); }
.st.not_done, .st.not_attempted { background: var(--h-bg-2); color: var(--h-muted); }
.chips .st { margin: 1px 2px 1px 0; }

/* facts (Hertz .fact) */
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.meta span { font-family: var(--mono); font-size: 11px; padding: 3px 8px; border-radius: 6px; background: var(--h-surface); border: 1px solid var(--h-border-2); color: var(--h-ink-2); }
.meta i { font-style: normal; color: var(--h-muted); font-weight: 500; margin-right: 6px; }

/* tables (Hertz) */
.tbl-wrap { overflow-x: auto; background: var(--h-surface); border: 1px solid var(--h-border); border-radius: var(--h-radius); box-shadow: var(--h-shadow); }
.card .tbl-wrap { border: 0; box-shadow: none; border-radius: 0; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--h-muted); font-weight: 600;
  padding: 12px 12px 8px; border-bottom: 1px solid var(--h-border); white-space: nowrap; background: var(--h-surface);
}
.tbl tbody td { padding: 10px 12px; border-bottom: 1px solid var(--h-border); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--h-bg-2); }
.tbl th.n, .tbl td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl td.n { font-family: var(--mono); font-size: 12.5px; }
.tbl tr.grow td { background: var(--h-bg-2); font-size: 12px; padding: 8px 12px; }
.tbl .how { font-size: 11.5px; color: var(--h-muted); }
.tbl.flat td { padding: 8px 6px; }
.best { color: var(--h-success); font-weight: 700; }
.tbl.board td { border-bottom: 0; padding: 6px 4px; }
.barcell { width: 32%; }
.minibar { display: block; height: 8px; border-radius: 0 4px 4px 0; }
.board-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.board-h .mono { font-size: 10.5px; }

/* ---------- explore: tree in the sidebar ---------- */
.tree { min-width: 0; display: flex; flex-direction: column; min-height: 0; background: var(--h-surface); border: 1px solid var(--h-border); border-radius: var(--h-radius); box-shadow: var(--h-shadow); overflow: hidden; }
.pivot { display: flex; padding: 3px; margin: 8px; background: var(--h-bg-2); border-radius: 8px; gap: 2px; flex: none; }
.pivot button { flex: 1; border: 0; background: none; border-radius: 6px; padding: 6px 4px; font-size: 11.5px; font-weight: 600; color: var(--h-muted); cursor: pointer; white-space: nowrap; }
.pivot button.on { background: var(--h-surface); color: var(--h-ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.tnodes { display: flex; flex-direction: column; overflow-y: auto; padding: 0 6px 8px; }
.tn { display: flex; align-items: center; gap: 6px; padding: 5px 8px 5px calc(6px + var(--d) * 13px); border-radius: 6px; color: var(--h-ink-2); font-size: 13px; text-decoration: none !important; line-height: 1.25; }
.tn:hover { background: var(--h-bg-2); color: var(--h-ink); }
.tn .car { color: var(--h-muted-2); display: inline-flex; transition: transform .12s ease; flex: none; }
.tn.open .car { transform: rotate(90deg); color: var(--h-muted); }
.tn .tl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--h-muted-2); font-weight: 600; }
.tn .cnt { font-family: var(--mono); font-size: 10.5px; color: var(--h-muted); }
.tn.open > .tl { font-weight: 600; color: var(--h-ink); }
.tn.sel { background: var(--h-accent-soft); }
.tn.sel .tk, .tn.sel .cnt, .tn.sel .tl { color: var(--h-accent-2); }
.tn.leaf { font-size: 11.5px; font-family: var(--mono); letter-spacing: -0.01em; }
.tn .sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.vd { display: inline-flex; flex: none; }
.vd.exact, .vd.pass { color: var(--h-success); }
.vd.fail, .vd.failed { color: var(--h-danger); }
.vd.check { color: var(--h-warning); }

.crumbs { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-bottom: 14px; font-size: 14px; }
.crumbs a { color: var(--h-muted); }
.crumbs a:hover { color: var(--h-accent-2); text-decoration: none; }
.crumbs > :last-child { color: var(--h-ink); font-weight: 700; }
.crumbs .cs { color: var(--h-muted-2); }
.crumbs .tk { font-size: 9.5px; }

.ktabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.ktab {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--h-border-2); background: var(--h-surface-2); color: var(--h-ink-2); text-decoration: none !important; transition: all .15s ease;
}
.ktab:hover { border-color: var(--h-border-strong); }
.ktab.on { border-color: var(--h-accent); background: var(--h-accent-soft); color: var(--h-accent-2); }
.ktab .n { font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--h-muted); }
.ktab.on .n { color: var(--h-accent-2); }
.ktab.empty { opacity: .5; }

.chart-card { padding: 20px 22px 16px; }
.chart-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 12px; }
.chart-head h2 { margin: 0 0 3px; }
.spec { font-size: 11px; color: var(--h-muted); }
.spec .dot { margin: 0 7px; color: var(--h-muted-2); }
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.controls label { font-size: 12px; color: var(--h-muted); display: inline-flex; gap: 6px; align-items: center; cursor: pointer; font-weight: 500; }
.controls input[type="checkbox"] { accent-color: var(--h-accent); margin: 0; }
select, input[type="search"] {
  font-family: inherit; font-size: 13px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--h-border-2);
  background: var(--h-surface-2); color: var(--h-ink); outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.controls select { padding: 5px 8px; font-size: 12px; }
select:focus, input[type="search"]:focus { border-color: var(--h-accent); box-shadow: 0 0 0 3px rgba(0, 180, 216, .12); }
.seg { display: inline-flex; background: var(--h-bg-2); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 11px; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--h-muted); }
.seg button.on { background: var(--h-surface); color: var(--h-ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--h-muted); margin: 0 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.legend i.line { width: 14px; height: 2px; border-radius: 1px; }
.excl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--h-border); }
.excl > .mono { font-size: 11px; }
.empty-state { padding: 36px 10px; text-align: center; color: var(--h-muted); }

/* chart marks (Hertz plot rules: hairline solid grid, text in text tokens, 2px surface ring) */
svg.chart { display: block; width: 100%; max-width: 100%; height: auto; overflow: visible; font-family: var(--font); }
svg.chart text { fill: var(--h-muted); font-size: 11px; }
svg.chart .tick text { fill: var(--h-muted); font-size: 10px; font-family: var(--mono); }
svg.chart .grid line { stroke: var(--grid); stroke-width: 1; }
svg.chart .base { stroke: var(--axis); stroke-width: 1; }
svg.chart .ghead { fill: var(--h-ink); font-weight: 700; font-size: 12px; }
svg.chart .gsub { fill: var(--h-muted); font-size: 10.5px; }
svg.chart .rowlabel { fill: var(--h-ink-2); font-size: 12px; }
svg.chart .val { fill: var(--h-ink); font-size: 11px; font-family: var(--mono); font-weight: 600; }
svg.chart .val.dim { fill: var(--h-muted); font-weight: 400; }
svg.chart .hit { fill: transparent; cursor: pointer; }
svg.chart .row { outline: none; }
svg.chart .row:hover .hit, svg.chart .row:focus .hit { fill: var(--h-bg-2); }
svg.chart .row.pinned .rowlabel { font-weight: 700; fill: var(--h-ink); }
svg.chart .whisk { stroke: var(--h-ink-2); stroke-width: 1.5; }
svg.chart .ring { stroke: var(--h-surface); stroke-width: 2; }
svg.chart .connector { stroke: var(--h-border-strong); stroke-width: 2; stroke-linecap: round; }
svg.chart .bandline { stroke: var(--h-border); }
svg.chart .ghdr { cursor: pointer; outline: none; }
svg.chart .ghdr .hit { fill: transparent; }
svg.chart .ghdr:hover .ghead, svg.chart .ghdr:focus .ghead { fill: var(--h-accent-2); }
svg.chart .refmark { stroke: var(--h-ink); stroke-width: 2; }

#tip { position: fixed; z-index: 60; pointer-events: none; background: var(--h-surface); color: var(--h-ink); border: 1px solid var(--h-border); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.08); border-radius: 8px; padding: 9px 11px; font-size: 12px; min-width: 200px; max-width: 340px; }
#tip .r { display: flex; justify-content: space-between; gap: 16px; }
#tip .r span { font-family: var(--mono); font-size: 11px; color: var(--h-muted); }
#tip .r b { font-weight: 600; font-variant-numeric: tabular-nums; }
#tip .sep { border-top: 1px solid var(--h-border); margin: 5px 0; }

/* compare tray */
.cmp-tray { position: sticky; bottom: 12px; margin-top: 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--h-surface); border: 1px solid var(--h-border); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.08); border-radius: var(--h-radius); padding: 8px 12px; z-index: 5; }
.cmp-tray > b { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--h-muted); }
.cmp-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-family: var(--mono); background: var(--h-bg-2); border: 1px solid var(--h-border-2); border-radius: 100px; padding: 2px 4px 2px 9px; }
.cmp-chip button { border: 0; background: none; cursor: pointer; color: var(--h-muted); padding: 0 4px; font-size: 13px; }

/* leaf */
.leaf-h { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
.leaf-h h2 { margin: 0 0 2px; font-size: 19px; }
.kgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kgrid > div { background: var(--h-surface); border: 1px solid var(--h-border); border-radius: var(--h-radius); padding: 12px 14px; box-shadow: var(--h-shadow); }
.kgrid .v { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.kgrid .v small { font-size: 11px; color: var(--h-muted); font-weight: 500; margin-left: 3px; }
.kgrid .l { font-family: var(--mono); font-size: 10.5px; color: var(--h-muted); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13px; margin: 0; }
.kv dt { font-family: var(--mono); font-size: 11px; color: var(--h-muted); padding-top: 2px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* coverage */
.matrix { border-collapse: separate; border-spacing: 3px; font-size: 12px; width: 100%; }
.matrix th { font-weight: 600; color: var(--h-ink-2); text-align: left; padding: 4px 6px; white-space: nowrap; }
.matrix thead th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--h-muted); text-align: center; vertical-align: bottom; }
.matrix td { height: 38px; border-radius: 6px; text-align: center; min-width: 58px; font-family: var(--mono); font-size: 11px; }
.matrix td svg { vertical-align: -2px; }
.c-ok { background: var(--h-success-soft); color: var(--h-success); }
.c-part { background: var(--h-warning-soft); color: var(--h-warning); }
.c-hidden { background: color-mix(in srgb, var(--h-warning-soft) 60%, var(--h-warning) 12%); color: var(--h-warning); }
.c-failed { background: var(--h-danger-soft); color: var(--h-danger); }
.c-notdone { background: var(--h-bg-2); color: var(--h-muted); }
.c-none { background: transparent; border: 1px dashed var(--h-border-2); color: var(--h-muted-2); }
i.cov { display: inline-block; width: 22px; height: 14px; border-radius: 4px; }

/* records */
.searchbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.searchbar input { flex: 1; min-width: 220px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .stats6 { grid-template-columns: repeat(3, 1fr); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .layout { flex-direction: column; align-items: stretch; padding: 20px 16px 64px; gap: 16px; }
  main { width: 100%; }
  .sidebar { position: static; flex: none; width: 100%; max-height: none; }
  .sidenav { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .sidebar-link { width: auto; flex: none; padding: 8px 11px; }
  .tree { max-height: 340px; }
  .topbar { padding: 12px 16px; }
  .brand-logo { height: 30px; }
  .session { display: none; }
}
@media (max-width: 640px) {
  .g2, .g3 { grid-template-columns: 1fr; }
  .stats6, .stats4 { grid-template-columns: repeat(2, 1fr); }
  .kv { grid-template-columns: 110px 1fr; }
  .card { padding: 16px; }
  .chart-card { padding: 14px 12px 10px; }
  .ktabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 12px; padding: 0 16px; }
  .ktab { flex: none; }
  .cmp-tray { position: static; }
}
