.evolutionBadge {
  // local placeholder for a brand green not yet in the shared palette; swap for a
  // @color-* variable once #33B343 lands in plugins/Morpheus/stylesheets/base/colors.less
  @_evolution-green: #33B343;

  display: inline-flex;
  align-items: center;
  // Fluid pill: font-size scales with the card/column width via cqi, like the metric readout (see
  // MetricValue.less); icon/height/line-height/padding are em ratios of it so the whole pill scales as
  // one unit. ~"" escaped so less.php emits the clamp()/cqi verbatim.
  font-size: ~"clamp(10px, 7.5px + 1.25cqi, 12px)";
  padding-left: 0.1667em; // 2px
  padding-right: 0.5em; // 6px
  border-radius: 40px;
  font-variant: tabular-nums;
  line-height: 1.6667; // 20px
  white-space: nowrap;
  vertical-align: middle;
  height: 1.6667em; // 20px

  .evolutionBadge__icon {
    display: inline-flex;
    flex: none;
    width: 1.3333em; // 16px
    height: 1.3333em;

    svg {
      display: block;
      width: 100%;
      height: 100%;
    }
  }

  &.evolutionBadge--positive {
    color: @_evolution-green;
    // opaque pale-green tint; lighten keeps the green's saturation, so tune the
    // percentage to taste (higher = paler)
    background-color: lighten(@_evolution-green, 50%);
  }

  &.evolutionBadge--negative {
    // theme primary series red; it resolves to a CSS var(--...) and LESS colour
    // functions (lighten/darken) can't operate on a var(), so mix toward white with
    // CSS color-mix() for an opaque pale tint (the var-safe equivalent of lighten)
    color: @theme-color-base-series;
    background-color: color-mix(in srgb, @theme-color-base-series 5%, white);
  }

  &.evolutionBadge--neutral {
    // silver dash + value on an opaque silver tint; same grey family, mixed toward
    // white so it reads as a pale pill on the light surface
    color: @theme-color-text-lighter;
    background-color: color-mix(in srgb, @theme-color-text-lighter 5%, white);
  }

  // brand green is a touch dark on a dark background, so lighten the text to keep
  // the pill legible
  .inDarkMode({
    &.evolutionBadge--positive {
      // mirror of light mode: lighten goes toward white for a pale tint on white,
      // so on the dark surface darken the green into an opaque dark-green tint instead
      color: lighten(@_evolution-green, 10%);
      background-color: darken(@_evolution-green, 28%);
    }

    &.evolutionBadge--negative {
      // mix toward black for an opaque dark tint on the dark surface (the var-safe
      // equivalent of darken)
      background-color: color-mix(in srgb, @theme-color-base-series 18%, black);
    }

    &.evolutionBadge--neutral {
      background-color: color-mix(in srgb, @theme-color-text-lighter 14%, black);
    }
  });
}
