/* Màu thương hiệu Dipu Shop: sửa nhóm biến dưới đây để đổi toàn bộ giao diện */
:root {
  --chinh: #16414F;
  --chinh-dam: #0E2C36;
  --chinh-nhat: #DCEDF1;
  --cam: #D95B36;
  --cam-dam: #B8461F;
  --muc: #16414F;
  --phu: #5F7D88;
  --nen: #F0FAF7;
  --giay: #FFFFFF;
  --vien: #CFE2E6;
  --tot: #1E7B4E;
  --tot-nhat: #E2F2E9;
  --xau: #B3261E;
  --xau-nhat: #FBE7E5;
  --canh: #8A5200;
  --canh-nhat: #FCEFD9;
  --chu: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --so: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.5 var(--chu); color: var(--muc); background: var(--nen); -webkit-text-size-adjust: 100%; }
h1 { font-size: 23px; line-height: 1.25; margin: 0; font-weight: 700; }
h2 { font-size: 17px; margin: 0; font-weight: 600; }
h3 { font-size: 15px; margin: 0 0 8px; font-weight: 600; }
a { color: var(--chinh); }
:focus-visible { outline: 2px solid var(--chinh); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Đăng nhập ---------- */
.dn { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(circle at 0% 0%, #DDF3EE 0 280px, transparent 281px),
  radial-gradient(circle at 100% 100%, #FFEDE4 0 240px, transparent 241px), var(--nen); }
.dn-hop { width: 100%; max-width: 400px; background: var(--giay); border: 2.4px solid var(--chinh); border-radius: 24px; padding: 26px 26px 28px; box-shadow: 7px 8px 0 #BFEBE2; }
.dn-hop .dn-logo { display: block; width: 92px; height: auto; margin: 0 auto 4px; }
.dn-hop h1 { text-align: center; font-size: 21px; }
.dn-hop p.mo { text-align: center; color: var(--phu); margin: 4px 0 18px; }
.dn-hop form { display: grid; gap: 12px; }
.dn-hop .nut { border-radius: 999px; padding: 11px 18px; font-size: 16px; }

/* ---------- Khung ứng dụng ---------- */
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 19px; color: var(--chinh); }
.logo img { display: block; height: auto; }
#app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100%; }
.ben { background: var(--giay); border-right: 1px solid var(--vien); padding: 18px 12px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.ben .logo { padding: 0 10px; }
#menu { display: grid; gap: 12px; }
.nhom-ten { font-size: 12px; color: var(--phu); padding: 0 10px 2px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
#menu a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--muc); text-decoration: none; }
#menu a:hover { background: var(--nen); }
#menu a.dang { background: var(--chinh-nhat); color: var(--chinh-dam); font-weight: 600; }
.toi { margin-top: auto; border-top: 1px solid var(--vien); padding: 12px 10px 0; display: grid; gap: 8px; font-size: 14px; }
.toi small { color: var(--phu); }
.dau-dt, .man-che { display: none; }
main { padding: 26px 30px 70px; max-width: 1280px; width: 100%; min-width: 0; }

/* ---------- Thành phần ---------- */
.tieu-de { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.tieu-de h1, .tieu-de h2 { margin-right: auto; }
.khung { background: var(--giay); border: 1px solid var(--vien); border-radius: 10px; padding: 18px; margin-bottom: 18px; }
.khung > h2 { margin-bottom: 12px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--phu); font-weight: 500; }
input, select, textarea { font: inherit; color: var(--muc); background: var(--giay); border: 1px solid var(--vien); border-radius: 6px; padding: 8px 10px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--chinh); outline: none; box-shadow: 0 0 0 3px var(--chinh-nhat); }
input:disabled, select:disabled { background: var(--nen); color: var(--phu); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--chinh); }
.o-quet { font-size: 17px; padding: 11px 12px; border: 2px solid var(--chinh); }
.luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 14px; }
.luoi .rong { grid-column: 1 / -1; }
.hang-nut { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hang-nut.phai { justify-content: flex-end; }
.loc { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.loc > * { width: auto; }
.loc input[type=search], .loc input[type=text] { min-width: 220px; }

.nut { font: inherit; font-weight: 600; border: 1px solid var(--chinh); background: var(--chinh); color: #fff; border-radius: 6px; padding: 8px 15px; cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-block; }
.nut:hover { background: var(--chinh-dam); border-color: var(--chinh-dam); }
.nut.cam { background: var(--cam); border-color: var(--cam); }
.nut.cam:hover { background: var(--cam-dam); border-color: var(--cam-dam); }
.nut.phu { background: var(--giay); color: var(--muc); border-color: var(--vien); font-weight: 500; }
.nut.phu:hover { border-color: var(--muc); }
.nut.xau { background: var(--giay); color: var(--xau); border-color: var(--xau); }
.nut.xau:hover { background: var(--xau-nhat); }
.nut.nho { padding: 3px 10px; font-size: 13px; }
.nut:disabled { opacity: .45; cursor: not-allowed; }
.bat-tat { font: inherit; font-size: 13px; border: 1px solid var(--chinh); background: var(--giay); color: var(--chinh); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.bat-tat.bat { background: var(--chinh); color: #fff; }
.tab { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--vien); margin-bottom: 14px; }
.tab a { padding: 7px 12px; text-decoration: none; color: var(--phu); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tab a.dang { color: var(--chinh); border-color: var(--chinh); font-weight: 600; }

.cuon { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--vien); vertical-align: top; }
th { font-size: 12px; color: var(--phu); font-weight: 600; white-space: nowrap; background: #F7FBFC; }
td.so, th.so { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.bam { cursor: pointer; }
tr.bam:hover td { background: #F5FAFB; }
td input, td select { padding: 5px 8px; }
td .nho-chu { font-size: 12px; color: var(--phu); }
.ma { font-family: var(--so); font-size: 13px; }
.mo { color: var(--phu); font-size: 13px; }
.rong-chu { color: var(--phu); text-align: center; padding: 26px 10px; }
.tong { font-size: 20px; font-weight: 700; }

.nhan { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--chinh-nhat); color: var(--chinh-dam); white-space: nowrap; }
.nhan.tot { background: var(--tot-nhat); color: var(--tot); }
.nhan.xau { background: var(--xau-nhat); color: var(--xau); }
.nhan.canh { background: var(--canh-nhat); color: var(--canh); }
.nhan.cam { background: #FFF1EA; color: var(--cam-dam); }
.nhan.xam { background: #EEF2F3; color: var(--phu); }

.goi-y { position: relative; }
.goi-y-ds { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 2px; background: var(--giay); border: 1px solid var(--vien); border-radius: 8px; box-shadow: 0 8px 24px rgba(22,65,79,.12); max-height: 300px; overflow-y: auto; }
.goi-y-ds button { display: block; width: 100%; text-align: left; font: inherit; background: none; border: 0; border-bottom: 1px solid var(--vien); padding: 8px 12px; cursor: pointer; color: var(--muc); }
.goi-y-ds button:hover, .goi-y-ds button:focus, .goi-y-ds button.dang { background: var(--nen); }
.goi-y-hang { max-height: 380px; }
.goi-y-hang button.dang { box-shadow: inset 3px 0 0 var(--cam); }

.chip-khach { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; background: var(--chinh-nhat); border-radius: 8px; }

.anh-luoi { display: flex; gap: 8px; flex-wrap: wrap; }
.anh-luoi figure { margin: 0; position: relative; }
.anh-luoi img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--vien); display: block; }
.anh-luoi figure button { position: absolute; top: 4px; right: 4px; }
.anh-sp { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--vien); }

.tien-do { display: grid; gap: 6px; }
.tien-do .dong { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--vien); border-radius: 8px; }
.tien-do .dong.du { border-color: var(--tot); background: var(--tot-nhat); }
.tien-do .dong.thua { border-color: var(--xau); background: var(--xau-nhat); }
.tien-do .dem { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 58px; text-align: right; }

/* ---------- Hộp thoại và thông báo ---------- */
.nen-hop { position: fixed; inset: 0; background: rgba(14,44,54,.42); z-index: 50; display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.hop { background: var(--giay); border-radius: 12px; width: 100%; max-width: 620px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(14,44,54,.3); }
.hop.rong { max-width: 980px; }
.hop-dau { padding: 16px 20px 10px; display: flex; align-items: center; gap: 10px; }
.hop-dau h2 { margin-right: auto; }
.hop-than { padding: 6px 20px 16px; overflow-y: auto; }
.hop-chan { padding: 12px 20px 16px; border-top: 1px solid var(--vien); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
#bao { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; width: min(92vw, 520px); pointer-events: none; }
.bao { background: var(--chinh-dam); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: 14px; }
.bao.loi { background: var(--xau); }
.bao.tot { background: var(--tot); }

.camera { position: relative; background: #000; border-radius: 10px; overflow: hidden; }
.camera video { width: 100%; display: block; max-height: 55vh; object-fit: cover; }

/* ---------- Điện thoại ---------- */
@media (max-width: 900px) {
  #app { display: block; }
  .dau-dt { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30; background: var(--giay); border-bottom: 1px solid var(--vien); height: 58px; padding: 0 12px; }
  .ben { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: 72%; max-width: 300px; height: 100%; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  body.mo-menu .ben { transform: none; }
  body.mo-menu .man-che { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(14,44,54,.35); }
  main { padding: 16px 12px 70px; }
  h1 { font-size: 20px; }
  .khung { padding: 14px; }
  .loc > * { width: 100%; }
  .loc input[type=search], .loc input[type=text] { min-width: 0; }
  th, td { padding: 7px 8px; }
  .hop-than, .hop-dau, .hop-chan { padding-left: 14px; padding-right: 14px; }
}
table.gon td { padding: 6px 10px; vertical-align: middle; }
.dong-dv td { background: #FFF8F3; }
.cat-chu { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) { .cat-chu { max-width: 160px; } }

/* ---------- Thẻ số liệu, bảng tổng kết ---------- */
.the-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.the-so { display: grid; gap: 2px; background: var(--giay); border: 1px solid var(--vien); border-radius: 10px; padding: 12px 14px; text-decoration: none; color: var(--muc); }
.the-so b { font-size: 19px; font-variant-numeric: tabular-nums; }
a.the-so:hover { border-color: var(--chinh); }
.the-so.dang { border: 2px solid var(--chinh); background: var(--chinh-nhat); }
table.tong-ket { max-width: 460px; margin-left: auto; }
table.tong-ket td { border: 0; padding: 4px 8px; }
table.bao-cao td { padding: 6px 8px; }
table.bao-cao tr.dam td { font-weight: 700; border-top: 2px solid var(--muc); }
.thanh { height: 8px; background: var(--nen); border-radius: 4px; overflow: hidden; min-width: 120px; }
.thanh span { display: block; height: 100%; background: var(--chinh); }

/* ---------- Phiếu giao hàng ---------- */
.vung-in .phieu { background: #fff; color: #000; border: 1px solid var(--vien); margin: 0 auto 18px; padding: 14px 16px; font-size: 13px; line-height: 1.4; }
.vung-in.a5 .phieu { max-width: 560px; }
.vung-in.k80 .phieu { max-width: 300px; font-size: 12px; padding: 8px; }
/* Nhãn A6 105×148mm: mỗi đơn một nhãn, chữ gọn, tên hàng tối đa 2 dòng */
.vung-in.a6 .phieu { max-width: 397px; min-height: 559px; font-size: 11px; padding: 8px 10px; }
.vung-in.a6 .phieu h2 { font-size: 14px; margin: 4px 0 0; }
.vung-in.a6 .phieu .ten-ch { font-size: 13px; }
.vung-in.a6 .phieu .ma-vach { width: 170px; height: 40px; }
.vung-in.a6 .phieu .nguoi-nhan { font-size: 13px; padding: 4px 6px; }
.vung-in.a6 .phieu td, .vung-in.a6 .phieu th { padding: 2px 3px; }
.vung-in.a6 .phieu .cod { font-size: 15px; padding: 4px; margin: 6px 0; }
@media print { .vung-in.a6 .phieu { min-height: 0; height: 142mm; overflow: hidden; } }
.phieu header { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.phieu .ten-ch { font-size: 16px; }
.phieu .phai { text-align: center; }
.phieu .ma-vach { width: 190px; height: 44px; display: block; fill: #000; }
.vung-in.k80 .phieu header { flex-direction: column; align-items: stretch; }
.vung-in.k80 .phieu .ma-vach { width: 100%; }
.phieu h2 { text-align: center; font-size: 17px; margin: 10px 0 2px; letter-spacing: .04em; }
.phieu .giua { text-align: center; margin: 2px 0 8px; }
.phieu .nguoi-nhan { border: 1px dashed #000; padding: 6px 8px; margin-bottom: 8px; font-size: 14px; }
.phieu table { font-size: inherit; }
.phieu th { background: none; color: #000; border-bottom: 1px solid #000; padding: 4px; }
.phieu td { border-bottom: 1px dotted #999; padding: 4px; }
.phieu small { color: #333; }
.phieu table.tien { width: auto; margin-left: auto; margin-top: 6px; }
.phieu table.tien td { border: 0; padding: 2px 4px; }
.phieu .cod { border: 2px solid #000; text-align: center; font-weight: 700; font-size: 16px; padding: 6px; margin: 8px 0; }
.phieu .ky { display: flex; justify-content: space-around; text-align: center; margin: 14px 0 40px; }

@media print {
  body { background: #fff; }
  body * { visibility: hidden; }
  #vungIn, #vungIn * { visibility: visible; }
  #vungIn { position: absolute; left: 0; top: 0; width: 100%; }
  .vung-in .phieu { border: 0; margin: 0; max-width: none !important; padding: 0; break-after: page; }
  .vung-in .phieu:last-child { break-after: auto; }
  .ben, .dau-dt, .man-che, #bao { display: none !important; }
  #app { display: block; }
  main { padding: 0; max-width: none; }
}
