/* ──────────────────────────────────────────────────────────────────────
   fhir262 matrix UI — refined.
   HS Design System tokens. Inter (400/500/600) + JetBrains Mono.
   Premium dashboard feel: subtle depth, tight type hierarchy,
   restrained color (warm HS red as accent, blue for links/actions).
   ──────────────────────────────────────────────────────────────────── */

:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* — surface — */
  --bg:            rgb(249,249,250);   /* page bg — subtle off-white */
  --bg-elev:       rgb(255,255,255);   /* cards */
  --bg-sunk:       rgb(243,244,246);   /* recessed header strips */
  --bg-alt:        rgb(250,250,250);   /* inputs */
  --bg-hover:      rgb(245,245,246);

  /* — text — */
  --fg:            rgb(29,35,49);      /* primary */
  --fg-soft:       rgb(46,52,56);
  --fg-muted:      rgb(113,118,132);   /* secondary */
  --fg-dim:        rgb(152,161,174);   /* muted */

  /* — borders — */
  --border:        rgb(235,236,238);
  --border-strong: rgb(204,206,211);

  /* — brand — */
  --accent:        rgb(234,74,53);     /* HS warm red */
  --accent-deep:   rgb(215,39,15);
  --accent-bg:     rgb(254,247,246);   /* selected wash */
  --accent-bg-2:   rgb(254,249,249);

  /* — action — */
  --action:        rgb(30,113,217);    /* primary blue */

  /* — status — */
  --c-pass:        rgb(106,163,0);
  --c-pass-bg:     rgb(244,249,233);
  --c-pass-soft:   rgb(184,213,118);

  --c-fail:        rgb(215,39,15);
  --c-fail-bg:     rgb(254,249,249);
  --c-fail-soft:   rgb(234,74,53);

  --c-skip:        rgb(152,161,174);
  --c-skip-bg:     rgb(245,245,246);
  --c-skip-soft:   rgb(204,206,211);

  /* — geometry — */
  --row-h:        46px;
  --col-w:        128px;
  --row-name-w:   368px;

  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;

  /* — shadows: feather-light layered tone — */
  --ring:        inset 0 0 0 1px var(--border);
  --ring-strong: inset 0 0 0 1px var(--border-strong);
  --shadow-xs:   0 1px 2px rgba(15, 17, 22, 0.04);
  --shadow-sm:   0 1px 2px rgba(15, 17, 22, 0.05), 0 1px 1px rgba(15, 17, 22, 0.03);
  --shadow-md:   0 4px 12px rgba(15, 17, 22, 0.05), 0 1px 2px rgba(15, 17, 22, 0.04);
  --shadow-lg:   0 12px 40px rgba(15, 17, 22, 0.06), 0 2px 8px rgba(15, 17, 22, 0.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss03";
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
a { color: inherit; text-decoration: none; }
button { font: inherit; border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0; }

.app {
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
}

/* ─── Header ──────────────────────────────────────────────────────────── */
.hdr {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 40px;
  padding: 22px 32px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  color: var(--accent);
  display: inline-flex;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  background: var(--accent-bg);
  border-radius: 8px;
}
.brand-text { display: flex; flex-direction: column; gap: 4px; }
.brand-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--fg);
}
.brand-sub {
  font-size: 10px;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-weight: 500;
}

.hdr-meta { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.meta-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px;
  white-space: nowrap;
}
.meta-row .meta-k { color: var(--fg-dim); }
.meta-row .meta-v { color: var(--fg-soft); font-weight: 500; }
.meta-row-btn {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  padding: 5px 10px 5px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  font: inherit;
  color: inherit;
}
.meta-row-btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.meta-row-btn:hover .meta-k { color: var(--fg); }
.meta-row-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.meta-row-chev {
  color: var(--fg-soft);
  margin-left: 4px;
  transition: color 0.1s, transform 0.15s;
}
.meta-row-btn:hover .meta-row-chev { color: var(--fg); }
.meta-row-btn-open .meta-row-chev { transform: rotate(180deg); color: var(--fg); }
.meta-row-btn-open { background: var(--bg-hover); border-color: var(--border-strong); }

/* ─── Run history popover ─────────────────────────────────────────────── */
.popover-scrim {
  position: fixed; inset: 0;
  z-index: 90;
  background: transparent;
}
.run-pop {
  position: fixed;
  z-index: 100;
  width: 560px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 120px);
  background: var(--bg-elev);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: pop-in 0.14s ease-out;
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.run-pop-head {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
}
.run-pop-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.run-pop-sub {
  font-size: 11.5px;
  color: var(--fg-dim);
  margin-top: 3px;
}
.run-pop-list {
  overflow-y: auto;
  flex: 1;
  padding: 4px 0;
}

.run-row {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 18px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.run-row:last-child { border-bottom: 0; }
.run-row:hover { background: var(--bg-hover); }
.run-row-current {
  background: var(--accent-bg);
}
.run-row-current:hover { background: var(--accent-bg); }

.run-row-l { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.run-row-top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  min-width: 0;
}
.run-when {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
}
.run-current-tag {
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent);
  color: rgb(249,249,249);
  white-space: nowrap;
}
.run-branch {
  font-size: 10.5px;
  color: var(--fg-muted);
  padding: 1px 6px;
  background: var(--bg-sunk);
  border-radius: 4px;
  border: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.run-msg {
  font-size: 12.5px;
  color: var(--fg-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-row-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px;
  color: var(--fg-dim);
  margin-top: 3px;
}
.run-commit {
  color: var(--action);
  transition: color 0.12s;
}
.run-commit:hover { text-decoration: underline; }
.run-meta-dot { width: 2px; height: 2px; background: var(--fg-dim); border-radius: 50%; opacity: 0.6; }

.run-row-r {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}
.run-impls {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.run-impl-chip {
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-sunk);
  color: var(--fg-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.run-bar {
  display: flex; height: 3px; border-radius: 99px; overflow: hidden;
  background: var(--bg-sunk);
}
.run-counts {
  display: flex; align-items: center; gap: 10px;
  font-size: 10.5px;
  justify-content: flex-end;
}
.run-cnt-pass { color: var(--c-pass); }
.run-cnt-fail { color: var(--c-fail); }
.run-cnt-skip { color: var(--fg-dim); }
.meta-dot { width: 2px; height: 2px; background: var(--fg-dim); border-radius: 50%; opacity: 0.6; }
.meta-v.link { cursor: pointer; transition: color 0.12s; }
.meta-v.link:hover { color: var(--action); }

.hdr-repo {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border-strong);
  padding: 7px 12px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-soft);
  background: var(--bg-elev);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.12s, color 0.12s;
}
.hdr-repo:hover { border-color: var(--fg-muted); color: var(--fg); }

/* ─── Impl summary strip ──────────────────────────────────────────────── */
.impl-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  padding: 20px 32px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.impl-card {
  position: relative;
  background: var(--bg-elev);
  border-radius: var(--r-md);
  box-shadow: var(--ring), var(--shadow-xs);
  padding: 16px 18px 14px;
  display: flex; flex-direction: column; gap: 12px;
  text-align: left;
  transition: box-shadow 0.16s, transform 0.16s;
  cursor: pointer;
}
.impl-card:hover { box-shadow: var(--ring-strong), var(--shadow-sm); }
.impl-card-hidden {
  background: var(--bg-sunk);
  box-shadow: var(--ring);
}
.impl-card-hidden .impl-card-name,
.impl-card-hidden .impl-card-pct-num,
.impl-card-hidden .impl-card-ver,
.impl-card-hidden .impl-counts { opacity: 0.5; }
.impl-card-hidden .impl-bar { opacity: 0.4; }

.impl-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.impl-card-id { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.impl-card-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--fg);
  line-height: 1.2;
}
.impl-card-ver {
  font-size: 11px;
  color: var(--fg-dim);
  font-weight: 400;
}
.impl-card-pct { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.impl-card-pct-num {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum", "cv11";
}
.impl-card-pct-num .pct-sign {
  font-size: 14px;
  color: var(--fg-dim);
  margin-left: 2px;
  font-weight: 500;
}
.impl-card-pct-lbl {
  font-size: 10px;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

.impl-bar {
  display: flex;
  height: 4px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--bg-sunk);
}
.bar-seg { display: block; height: 100%; }
.bar-pass { background: var(--c-pass); }
.bar-fail { background: var(--c-fail); }
.bar-skip { background: var(--c-skip-soft); }

.impl-counts {
  display: flex; align-items: center; gap: 14px;
  font-size: 11.5px; color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}
.cnt { display: inline-flex; align-items: center; gap: 6px; }
.cnt-time { margin-left: auto; color: var(--fg-dim); font-size: 11px; }
.cnt-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.cnt-pass .cnt-dot, .cnt-dot-pass { background: var(--c-pass); }
.cnt-fail .cnt-dot, .cnt-dot-fail { background: var(--c-fail); }
.cnt-skip .cnt-dot, .cnt-dot-skip { background: var(--c-skip-soft); }

.impl-card-eye {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  color: var(--fg-dim);
  opacity: 0;
  transition: opacity 0.12s;
  pointer-events: none;
}
.impl-card:hover .impl-card-eye { opacity: 1; }
.impl-card-hidden .impl-card-eye { opacity: 1; color: var(--fg-muted); }
.impl-card-hidden .impl-card-pct,
.impl-card-hidden:not(:hover) .impl-card-eye { /* keep eye visible */ }
/* When hidden, push eye out of the way of % */
.impl-card-hidden .impl-card-eye {
  top: 14px; right: 18px;
  background: var(--bg-elev);
  border-radius: 50%;
  width: 20px; height: 20px;
  box-shadow: var(--ring);
}

/* ─── Page layout ─────────────────────────────────────────────────────── */
.page {
  display: grid;
  grid-template-columns: 268px 1fr;
  min-height: calc(100vh - 220px);
}

/* ─── Sidebar ─────────────────────────────────────────────────────────── */
.side {
  border-right: 1px solid var(--border);
  background: var(--bg-elev);
  display: flex; flex-direction: column;
}
.side-head {
  padding: 22px 22px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-weight: 500;
  color: var(--fg-dim);
}
.side-list {
  display: flex; flex-direction: column;
  padding: 0 12px;
  gap: 2px;
  flex: 1;
}
.side-item {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  display: flex; flex-direction: column; gap: 7px;
  transition: background 0.1s;
  position: relative;
}
.side-item:hover { background: var(--bg-hover); }
.side-item-sel { background: var(--accent-bg); }
.side-item-sel:hover { background: var(--accent-bg); }
.side-item-sel::before {
  content: "";
  position: absolute;
  left: 0; top: 10px; bottom: 10px;
  width: 2px;
  background: var(--accent);
  border-radius: 2px;
  transform: translateX(-12px);
}
.side-item-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.side-item-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg-muted);
}
.side-item-sel .side-item-name { color: var(--fg); font-weight: 600; }
.side-item-pct {
  font-size: 11px;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}
.side-item-meta {
  font-size: 10.5px;
  color: var(--fg-dim);
  letter-spacing: 0.01em;
}
.side-fail-tag { color: var(--c-fail); font-weight: 500; }
.side-skip-tag { color: var(--fg-dim); }
.side-bar {
  display: flex; height: 2px; border-radius: 99px; overflow: hidden;
  background: var(--bg-sunk);
}

.side-foot {
  border-top: 1px solid var(--border);
  padding: 14px 22px;
  margin-top: auto;
}
.legend {
  display: flex; gap: 16px;
  font-size: 10.5px; color: var(--fg-dim);
  text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 500;
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ─── Main ────────────────────────────────────────────────────────────── */
.main { padding: 24px 32px 80px; min-width: 0; }

/* ─── Toolbar ─────────────────────────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.search {
  position: relative;
  display: flex; align-items: center; gap: 9px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 0 12px;
  height: 36px;
  width: 320px;
  color: var(--fg-muted);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.search:focus-within {
  border-color: var(--action);
  box-shadow: 0 0 0 3px rgba(30,113,217,0.15);
}
.search input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: none;
  font: inherit; font-size: 13.5px;
  color: var(--fg);
}
.search input::placeholder { color: var(--fg-dim); }
.search-clear {
  color: var(--fg-muted);
  font-size: 18px; line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}
.search-clear:hover { background: var(--bg-hover); color: var(--fg); }

.filters { display: flex; gap: 8px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
  background: var(--bg-elev);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.chip:hover { color: var(--fg); border-color: var(--fg-muted); }
.chip-on {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent-deep);
  box-shadow: none;
}
.chip-on:hover { background: var(--accent-bg-2); color: var(--accent-deep); border-color: var(--accent); }
.chip-ghost {
  background: var(--bg-alt);
  color: var(--fg-muted);
  border-style: dashed;
}
.chip-ghost:hover { color: var(--action); border-color: var(--action); }

.chip-dot { width: 6px; height: 6px; border-radius: 50%; }
.chip-dot-fail { background: var(--c-fail); }

/* ─── Matrix shell ────────────────────────────────────────────────────── */
.matrix-wrap {
  background: var(--bg-elev);
  border-radius: var(--r-md);
  box-shadow: var(--ring), var(--shadow-sm);
  overflow: clip;
}
.matrix-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.matrix-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--fg);
  line-height: 1.2;
}
.matrix-sub {
  font-size: 13px;
  color: var(--fg-muted);
  margin-top: 5px;
}
.matrix-meta {
  display: flex; align-items: center; gap: 14px;
  white-space: nowrap;
}
.matrix-count {
  font-size: 11.5px;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sort-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px;
  padding: 0 8px 0 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--accent-deep);
  background: var(--accent-bg);
  border: 1px solid var(--accent);
  transition: background 0.12s;
}
.sort-pill:hover { background: var(--accent-bg-2); }
.sort-pill-x { margin-left: 2px; font-size: 14px; line-height: 1; opacity: 0.7; }

.matrix { overflow-x: auto; }

.matrix-header {
  position: sticky;
  top: 0;
  z-index: 3;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--bg-sunk);
  scrollbar-width: none;
}
.matrix-header::-webkit-scrollbar { display: none; }
.matrix-header > .matrix-grid { min-width: 100%; }

.matrix-grid {
  display: grid;
  grid-template-columns: var(--row-name-w) repeat(var(--cols), minmax(var(--col-w), 1fr));
  min-width: 100%;
}
.cell {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: var(--bg-elev);
}

/* Sticky first column — test names stay anchored during horizontal scroll */
.matrix-grid > .cell-corner,
.matrix-grid > .cell-row-name {
  position: sticky;
  left: 0;
  z-index: 2;
}
.matrix-grid > .cell-row-name {
  box-shadow: 1px 0 0 var(--border);
}
.matrix-grid > .cell-corner {
  box-shadow: 1px 0 0 var(--border-strong);
}
.matrix-grid > .cell-group {
  /* span row stays in flow; inner content sticks to viewport edge below */
}

.cell-group {
  display: block;
  padding: 0;
  background: var(--bg-sunk);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-right: 0;
  color: var(--fg-soft);
  text-decoration: none;
  transition: background 0.1s;
  min-height: 36px;
}
.cell-group:hover { background: var(--bg-hover); }
.cell-group:first-child,
.matrix-grid > .cell-group:nth-child(-n+2) { border-top: 0; }
.cell-group-inner {
  position: sticky;
  left: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 22px 8px 18px;
  min-height: 36px;
  width: max-content;
  max-width: 100%;
}
.group-folder {
  display: inline-flex;
  align-items: center; justify-content: center;
  color: var(--fg-muted);
  width: 16px; height: 16px;
  flex-shrink: 0;
}
.group-folder svg { width: 14px; height: 14px; display: block; }

.cell-describe {
  display: block;
  padding: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  border-right: 0;
  min-height: 28px;
  /* Grid items need min-width:0 to let their contents shrink below intrinsic
     size — without this, a long describe forces the row wider than the page. */
  min-width: 0;
}
.cell-describe-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 22px 6px 32px;
  min-height: 28px;
  color: var(--fg-soft);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}
.describe-seg { min-width: 0; }
.describe-sep { color: var(--fg-muted); font-weight: 400; }

.cell-corner {
  background: var(--bg-sunk);
  border-bottom: 1px solid var(--border-strong);
}
.cell-head {
  padding: 12px 16px 14px;
  background: var(--bg-sunk);
  border-bottom: 1px solid var(--border-strong);
  display: flex; flex-direction: column; gap: 8px;
  text-align: left;
  transition: background 0.12s;
}
.cell-head-btn { cursor: pointer; }
.cell-head-btn:hover { background: var(--bg-hover); }
.cell-head-sorted {
  background: var(--accent-bg) !important;
  border-bottom-color: var(--accent) !important;
}
.head-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--fg);
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
}
.head-sort-icon {
  color: var(--fg-dim);
  display: inline-flex; align-items: center;
  transition: color 0.12s, opacity 0.12s;
  opacity: 0;
}
.cell-head-btn:hover .head-sort-icon { opacity: 1; }
.cell-head-sorted .head-sort-icon { opacity: 1; color: var(--accent-deep); }
.head-pct {
  font-size: 11px;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}
.head-bar {
  display: flex; height: 3px; border-radius: 99px; overflow: hidden;
  background: var(--bg-elev);
}

/* ─── Test rows ───────────────────────────────────────────────────────── */
.cell-row-name {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px 12px 28px;
  min-height: var(--row-h);
  background: var(--bg-elev);
  text-decoration: none;
  transition: background 0.1s;
  position: relative;
}
.cell-row-name:hover { background: var(--bg-hover); }
.cell-row-name-nested { padding-left: 44px; }
.row-name-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg);
  line-height: 1.4;
  flex: 1; min-width: 0;
}
.row-name-ext {
  color: var(--fg-dim);
  opacity: 0;
  font-size: 12px;
  transition: opacity 0.1s, color 0.1s;
  flex-shrink: 0;
}
.cell-row-name:hover .row-name-ext { opacity: 1; color: var(--action); }

/* ─── Group / file divider rows ───────────────────────────────────────── */
.group-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-muted);
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.group-file {
  font-size: 11px;
  color: var(--fg-dim);
  font-weight: 400;
  white-space: nowrap;
}
.group-count {
  font-size: 11px;
  color: var(--fg-dim);
  text-transform: lowercase;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.group-stat {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}
.group-stat-fail { color: var(--c-fail); }
.group-stat-pass { color: var(--c-pass); }
.group-stat-skip { color: var(--fg-dim); }
.group-ext {
  margin-left: auto;
  font-size: 12px;
  color: var(--fg-dim);
  opacity: 0;
  transition: opacity 0.1s, color 0.1s;
}
.cell-group:hover .group-ext { opacity: 1; color: var(--action); }

.cell-result {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--row-h);
  padding: 0 8px;
  position: relative;
  transition: background 0.1s;
}
.cell-result.cell-clickable { cursor: pointer; }
.cell-result:not(.cell-clickable) { cursor: default; }
.cell-pass { background: var(--bg-elev); }
.cell-fail { background: var(--c-fail-bg); }
.cell-skipped { background: var(--bg-elev); }
.cell-none { background: var(--bg-elev); }
.cell-clickable:hover { background: rgba(234,74,53,0.12); }
.cell-expanded {
  background: rgba(234,74,53,0.18) !important;
  box-shadow: inset 0 -2px 0 var(--c-fail);
}
.cell-ms {
  font-size: 11px;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}
.cell-fail .cell-ms { color: var(--c-fail-soft); }

/* glyphs */
.glyph { display: inline-block; }
.glyph-dot { width: 8px; height: 8px; border-radius: 50%; }
.glyph-none { color: var(--fg-dim); font-size: 12px; }

.cell-empty {
  padding: 44px 22px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 13px;
  background: var(--bg-sunk);
}

/* ─── Failure detail ──────────────────────────────────────────────────── */
.cell-expansion {
  background: var(--bg-sunk);
  border-bottom: 1px solid var(--border);
  padding: 0;
}
.fail-detail {
  margin: 14px 18px 18px;
  background: var(--bg-elev);
  border: 1px solid var(--accent);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.fail-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  background: var(--accent-bg);
  border-bottom: 1px solid var(--accent);
}
.fail-head-l { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fail-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--accent-deep);
  color: rgb(249,249,249);
}
.fail-impl { font-size: 13px; font-weight: 600; color: var(--accent-deep); }
.fail-arrow { color: var(--fg-dim); font-size: 13px; }
.fail-test { font-size: 13px; color: var(--fg); font-weight: 500; }
.fail-head-r {
  font-size: 11.5px;
  color: var(--accent-deep);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.jest-out {
  margin: 0;
  padding: 16px 20px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--fg-soft);
  background: var(--bg-elev);
  overflow-x: auto;
}
.jest-out .line { white-space: pre; }
.line-bullet { color: var(--c-fail); font-weight: 500; font-size: 12.5px; }
.bullet { color: var(--c-fail); margin-right: 6px; }
.line-blank { line-height: 0.7; }
.line-indent { padding-left: 18px; }
.line-indent2 { padding-left: 36px; }
.jest-out .kw { color: var(--fg); font-weight: 500; }
.jest-out .path { color: var(--action); }
.c-expected { color: var(--c-pass); }
.c-received { color: var(--c-fail); }
.c-muted { color: var(--fg-dim); }
.diff-minus { color: var(--c-fail); background: rgba(215,39,15,0.06); }
.diff-plus  { color: var(--c-pass); background: rgba(106,163,0,0.06); }
.diff-ctx   { color: var(--fg-dim); }
.stack-line { font-size: 11px; color: var(--fg-dim); }

/* Test bullet line shows the full describe › it path. */
.bullet-sep { color: var(--fg-dim); margin: 0 2px; }
.assertion-line { color: var(--fg); }

/* Jest-style code frame: gutter + line text, ">" on the failing line and
   a caret pointing at the failing column under it. */
.code-frame {
  margin: 6px 0 6px;
  padding-left: 18px;
}
.cf-row { display: flex; white-space: pre; font-family: var(--font-mono); }
.cf-marker {
  display: inline-block;
  width: 1.5ch;
  color: var(--c-fail);
  font-weight: 600;
}
.cf-num {
  display: inline-block;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}
.cf-sep { color: var(--fg-dim); padding: 0 0.6ch; }
.cf-code { color: var(--fg-soft); }
.cf-row-fail .cf-num { color: var(--c-fail); }
.cf-row-fail .cf-code { color: var(--fg); }
.cf-row-caret .cf-code { color: var(--c-fail); }
.cf-caret { color: var(--c-fail); font-weight: 600; }

.fail-actions {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-sunk);
  gap: 10px;
}
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 500;
  padding: 7px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--fg-soft);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.12s, color 0.12s;
}
.btn:hover { border-color: var(--action); color: var(--action); }
.fail-file { font-size: 11px; color: var(--fg-dim); font-family: var(--font-mono); }

/* ─── Scrollbar polish ────────────────────────────────────────────────── */
.matrix::-webkit-scrollbar,
.jest-out::-webkit-scrollbar { height: 10px; width: 10px; }
.matrix::-webkit-scrollbar-thumb,
.jest-out::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
.matrix::-webkit-scrollbar-track,
.jest-out::-webkit-scrollbar-track { background: transparent; }

/* ─── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .impl-strip { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}
@media (max-width: 820px) {
  .page { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--border); }
  .hdr { grid-template-columns: 1fr; gap: 16px; padding: 20px; }
  .hdr-meta { align-items: flex-start; }
  .impl-strip { padding: 16px; }
  .main { padding: 16px; }
}
