:root { 
  --pad: 14px; 
  --radius: 10px; 
  --muted: #7a7a7a; 
  --bg: #fff; 
  --card: #fff; 
  --border: #eaeaea; 
  --accent: #1f7aec; 
  --accent-bg: #eaf3ff; 
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}
:root {
  /* Pills background */
  --pill-pink:   #ffd9d9;
  --pill-cream:  #E6E1A8;
  --pill-blue:   #9BD5FF;
  --pill-green:  #B9F089;
  --pill-lime:   #E6F28E;
  --pill-orange: #FFC266;
  --pill-lilac:  #E8D9FF;
  --pill-teal:   #8FD4C0;
  --pill-violet: #C7B5FF;
  --pill-white:  #FFFFFF;

  /* Text & borders */
  --text-primary: #222222;
  --icon-check:  #111111;
  --pill-border: #E5E5E5;
}

* { box-sizing: border-box; }
body { font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; margin: 0; background: var(--bg); color: #111; }
.container { padding: var(--pad); max-width: 900px; margin: 0 auto; }
.page-content { padding: 16px; }
.form-row { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.form-row label { font-size:14px; }
.form-row input[type="text"],
.form-row input[type="password"] { padding:4px 6px; font-size:14px; }
.error { color:#b91c1c; font-size:13px; margin-top:4px; }
h2 { margin: 0 0 10px; font-size: 18px; }
.search { position: sticky; top: 0; background: var(--bg); padding: 10px; z-index: 10; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid #e0e0e0; }
.input-wrap { position: relative; flex: 1; display: flex; }
.input { padding: 10px 15px; width: 100%; font-size: 16px; border: 1px solid #e0e0e0; border-radius: 4px; height: 44px; box-sizing: border-box; }
.clear-btn { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: #f3f3f3; border: 1px solid #e0e0e0; color: #333; border-radius: 50%; width: 24px; height: 24px; line-height: 22px; text-align: center; font-weight: 700; cursor: pointer; display: none; border: none; }
.clear-btn.show { display: inline-block; }

.mr-auto { margin-right: auto; }
.large-font { font-size: 13px !important; line-height: 1.4 !important; }

.top-search { position: sticky; top: 0; background: var(--bg); padding: var(--pad) var(--pad) 10px; z-index: 10; display: flex; gap: 8px; align-items: center; border-bottom: 1px solid var(--border); margin-bottom: 10px;}
    .top-input-wrap { position: relative; flex: 1; }
    .top-input { padding: 10px 36px 10px 12px; width: 100%; font-size: 16px; border: 1px solid var(--border); border-radius: 8px; }
    .top-clear-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: #f3f3f3; border: 1px solid var(--border); color: #333; border-radius: 999px; width: 22px; height: 22px; line-height: 20px; text-align: center; font-weight: 700; cursor: pointer; display: none; }
    .top-clear-btn.show { display: inline-block; }

.hint { color: var(--muted); font-size: 12px; display: none; }
.spinner { display: none; width: 14px; height: 14px; border: 2px solid #ccc; border-top-color: #333; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; margin-left: 6px; }
@keyframes spin { to { transform: rotate(360deg) } }
.results { padding: 0 var(--pad) var(--pad); display: grid; gap: 12px; }
.order { /* border: 1px solid var(--border); */ border-radius: var(--radius); padding: 10px 0; background: var(--card); }
.row { display: grid; grid-template-columns: 1fr; gap: 6px; }
.col { display: grid; grid-template-columns: 110px 1fr; align-items: center; }
.label { color: var(--muted); font-size: 11px; }
.value { color: #333; font-weight: 600; font-size: 13px; }
.items { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 8px; }

 .fab { position: fixed; z-index: 9998; border: 0; border-radius: 999px; padding: 12px 16px; font-weight: 700; box-shadow: 0 10px 22px rgba(0,0,0,.18); cursor: pointer; }
 .fab.fab-kiemhang { right: calc(14px + var(--safe-right)); bottom: calc(16px + var(--safe-bottom)); background: #1f7aec; color: #fff; }
 .fab.fab-hoanthanh { left: calc(14px + var(--safe-left)); bottom: calc(16px + var(--safe-bottom)); background: #12b886; color: #fff; }

 .item.kiemhang-ok .item-content { outline: 2px solid rgba(18,184,134,.35); border-radius: 10px; }
 .item.kiemhang-short .item-content { outline: 2px solid rgba(224,49,49,.35); border-radius: 10px; }
 .kiemhang-badge { position: absolute; top: 8px; right: 8px; z-index: 6; background: rgba(0,0,0,.75); color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 999px; }
/* Order header */
.order-title { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 10px; border-radius:8px; border:1px solid var(--border); background:#f9fafb; margin-bottom:10px; }
.order-title .left { display:flex; align-items:center; gap:8px; font-weight:400; color:#333; font-size:13px; }
.order-title .right { font-weight:700; color:#555; font-size:13px; }
.order-title .logo { width:18px; height:18px; border-radius:4px; background:#ddd; display:inline-block; }
/* Sample partner-specific themes (placeholder, adjust as needed) */
.order-title-ghn { background:#fff7e6; border-color:#ffd8a8; }
.order-title-ghn .left { color:#f36f21; }
/* GHN logo-like box (approx) */
.order-title-ghn .logo { background: linear-gradient(135deg, #1b3c87 0%, #1b3c87 50%, #f36f21 50%, #f36f21 100%); }
.order-title-ghtk { background:#e6fff3; border-color:#a7f3d0; }
.order-title-ghtk .left { color:#00b14f; }
.order-title-ghtk .logo { background:#00b14f; }
.order-title-vnpost { background:#fff0e6; border-color:#ffcc99; }
.order-title-vnpost .left { color:#f7941e; }
.order-title-vnpost .logo { background:#f7941e; }
.order-title-spx, .order-title-shopeexpress { background:#fff0eb; border-color:#ffc4b3; }
.order-title-spx .left, .order-title-shopeexpress .left { color:#ee4d2d; }
.order-title-spx .logo, .order-title-shopeexpress .logo { background:#ee4d2d; }
.order-title-ninjavan { background:#ffeef1; border-color:#ffc7cd; }
.order-title-ninjavan .left { color:#e30613; }
.order-title-ninjavan .logo { background:#e30613; }
.order-title-jt, .order-title-jtexpress { background:#ffecec; border-color:#ffb3b3; }
.order-title-jt .left, .order-title-jtexpress .left { color:#d71920; }
.order-title-jt .logo, .order-title-jtexpress .logo { background:#d71920; }
/* E-commerce platforms */
.order-title-shopee { background:#fff0eb; border-color:#ffc4b3; }
.order-title-shopee .left { color:#ee4d2d; }
.order-title-shopee .logo { background:#ee4d2d; }
.order-title-tiktok { background:#eefcff; border-color:#b3ecff; }
.order-title-tiktok .left { color:#25f4ee; }
.order-title-tiktok .logo { background: linear-gradient(135deg, #25f4ee 0%, #25f4ee 50%, #fe2c55 50%, #fe2c55 100%); }
.order-title-lazada { background:#f4f0ff; border-color:#d5c8ff; }
.order-title-lazada .left { color:#1a53ff; }
.order-title-lazada .logo { background: linear-gradient(135deg, #ff5a00 0%, #ff5a00 33%, #ffb700 33%, #ffb700 66%, #1a53ff 66%, #1a53ff 100%); }
.platform-logo {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  object-fit: contain;
  margin-right: 6px;
  vertical-align: middle;
}
.item { position: relative; /* overflow: hidden; */ touch-action: pan-y; }
/* Swipeable content */
.item-content { position: relative; z-index: 2; display: grid; grid-template-columns: 40% 1fr; gap: 12px; align-items: center; padding: 10px 0; background: #fff; width: 100%; transform: translateX(0); transition: transform .18s ease; touch-action: pan-y; }
.item img { width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 10px; background: #f2f2f2; }
.item .meta { display: grid; gap: 0px; }
/* Actions tray on the right */
/* Actions tray stays docked at right=0, hidden under content until content slides left */
.item-actions { position: absolute; z-index: 1; top: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 1fr; gap: 6px; padding: 8px; background: #fff; }
.item-actions .btn { display: flex; align-items: center; justify-content: center; padding: 0 10px; font-size: 12px; color: #fff; border-radius: 8px; border: 0; cursor: pointer; height: 100%; }
.item-actions .btn .icon { width: 14px; height: 14px; margin-right: 6px; display: inline-block; }
.item-actions .btn .icon svg { width: 100%; height: 100%; display: block; fill: currentColor; }
.btn.btn-thieu { background: #e03131; } /* Thiếu hàng: red */
.btn.btn-het { background: #f59f00; }   /* Hết hàng: amber */
.btn.btn-detail { background: #1f7aec; }
.btn.btn-laysau { background: #495057; }
.btn.btn-print-label { background: var(--pill-teal); }
/* More (three-dots) button to open actions */
.more-btn { position: absolute; bottom: 6px; right: 10px; width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--border); background: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; z-index: 3; }
.more-btn svg { width: 18px; height: 18px; fill: #666; }
.item .title { font-size: 13px; color: #333; font-weight: 400; }
.muted { color: var(--muted); font-size: 12px; }
.attrs { display: flex; flex-wrap: wrap; gap: 6px; }
.badges { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.badge { padding: 4px 8px; border-radius: 999px; font-size: 12px; }
.badge.qty { background: var(--accent-bg); color: var(--accent); font-weight: 700; } /* same as attr when = 1 */
.badge.qty.warn { background: #f76707; color: #fff; } /* strong orange for >1 */
.badge.price { background: #f6f6f6; color: #333; }
.badge.code { background: var(--pill-lilac); color: #333; font-weight:600; }
.badge.classif { background: #f6f6f6; color: var(--muted); }

.invbal-list .badge { font-size: 14px; }

/* Cancelled orders */
.order-cancelled-banner {
  margin: 10px 0 0 0;
  padding: 18px 10px;
  border-radius: 0;
  background: #ff6a6a;
  color: #fff;
  font-weight: 700;
  text-align: center;
}

.order.order-cancelled .item-actions .btn:disabled,
.order.order-cancelled .more-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}


/* Dòng 1: shortName – nhỏ hơn, không đậm */
.products-info-name,
.item .title-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Dòng 2: phân loại – to, đậm, không badge */
.badge.products-info-attr,
.item .attr-text {
  font-size: 14px;      
  font-weight: 500;
  color: #111;
  margin-bottom: 2px;
  padding: 4px 8px;
  background: var(--pill-lime);
}

/* Dòng 3: xQty – badge chính, cỡ bằng dòng 1 */
.badge.qty.qty-main {
  font-size: 14px;
  font-weight: 500;
  padding: 4px 8px;
}

/* xQty = 1: màu đen, nền xám nhạt */
.badge.qty.qty-main.single {
  background: #e5e7eb;
  color: #111;
}

/* xQty > 1: màu chú ý hơn */
.badge.qty.qty-main.warn {
  background: var(--pill-orange);  /* cam đậm hơn */
  color: var(--text-primary);
}

/* Dòng 4: giá + mã – badge nhỏ hơn */
.badges-small .badge {
  font-size: 11px;
  padding: 2px 6px;
}

.pt-12 {
  padding-top: 12px;
}

/* Ví dụ class chung cho pill */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--pill-pink); /* đổi theo từng loại */
}

/* Icon tròn trắng bên trái */
.pill__icon {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--pill-white);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--icon-check);
  font-size: 13px;
}

/* Status badges */
.badge.status { font-weight:700; }
.status-laysau { background: var(--accent-bg); color: var(--accent); border: 1px solid #fff; border-left: 0; }
.status-thieu { background: #fff0f0; color: #c92a2a; }
.status-het { background: #fff7e6; color: #d9480f; }
.status-extra {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  z-index: 4;
  color: #ffffff;
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.25);
}

.status-extra.status-het-hang {
  background: #f5a623;
}

.status-extra.status-dut-hang {
  background: #6f42c1;
}
.badge-active { background:#e0f7e9; color:#05642c; }
.badge-inactive { background:#fde7e7; color:#b71c1c; }
/* Order footer */
.order-footer { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); display:flex; justify-content:flex-end; color:#555; font-size:12px; }
.order-footer .count { font-weight:700; margin-left:0px; color:#333; }
.badge.attr { background: var(--accent-bg); color: var(--accent); font-weight: 700; }

/* Lightbox for image zoom */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: none; align-items: center; justify-content: center; z-index: 1000; }
.lightbox img { max-width: 95vw; max-height: 90vh; width: 100%; height: auto; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.lightbox .close { position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,.9); border: 0; border-radius: 999px; width: 36px; height: 36px; font-size: 18px; font-weight: 700; cursor: pointer; }

/* Product Details Modal */
.product-modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: none; align-items: stretch; justify-content: center; z-index: 1001; padding: 0; }
.product-modal.show { display: flex; animation: fadeIn 0.2s ease; }
.product-content { background: white; border-radius: 0; width: 100%; max-width: 100%; max-height: 100vh; overflow-y: auto; box-shadow: 0 4px 20px rgba(0,0,0,0.15); }
.product-header { padding: 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.product-header h3 { margin: 0; font-size: 18px; color: #333; }
.close-product { background: none; border: none; font-size: 24px; cursor: pointer; color: #666; padding: 0; line-height: 1; }
.product-body { padding: 16px; }
.product-image { width: 100%; height: 200px; margin-bottom: 16px; background: #f8f8f8; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.product-image img { max-width: 100%; max-height: 100%; object-fit: contain; }
.detail-row { display: flex; margin-bottom: 12px; line-height: 1.5; }
.detail-row .label { font-weight: 600; color: #555; min-width: 100px; margin-right: 12px; }
.detail-row .value { flex: 1; color: #333; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (min-width: 500px) {
  .product-body { display: flex; gap: 20px; }
  .product-image { width: 200px; height: 200px; margin-bottom: 0; }
}

@media (min-width: 640px) {
  .product-modal { align-items: center; padding: 20px; }
  .product-content { border-radius: 12px; width: 100%; max-width: 500px; max-height: 90vh; }
  .container { padding: 18px; }
  .results { padding: 0 18px 18px; }
  .row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Shared utility and component classes */
.card { border-radius:10px; padding:0; margin:10px 0; background:#fff; }
.card-row { display:flex; align-items:center; gap:12px; }
.thumb-50 { width:50px; height:50px; object-fit:cover; border-radius:8px; background:#f2f2f2; }
.thumb-60 { width:60px; height:60px; object-fit:cover; border-radius:8px; background:#f2f2f2; }
.subtle { color:#666; font-size:12px; }
.flex-1 { flex:1; }
.min-w-0 { min-width:0; }

/* Products page: list row styles */
.products-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  background: #f2f2f2;
  cursor: pointer;
}

.products-info-fullname {
  font-size: 0.7em;
}

/* .products-info-name {
  font-weight: 600;
} */

.products-info-attr {
  font-size: 12px;
}

.products-info-code {
  font-size: 12px;
  color: #6b7280;
}

.products-price-cell {
  text-align: left;
  justify-content: flex-start !important;
  font-weight: 600;
  font-size: 12px;
}

.products-img-cell {
  vertical-align: top;
}

/* Generic layout utilities */
.items-center { align-items: center; }
.justify-end { justify-content: flex-end; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }

/* Generic error message block */
.error-message {
  display: none;
  color: #b91c1c;
  font-size: 13px;
  margin-top: 4px;
}

/* Products page: search row */
.products-search-row {
  flex-wrap: wrap;
}
.products-search-input {
  flex: 1;
  min-width: 200px;
}

/* Modal helpers */
.modal-product-name {
  word-break: break-word;
}

/* Products page: results layout */
.products-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.products-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}

.products-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.products-actions {
  display: flex;
  align-items: flex-start;
}

.products-empty {
  padding: 10px 4px;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 600px) {
  .products-row {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    grid-template-areas:
      'img info'
      'img footer';
  }
  .products-img-cell { grid-area: img; }
  .products-info { grid-area: info; }
  .products-price-cell,
  .products-actions {
    grid-area: footer;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
  }
}

/* Lấy sau page specific styles */
.page-lay-sau {
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
}

.page-lay-sau .title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.page-lay-sau .order-list-header {
  font-weight: bold;
  margin: 12px 0 0 12px;
  color: #333;
  font-size: 15px;
}

.page-lay-sau .order-details {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 12px;
  min-height: 24px;
}

.page-lay-sau .order-details img {
  vertical-align: middle;
  margin-right: 4px;
  border-radius: 0;
  width: 16px;
  height: 16px;
}

.page-lay-sau .product-actions {
  margin-top: 10px;
  text-align: left;
  padding: 0 10px 10px;
  width: 100%;
  box-sizing: border-box;
}

.page-lay-sau .product-actions .btn {
  margin: 0;
}

.page-lay-sau .fulfill-btn {
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-lay-sau .fulfill-btn:hover {
  background-color: #218838;
}

.page-lay-sau .modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.page-lay-sau .modal.show {
  display: flex;
}

.page-lay-sau .modal-content {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.page-lay-sau .modal-header {
  padding: 16px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-lay-sau .modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
}

.page-lay-sau .modal-body {
  padding: 20px;
}

.page-lay-sau .modal-footer {
  padding: 16px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.page-lay-sau .close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.header-actions {
  display: flex;
  gap: 12px;
}

/* Product list */
.product-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  /* gap: 16px;
  margin-top: 20px;
  margin-bottom: 60px; */
}

.product-item {
  background: white;
  border-radius: 8px;
  /* box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); */
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.product-item.expanded {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.order-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  background: #f8f9fa;
  /* border-top: 1px solid #e9ecef; */
}

.product-item.expanded .order-list {
  max-height: 500px;
  overflow-y: auto;
}

.order-item {
  padding: 12px 16px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-item:last-child {
  border-bottom: none;
}

.order-info {
  flex: 1;
}

.order-code {
  font-weight: 500;
  color: #1971c2;
  margin-bottom: 4px;
}

.order-qty {
  font-size: 13px;
  color: #6c757d;
}

.order-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 12px;
}

.customer-name {
  color: #5c636a;
  font-weight: normal;
  margin-left: 4px;
}

.order-date {
  color: #6c757d;
  font-style: italic;
}

.product-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.item-content {
  display: flex;
  align-items: flex-start;
  padding: 12px 0 12px 10px;
  gap: 12px;

  border: 1px solid #f5f5f5;
  margin-bottom: 10px;
  background-color: #fdfdfd;
  border-radius: 8px;
}

.item-content img {
  width: 40%;
  max-width: 100px;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  background: #f8f9fa;
  cursor: pointer;
}

.meta {
  flex: 1;
  min-width: 0;
}

.title {
  font-weight: 500;
  margin-bottom: 6px;
  color: #333;
}

.attrs {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.attrs-left {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.qty-wrapper {
  margin-left: auto;
  display: flex;
  justify-content: flex-end;
  margin-right: 0px;
  /* margin-bottom: 6px; */
}

.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.4;
}

.badge.qty {
  background: #e9ecef;
  color: #495057;
}

.badge.qty.warn {
  background: #fff3bf;
  color: #e67700;
}

.badge.classif {
  background: #e7f5ff;
  color: #1971c2;
}

.badge.attr {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  color: #495057;
}

.badges {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.product-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: pointer;
  transition: transform 0.2s;
}

.product-img:hover {
  transform: scale(1.05);
}

.product-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: #6c757d;
  background: #f1f3f5;
}

.product-info {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-name {
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 12px;
  color: #333;
  line-height: 1.4;
}

.product-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.product-qty {
  background: #e9ecef;
  color: #495057;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
}

.product-code {
  background: #e7f5ff;
  color: #1971c2;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
}

.product-actions {
  margin-top: auto;
}

/* Loading indicator */
.loading-indicator {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
}

.loading-indicator p {
  margin-top: 12px;
  color: #6c757d;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: #007bff;
  animation: spin 1s ease-in-out infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty state */
.empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.7;
}

.empty-state h3 {
  margin: 0 0 8px;
  color: #343a40;
  font-size: 18px;
}

.empty-state p {
  margin: 0;
  color: #6c757d;
  max-width: 400px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.btn-primary {
  background: #007bff;
  color: white;
  border-color: #007bff;
}

.btn-primary:hover {
  background: #0069d9;
  border-color: #0062cc;
}

.btn-outline {
  background: transparent;
  border-color: #dee2e6;
  color: #495057;
}

.btn-outline:hover {
  background: #f8f9fa;
  border-color: #ced4da;
}

.btn-sm {
  padding: 4px 12px;
  font-size: 13px;
}

.btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.lightbox img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.lightbox .close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox .close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .header-actions {
    width: 100%;
  }
  
  .btn {
    /* width: 100%; */
    min-width: 44px;
  }
  .label-preview-overlay .btn {
    min-width: 64px;
  }
  
  .product-list {
    grid-template-columns: 1fr;
  }
}
.space-between { display:flex; align-items:center; justify-content:space-between; }
.border-top-dashed { border-top:1px dashed #eee; }
.mt-10 { margin-top:10px; }
.mt-4 { margin-top:4px; }
.gap-8 { display:flex; gap:8px; }

/* Global app loading overlay (shown on page navigation) */
.app-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1300;
}

.app-loading-overlay.show {
  display: flex;
}

.app-loading-spinner {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 3px solid rgba(148, 163, 184, 0.6);
  border-top-color: #1f7aec;
  animation: spin 0.8s linear infinite;
}

/* Shared checkbox choice row (for roles/permissions, etc.) */
.choice-row {
  padding:4px 2px;
  margin-bottom:2px;
  line-height:1.4;
  min-height:34px;
  display:flex;
  align-items:center;
}
.choice-row label {
  display:flex;
  align-items:center;
  gap:8px;
  width:100%;
}
.choice-row input[type="checkbox"] {
  width:18px;
  height:18px;
  flex-shrink:0;
}

/* Inline variant: allow multiple choices on a single row (e.g. radio group in settings) */
.choice-row-inline label {
  width:auto;
}

/* More utilities */
.fw-700 { font-weight:700; }
.fw-600 { font-weight:600; }
.py-8 { padding-top:8px; padding-bottom:8px; }
.cursor-pointer { cursor:pointer; }
.flex { display:flex; }
.gap-12 { gap:12px; }
.flex-wrap { flex-wrap: wrap; }

/* Modal (shared) */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.5); display:none; align-items:center; justify-content:center; z-index:1102; }
.modal-overlay.show { display:flex; }
.modal-card { background:#fff; border-radius:12px; width:90%; max-width:360px; padding:16px; box-shadow:0 10px 30px rgba(0,0,0,.25); }

/* Mobile tweak: avoid iOS keyboard shifting popup vs caret by anchoring modal near top */
@media (max-width: 768px) {
  .modal-overlay {
    align-items: flex-start;
    justify-content: center;
    padding-top: 24px;
  }

  .modal-card {
    margin: 0 12px;
    width: calc(100% - 24px);
    max-height: 80vh;
    overflow-y: auto;
  }
}
.modal-title { margin:0 0 10px; font-size:18px; }
.modal-info { color:#666; font-size:13px; margin-bottom:8px; }
.modal-input { width:100%; padding:10px; border:1px solid #e5e7eb; border-radius:8px; }
.modal-actions { display:flex; gap:10px; justify-content:flex-end; }

/* Make the primary action button in popups (e.g. In) wider for easier tapping */
.modal-actions .btn-primary {
  padding-left: 18px;
  padding-right: 18px;
}

/* Label print quantity modal (inner layout) */
.modal-header {
  margin-bottom: 4px;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.form-group {
  margin: 0;
}

.form-group label {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
  color: #374151;
}

.form-control {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  font-size: 14px;
  box-sizing: border-box;
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

/* Label print preview overlay */
.label-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1103;
}

.label-preview-card {
  background: #fff;
  border-radius: 12px;
  width: 92%;
  max-width: 420px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.label-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
}

.label-preview-title {
  font-size: 16px;
  font-weight: 600;
}

.label-preview-header-actions {
  display: flex;
  gap: 8px;
}

.label-preview-content {
  padding: 16px;
  overflow-y: auto;
}

.label-preview-row {
  background: #f9fafb;
  border-radius: 8px;
  padding: 5px;
  border: 1px dashed #e5e7eb;
}

.label-preview-row-1x {
  display: flex;
  justify-content: center;
  max-width: 180px; /* 170px label + 2*4px horizontal padding */
  margin: 0 auto;
}

.label-preview-row-1x .label-preview-item {
  width: 170px;
}

.label-preview-row-2x {
  display: flex;
  gap: 0;
  width: 350px;
}

.label-preview-row-2x .label-preview-item {
  flex: 0 0 170px;
  min-width: 0;
}

.label-preview-item {
  background: #fff;
  border-radius: 6px;
  padding: 6px 8px;
  border: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: 110px;
  justify-content: flex-start;
  overflow: hidden;
}

.label-preview-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.label-preview-brand {
  font-size: 10px;
  font-weight: 700;
}

.label-preview-name {
  font-size: 10px;
  font-weight: 500;
}

.label-preview-barcode {
  margin: 2px 0;
  height: 40px;
  background-image: repeating-linear-gradient(
    to right,
    #111 0,
    #111 2px,
    transparent 2px,
    transparent 4px
  );
}

.label-preview-code {
  font-size: 10px;
}

.label-preview-attr {
  font-size: 9px;
  color: #4b5563;
}

.label-preview-note {
  justify-content: center;
}

.label-preview-note-line {
  font-size: 11px;
  font-weight: 600;
}

.label-preview-more {
  margin-top: 8px;
  font-size: 12px;
  color: #4b5563;
  text-align: center;
}

/* Toasts (shared) */
.toast-root {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

@media (max-width: 900px) {
  .page-orders-search {
    padding-bottom: 96px;
  }

  .page-orders-search #btnScanOrderCode.tb-orders-scan {
    position: fixed;
    left: 50%;
    bottom: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 1098;

    width: 80px;
    height: 56px;
    border-radius: 999px;

    background: #2563eb;
    color: #fff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  }

  .page-orders-search #btnScanOrderCode.tb-orders-scan svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
  }
}

.toast { border:1px solid #e5e7eb; padding:10px 12px; border-radius:8px; box-shadow:0 4px 14px rgba(0,0,0,.08); min-width:200px; transition: opacity .3s; }
.toast-info { background:#eff6ff; color:#1e3a8a; }
.toast-success { background:#ecfdf5; color:#065f46; }
.toast-error { background:#fee2e2; color:#991b1b; }

/* Progress */ 
.content-wrapper { padding:var(--pad); border:1px solid #eee; border-radius:8px; }

/* Sync status list */
.status-list { display:flex; flex-direction:column; gap:6px; font-size:13px; margin-top:4px; }
.status-row { padding:6px 8px; border-radius:6px; border:1px solid #e5e7eb; background:#f9fafb; }
.status-label-ok { color:#047857; }
.status-label-error { color:#b91c1c; }
