.performance-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  color: #64748b;
  font-size: 13px;
  line-height: 1.4;
}

.performance-legend__item {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
  white-space: nowrap;
}

.performance-legend__swatch {
  display: inline-block;
  flex: 0 0 28px;
  width: 28px;
  height: 0;
  border-top: 3px solid currentColor;
  border-radius: 999px;
}

.performance-legend__swatch--strategy {
  color: #e8384f;
}

.performance-legend__swatch--benchmark {
  color: #3b82f6;
}

.performance-legend__swatch--excess {
  color: #f59e0b;
  border-top-style: dashed;
}

.performance-legend__label {
  color: #475569;
  font-weight: 500;
}

.strategy-sparkline {
  position: relative;
  min-height: 142px;
  padding-top: 24px;
}

.sparkline-legend {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  color: #64748b;
  font-size: 11px;
  line-height: 18px;
  pointer-events: none;
}

.sparkline-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.sparkline-legend__swatch {
  display: inline-block;
  width: 18px;
  height: 0;
  border-top: 2px solid currentColor;
  border-radius: 999px;
}

.sparkline-legend__swatch--strategy {
  color: #e8384f;
}

.sparkline-legend__swatch--benchmark {
  color: #3b82f6;
}

@media (max-width: 640px) {
  .performance-legend {
    align-items: flex-start;
    gap: 9px 16px;
  }

  .performance-legend__item {
    flex: 1 1 180px;
  }
}
