.admin-product-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.product-sort-row {
  position: relative;
  transition: opacity .16s ease, background .16s ease, transform .16s ease;
}

.product-sort-row.is-dragging {
  opacity: .38;
  background: #eef8f7;
  transform: scale(.995);
}

.product-sort-row.drop-before::before,
.product-sort-row.drop-after::after {
  position: absolute;
  right: 0;
  left: 0;
  z-index: 2;
  height: 4px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 3px #0b938822;
  content: "";
}

.product-sort-row.drop-before::before { top: -2px; }
.product-sort-row.drop-after::after { bottom: -2px; }

.admin-row .product-drag-handle {
  display: grid;
  place-items: center;
  min-width: 54px;
  padding: 5px 9px;
  border-style: dashed;
  background: #f4faf9;
  color: var(--teal);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.admin-row .product-drag-handle:active { cursor: grabbing; }
.product-drag-handle span { font-size: 22px; line-height: .8; letter-spacing: -6px; transform: rotate(90deg); }
.product-drag-handle small { color: inherit; font-size: 9px; font-weight: 900; }

.image-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(105px,1fr));
  gap: 10px;
}

.image-sort-card {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  transition: opacity .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.image-sort-card.is-primary { border-color: var(--teal); background: #eefaf8; }
.image-sort-card.is-dragging { opacity: .35; }
.image-sort-card.image-drop-before { box-shadow: 4px 0 0 var(--teal); }
.image-sort-card.image-drop-after { box-shadow: -4px 0 0 var(--teal); }
.image-sort-card img { width: 100%; height: 90px; border-radius: 8px; object-fit: cover; }

.image-position {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.image-preview .image-drag-handle,
.image-preview .make-primary-image {
  width: 100%;
  padding: 6px;
  border: 1px dashed #a8cfca;
  border-radius: 7px;
  background: #fff;
  color: var(--teal);
  font-size: 10px;
  font-weight: 900;
}

.image-preview .image-drag-handle { cursor: grab; touch-action: none; user-select: none; }
.image-preview .image-drag-handle:active { cursor: grabbing; }
.image-drag-handle span { display: inline-block; letter-spacing: -5px; transform: rotate(90deg); }
.primary-image-badge { display: grid; place-items: center; min-height: 28px; border-radius: 7px; background: var(--teal); color: #fff; font-size: 10px; }

.image-preview .remove-product-image {
  position: absolute;
  top: 3px;
  left: 3px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  padding: 0;
  border: 1px solid #f1c4cb;
  border-radius: 50%;
  background: #fff3f5;
  color: #ae263c;
  font-weight: 900;
}

.product-panel-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.product-search-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 16px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f7f9fc;
}

.product-search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(430px,100%);
  margin: 0;
  padding: 0 12px;
  border: 1px solid #dce3ec;
  border-radius: 10px;
  background: #fff;
}

.product-search-field:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px #0b938818; }
.product-search-field>span { color: var(--teal); font-size: 23px; line-height: 1; }
.panel .product-search-field input { height: 43px; margin: 0; padding: 0; border: 0; box-shadow: none; background: transparent; }

.product-search-summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.product-search-summary strong { color: var(--navy); font-size: 12px; }
.product-search-summary .text-action { padding: 5px; font-size: 11px; }

.product-order-notice {
  margin: 0 0 12px;
  padding: 9px 12px;
  border-radius: 9px;
  background: #fff8dc;
  color: #6f5710;
  font-size: 12px;
  font-weight: 800;
}

.product-order-field {
  display: grid;
  justify-items: center;
  gap: 3px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.admin-row .product-order-field input {
  width: 66px;
  padding: 8px 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  text-align: center;
  color: var(--navy);
  font-weight: 900;
}

.admin-row .product-delete {
  border-color: #f1c4cb;
  background: #fff3f5;
  color: #ae263c;
}

.admin-row .product-delete:hover {
  background: #ae263c;
  border-color: #ae263c;
  color: #fff;
}

.admin-product-actions button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

@media (max-width: 600px) {
  .product-search-toolbar { align-items: stretch; flex-direction: column; padding: 10px; }
  .product-search-field { width: 100%; }
  .product-search-summary { justify-content: space-between; white-space: normal; }

  .product-panel-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .admin-product-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-product-actions button {
    padding: 7px 9px;
    font-size: 11px;
  }

  .admin-row .product-drag-handle {
    grid-template-columns:20px auto;
    justify-content: center;
    min-width: 0;
  }

  .product-order-field {
    grid-template-columns:auto 54px;
    align-items: center;
  }

  .admin-row .product-order-field input {
    width: 54px;
    padding: 6px 4px;
  }

  .image-preview { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .image-sort-card img { height: 110px; }
}
