/* =============================================================================
   NamPhuongERP 1.64.6 — Thu gon buoc Khach hang tren mobile
   =============================================================================
   NAP CUOI CUNG, sau namphuong-ui-mobile-fix-1.64.5.css.
   Chi dung toi trinh bay. Khong xoa field lo nao khoi DOM.

   Dung class .np1646-mobile / .np1644-compact-head do patch gan theo matchMedia
   thay vi @media — dieu kien man hinh nam gon o mot cho trong JS, va quy tac
   kiem tra duoc bang jsdom (jsdom KHONG ap dung @media).
   ============================================================================= */


/* =============================================================================
   1. HEADER — mot hang duy nhat, cao ~38px
   =============================================================================
   patch chuyen .np1644-track vao TRONG .np1644-head, nen bo cuc thanh:
       [Khách hàng]  [━━━━━━━ thanh co gian ━━━━━━━]  [Bước 1/4]  [✕]
   ============================================================================= */
body.np1646-mobile.np1644-compact-head .np-sale-wizard-head{
  padding:5px 12px 6px !important;
  margin:0 -10px 6px !important;
}
body.np1646-mobile.np1644-compact-head .np-sale-wizard-head > .np1644-head{
  gap:9px !important;
  min-height:34px;
}
/* Ten buoc: khong cho no chiem het, nhuong cho cho thanh tien do. */
body.np1646-mobile .np1644-head .np1644-title{
  flex:0 1 auto !important;
  font-size:14px !important;
  max-width:44% !important;
}
/* Thanh tien do nam giua, co gian theo cho con lai. */
body.np1646-mobile .np1644-head > .np1644-track{
  display:block !important;
  flex:1 1 auto !important;
  min-width:34px !important;
  margin:0 !important;
  height:4px !important;
}
body.np1646-mobile .np1644-head .np1644-count{
  flex:0 0 auto !important;
  font-size:11px !important;
}
/* Nut Dong: 32px theo yeu cau (1.64.5 dat 36px).
   Cung do uu tien (0,3,1) nhung file nay nap sau nen thang. */
body.np1644-compact-head .np1644-head > .np-sale-close{
  width:32px !important;
  min-width:32px !important;
  max-width:32px !important;
  height:32px !important;
  min-height:32px !important;
}
body.np1644-compact-head .np1644-head > .np-sale-close::before{
  font-size:14px !important;
}


/* =============================================================================
   2. KHACH HANG — chi con MOT o tren giao dien
   =============================================================================
   The <label> boc <select id="saleCustomer"> bi an KHOI GIAO DIEN, nhung
   select van nam nguyen trong DOM va van giu customer_id. Moi nghiep vu doc
   #saleCustomer.value (gia rieng, cong no, vo, tuyen, lich su, luu don, kiem
   tra buoc 1) chay y nhu cu.

   Dung clip thay vi display:none: phan tu bi display:none khong the .focus()
   duoc, ma np121ValidateStep(1) co goi $('#saleCustomer')?.focus() khi chua
   chon khach (namphuong-app-1.54.2.js:679). Giu no van "focus duoc" de luong
   bao loi cua loi khong gay loi im lang.
   ============================================================================= */
body.np1646-mobile #saleCustomer{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  margin:-1px !important;
  padding:0 !important;
  border:0 !important;
  clip:rect(0 0 0 0) !important;
  clip-path:inset(50%) !important;
  overflow:hidden !important;
  white-space:nowrap !important;
}
/* Label boc select duoc patch gan class .np1646-select-label.
   KHONG dung :has() — iOS Safari cu (<15.4) khong ho tro, thieu no thi dong chu
   "Khách hàng" van hien lac long. Label thu ve 0 chieu cao nhung KHONG
   display:none, vi select ben trong phai con focus() duoc (dong 679 cua loi). */
body.np1646-mobile .np1646-select-label{
  display:block !important;
  height:0 !important;
  margin:0 !important;
  padding:0 !important;
  overflow:hidden !important;
  font-size:0 !important;
}
/* O tim tro thanh o khach duy nhat: to hon, ro hon. */
body.np1646-mobile .customer-search-label{
  margin-bottom:8px !important;
}
body.np1646-mobile .customer-search-label #saleCustomerSearch{
  height:44px !important;
  min-height:44px !important;
  font-size:15px !important;
}

/* 3. Dong dem "xxx khách đang hoạt động" — an khi o tim con trong.
      Cac trang thai khac ("Khong tim thay khach nao", "3 khach phu hop") van
      hien vi chung co ich luc dang tim. */
body.np1646-mobile #np1462CustomerSearchStatus.np1646-idle{
  display:none !important;
}


/* =============================================================================
   4. NGUOI TAO DON — an khoi form ban hang
   =============================================================================
   CHI an tren form ban hang (.np-sale-creator do np124AddSaleCreator chen vao
   #saleForm). Cac cho khac van hien binh thuong vi dung class KHAC:
       .np-review-creator        (man xem lai truoc khi gui duyet)
       .np-sale-detail-creator   (chi tiet don / lich su giao dich)
       hoa don in ra dung markup rieng trong npinv
   Khong xoa DOM, khong dung toi du lieu creator/seller khi luu don.
   ============================================================================= */
body.np1646-mobile #saleForm .np-sale-creator{
  display:none !important;
}


/* =============================================================================
   5. NGAY BAN — mot hang gon ~38px, hien dd/mm/yyyy
   =============================================================================
   iOS tu ve input[type=date] thanh "30 thg 8, 2026". Do trinh duyet ve nen CSS
   khong doi duoc chuoi do. Cach xu ly: giu nguyen input (type, value, required,
   nghiep vu), cho no opacity:0 va trai kin hang; mot <span> ben duoi hien
   dd/mm/yyyy do patch cap nhat. Cham vao hang van mo lich chon ngay cua may.

   Dung opacity:0 chu KHONG dung color:transparent — opacity:0 an chac o moi
   trinh duyet, con color:transparent co the khong an het phan trinh duyet tu ve.
   ============================================================================= */
/* Nhan ngay MAC DINH an. paintDate() chen the nay vao DOM va khong go ra khi
   roi mobile, nen neu khong co dong nay thi tren desktop se thay ca nhan
   dd/mm/yyyy lan input ngay goc. Chi hien khi dang o che do mobile. */
.np1646-date-text{
  display:none;
}
body.np1646-mobile label.np1646-date .np1646-date-text{
  display:block;
}

body.np1646-mobile label.np1646-date{
  position:relative !important;
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:10px !important;
  min-height:38px !important;
  height:38px !important;
  padding:0 12px !important;
  margin:0 0 8px !important;
  border:1px solid var(--npui-border, #d8dee5) !important;
  border-radius:10px !important;
  background:var(--npui-surface, #fff) !important;
  font-size:13px !important;
  font-weight:600 !important;
  color:var(--npui-text-2, #41505f) !important;
  overflow:hidden !important;
}
body.np1646-mobile label.np1646-date > #saleDate{
  position:absolute !important;
  inset:0 !important;
  width:100% !important;
  height:100% !important;
  min-height:0 !important;
  margin:0 !important;
  padding:0 !important;
  border:0 !important;
  border-radius:inherit !important;
  background:transparent !important;
  opacity:0 !important;              /* an chac hon color:transparent */
  -webkit-appearance:none;
  appearance:none;
}
body.np1646-mobile label.np1646-date .np1646-date-text{
  margin-left:auto;
  font-size:14px !important;
  font-weight:800 !important;
  font-variant-numeric:tabular-nums;
  color:var(--npui-text, #0f172a) !important;
  pointer-events:none;
}
