/* Analyses list: the score-card grid (one card per benchmark report). */

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--gap);
}

.analysis-card { display: block; }
.analysis-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
}
.analysis-card-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.analysis-card-project {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}
.analysis-card-project .dot-badge {
  width: 7px;
  height: 7px;
  border-radius: 2px;
}
.analysis-card .pill { margin-top: 8px; }
.analysis-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 4px 18px 4px;
}
.analysis-stat-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}
.analysis-stat-label {
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 2px;
}
.analysis-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 18px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

/* ── Analysis results page (Alarm Analyzer screen) ────────────────── */
.analysis-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
}
@media (max-width: 1080px) {
  .analysis-detail-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Right column: stacked side cards (same rhythm as .issue-side, which
   lives in issues.css — not loaded on analysis pages). */
.analysis-side {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
}

.finding-row {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.finding-row:last-child { border-bottom: none; }
.finding-row:hover { background: var(--surface-2); }
.finding-row-title {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.finding-row-title .row-title { white-space: normal; }
.finding-row-detail {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 4px;
  line-height: 1.45;
}
.finding-row-cite {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  color: var(--text-3);
  font-size: 11px;
}
.finding-row-tags {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 6px;
  overflow-wrap: anywhere;
}
/* The per-finding actions ("Add as todo" / "Create issue", or their
   done-state pills) always stack vertically and share one width, so two
   findings never disagree on whether their buttons sit inline or wrapped
   (user feedback). align-items: stretch + a min-width makes both children
   as wide as the wider label; forms/buttons fill that width. */
.finding-row-action {
  flex: none;
  padding-top: 2px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 132px;
}
.finding-row-action form { display: flex; margin: 0; }
.finding-row-action .btn { width: 100%; justify-content: center; }
.finding-row-action .pill {
  padding: 7px 11px;
  border-radius: 8px;
  justify-content: center;
  text-align: center;
}

/* Collapsible card via native <details> (no JS). The <summary> is the card
   head; the chevron rotates when open. */
.collapse-card > summary {
  list-style: none;
  cursor: pointer;
}
.collapse-card > summary::-webkit-details-marker { display: none; }
.collapse-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.collapse-chevron {
  color: var(--text-3);
  flex: none;
  transition: transform 0.18s ease;
}
.collapse-card[open] > summary .collapse-chevron { transform: rotate(180deg); }

/* Severity ring: how many findings, coloured by the worst severity. */
.finding-ring {
  flex: none;
  width: 60px;
  height: 60px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.finding-ring svg { transform: rotate(-90deg); }
.finding-ring-value {
  position: absolute;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
}
.finding-ring-total {
  font-size: 10px;
  color: var(--text-3);
}

/* ── Hero health ring: checks passed / assessed, worst-severity hue ── */
.health-ring {
  flex: none;
  width: 104px;
  height: 104px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.health-ring svg { transform: rotate(-90deg); }
.health-ring-center { position: absolute; text-align: center; }
.health-ring-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
}
.health-ring-total {
  font-size: 14px;
  color: var(--text-3);
}
.health-ring-label {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 3px;
  letter-spacing: .5px;
}

/* ── KPI scorecard + rate chart on one aligned row: same 1.65fr/1fr
      split as .analysis-detail-grid below, so the columns line through. */
.analysis-kpi-row {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: var(--gap);
  align-items: stretch;
}
.analysis-kpi-row.no-chart { grid-template-columns: minmax(0, 1fr); }
.analysis-kpi-tiles .kpi-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  height: 100%;
  align-content: stretch;
}
/* Beside the chart the tiles cap at two rows — two ~100px rows fill the
   chart's height instead of one row of chart-tall slabs. Columns follow
   the tile count (2 up to 4 tiles, 3 for 5–6, 4 for 7+): smaller cards
   beat a third row. */
.analysis-kpi-row:not(.no-chart) .analysis-kpi-tiles .kpi-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.analysis-kpi-row:not(.no-chart) .analysis-kpi-tiles .kpi-grid:has(> :nth-child(5)) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.analysis-kpi-row:not(.no-chart) .analysis-kpi-tiles .kpi-grid:has(> :nth-child(7)) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1080px) {
  .analysis-kpi-row { grid-template-columns: minmax(0, 1fr); }
}

/* ── Priority mix vs the 80/15/5 guideline ────────────────────────── */
.prio-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.prio-row + .prio-row { margin-top: 10px; }
.prio-row-label {
  flex: none;
  width: 62px;
  font-size: 11px;
  color: var(--text-3);
}
.prio-bar {
  flex: 1;
  display: flex;
  gap: 2px;
  height: 14px;
  border-radius: 4px;
  overflow: hidden;
}
.prio-bar-target { opacity: .45; }
.prio-seg { min-width: 2px; }
.prio-low { background: var(--ok); }
.prio-med { background: var(--warn); }
.prio-high { background: var(--crit); }
.prio-legend {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-2);
}
.prio-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.prio-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}

/* ── Traces section (bead induindex-za4) ───────────────────────── */
.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-2);
  /* Same tuning as .list-group-title: these add to .app-content's 18px flex
     gap rather than collapsing, so 10px binds the heading to its section and
     32px breaks it from what came before. */
  margin: 14px 0 -8px;
}
.trace-list { display: flex; flex-direction: column; gap: 8px; }
.trace-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  text-decoration: none;
  color: inherit;
}
.trace-row .row-main { flex: 1; display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.trace-row .row-meta { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.trace-row:hover { border-color: var(--border-2); }
