/* ---- filters ------------------------------------------------------- */
.filters {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  margin-bottom: 14px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-muted);
}
.field select, .field input {
  font: inherit; font-size: 13px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: 6px; padding: 6px 9px; min-width: 128px;
}
.field input { min-width: 176px; }
.field select:focus-visible, .field input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent;
}
.count { margin-left: auto; font-size: 12px; color: var(--ink-muted); padding-bottom: 7px; }

/* ---- legend -------------------------------------------------------- */
.legend {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-2); margin-bottom: 16px;
}
.ramp { display: flex; border-radius: 4px; overflow: hidden; box-shadow: 0 0 0 1px var(--ring); }
.ramp i { width: 22px; height: 12px; display: block; }
.legend .cap { color: var(--ink-muted); }
.legend .ramp-group { display: flex; align-items: center; gap: 10px; }

/* ---- table --------------------------------------------------------- */
.table-scroll {
  overflow-x: auto; background: var(--surface);
  border: 1px solid var(--ring); border-radius: 10px;
}
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface); color: var(--ink-2);
  font-size: 11px; font-weight: 650; letter-spacing: 0.03em; text-transform: uppercase;
  text-align: right; white-space: nowrap; padding: 11px 10px;
  border-bottom: 1px solid var(--rule); cursor: pointer; user-select: none;
}
thead th:first-child, thead th.txt { text-align: left; }
thead th:hover { color: var(--ink); }
thead th .arrow { opacity: 0; margin-left: 3px; font-size: 9px; }
thead th[aria-sort] { color: var(--ink); }
thead th[aria-sort] .arrow { opacity: 1; }
tbody td {
  padding: 7px 10px; text-align: right; white-space: nowrap;
  border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums;
}
tbody td.txt { text-align: left; font-variant-numeric: normal; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td:not(.heat) { background: var(--row-hover); }
td.team { font-weight: 600; }
td.dim { color: var(--ink-2); }
/* 2px surface gap between adjacent fills */
td.heat {
  background-clip: padding-box;
  border-right: 2px solid var(--surface);
  border-left: 2px solid var(--surface);
  cursor: default;
}
tbody tr:hover td.heat { box-shadow: inset 0 0 0 2px var(--ring); }
.empty { padding: 40px; text-align: center; color: var(--ink-muted); }

/* ---- tooltip ------------------------------------------------------- */
#tip {
  position: fixed; z-index: 30; pointer-events: none; opacity: 0;
  transition: opacity .09s ease; background: var(--surface); color: var(--ink);
  border: 1px solid var(--ring); border-radius: 8px; padding: 9px 11px;
  font-size: 12px; line-height: 1.45; max-width: 288px;
  box-shadow: 0 4px 16px rgba(0,0,0,.16);
}
#tip .t-metric { font-weight: 650; margin-bottom: 3px; }
#tip .t-row { color: var(--ink-2); display: flex; justify-content: space-between; gap: 14px; }
#tip b { color: var(--ink); font-variant-numeric: tabular-nums; }
#tip .t-desc {
  color: var(--ink-2); margin-top: 7px; padding-top: 7px;
  border-top: 1px solid var(--grid);
}
footer.note { margin-top: 18px; font-size: 12px; color: var(--ink-muted); max-width: 78ch; }

/* ---- glossary (rendered from metrics.json) -------------------------- */
.gloss-h {
  font-size: 11px; font-weight: 650; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--ink-muted);
  margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--grid);
}
dl.gloss { margin: 0; display: grid; gap: 11px; }
dl.gloss dt {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-size: 13px; font-weight: 600; color: var(--ink);
}
dl.gloss .gk {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  padding: 2px 6px; border-radius: 4px;
  background: var(--row-hover); color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
dl.gloss .dir {
  font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-muted);
}
dl.gloss dd {
  margin: 3px 0 0; font-size: 12.5px; line-height: 1.55;
  color: var(--ink-2); max-width: 82ch;
}
