/* ==========================================================
   CODSHIPX AI CRM — R69-B1
   Orders false-empty suppression + Products action alignment
   ========================================================== */

/* ----------------------------------------------------------
   ORDERS

   "No orders found" remains the authoritative true empty state.
   A short reveal delay prevents the false empty-state flash
   during fast status-tab transitions.
   ---------------------------------------------------------- */

@keyframes cxR69B1OrderEmptyReveal {
  from {
    opacity: 0;
    visibility: hidden;
  }

  to {
    opacity: 1;
    visibility: visible;
  }
}

.r7-orders .cx-native-empty {
  opacity: 0;
  visibility: hidden;

  animation:
    cxR69B1OrderEmptyReveal
    .01s
    linear
    .42s
    forwards;
}

/* Existing loading signal remains immediate. */

.r7-orders .crm-sync-line {
  position: relative;
  z-index: 2;
}

/* ----------------------------------------------------------
   PRODUCTS

   Product row now visually contains:
   1 image
   2 product
   3 price
   4 cost
   5 delivery
   6 availability
   7 stock
   8 actions

   Keep Edit / Archive in the final right-side column.
   ---------------------------------------------------------- */

.r7-products .r63-product-list {
  width: 100%;
  min-width: 0;

  overflow-x: auto;
  overflow-y: visible;

  scrollbar-width: thin;
}

.r7-products .r63-product-row {
  display: grid !important;

  grid-template-columns:
    44px
    minmax(180px, 1.45fr)
    minmax(92px, .72fr)
    minmax(92px, .72fr)
    minmax(92px, .72fr)
    minmax(108px, .80fr)
    minmax(72px, .55fr)
    minmax(128px, auto)
    !important;

  align-items: center !important;

  column-gap: 14px !important;
  row-gap: 8px !important;

  width: 100% !important;
  min-width: 900px !important;

  box-sizing: border-box;
}

/* Explicit action owner when class exists. */

.r7-products
.r63-product-row
> .r63-row-actions {
  grid-column: 8 !important;
  grid-row: 1 !important;

  justify-self: end !important;
  align-self: center !important;

  display: flex !important;

  align-items: center !important;
  justify-content: flex-end !important;

  flex-wrap: nowrap !important;

  gap: 7px !important;

  min-width: 128px !important;
}

/* Structural fallback:
   action block is the final product-row child. */

.r7-products
.r63-product-row
> :last-child {
  grid-column: 8 !important;
  grid-row: 1 !important;

  justify-self: end !important;
  align-self: center !important;
}

/* Keep action controls on one line. */

.r7-products
.r63-product-row
> :last-child button {
  flex: 0 0 auto !important;

  white-space: nowrap !important;

  margin: 0 !important;
}

/* No left-edge spill from action buttons. */

.r7-products
.r63-product-row
> :last-child {
  margin-left: 0 !important;
  transform: none !important;
}

/* Narrow CRM content:
   preserve the correct grid and permit horizontal scrolling
   instead of throwing Actions into a second left-side row. */

@media (max-width: 1180px) {
  .r7-products .r63-product-row {
    min-width: 940px !important;
  }
}

@media (max-width: 820px) {
  .r7-products .r63-product-row {
    min-width: 900px !important;
  }
}

/* Accessibility: reduced-motion users still receive a short
   visibility delay without motion. */

@media (prefers-reduced-motion: reduce) {
  .r7-orders .cx-native-empty {
    animation-duration: .001s !important;
  }
}
