/* v4.4.0 (rà giao diện nhóm Cổng, gửi nhận, QR): màn hình Cổng bảo vệ, Sổ ra vào, CBCNV, đăng ký ra vào, cảnh báo xác nhận, điểm QR
   Chỉ bổ sung / ghi đè có phạm vi; không sửa khối <style> chung trong index.html */

/* ---------- Cổng bảo vệ: tiêu đề một dòng, Làm mới là nút biểu tượng, việc phụ gom một thanh ---------- */
.gb-head.gb-head2{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:2px 12px;margin-bottom:2px}
.gb-head.gb-head2 .gb-ttl{display:flex;align-items:center;gap:10px;min-width:0}
.gb-head.gb-head2 .gb-ttl h1{margin:0}
.btn.gb-ref{width:44px;min-height:44px;padding:0;flex:none}
.gb-head.gb-head2 .gb-stamp{grid-column:1;display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-height:22px}
.gb-head.gb-head2 .gb-tools{grid-column:2;grid-row:1 / span 2;display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
@media(max-width:899px){
  .gb-head.gb-head2{grid-template-columns:minmax(0,1fr)}
  .gb-head.gb-head2 .gb-ttl{justify-content:space-between}
  .gb-head.gb-head2 .gb-tools{grid-column:1;grid-row:auto;flex-wrap:nowrap;justify-content:flex-start;overflow-x:auto;margin:6px -14px 0;padding:2px 14px 4px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  .gb-head.gb-head2 .gb-tools::-webkit-scrollbar{display:none}
  .gb-head.gb-head2 .gb-tools .btn{flex:none;min-height:40px;white-space:nowrap}
}
/* Thẻ lọc: vùng chạm >= 40px */
.gb .gb-chips button,.gb-chips.gb-logf button{height:40px;padding:0 14px}
/* Điện thoại: dòng xe / khách dễ đọc hơn, nút Cho vào / Cho ra to, dễ bấm bằng ngón cái */
@media(max-width:640px){
  .gb .gb-act{width:104px}
  .gb .gb-go{min-height:60px;font-size:16px}
  .gb .gb-main{padding:12px 6px 12px 10px}
}

/* ---------- Sổ ra vào: giờ và chiều xếp chồng, ô tìm cả hàng, lọc nhanh Vào / Ra ---------- */
.gb-lw{display:flex;align-items:center;gap:10px;flex:none}
.gb-chips.gb-logf{margin:0 0 10px}
@media(max-width:640px){
  .gb-logbar{flex-wrap:wrap}
  .gb-logbar .gb-qwrap{flex:1 1 100%}
  .gb-logbar input[type=date]{max-width:none!important;flex:1 1 100%;min-height:44px}
  .gb-log .gb-lr{align-items:flex-start;gap:10px;padding:10px}
  .gb-lw{flex-direction:column;align-items:flex-start;gap:4px;width:50px}
  .gb-log .gb-lr>.btn.sm{min-height:40px;align-self:center;padding:0 10px}
}

/* ---------- Ra vào cổng CBCNV: tiêu đề không bị ép thành cột hẹp trên điện thoại ---------- */
@media(max-width:760px){
  .cv-hd>.mhead{flex-wrap:wrap}
  .cv-hd>.mhead>.grow{min-width:100%}
  .cv-hd>.mhead>.row-acts{width:100%;display:flex;flex-wrap:wrap;gap:8px}
  .cv-hd>.mhead>.row-acts>.btn{min-height:44px}
}
.cv .cv-top2{display:flex;align-items:center;gap:8px;flex-wrap:wrap;flex:1 1 auto}
.cv .cv-top2 .grow{flex:1}
@media(max-width:760px){
  .cv .cv-q{flex:1 1 100%;min-width:0}
  .cv .cv-top2{width:100%}
  .cv .cv-top2 .btn.sm{min-height:40px}
  .cv .cv-seg{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}
  .cv .cv-seg button{min-width:0;font-size:14px;padding:4px 6px;flex-wrap:wrap;gap:4px;line-height:1.2;text-align:center}
}

/* ---------- Đăng ký ra vào cổng: 3 bước có tiêu đề, loại đăng ký bằng 2 nút lớn ---------- */
.gf-sec{display:flex;align-items:center;gap:10px;font-weight:700;font-size:16px;color:var(--fg);padding-top:14px;border-top:1px solid var(--line2);margin-top:2px}
.gf-sec:first-child{border-top:0;padding-top:0;margin-top:0}
.gf-n{width:26px;height:26px;border-radius:13px;background:var(--brand);color:#fff;display:inline-flex;align-items:center;justify-content:center;font-size:13px;flex:none}
.mseg.gf-kind button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;min-height:58px;padding:6px 10px;line-height:1.25;color:var(--fg)}
.mseg.gf-kind button.on{border-color:var(--brand);background:var(--brand-soft);color:var(--brand-ink)}
.mseg.gf-kind button:disabled{cursor:default;opacity:.6}.mseg.gf-kind button.on:disabled{opacity:1}
.gf-supp .chk{min-height:44px}
.form.gf-vis{grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:6px;align-items:center;border:1px solid var(--line);border-radius:12px;padding:8px 10px;background:var(--soft)}
.gf-vn{grid-column:1/-1;font-size:13px;font-weight:700;color:var(--muted)}
.gf-add{margin-top:8px}
.actions.gf-act{margin-top:18px}
.mseg3.gr-vt button{overflow-wrap:normal;word-break:normal;hyphens:none}
@media(max-width:640px){
  .gf-sp{display:none}
  .form.gf-vis{grid-template-columns:repeat(2,minmax(0,1fr))}
  .form.gf-vis>input:nth-of-type(1){grid-column:1/-1}
  .gf-vis .cccd-scan,.gf-vdel{min-height:44px}
  .actions.gf-act{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px}
  .mseg3.gr-vt button{font-size:14px;padding:6px 4px}
}

/* ---------- Cảnh báo xác nhận của bảo vệ: bộ lọc gọn, không tràn ngang ---------- */
.gn .toolbar.ga-tb{display:flex;flex-wrap:wrap;gap:8px 10px;align-items:flex-end}
.ga-f{display:flex;flex-direction:column;gap:4px;font-size:13px;font-weight:600;color:var(--muted);min-width:0;margin:0}
.ga-f .inp{min-width:150px;width:auto}
@media(max-width:899px){.ga440>.mhead{flex-wrap:wrap}.ga440>.mhead>.grow{min-width:0;flex:1 1 220px}}
@media(max-width:640px){
  .gn .toolbar.ga-tb{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
  .ga-f .inp{min-width:0;width:100%;min-height:44px}
  .ga-set{grid-column:1/-1;min-height:44px}
  .ga440 .tbl-wrap{overflow-x:auto;max-width:100%}
}

/* ---------- Điểm dán mã QR: hướng dẫn thu gọn ---------- */
.qr-help{margin:0 0 12px;background:var(--info-soft);border-radius:10px;padding:0 12px}
.qr-help summary{cursor:pointer;min-height:44px;display:flex;align-items:center;gap:8px;font-weight:600;color:var(--info);list-style:none}
.qr-help summary::-webkit-details-marker{display:none}
.qr-help summary::after{content:'▸';margin-left:auto}.qr-help[open] summary::after{content:'▾'}
.qr-help>div{padding:0 0 12px;line-height:1.5}
@media(max-width:640px){.qr-pg>.bar h1{flex:1 1 100%;margin:0}.qr-pg>.bar .btn{flex:1}}
@media(max-width:640px){.ga440 .mstats{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}.ga440 .mstat{padding:8px}.ga440 .mstat span{font-size:12px;line-height:1.3}}
/* v4.6.0 (TD-002): đăng ký xe, hàng hóa nhiều dòng hàng */
.gf-goods{display:grid;gap:6px}
.gf-gh,.gf-gl{display:grid;grid-template-columns:24px 2fr 1.2fr 1fr 1fr auto;gap:6px;align-items:center}
.gf-gh{padding-left:30px;grid-template-columns:2fr 1.2fr 1fr 1fr auto}
.gf-gn{color:var(--muted);font-size:13px}
@media (max-width:640px){
  .gf-gh{display:none}
  .gf-gl{grid-template-columns:24px 1fr 1fr;padding:8px 0;border-bottom:1px solid var(--line2)}
  .gf-gl>input:first-of-type{grid-column:2 / 4}
}

/* TD-014 (UX-19): dòng phím tắt máy tính chỉ hiện trên màn hình rộng */
@media (max-width:899px){.gb-kbd{display:none}}
/* TD-014 (NAV-10): đang mở hộp thoại / khung Cho vào-ra: thanh Hoàn tác xuống dưới lớp phủ, không che nút cuối của hộp thoại */
body:has(.modal-bg, .gb-sheet) .gb-undo{z-index:55}
/* TD-016 (5.1.0): In tem hàng loạt - chọn cỡ, nhóm theo màu loại, xem trước trang A4 */
.qrt-co{display:flex;gap:8px 18px;flex-wrap:wrap}.qrt-co-i{display:flex;align-items:center;gap:4px;cursor:pointer}
.qrt-nhom td{vertical-align:middle}.qrt-loai{display:flex;gap:6px;flex-wrap:wrap;margin-top:6px}.qrt-chip{border:1.5px solid;border-radius:12px;padding:1px 8px;font-size:12px;background:#fff}
.qrt-xem{display:flex;flex-wrap:wrap;gap:16px;margin-top:12px}.qrt-trang{position:relative;background:#fff;box-shadow:0 1px 6px rgba(0,0,0,.25);overflow:hidden}
.qrt-cat{position:absolute;background:#777}
@media(max-width:640px){.qrt-trang{transform:scale(.8);transform-origin:top left}}
