/* Product image display + supermarket image picker. */
.product-thumb{
  width:58px;
  height:58px;
  border-radius:11px;
  object-fit:contain;
  padding:0;
  background:#fff;
  border:1px solid #f1f3f5;
}

.market-quick-thumb{
  width:58px;
  height:58px;
  box-sizing:border-box;
  border:1px solid #f1f3f5;
  border-radius:11px;
  padding:0;
  background:#fff;
}
.market-quick-thumb img{
  width:100%;
  height:100%;
  object-fit:contain;
}
.product-image-manager-body{grid-template-columns:300px minmax(0,1fr);}
.product-image-candidate-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
}
.product-image-candidate-thumb{
  width:100%;
  aspect-ratio:1/1;
  min-height:0;
}
@media (max-width:767px){
  .product-thumb,
  .market-quick-thumb{
    width:64px !important;
    height:64px !important;
  }
  .product-card{
    padding-top:10px !important;
    padding-bottom:10px !important;
  }
  .product-image-manager{height:92vh !important;border-radius:20px !important;}
  .product-image-manager-body{grid-template-columns:42% minmax(0,58%);}
  .product-image-candidate-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;}
  .product-image-candidate-card{padding:6px !important;}
}

.product-image-compare-table{
  display:grid;
  grid-template-columns:36px 42px 72px 78px 58px 76px 26px;
  grid-auto-rows:28px;
  gap:4px;
  align-items:center;
  width:max-content;
  max-width:100%;
  overflow-x:auto;
  scrollbar-width:none;
  font-variant-numeric:tabular-nums;
}
.product-image-compare-table::-webkit-scrollbar{display:none;}
#productImageOwnPriceSummary,
#productImageSelectedMarketSummary{display:contents;}
#productImageOwnPriceSummary.hidden,
#productImageSelectedMarketSummary.hidden{display:none !important;}
.product-image-compare-label,
.product-image-compare-source,
.product-image-compare-kind,
.product-image-compare-price,
.product-image-compare-qc,
.product-image-compare-retail,
.product-image-compare-link{
  box-sizing:border-box;
  width:100%;
  height:28px;
  min-width:0;
}
.product-image-compare-label{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  font-size:9px;
  font-weight:800;
  letter-spacing:.025em;
  color:#9ca3af;
}
.product-image-compare-source,
.product-image-compare-kind,
.product-image-compare-price,
.product-image-compare-qc,
.product-image-compare-retail{
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:8px;
  white-space:nowrap;
  font-size:10px;
  font-weight:800;
  line-height:1;
}
.product-image-compare-source{
  padding:0 4px;
  color:#fff;
  background:#111827;
}
.product-image-compare-source-own{
  color:#9ca3af;
  background:#f3f4f6;
}
.product-image-compare-kind{background:#f9fafb;color:#4b5563;}
.product-image-compare-price{background:#ecfdf5;color:#16a34a;}
.product-image-compare-qc{background:#f3f4f6;color:#4b5563;}
.product-image-compare-retail{background:#f3f4f6;color:#374151;}
.product-image-compare-retail>span{margin-right:4px;color:#9ca3af;font-weight:600;}
.product-image-compare-kind-edit{
  padding:0 5px;
  border:1px solid #e5e7eb;
  background:#fff;
}
.product-image-compare-kind-edit select{
  width:100%;
  height:100%;
  background:transparent;
  border:0;
  outline:0;
  font:inherit;
  line-height:1;
  color:inherit;
  text-align:center;
}
.product-image-compare-qc-edit{gap:3px;padding:0 5px;}
.product-image-compare-qc-edit input{
  width:31px;
  height:100%;
  margin:0;
  padding:0;
  background:transparent;
  border:0;
  outline:0;
  text-align:right;
  font:inherit;
  line-height:1;
  color:inherit;
}
.product-image-compare-link{
  display:flex;
  align-items:center;
  justify-content:center;
}
.product-image-compare-link a{
  box-sizing:border-box;
  width:28px;
  height:28px;
  border:1px solid #e5e7eb;
  border-radius:8px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#6b7280;
  background:#fff;
}
.product-image-compare-link a:hover{color:#16a34a;border-color:#bbf7d0;}
.product-image-compare-structure{
  grid-column:4 / 7;
  height:20px;
  display:flex;
  align-items:flex-start;
  padding-top:1px;
  font-size:9px;
  line-height:1.2;
  color:#9ca3af;
  white-space:nowrap;
}
button.product-image-compare-source{
  border:0;
  cursor:pointer;
}
button.product-image-compare-source:hover{background:#1f2937;}
@media (max-width:767px){
  .product-image-compare-table{
    grid-template-columns:32px 40px 58px 74px 58px 70px 26px;
    gap:3px;
  }
  .product-image-compare-link a{width:26px;height:26px;}
  .product-image-compare-structure{grid-column:4 / 7;}
}


button.product-image-compare-source{
  border:0;
  padding:0 4px;
  cursor:pointer;
}
button.product-image-compare-source:hover{
  background:#1f2937;
}

.product-thumb-button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  padding:0;
  margin:0;
  border:0;
  background:transparent;
  border-radius:11px;
  cursor:pointer;
}
.product-thumb-button:focus-visible{outline:2px solid #16a34a;outline-offset:2px;}
.product-thumb-button:hover .product-thumb{border-color:#bbf7d0;}

.product-market-detail-modal{font-variant-numeric:tabular-nums;}
.product-market-detail-hero{
  display:grid;
  grid-template-columns:184px minmax(0,1fr);
  gap:20px;
  align-items:start;
}
.product-market-detail-image{
  width:184px;
  height:184px;
  border:1px solid #e2e8f0;
  border-radius:16px;
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}
.product-market-detail-image img{
  width:100%;
  height:100%;
  object-fit:contain;
  padding:7px;
}
.product-market-detail-copy{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:9px;
  padding-top:1px;
}
.product-market-detail-own-name{
  font-size:15px;
  line-height:1.35;
  font-weight:800;
  color:#111827;
  overflow-wrap:anywhere;
}
.product-market-detail-market-name{
  min-width:0;
  width:100%;
  font-size:12.5px;
  line-height:1.42;
  font-weight:650;
  color:#475569;
  overflow-wrap:anywhere;
}
.product-market-detail-source-row{
  display:flex;
  align-items:center;
  min-height:24px;
}
.product-market-detail-source-link-chip{
  flex:0 0 auto;
  min-height:24px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:4px;
  padding:3px 8px;
  border:1px solid #e2e8f0;
  border-radius:8px;
  background:#f8fafc;
  color:#64748b;
  font-size:9.5px;
  line-height:1.2;
  font-weight:700;
  text-decoration:none;
  white-space:nowrap;
}
.product-market-detail-source-link-chip:hover{
  border-color:#bbf7d0;
  background:#f0fdf4;
  color:#15803d;
}
.product-market-detail-source-link-chip.is-static{cursor:default;}

.product-market-pack-list{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:1px;
}
.product-market-pack-item{
  min-height:28px;
  display:inline-flex;
  align-items:center;
  gap:6px;
  max-width:100%;
  padding:5px 8px;
  border:1px solid #e2e8f0;
  border-radius:9px;
  background:#f8fafc;
  color:#64748b;
  font-size:10.5px;
  line-height:1.25;
}
.product-market-pack-item>strong{
  flex:0 0 auto;
  font-size:10.5px;
  font-weight:750;
  color:#334155;
}
.product-market-pack-item>span{
  min-width:0;
  color:#64748b;
  overflow-wrap:anywhere;
}
.product-market-detail-table{
  margin-top:14px;
  border:1px solid #e2e8f0;
  border-radius:13px;
  overflow:hidden;
}
.product-market-detail-head,
.product-market-detail-row{
  display:grid;
  grid-template-columns:50px 72px minmax(78px,1fr) 48px minmax(70px,1fr);
  gap:6px;
  align-items:center;
  min-height:36px;
  padding:0 10px;
}
.product-market-detail-head{
  background:#f8fafc;
  border-bottom:1px solid #e2e8f0;
  font-size:9px;
  font-weight:700;
  color:#94a3b8;
  text-align:right;
}
.product-market-detail-head span:nth-child(1),
.product-market-detail-head span:nth-child(2){text-align:left;}
.product-market-detail-row{
  background:#fff;
  border-bottom:1px solid #f1f5f9;
  font-size:11px;
  color:#374151;
}
.product-market-detail-row:last-child{border-bottom:0;}
.product-market-detail-side{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:2px;
  font-size:9px;
  font-weight:700;
  color:#6b7280;
}
.product-market-detail-number{
  text-align:right;
  font-weight:750;
  color:#111827;
  white-space:nowrap;
}
@media (max-width:520px){
  .product-market-detail-modal{max-height:90vh !important;border-radius:18px !important;}
  .product-market-detail-hero{
    grid-template-columns:124px minmax(0,1fr);
    gap:12px;
  }
  .product-market-detail-image{
    width:124px;
    height:124px;
    border-radius:14px;
  }
  .product-market-detail-copy{gap:7px;padding-top:0;}
  .product-market-detail-own-name{font-size:13px;}
  .product-market-detail-market-name{
    font-size:10.5px;
    line-height:1.35;
  }
  .product-market-detail-source-row{min-height:21px;}
  .product-market-detail-source-link-chip{
    min-height:21px;
    padding:2px 6px;
    border-radius:7px;
    font-size:8.5px;
  }
  .product-market-pack-list{gap:5px;}
  .product-market-pack-item{
    min-height:25px;
    padding:4px 7px;
    border-radius:8px;
    font-size:9px;
  }
  .product-market-pack-item>strong{font-size:9px;}
  .product-market-detail-head,
  .product-market-detail-row{
    grid-template-columns:40px 60px minmax(62px,1fr) 38px minmax(58px,1fr);
    gap:4px;
    padding:0 7px;
  }
  .product-market-detail-row{font-size:10px;}
  .product-market-detail-head{font-size:8px;}
}

/* Mobile sales card core flow: give product identity its own readable row.
   Quantity remains the same updateCart/qty-edit owner and is always touch reachable. */
@media (max-width:480px){
  /* Main text and stepper share one compact line on a normal phone.
     The old full-width second row left ~50px empty under the price. */
  #tab-ban-hang .product-card > .flex.justify-between.items-center{
    flex-wrap:nowrap;
    align-items:center;
    gap:8px;
  }
  #tab-ban-hang .product-card > .flex.justify-between.items-center > :first-child{
    flex:1 1 auto;
    min-width:0;
    padding-right:0 !important;
  }
  #tab-ban-hang .product-card > .flex.justify-between.items-center > :last-child{
    flex:0 0 132px;
    justify-content:flex-end;
    min-width:132px;
  }
  #tab-ban-hang .product-card .line-clamp-1{
    -webkit-line-clamp:2;
    overflow-wrap:anywhere;
  }
  #tab-ban-hang .product-card button[onclick^="updateCart("]{
    width:40px !important;
    height:40px !important;
    min-width:40px;
    min-height:40px;
  }
  #tab-ban-hang .product-card button[onclick^="updateCart("] i{
    font-size:14px !important;
  }
  #tab-ban-hang .product-card input[data-qty-editor="product"]{
    width:40px !important;
    min-width:40px;
    font-size:16px !important;
  }
  #tab-ban-hang .product-card input[data-line-note-id]{
    min-height:40px;
    font-size:16px !important;
  }
}


/* SPEC-PWA-SALES-TYPE-20261101:
   Product names use the same compact 14px emphasis as debtor names.
   Keep 40px increment/decrement targets and the 16px quantity editor. */
@media (max-width:480px){
  #tab-ban-hang .product-card .line-clamp-1{
    font-size:14px !important;
    line-height:1.35 !important;
    font-weight:700 !important;
  }
  #tab-ban-hang .product-card .sale-product-price-row{
    margin-top:2px !important;
  }
}


/* Existing smallest-phone breakpoint: keep names legible beside photos. */
@media (max-width:340px){
  #tab-ban-hang .product-card > .flex.justify-between.items-center{
    flex-wrap:wrap;
    row-gap:6px;
  }
  #tab-ban-hang .product-card > .flex.justify-between.items-center > :first-child{flex:1 1 100%}
  #tab-ban-hang .product-card > .flex.justify-between.items-center > :last-child{
    flex:1 1 100%;
    justify-content:flex-end;
  }
}
