@media (max-width: 767px) {
  /* Match the existing catalogue selectors so its vertical flag stack becomes a row. */
  :is(body, body:not(#index):not(#product):not(#cart) #js-product-list)
    .product-miniature .product-left .product-image-container > .product-flags-plist {
    inset: 6px 6px auto !important;
    display: flex !important;
    flex-flow: row wrap !important;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 3px;
    width: auto !important;
    max-width: none !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none;
  }

  :is(body, body:not(#index):not(#product):not(#cart) #js-product-list)
    .product-miniature .product-image-container > .product-flags-plist > .product-flag:is(.discount-percentage, .discount, .new),
  body#product #content.page-content > .product-flags > .product-flag:is(.discount-percentage, .discount, .new) {
    position: static !important;
    display: inline-flex !important;
    align-items: center;
    box-sizing: border-box;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100%;
    height: auto !important;
    min-height: 18px !important;
    margin: 0 !important;
    padding: 2px 5px !important;
    border: 0 !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    text-shadow: none !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1.15 !important;
    letter-spacing: 0;
    text-transform: none !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  :is(body, body:not(#index):not(#product):not(#cart) #js-product-list)
    .product-miniature .product-image-container > .product-flags-plist > .product-flag:is(.discount-percentage, .discount, .new)::before,
  :is(body, body:not(#index):not(#product):not(#cart) #js-product-list)
    .product-miniature .product-image-container > .product-flags-plist > .product-flag:is(.discount-percentage, .discount, .new)::after {
    content: none !important;
    display: none !important;
  }

  :is(body, body:not(#index):not(#product):not(#cart) #js-product-list)
    .product-miniature .product-image-container > .product-flags-plist > .product-flag:is(.discount-percentage, .discount),
  body#product #content.page-content > .product-flags > .product-flag:is(.discount-percentage, .discount) {
    background: #bd2328 !important;
    color: #fff !important;
  }

  :is(body, body:not(#index):not(#product):not(#cart) #js-product-list)
    .product-miniature .product-image-container > .product-flags-plist > .product-flag.new,
  body#product #content.page-content > .product-flags > .product-flag.new {
    background: #f3c102 !important;
    color: #111 !important;
  }

  /* The miniature prints the formatted reduction before PrestaShop's fallback flag. */
  :is(body, body:not(#index):not(#product):not(#cart) #js-product-list)
    .product-miniature .product-image-container > .product-flags-plist > .discount-percentage ~ .product-flag.discount {
    display: none !important;
  }

  body#product #content.page-content > .product-flags > .product-flag:is(.discount-percentage, .discount, .new) {
    min-height: 20px !important;
    padding-inline: 7px !important;
  }

  body#product #content.page-content > .product-flags > .product-flag:is(.discount-percentage, .discount) {
    order: 1;
    margin-inline-start: auto !important;
  }
}

@media (max-width: 359px) {
  body:not(#index):not(#product):not(#cart) #js-product-list
    .product-miniature .product-left .product-image-container > .product-flags-plist {
    inset: 4px 4px auto !important;
  }
}
