/* Evaluation card layout fix */
.eval-grid .eval-pill:nth-child(3) {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 3.25rem;
}

.eval-grid .eval-pill:nth-child(3) span {
  margin-bottom: 0;
}

.eval-grid .eval-pill:nth-child(3) strong {
  text-align: right;
  white-space: nowrap;
}

.eval-grid.compact .eval-pill:nth-child(3) {
  min-height: 2.875rem;
}

/* 14-day performance layout: keep AI4/CT6 tidy and make BBFS align like daily evaluation cards */
.performance-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.625rem;
}

.performance-grid .perf-metric {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "label label"
    "value percent";
  align-items: end;
  min-width: 0;
  min-height: 3.25rem;
  padding: 0.6875rem 0.75rem;
  overflow: hidden;
}

.performance-grid .perf-metric span {
  grid-area: label;
  margin-bottom: 0.375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.performance-grid .perf-metric strong {
  grid-area: value;
  line-height: 1;
  white-space: nowrap;
}

.performance-grid .perf-metric em {
  grid-area: percent;
  float: none;
  margin-top: 0;
  padding-left: 0.375rem;
  line-height: 1;
  text-align: right;
  white-space: nowrap;
}

.performance-grid .perf-metric:nth-child(2) { order: 1; }
.performance-grid .perf-metric:nth-child(3) { order: 2; }

.performance-grid .perf-metric:nth-child(1) {
  order: 3;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 3.25rem;
}

.performance-grid .perf-metric:nth-child(1) span,
.performance-grid .perf-metric:nth-child(1) strong,
.performance-grid .perf-metric:nth-child(1) em {
  display: block;
  margin: 0;
}

.performance-grid .perf-metric:nth-child(1) span {
  flex: 1 1 auto;
  min-width: 0;
}

.performance-grid .perf-metric:nth-child(1) strong,
.performance-grid .perf-metric:nth-child(1) em {
  flex: 0 0 auto;
}

.performance-grid .perf-metric:nth-child(1) em {
  padding-left: 0;
}

.performance-grid .perf-metric:nth-child(n+4) {
  order: 4;
}

@media (max-width: 340px) {
  .performance-grid {
    grid-template-columns: 1fr;
  }

  .performance-grid .perf-metric,
  .performance-grid .perf-metric:nth-child(1) {
    grid-column: 1;
  }
}