/* Report tab (views/report.mjs). Reads like a short printed report: a clear headline,
   the funnel, ranked findings, and a quiet rail of ways to share. Tokens only. */

.report-head { display: grid; gap: var(--space-2); margin-bottom: var(--space-5); max-width: 880px; }
.report-eyebrow {
  margin: 0;
  font: 600 var(--text-xs)/1.3 var(--font-sans);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.report-title { font-size: var(--text-xl); line-height: 1.2; letter-spacing: -0.015em; }
.report-summary { margin: 2px 0 0; font-size: var(--text-md); line-height: 1.55; color: var(--ink-2); max-width: 70ch; }

.report-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  margin: var(--space-3) 0 0;
  padding: var(--space-3) 0 0;
  border-top: 1px solid var(--line);
}
.report-stat { display: grid; gap: 2px; min-width: 0; }
.report-stat-label { font-size: var(--text-xs); color: var(--ink-3); font-weight: 500; }
.report-stat-value { margin: 0; font-size: var(--text-lg); font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }

.report-funnel { margin: 0 0 var(--space-6); padding: 0; display: grid; gap: var(--space-2); }
.report-funnel-scroll { overflow-x: auto; border-radius: 12px; box-shadow: var(--shadow); }
.report-funnel-img { display: block; width: 100%; height: auto; min-width: 720px; }
.report-funnel figcaption { padding: 0 var(--space-1); }
.report-funnel-list { padding: 4px var(--space-4) var(--space-2); }
.report-empty-head { margin-bottom: var(--space-5); }
.report-empty-card { padding: 0; }

.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--space-6);
  align-items: start;
}
.report-main { display: grid; gap: var(--space-6); min-width: 0; }
.report-actions { min-width: 0; }
@media (min-width: 1001px) {
  .report-actions { position: sticky; top: 112px; }
}
@media (max-width: 1000px) {
  .report-layout { grid-template-columns: minmax(0, 1fr); }
  .report-actions { order: -1; }
}

.report-section { display: grid; gap: var(--space-3); min-width: 0; }
.report-section-head { display: grid; gap: 4px; padding-bottom: var(--space-2); border-bottom: 1px solid var(--line); }
.report-h2 { font-size: var(--text-lg); }
.report-note { margin: 0; font-size: var(--text-xs); color: var(--ink-3); line-height: 1.5; }
.report-empty-line { margin: 0; color: var(--ink-2); }
.report-sub { display: block; font-size: var(--text-xs); color: var(--ink-3); font-weight: 400; line-height: 1.4; }
.report-of { display: block; font-size: var(--text-xs); color: var(--ink-3); }
.report-label { display: block; font-size: var(--text-xs); font-weight: 600; color: var(--ink-3); margin-bottom: 2px; }
.report-link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--ink-3) 45%, transparent);
  text-underline-offset: 3px;
}
.report-link:hover { color: var(--accent); text-decoration-color: currentColor; }

.report-table td { vertical-align: top; }
.report-inline { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.report-inline li { display: flex; align-items: baseline; gap: 6px; line-height: 1.4; }
.report-drop {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg) translateY(1px);
  background: var(--bad);
}
.report-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.report-good-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 3px;
  background: var(--good);
  vertical-align: 1px;
}

/* ranked failure modes */
.report-modes { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; counter-reset: none; }
.report-mode {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--line);
}
.report-mode:first-child { padding-top: var(--space-1); }
.report-mode:last-child { border-bottom: 0; padding-bottom: 0; }
.report-rank {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  font-weight: 600;
  color: var(--ink);
}
.report-mode-body { display: grid; gap: var(--space-2); min-width: 0; }
.report-mode-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px var(--space-4); }
.report-mode-name { font-size: var(--text-md); line-height: 1.35; }
.report-mode-count { display: flex; align-items: baseline; gap: 8px; margin: 0; font-size: var(--text-sm); white-space: nowrap; }
.report-mode-count .soft { font-size: var(--text-xs); }
.report-priority { font-size: var(--text-xs); color: var(--ink-3); margin-left: 2px; }
.report-def { margin: 0; color: var(--ink-2); line-height: 1.55; max-width: 72ch; }
.report-impact { margin: 0; line-height: 1.5; max-width: 72ch; }
.report-quote {
  margin: 0;
  padding: 8px 12px;
  border-left: 3px solid var(--line);
  border-radius: 0 8px 8px 0;
  background: var(--surface-2);
  line-height: 1.5;
  max-width: 72ch;
}

.report-rate { font-weight: 600; }
.report-rate.is-good { color: var(--good); }
.report-rate.is-bad { color: var(--bad); }
.report-passall { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; }
.report-passall .icon { color: var(--good); }
.report-version-cell { white-space: normal; }

.report-next { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.report-next li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.report-next li .chip { flex: none; min-width: 108px; justify-content: center; }
.report-next-text { display: grid; gap: 2px; min-width: 0; line-height: 1.45; }
.report-next-text > span:last-child { color: var(--ink-2); }

/* share rail */
.report-actions-box {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.report-actions-title { font-size: var(--text-md); }
.report-action { display: grid; justify-items: start; gap: 4px; min-width: 0; }
.report-action .btn { max-width: 100%; white-space: normal; height: auto; min-height: 34px; padding-top: 7px; padding-bottom: 7px; text-align: left; line-height: 1.3; }
.report-action .hint { line-height: 1.45; }
.report-hint-empty { color: var(--ink-2); }
.report-share {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
  font-size: var(--text-xs);
  color: var(--ink-2);
  line-height: 1.5;
}
.report-share .icon { flex: none; margin-top: 1px; color: var(--ink-3); }

@media (max-width: 1000px) {
  .report-actions-box { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); align-items: start; }
  .report-actions-title, .report-share { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .report-stats { gap: var(--space-2) var(--space-5); }
  .report-mode { grid-template-columns: 28px minmax(0, 1fr); gap: 10px; }
  .report-rank { width: 28px; height: 28px; }
  .report-next li { flex-direction: column; gap: var(--space-2); }
  .report-funnel-img { min-width: 640px; }

  /* Tables become one card per row: the first cell on top, then each value under its own label. */
  .report-table, .report-table tbody { display: block; }
  .report-table thead { display: none; }
  .report-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .report-table tbody tr:last-child { border-bottom: 0; }
  .report-table td { display: block; padding: 0; border: 0; min-width: 0; }
  .report-table tbody tr:hover td { background: none; }
  .report-table td.num { text-align: left; white-space: normal; }
  .report-table td:first-child, .report-table td.report-td-wide { grid-column: 1 / -1; }
  .report-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font: 600 var(--text-xs)/1.3 var(--font-sans);
    color: var(--ink-3);
  }
  .report-table .report-check-name { min-width: 0; }
}
.report-check-name { min-width: 190px; }
.report-checks-table th { white-space: normal; min-width: 76px; }
.report-checks-table .chip { white-space: nowrap; }

/* Single-column grids never grow past their box. */
.report-head, .report-section, .report-mode-body, .report-action, .report-funnel { grid-template-columns: minmax(0, 1fr); }
