.product-flags:has(> .second-hand),
.product-flags:has(> .prdanea-service) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  column-gap: 0.5rem;
  align-items: start;
  box-sizing: border-box;
  width: 100%;
  top: 0;
  left: 0;
  margin: 0;
  padding: 0.5rem;
}

.product-flags:has(> .second-hand) > :not(.second-hand):not(.prdanea-service),
.product-flags:has(> .prdanea-service) > :not(.second-hand):not(.prdanea-service) {
  grid-column: 1;
  justify-self: start;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

body .product-flags > li.badge.second-hand,
body .product-flags > li.product-flag.second-hand,
.product-flags .second-hand {
  /* The theme's layered !important background reads these badge-local values. */
  --bs-primary-rgb: 0, 131, 143;
  --bs-bg-opacity: 1;
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  align-self: start;
  margin: 0;
  background-color: #00838f !important;
  border-color: #00838f !important;
  color: #fff !important;
  text-transform: none;
}

body .product-flags > li.badge.prdanea-service,
body .product-flags > li.product-flag.prdanea-service,
.product-flags .prdanea-service {
  --bs-primary-rgb: 255, 193, 7;
  --bs-bg-opacity: 1;
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  align-self: start;
  margin: 0;
  background-color: #ffc107 !important;
  border-color: #ffc107 !important;
  color: #212529 !important;
  text-transform: none;
}

/* The theme sets white text with !important inside this layer. Override it there. */
@layer bs-base {
  body .product-flags > li.badge.prdanea-service,
  body .product-flags > li.product-flag.prdanea-service,
  .product-flags .prdanea-service {
    color: #212529 !important;
  }
}
