/* Bổ sung cho bản chạy thật (bản mẫu không có màn đăng nhập, mục "sắp có") */
.login { min-height: 100vh; width: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; }
.login-card h2 { margin: 0; font-size: 18px; }
.brand-l { display: flex; gap: 12px; align-items: center; margin-bottom: 4px; }
.brand-l img { width: 48px; height: 48px; }
.brand-l b { display: block; font-size: 18px; color: var(--brand); }
.brand-l small { color: var(--muted); }
.err { color: var(--warn); min-height: 1.4em; margin: 0; }
.nav.soon { opacity: .55; }
.soon-t { margin-left: auto; font-style: normal; font-size: 10px; background: rgba(255,255,255,.12); padding: 1px 6px; border-radius: 99px; }
.side-foot .link { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
#toast.bad { background: var(--warn); }
.modal .login-card, .modal-body.login-card { box-shadow: none; width: 100%; }
.timeline li.click { cursor: pointer; }
.pad { padding: 14px; }
/* Bảng trong ngăn chi tiết / hộp thoại: không bị co dẹt, không ép rộng 760px như bảng toàn trang */
.drawer-body > *, .modal-body > * { flex-shrink: 0; }
.drawer .table-wrap table { min-width: 0; }
.modal .table-wrap table.lot-table { min-width: 720px; }
.lot-table input, .lot-table select { width: 100%; min-width: 90px; }
.kv b.big { font-size: 17px; color: var(--brand); }
.drawer .link { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font-weight: 600; text-decoration: underline; }
/* Phiếu bán hàng: khi in chỉ in phiếu, khổ giấy nhiệt 80mm */
.receipt { max-width: 320px; margin: 0 auto; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.receipt > b { font-size: 15px; text-align: center; }
.receipt > small { text-align: center; color: var(--muted); }
.receipt p { margin: 0; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td { padding: 4px 0; border-bottom: 1px dashed var(--line); vertical-align: top; }
.receipt .r { text-align: right; }
.big-ok code { font-size: 22px; letter-spacing: 1px; background: var(--brand-2); padding: 6px 12px; border-radius: 8px; }
.task .script { margin-top: 6px; }
@media print {
  body * { visibility: hidden; }
  #receipt, #receipt * { visibility: visible; }
  #receipt { position: absolute; left: 0; top: 0; width: 72mm; max-width: none; }
  @page { size: 80mm auto; margin: 4mm; }
}
/* Trang Kết nối nền tảng */
.conns { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin-bottom: 8px; }
.conn { display: flex; flex-direction: column; gap: 10px; }
.conn.planned { opacity: .75; }
.conn .ok-t { color: var(--brand); background: var(--brand-2); }
.conn-form { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.conn code { word-break: break-all; }
.switch input { width: 18px; height: 18px; }

/* Sổ quỹ & công nợ */
.pos-t { color: #15803d; }
.neg-t { color: #b91c1c; }
tr.cancelled td { color: var(--muted, #888); }
tr.cancelled td:nth-child(-n+7) b, tr.cancelled td:nth-child(-n+5) { text-decoration: line-through; }
.tag.ok { background: #dcfce7; color: #15803d; }
.tag.muted { opacity: .6; }
.print-only { display: none; }
@media print { .print-only { display: block; } }
/* Tem mã vạch: khung tem theo mm, xem trước trên màn hình, khi in chỉ in khung tem (khổ giấy riêng từng loại) */
.lab { box-sizing: border-box; width: 35mm; height: 22mm; padding: 1mm 1.5mm; overflow: hidden; display: flex; flex-direction: column; font: 6.5pt/1.15 Arial, sans-serif; color: #000; background: #fff; break-inside: avoid; }
.lab-name { font-size: 6.5pt; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lab-l1, .lab-l2 { font-size: 6pt; white-space: nowrap; overflow: hidden; }
.lab-bc { flex: 1; min-height: 0; display: flex; }
.lab-bc svg { width: 100%; height: 100%; }
.roll1 .lab { width: 50mm; height: 30mm; font-size: 8pt; } .roll1 .lab-name { font-size: 8pt; } .roll1 .lab-l1, .roll1 .lab-l2 { font-size: 7.5pt; }
.a4 .lab { width: 38.1mm; height: 21.2mm; }
.label-preview { display: flex; justify-content: center; padding: 10px; background: var(--bg, #f4f4f4); border-radius: 8px; margin-bottom: 10px; }
.label-preview .lab { outline: 1px dashed #999; transform: scale(1.6); transform-origin: top center; margin-bottom: calc(22mm * .6); }
.label-preview.roll1 .lab { margin-bottom: calc(30mm * .6); }
#labels { display: none; }
@page lab-roll2 { size: 70mm 22mm; margin: 0; }
@page lab-roll1 { size: 50mm 30mm; margin: 0; }
@page lab-a4 { size: A4; margin: 10.7mm 4.75mm; }
@media print {
  body.printing-labels > *:not(#labels) { display: none !important; }
  body.printing-labels #labels, body.printing-labels #labels * { visibility: visible; }
  body.printing-labels #labels { display: flex; flex-wrap: wrap; position: static; }
  #labels.roll2 { page: lab-roll2; width: 70mm; }
  #labels.roll1 { page: lab-roll1; width: 50mm; }
  #labels.a4 { page: lab-a4; display: grid; grid-template-columns: repeat(5, 38.1mm); grid-auto-rows: 21.2mm; }
}
/* Giấy 100×150mm (máy in vận đơn): 12 tem 50×25mm, hoặc 1 tem lớn mỗi tờ */
.a6 .lab { width: 50mm; height: 25mm; padding: 1.5mm 2mm; font-size: 8pt; } .a6 .lab-name { font-size: 8pt; } .a6 .lab-l1, .a6 .lab-l2 { font-size: 7.5pt; }
.a6big .lab { width: 100mm; height: 150mm; padding: 8mm; font-size: 16pt; justify-content: center; gap: 4mm; }
.a6big .lab-name { font-size: 18pt; -webkit-line-clamp: 3; } .a6big .lab-l1, .a6big .lab-l2 { font-size: 14pt; white-space: normal; } .a6big .lab-bc { flex: 0 0 45mm; }
.label-preview.a6 .lab { margin-bottom: calc(25mm * .6); }
.label-preview.a6big .lab { transform: scale(.45); margin-bottom: calc(150mm * -.55); }
@page lab-a6 { size: 100mm 150mm; margin: 0; }
@page lab-a6big { size: 100mm 150mm; margin: 0; }
@media print {
  #labels.a6 { page: lab-a6; display: grid; grid-template-columns: repeat(2, 50mm); grid-auto-rows: 25mm; width: 100mm; }
  #labels.a6big { page: lab-a6big; display: block; width: 100mm; }
  #labels.a6big .lab { break-after: page; }
}
/* Bảng giá theo nhóm */
.pricebook th small, .pricebook td small { display: block; font-weight: normal; }
.pb-in { width: 110px; text-align: right; }
.pb-in.own, b.own { font-weight: 700; color: var(--brand, #2e6b12); }
.pb-in.dirty { background: #fff7cc; }
tr.loss td { background: #fff1f1; }
.test-banner { background: #b91c1c; color: #fff; padding: 6px 12px; font-size: 13px; font-weight: 600; text-align: center; }
/* Nhãn giao hàng / phiếu soạn hàng khổ 100×150 */
.ship-lab { width: 100mm !important; height: 150mm !important; padding: 5mm !important; font-size: 10pt !important; gap: 3mm; justify-content: flex-start !important; display: flex; flex-direction: column; }
.ship-lab .sl-from { font-size: 8.5pt; border-bottom: 1px dashed #000; padding-bottom: 2mm; }
.ship-lab .sl-to { display: flex; flex-direction: column; font-size: 12pt; gap: 1mm; }
.ship-lab .sl-to small { font-size: 8pt; }
.ship-lab .sl-cod { border: 2px solid #000; padding: 2mm; font-size: 13pt; text-align: center; }
.ship-lab .sl-items { font-size: 9pt; flex: 1; overflow: hidden; }
.ship-lab .lab-bc { flex: 0 0 22mm; }
.ship-lab .sl-foot { font-size: 8pt; }
.ship-lab table.pick { width: 100%; font-size: 10pt; border-collapse: collapse; }
.ship-lab table.pick td { border-bottom: 1px solid #ccc; padding: 1mm 0; }
.bom-sel { max-width: 230px; }
.nowrap { white-space: nowrap; }
.nowrap .qty { width: 70px; }
/* Phiếu đơn hàng / phiếu giao hàng: A5, A4, giấy nhiệt 80mm, 100×150mm */
.ordp { background: #fff; color: #000; font-size: 10pt; line-height: 1.35; display: flex; flex-direction: column; gap: 2.5mm; }
.ordp small { display: block; font-size: 8pt; color: #333; }
.ordp .op-head { display: flex; justify-content: space-between; gap: 4mm; border-bottom: 1px solid #000; padding-bottom: 2mm; }
.ordp .op-head b { font-size: 11pt; }
.ordp .op-bc svg { height: 12mm; width: auto; max-width: 55mm; }
.ordp h2 { margin: 0; font-size: 14pt; text-align: center; letter-spacing: .5px; }
.ordp h2 span { white-space: nowrap; }
.ordp .op-meta { margin: 0; text-align: center; font-size: 8.5pt; }
.ordp .op-to { border: 1px solid #000; padding: 2mm 3mm; display: flex; flex-direction: column; gap: 1mm; }
.ordp table { width: 100%; border-collapse: collapse; }
.ordp .op-items th, .ordp .op-items td { border-bottom: 1px solid #999; padding: 1.2mm 1mm; text-align: left; vertical-align: top; }
.ordp .op-items th { border-bottom: 1px solid #000; font-size: 8.5pt; }
.ordp .op-items td small { color: #555; }
.ordp .r, .ordp th.r { text-align: right; }
.ordp .op-sum td { padding: .6mm 1mm; }
.ordp .op-sum { width: 60%; margin-left: auto; }
.ordp .op-total td { font-weight: 700; font-size: 12pt; border-top: 1px solid #000; }
.ordp .op-pay { border: 2px solid #000; padding: 2mm; text-align: center; font-size: 11pt; }
.ordp .op-qr { display: flex; align-items: center; gap: 3mm; }
.ordp .op-qr img { width: 32mm; height: 32mm; object-fit: contain; }
.ordp .op-note { margin: 0; font-size: 9pt; }
.ordp .op-sign { display: flex; justify-content: space-around; text-align: center; margin-top: 3mm; min-height: 22mm; font-weight: 600; }
.ordp .op-thanks { margin: 0; text-align: center; font-size: 8.5pt; font-style: italic; }
.ordp-k80, .ordp-l100 { font-size: 9pt; }
.ordp-k80 .op-head, .ordp-l100 .op-head { flex-direction: column; align-items: center; text-align: center; }
.ordp-k80 .op-sum, .ordp-l100 .op-sum { width: 100%; }
.ordp-k80 h2, .ordp-l100 h2 { font-size: 12pt; }
.ordp-preview { border: 1px dashed #bbb; border-radius: 8px; padding: 10px; background: #fff; max-height: 55vh; overflow: auto; }
.ordp-preview .ordp-k80 { width: 72mm; margin: 0 auto; }
.ordp-preview .ordp-l100 { width: 92mm; margin: 0 auto; }
@page ord-a5 { size: A5; margin: 8mm; }
@page ord-a4 { size: A4; margin: 12mm; }
@page ord-k80 { size: 80mm auto; margin: 3mm 4mm; }
@page ord-l100 { size: 100mm 150mm; margin: 4mm; }
@media print {
  #labels.ordp-box { display: block !important; width: auto; }
  #labels.ordp-box .ordp { break-after: page; }
  #labels.ordp-box.a5 { page: ord-a5; } #labels.ordp-box.a4 { page: ord-a4; }
  #labels.ordp-box.k80 { page: ord-k80; width: 72mm; } #labels.ordp-box.l100 { page: ord-l100; width: 92mm; }
}
