/* ============================================================
   SITE REVIEW — the per-site scorecard, the adherence matrix and
   the ranked-in-context bars.
   ============================================================ */

/* ---- Scorecard: the site picker tile plus its headline metrics ---- */
.scorecard {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 880px) {
  .scorecard {
    grid-template-columns: minmax(0, 0.85fr) repeat(4, minmax(0, 1fr));
  }
}

.scorecard-site {
  background: #e3f2ff;
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.scorecard-site-label {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #555b65;
}

.scorecard-site-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.5rem;
  color: var(--text);
}

.scorecard-site-caret {
  font-size: 0.8rem;
  color: #555b65;
}

.scorecard-site-meta {
  margin: 0;
  font-size: 0.75rem;
  color: #555b65;
  line-height: 1.5;
}

.scorecard-metric {
  padding: 24px 22px;
  border-top: 1px solid var(--border-subtle);
}

@media (min-width: 880px) {
  .scorecard-metric {
    border-top: none;
    border-left: 1px solid var(--border-subtle);
  }
}

.metric-label {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-value {
  font-size: 1.55rem;
  color: var(--text);
  font-weight: 400;
  line-height: 1;
  margin-bottom: 8px;
}

.metric-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 10px 0 0;
}

/* ---- Adherence matrix: sites x protocol visits, RAG by % performed.
       Thresholds mirror the platform's own (>=95 ok, >=85 warn). ---- */
.matrix-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  background: var(--bg);
  overflow-x: auto;
}

.matrix {
  display: grid;
  grid-template-columns: 92px repeat(8, minmax(46px, 1fr)) 78px;
  gap: 5px;
  min-width: 640px;
}

.matrix-head {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  padding-bottom: 8px;
}

.matrix-head--total {
  color: var(--text);
}

.matrix-row-label {
  font-size: 0.8rem;
  color: var(--text);
  display: flex;
  align-items: center;
}

.matrix-row-label--focus {
  font-weight: 500;
}

.matrix-cell {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  color: var(--text);
  border-radius: 4px;
}

.matrix-cell--ok {
  background: #c5ff7e;
}

.matrix-cell--warn {
  background: #ffdf7e;
}

.matrix-cell--bad {
  background: #ffa77e;
}

.matrix-cell--total {
  background: var(--bg-alt);
}

.matrix-cell--none {
  background: var(--bg-alt);
  color: #a0a0a0;
}

.matrix-legend {
  display: flex;
  gap: 20px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--bg-soft);
  font-size: 0.72rem;
  color: var(--muted);
  align-items: center;
  flex-wrap: wrap;
}

.matrix-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.matrix-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.matrix-legend-note {
  margin-left: auto;
}

/* ---- Ranked bars: every site weighed against the others ---- */
.rank-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px;
  background: var(--bg);
}

.rank-title {
  font-size: 0.85rem;
  color: var(--text);
  margin: 0 0 2px;
}

.rank-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 16px;
}

.rank-row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 52px;
  gap: 14px;
  align-items: center;
  padding: 7px 0;
}

.rank-name {
  font-size: 0.82rem;
  color: var(--text);
}

.rank-name--focus {
  font-weight: 500;
}

.rank-track {
  height: 14px;
  background: var(--bg-alt);
  border-radius: 3px;
}

.rank-fill {
  display: block;
  height: 14px;
  border-radius: 3px;
}

.rank-fill--bad {
  background: #ffa77e;
}

.rank-fill--warn {
  background: #ffdf7e;
}

.rank-fill--calm {
  background: #dde1e7;
}

.rank-value {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: right;
}

.rank-foot {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--bg-soft);
}
