.p-tools {
  position: relative;
}

.p-tools .pr-action {
  position: relative;
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  width: 100%;
}

.p-tools .pr-action .add-to-cart-button,
.p-tools .pr-action .btn-cart {
  position: relative;
  z-index: 2;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.listing-qty-floating {
  position: absolute;
  top: calc(100% - 1px);
  right: 0;
  left: auto;
  z-index: 3;
  display: flex;
  align-items: stretch;
  width: 96px;
  height: 46px;
  border: 1px solid #d8d8d8;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateX(6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  pointer-events: none;
}

.product:hover .listing-qty-floating,
.p-tools:hover .listing-qty-floating,
.p-tools:focus-within .listing-qty-floating {
  opacity: 0.9;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}

.listing-qty-floating__input {
  width: 58px;
  min-width: 58px;
  border: 0;
  text-align: center;
  font-size: 15px;
  color: #222;
  background: #fff;
  outline: none;
  padding: 0 6px;
  -moz-appearance: textfield;
}

.listing-qty-floating__input::-webkit-outer-spin-button,
.listing-qty-floating__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.listing-qty-floating__buttons {
  display: flex;
  flex-direction: column;
  width: 36px;
  border-left: 1px solid #d8d8d8;
}

.listing-qty-floating__btn {
  flex: 1;
  border: 0;
  background: #fff;
  color: #555;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  transition: background 0.15s ease;
}

.listing-qty-floating__btn:hover {
  background: #f5f5f5;
}

.listing-qty-floating__btn + .listing-qty-floating__btn {
  border-top: 1px solid #d8d8d8;
}

/* jemné zúžení žlutého tlačítka, aby vedle něj byl prostor */
.p-tools .pr-action .add-to-cart-button,
.p-tools .pr-action .btn-cart {
  min-width: 124px;
}

/* mobil */
@media (max-width: 767px) {
  .p-tools .pr-action {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;          /* důležité: nezalamovat */
    justify-content: flex-start;
    align-items: stretch;
    gap: 8px;
    width: 100%;
  }

  .listing-qty-floating {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    bottom: auto;
    width: 88px;
    height: 42px;
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
    box-shadow: none;
    flex: 0 0 88px;
    order: 1;
  }

  .listing-qty-floating__input {
    width: 52px;
    min-width: 52px;
    font-size: 14px;
  }

  .listing-qty-floating__buttons {
    width: 32px;
  }

  .listing-qty-floating__btn {
    font-size: 16px;
  }

  .p-tools .pr-action .add-to-cart-button,
  .p-tools .pr-action .btn-cart {
    order: 2;
    flex: 0 0 48px;             /* pevná šířka ikonky */
    min-width: 48px;
    width: 48px;
    max-width: 48px;
    min-height: 42px;
    height: 42px;
    padding: 0;
    position: relative;
    justify-content: center;
    display: inline-flex;
  }

  /* schovat text */
  .p-tools .pr-action .add-to-cart-button span,
  .p-tools .pr-action .btn-cart span {
    display: none;
  }

  /* schovat původní ikonku */
  .p-tools .pr-action .add-to-cart-button::before,
  .p-tools .pr-action .btn-cart::before {
    display: none;
  }

  /* naše SVG ikonka */
  .p-tools .pr-action .add-to-cart-button::after,
  .p-tools .pr-action .btn-cart::after {
    content: "";
    width: 20px;
    height: 20px;
    background: url('/user/documents/upload/dokosiku.svg') no-repeat center;
    background-size: contain;
    display: block;
  }
}

/* menší notebooky / užší listing */
@media (min-width: 768px) and (max-width: 1280px) {
  .listing-qty-floating {
    width: 90px;
    height: 44px;
  }

  .listing-qty-floating__input {
    width: 54px;
    min-width: 54px;
    font-size: 14px;
  }

  .listing-qty-floating__buttons {
    width: 34px;
  }

  .p-tools .pr-action .add-to-cart-button,
  .p-tools .pr-action .btn-cart {
    min-width: 116px;
    min-height: 44px;
  }
}

@media (max-width: 767px) {
  .p-tools,
  .p-tools .pr-action {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .p-tools .pr-action > * {
    float: none !important;
  }

  .listing-qty-floating {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;
    bottom: auto !important;
    display: flex !important;
    flex: 0 0 88px !important;
    width: 88px !important;
    height: 42px !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    pointer-events: auto !important;
    box-shadow: none !important;
    margin: 0 !important;
    order: 1 !important;
  }

  .p-tools .pr-action .add-to-cart-button,
  .p-tools .pr-action .btn-cart {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 48px !important;
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    height: 42px !important;
    min-height: 42px !important;
    margin: 0 !important;
    padding: 0 !important;
    order: 2 !important;
  }

  .p-tools .pr-action .add-to-cart-button span,
  .p-tools .pr-action .btn-cart span {
    display: none !important;
  }

  .p-tools .pr-action .add-to-cart-button::before,
  .p-tools .pr-action .btn-cart::before {
    display: none !important;
  }

  .p-tools .pr-action .add-to-cart-button::after,
  .p-tools .pr-action .btn-cart::after {
    content: "";
    display: block;
    width: 20px;
    height: 20px;
    background: url('/user/documents/upload/dokosiku.svg') no-repeat center;
    background-size: contain;
  }
}