/* Cash desk refinements: one quiet workflow, with search and scanning sharing
   the same primary input. Loaded last to retire older sale-screen overrides. */
.crm-sale-form {
  position: relative;
}

.crm-sale-flow-actions {
  position: absolute;
  top: 0;
  right: 4px;
  z-index: 3;
  display: flex;
  height: 72px;
  align-items: center;
  margin: 0 !important;
}

body.admin-page .crm-sale-flow-actions #crm-sale-clear {
  display: grid;
  width: 34px;
  min-height: 34px;
  padding: 0;
  place-items: center;
  color: #b84a53;
  border: 0;
  border-radius: 50%;
  background: #f4f5f7;
  cursor: pointer;
  transition: color 120ms ease, background-color 120ms ease, transform 120ms ease;
}

body.admin-page .crm-sale-flow-actions #crm-sale-clear svg {
  display: block;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

body.admin-page .crm-sale-flow-actions #crm-sale-clear:hover {
  color: #a91e28;
  background: #feecef;
}

body.admin-page .crm-sale-flow-actions #crm-sale-clear:focus-visible {
  outline: 3px solid rgba(201, 42, 53, .18);
  outline-offset: 2px;
}

body.admin-page .crm-sale-path {
  width: calc(100% - 44px);
  margin: 0 44px 12px 0;
  gap: 4px;
  padding: 4px;
  overflow: visible;
  border: 0;
  border-radius: 14px;
  background: #eef1f5;
}

body.admin-page .crm-sale-path li {
  min-width: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
}

body.admin-page .crm-sale-path li.active {
  z-index: 1;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(26, 32, 44, .07);
}

body.admin-page .crm-sale-path li.active::after {
  display: none;
}

body.admin-page .crm-sale-path li.complete {
  background: rgba(255, 255, 255, .48);
}

body.admin-page .crm-sale-path li > span {
  box-sizing: border-box;
  width: 26px;
  height: 26px;
  border: 0;
  color: #667080;
  background: #dce1e8;
}

body.admin-page .crm-sale-path li.active > span {
  color: #fff;
  background: #3569d4;
  box-shadow: 0 0 0 4px rgba(53, 105, 212, .1);
}

body.admin-page .crm-sale-path li.complete > span {
  position: relative;
  background: #278455;
  box-shadow: 0 0 0 4px rgba(39, 132, 85, .09);
}

body.admin-page .crm-sale-path li.complete > span::before {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 9px;
  height: 5px;
  border-bottom: 2px solid #fff;
  border-left: 2px solid #fff;
  content: "";
  transform: rotate(-45deg);
}

body.admin-page .crm-sale-scanner {
  gap: 8px;
  padding: 10px;
  border: 0;
  border-left: 3px solid #3569d4;
  background: #f3f6fb;
}

body.admin-page .crm-sale-scanner[data-crm-sale-scan-mode="unit"] {
  border: 0;
  border-left: 3px solid #24945c;
}

body.admin-page #crm-sale-scanner-input {
  min-height: 50px;
  padding-right: 72px;
  font-size: 16px;
}

body.admin-page .crm-sale-scanner {
  margin-bottom: 16px;
}

body.admin-page .crm-sale-code-preview {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid #c8d7ef;
  border-radius: 10px;
  background: #fff;
  color: #1b2637;
}

body.admin-page .crm-sale-code-preview[hidden] { display: none; }
body.admin-page .crm-sale-code-preview span { color: #3569d4; font-size: 10px; font-weight: 800; text-transform: uppercase; }
body.admin-page .crm-sale-code-preview b { font-size: 14px; line-height: 1.35; }
body.admin-page .crm-sale-code-preview small { color: #667080; font-size: 11px; }

body.admin-page .crm-module .crm-sale-register .crm-sale-line {
  grid-template-columns: minmax(0, 1fr) auto 132px 112px;
  gap: 18px;
  align-items: start;
  padding: 16px 48px 16px 22px;
}

body.admin-page .crm-sale-line-product,
body.admin-page .crm-sale-line-quantity,
body.admin-page .crm-sale-line-price,
body.admin-page .crm-sale-line-gift-column {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 5px;
}

body.admin-page .crm-sale-line-column-label,
body.admin-page .crm-sale-line-quantity > span,
body.admin-page .crm-sale-line-price > span {
  display: flex;
  min-height: 17px;
  align-items: center;
  color: #858d99;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  line-height: 1;
  text-transform: uppercase;
}

body.admin-page .crm-sale-line-product > span:not(.crm-sale-scan-status) {
  display: flex;
  min-height: 40px;
  align-items: center;
}

body.admin-page .crm-sale-line-product code {
  margin: 0;
}

body.admin-page .crm-sale-line-cost {
  font-size: 11px;
}

body.admin-page .crm-sale-register .crm-sale-scan-status {
  min-height: 16px;
  margin: 1px 0 0;
  font-size: 11px;
}

body.admin-page .crm-sale-line-price input {
  min-height: 40px;
}

body.admin-page .crm-sale-line-quantity input {
  width: 72px;
  min-height: 40px;
  padding: 0 8px;
  border: 1px solid #cbd4e2;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  font-weight: 750;
  text-align: center;
}

body.admin-page .crm-sale-line-gift-column .crm-sale-line-gift {
  margin-top: 0;
}

body.admin-page .crm-sale-line-gift {
  display: inline-flex;
  width: max-content;
  font-size: 11px;
}

.crm-sale-line-gift input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.crm-sale-line-gift span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  color: #747c88;
  border-radius: 999px;
  background: #f3f4f6;
  transition: color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

.crm-sale-line-gift svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
}

.crm-sale-line-gift input:checked + span {
  color: #8b590d;
  background: #fff1d8;
  box-shadow: inset 0 0 0 1px #efd49d;
}

.crm-sale-line-gift input:focus-visible + span {
  outline: 3px solid rgba(168, 102, 18, .18);
  outline-offset: 2px;
}

@media (max-width: 700px) {
  body.admin-page .crm-sale-path {
    width: calc(100% - 38px);
    margin-right: 38px;
  }

  body.admin-page .crm-sale-flow-actions #crm-sale-clear {
    width: 30px;
    min-height: 30px;
  }

  body.admin-page #crm-sale-scanner-input {
    font-size: 15px;
  }

  body.admin-page .crm-module .crm-sale-register .crm-sale-line {
    grid-template-columns: minmax(0, 1fr) auto 116px 104px;
    gap: 10px;
    padding-left: 14px;
  }
}

@media (max-width: 520px) {
  body.admin-page .crm-module .crm-sale-register .crm-sale-line {
    grid-template-columns: minmax(0, 1fr) 72px 104px;
  }

  body.admin-page .crm-sale-line-product { grid-column: 1 / -1; }
  body.admin-page .crm-sale-line-quantity { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  body.admin-page .crm-sale-flow-actions #crm-sale-clear,
  .crm-sale-line-gift span { transition: none; }
}
