/* ============================================================
   Hit DNA admin dashboard (#hitDnaPanel). Loaded after nordic.css.
   Chrome stays nordic ink; colour appears only as data marks:
   hits = blue, non-hits = orange (validated pair, see dataviz skill).
   ============================================================ */

.hit-dna-panel {
  --hd-hit: #2a78d6;
  --hd-miss: #eb6834;
  --hd-ink: rgb(0 0 0 / 72%);
  --hd-muted: rgb(0 0 0 / 22%);
  --hd-grid: rgb(0 0 0 / 7%);
  --hd-band: rgb(0 0 0 / 6%);
  --hd-surface: var(--nordic-surface, #fff);
  --hd-line: var(--glass-line, rgb(0 0 0 / 10%));
  margin: 0; /* same width as the catalog/whitelist panels */
  padding: 20px 24px 24px;
}

.hit-dna-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
  padding-right: 88px; /* room for .panel-refresh + .panel-toggle (top-right, 30px each) */
}

.hit-dna-head h2 { margin: 2px 0 0; font-size: 17px; }
.hit-dna-actions { display: flex; align-items: center; gap: 8px; margin-top: -4px; } /* centre the 30px market pills on the corner buttons (top 16px) */
.hit-dna-market { display: inline-flex; gap: 4px; }
.hit-dna-market button { min-height: 30px; padding: 0 12px; font-size: 12px; }
.hit-dna-lede { margin: 0 0 16px; font-size: 12px; max-width: 70ch; }

.hd-empty { padding: 28px 0; text-align: center; }

/* ── stat tiles ── */
.hd-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.hd-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--hd-line);
  border-radius: 10px;
  background: var(--hd-surface);
}

.hd-stat-value { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.hd-stat-caption { font-size: 12px; color: var(--glass-body, rgb(0 0 0 / 64%)); }
.hd-stat-note { font-size: 11px; }

/* ── card grid ── */
.hd-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.hd-card {
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--hd-line);
  border-radius: 12px;
  background: var(--hd-surface);
}

.hd-card-advice, .hd-card-wide { grid-column: 1 / -1; }
.hd-card-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.hd-hint { margin: 4px 0 10px; font-size: 12px; }
.hd-footnote { margin: 10px 0 0; font-size: 11px; }

/* ── legend ── */
.hd-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 8px; font-size: 12px; }
.hd-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.hd-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.hd-swatch.is-hit { background: var(--hd-hit); }
.hd-swatch.is-miss { background: var(--hd-miss); }
.hd-swatch.is-muted { background: var(--hd-muted); }
.hd-swatch.is-ink { background: var(--hd-ink); }
.hd-swatch.is-band { background: var(--hd-band); outline: 1px solid var(--hd-grid); }

/* ── svg charts ── */
.hd-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 8px; }
.hd-toolbar .hd-legend { margin: 0; }
.hd-table-toggle { flex: 0 0 auto; min-height: 26px; padding: 0 10px; font-size: 11px; }
.hd-chart { width: 100%; max-width: 720px; height: auto; display: block; overflow: visible; }
.hd-chart text { font-family: inherit; }
.hd-gridline { stroke: var(--hd-grid); stroke-width: 1; }
.hd-ref { stroke: rgb(0 0 0 / 35%); stroke-width: 1; stroke-dasharray: 3 3; }
.hd-axis { font-size: 10px; fill: rgb(0 0 0 / 45%); font-variant-numeric: tabular-nums; }
.hd-row-label { font-size: 11.5px; fill: var(--hd-ink); }
.hd-row-label.is-muted { fill: rgb(0 0 0 / 40%); }
.hd-hit-area { fill: transparent; }
.hd-row:hover .hd-hit-area, .hd-row:focus .hd-hit-area { fill: rgb(0 0 0 / 3%); }
.hd-row:focus { outline: none; }
.hd-bar.is-hit, .hd-dot.is-hit { fill: var(--hd-hit); }
.hd-bar.is-miss, .hd-dot.is-miss { fill: var(--hd-miss); }
.hd-bar.is-muted, .hd-dot.is-muted { fill: var(--hd-muted); }
.hd-bar.is-ink { fill: var(--hd-ink); }
.hd-bar { opacity: 0.35; }
.hd-bar.is-ink { opacity: 0.8; }
.hd-dot { stroke: var(--hd-surface); stroke-width: 2; }
.hd-whisker { stroke-width: 2; stroke-linecap: round; }
.hd-whisker.is-hit { stroke: var(--hd-hit); }
.hd-whisker.is-miss { stroke: var(--hd-miss); }
.hd-whisker.is-muted { stroke: var(--hd-muted); }
.hd-link { stroke: rgb(0 0 0 / 18%); stroke-width: 2; }
.hd-band { fill: var(--hd-band); }

/* ── tables (accessible alternative to every chart) ── */
.hd-table-wrap { overflow-x: auto; }
.hd-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.hd-table th, .hd-table td { padding: 6px 8px; border-bottom: 1px solid var(--hd-line); text-align: left; }
.hd-table th { font-weight: 500; color: var(--glass-label, rgb(0 0 0 / 50%)); }

/* ── advice ── */
.hd-advice { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.hd-advice li { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--hd-line); border-radius: 10px; }
.hd-advice strong { font-size: 13px; }
.hd-advice p { margin: 4px 0; font-size: 13px; line-height: 1.45; }
.hd-evidence { font-size: 11px; font-variant-numeric: tabular-nums; }
.hd-dir { flex: 0 0 26px; height: 26px; border-radius: 999px; display: grid; place-items: center; font-weight: 700; color: #fff; }
.hd-dir.is-hit { background: var(--hd-hit); }
.hd-dir.is-miss { background: var(--hd-miss); }

/* ── meters (genre floor, catalogue) ── */
.hd-meter-list { display: flex; flex-direction: column; gap: 8px; }
.hd-meter { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 42px; align-items: center; gap: 10px; font-size: 12px; }
.hd-meter-track { height: 8px; border-radius: 4px; background: var(--hd-band); overflow: hidden; }
.hd-meter-fill { display: block; height: 100%; border-radius: 4px; background: var(--hd-ink); }
.hd-meter-fill.is-hit { background: var(--hd-hit); }
.hd-meter-value { text-align: right; font-variant-numeric: tabular-nums; }

/* ── words ── */
.hd-words-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.hd-words-col h4 { margin: 0 0 8px; font-size: 12px; font-weight: 600; }
.hd-words { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.hd-words li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 8px; font-size: 12.5px; border-radius: 4px; }
.hd-words li:hover, .hd-words li:focus { background: rgb(0 0 0 / 3%); outline: none; }
.hd-word { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-word-bar { height: 6px; border-radius: 3px; justify-self: start; }
.hd-word-bar.is-hit { background: var(--hd-hit); }
.hd-word-bar.is-miss { background: var(--hd-miss); }
.hd-word-bar.is-ink { background: var(--hd-ink); opacity: 0.6; }

/* ── catalogue ── */
.hd-songs { display: flex; flex-direction: column; }
.hd-song { border-bottom: 1px solid var(--hd-line); }
.hd-song summary { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 44px; gap: 12px; align-items: center; padding: 9px 2px; cursor: pointer; font-size: 13px; list-style: none; }
.hd-song summary::-webkit-details-marker { display: none; }
.hd-song summary:hover { background: rgb(0 0 0 / 3%); }
.hd-song-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-song-p { text-align: right; font-variant-numeric: tabular-nums; }
.hd-song-advice { margin: 0 0 12px; padding: 0 0 0 16px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.hd-song-advice strong { display: block; font-weight: 600; }

/* ── locked / status ── */
.hd-card-locked { border-style: dashed; }
.hd-locked-list { margin: 0; padding-left: 18px; font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }

/* ── tooltip ── */
.hd-tooltip {
  position: fixed;
  z-index: 1000;
  max-width: 280px;
  padding: 8px 10px;
  border: 1px solid var(--glass-line, rgb(0 0 0 / 10%));
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 24px rgb(0 0 0 / 12%);
  font-size: 12px;
  line-height: 1.4;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}
.hd-tooltip[hidden] { display: none; }

@media (max-width: 900px) {
  .hit-dna-head { flex-wrap: wrap; }
  .hit-dna-actions { width: 100%; justify-content: space-between; }
  .hd-grid { grid-template-columns: minmax(0, 1fr); }
  .hd-words-grid { grid-template-columns: minmax(0, 1fr); }
  .hit-dna-panel { padding: 16px; }
}

@media (forced-colors: active) {
  .hd-dot, .hd-bar, .hd-meter-fill, .hd-word-bar { forced-color-adjust: none; }
}
