/* ==========================================================================
   mobile-modals.css — khuôn modal mobile dùng chung toàn hệ thống (<768px).
   Tách từ pos-mobile.css (mẫu POS, commit 1833b47) để mọi màn nhập chứng từ
   (Hóa đơn bán lẻ / Tạo đơn hàng / Phiếu nhập kho / Hàng bán trả lại / Tiếp nhận
   BHSC) cùng ăn một nguồn. Desktop >=768px không đổi một pixel.

   Khung sheet dùng danh sách id hiện có hoặc class .mm-form.
   Phải neo bằng id vì các rule toàn cục app.css cần thắng đều rất đặc hiệu:
   `.tdh input/.btn` 32px !important, `button:not(...17 class)` (0,17,1), và
   `.modal:not(...)...modal-dialog-centered > .modal-content` (0,7,0). Class thuần
   không thắng nổi; :is(#id,...) cho specificity cấp id (1,0,0) thắng tất cả.
   ========================================================================== */

/* Hai vùng hiển thị loại trừ nhau: phần tử pos-mobile-only ẩn trên desktop.
   Chỉ màn nào gắn class mới bị ảnh hưởng (POS + các màn áp khuôn). */
.pos-mobile-only { display: none; }

@media (max-width: 767.98px) {
    /* Token màu + cỡ control dùng chung. .pos cho trang POS; .pos-mobile-fullscreen
       cho modal mọi màn (kể cả màn không có gốc .pos). */
    .pos,
    .pos-mobile-fullscreen {
        --pos-control-height: 36px;
        --pos-qty-input-width: 50px;
        --pos-title-size: 16px;
        --pos-blue: #075bfb;
        --pos-ink: #111a2e;
        --pos-muted: #556784;
        --pos-border: #d5e0f2;
        --pos-tint: #ebf2ff;
        --pos-bg: #f6f8fd;
    }

    .pos-desktop-only { display: none !important; }
    .pos-mobile-only { display: revert; }

    /* ---------- Khung sheet fullscreen + safe-area ---------- */
    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) {
        inset: var(--pos-viewport-top, 0px) 0 auto;
        width: 100%;
        height: var(--pos-viewport-height, 100dvh);
        max-width: none;
        max-height: none;
        margin: 0;
        padding: 0 !important;
        border: 0;
        border-radius: 0;
        overflow: hidden;
        --ctl-h: var(--pos-control-height);
        --s2-h: var(--pos-control-height);
        --s2-rh: calc(var(--pos-control-height) - 2px);
    }

    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) .modal-dialog {
        width: 100%;
        max-width: none;
        height: 100%;
        min-height: 0;
        max-height: 100%;
        margin: 0;
        align-items: stretch;
    }

    /* max-height:none + top:0 thắng rule leak `.modal:not(...fullscreen-sm-down)`
       của app.css (guard đặt nhầm trên .modal thay vì .modal-dialog — bẫy đã nhớ). */
    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) .modal-dialog > .modal-content {
        top: 0;
        height: 100%;
        max-height: none;
        border: 0;
        border-radius: 0;
        overflow: hidden;
    }

    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) .modal-body {
        padding: 10px;
        overflow-y: auto;
        min-height: 0;
    }

    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) .modal-header,
    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) .modal-footer {
        padding: 7px 10px;
        background: var(--pos-bg);
        flex-shrink: 0;
    }

    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) .modal-header {
        padding-top: calc(7px + env(safe-area-inset-top));
    }

    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) .modal-footer {
        padding-bottom: calc(7px + env(safe-area-inset-bottom));
    }

    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) .modal-header .btn-outline-success {
        margin-inline: 6px !important;
        font-size: .79rem;
        padding: 0 6px !important;
        min-width: 0 !important;
        white-space: nowrap;
    }

    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) .modal-header .btn-close {
        flex: 0 0 auto;
        margin: 0 0 0 auto;
        border: 1px solid var(--pos-border);
        border-radius: 9px !important;
        background-color: white;
    }

    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) .modal-title {
        font-size: var(--pos-title-size);
        line-height: 1.25;
        font-weight: 700 !important;
    }

    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) .modal-title .tdh-hicon {
        display: inline-grid;
        place-items: center;
        flex: 0 0 var(--pos-control-height);
        width: var(--pos-control-height);
        min-width: var(--pos-control-height);
        height: var(--pos-control-height);
        border-radius: 10px;
        background: var(--pos-blue);
        color: #fff;
        margin-inline-end: 3px;
        vertical-align: middle;
    }

    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) .modal-title .tdh-hicon .bi {
        font-size: 26px;
    }

    /* ---------- Control trong sheet: 36px, font 16px (chống iOS auto-zoom) ---------- */
    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) :is(
        input.form-control:not([type="hidden"]), select.form-select, .input-group-text,
        .select2-container .select2-selection--single, .select2-search__field
    ) {
        height: var(--pos-control-height) !important;
        min-height: var(--pos-control-height) !important;
        padding-block: 0;
        font-size: 16px;
    }

    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) .select2-container .select2-selection__rendered {
        height: auto !important;
        line-height: 1.25;
        font-size: 16px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) textarea.form-control {
        height: auto;
        font-size: 16px;
    }

    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) :is(.btn, .btn-close) {
        height: var(--pos-control-height) !important;
        min-height: var(--pos-control-height) !important;
        padding-block: 0;
    }

    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) .btn-close {
        box-sizing: border-box;
        width: var(--pos-control-height);
        padding: 0 !important;
    }

    /* select2 dropdown gắn trong modal (dropdownParent = .modal) */
    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) .select2-dropdown {
        border: 1px solid var(--pos-border);
        border-radius: 9px;
        box-shadow: 0 6px 18px #263e6c23;
    }

    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) .select2-search--dropdown .select2-search__field {
        border: 1px solid var(--pos-border);
        border-radius: 8px;
        padding-inline: 8px;
    }

    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien, .mm-form) .select2-search--dropdown .select2-search__field:focus {
        border-color: #91b3ff;
        outline: 2px solid #075bfb1c;
    }

    /* ---------- Ô tìm kiếm pill (pos-mobile-search) ---------- */
    /* 27/11 (sếp): thêm #posWorkspace — thanh tìm CHÍNH của trang POS (và #posSide) nằm ngoài
       các modal id, thiếu neo này là mất khung pill (hồi quy sau tách CSS vòng 1). */
    :is(#posWorkspace, #modalChonHang, #modalPickKh, #modalPickNv) .pos-mobile-search {
        --pos-search-inner-height: var(--pos-control-height);
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 0;
        min-width: 0;
        min-height: var(--pos-control-height);
        max-width: none !important;
        padding: 0;
        border: 0;
        box-shadow: inset 0 0 0 1px var(--pos-border);
        border-radius: 9px;
        background: #fff;
    }

    :is(#posWorkspace, #modalChonHang, #modalPickKh, #modalPickNv) .pos-mobile-search:focus-within {
        box-shadow: inset 0 0 0 1px #91b3ff, 0 0 0 2px #075bfb1c;
    }

    :is(#posWorkspace, #modalChonHang, #modalPickKh, #modalPickNv) .pos-mobile-search input.form-control {
        border: 0 !important;
        min-width: 0;
        height: var(--pos-search-inner-height) !important;
        min-height: var(--pos-search-inner-height) !important;
        padding: 0 8px !important;
        line-height: normal;
        background: transparent;
        box-shadow: none !important;
        margin: 0;
    }

    :is(#posWorkspace, #modalChonHang, #modalPickKh, #modalPickNv) .pos-mobile-search :is(.pos-scan-button, .input-group-text, .pos-mobile-search__submit) {
        display: inline-grid;
        place-items: center;
        flex: 0 0 var(--pos-search-inner-height);
        width: 38px;
        min-width: 38px !important;
        height: var(--pos-search-inner-height) !important;
        min-height: var(--pos-search-inner-height) !important;
        margin: 0;
        padding: 0 !important;
        font-size: .98rem;
    }

    :is(#posWorkspace, #modalChonHang, #modalPickKh, #modalPickNv) .pos-mobile-search :is(.pos-scan-button, .input-group-text) {
        border: 0;
        border-right: 1px solid var(--pos-border);
        border-radius: 8px 0 0 8px !important;
        background: #f1f6ff;
        color: var(--pos-blue);
    }

    :is(#posWorkspace, #modalChonHang, #modalPickKh, #modalPickNv) .pos-mobile-search .pos-mobile-search__submit {
        border: 1px solid transparent !important;
        border-radius: 0 8px 8px 0 !important;
        background: var(--pos-blue);
        color: white;
    }

    :is(#posWorkspace, #modalChonHang, #modalPickKh, #modalPickNv) .pos-mobile-search .pos-mobile-search__submit:hover {
        background: #064ed7;
    }

    /* ---------- Dải lọc thu gọn (Bộ lọc) trong modal Chọn mặt hàng ---------- */
    :is(#modalChonHang, #modalPickKh, #modalAddKh, #modalPickNv, #modalAddMh, #posPayModal, #modalThuTien) .tdh-modalbar {
        position: static !important;
    }

    /* mh-bar = dải lọc kiểu POS (Nhóm hàng / Kho / Tồn + ô Tìm). */
    #modalChonHang .mh-bar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 7px;
        padding: 8px;
        background: var(--pos-bg);
        border: 1px solid var(--pos-border);
        border-radius: 11px;
    }

    #modalChonHang .mh-f {
        flex-wrap: wrap;
        min-width: 0;
        grid-column: 1 / -1;
    }

    /* Thu gọn: JS gạt class mm-open trên .mh-bar / .mm-band khi bấm nút Bộ lọc.
       Không dùng :has() để tương thích Chrome cũ ở máy cửa hàng. */
    #modalChonHang .mh-bar:not(.mm-open) .mm-filter-field { display: none; }
    .mm-band:not(.mm-open) .mm-filter-field { display: none; }

    .pos-mh-filter-toggle {
        display: inline-flex;
        align-items: center;
        justify-self: start;
        gap: 6px;
        padding-inline: 9px;
        font-size: .8rem;
    }

    .pos-mh-filter-toggle[aria-expanded="true"] .bi-chevron-down { transform: rotate(180deg); }

    #modalChonHang .mh-f__lb {
        width: 100%;
        text-align: left;
        color: var(--pos-muted);
        font-size: .79rem;
        text-transform: none;
        letter-spacing: 0;
    }

    /* 27/11 (sếp): các ô lọc POS (Nhóm hàng/Kho/Tồn) full width. app.css đặt flex-basis
       200px/180px/130px theo biến thể (1,3,0) nên rule (1,2,0) cũ thua — nêu bật 3 biến thể
       kèm !important. */
    #modalChonHang .mh-f__ctl,
    #modalChonHang .mh-f--mhl .mh-f__ctl,
    #modalChonHang .mh-f--kho .mh-f__ctl,
    #modalChonHang .mh-f--ton .mh-f__ctl {
        width: 100%;
        min-width: 0;
        flex: 1 1 100% !important;
    }
    #modalChonHang .mh-f__count { grid-area: 2 / 2; align-self: center; white-space: nowrap; }

    /* mm-band = dải lọc của màn chứng từ (giữ nguyên bộ lọc sẵn có, chỉ đổi cách bày). */
    .mm-band {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 7px;
        padding: 8px;
        background: var(--pos-bg);
        border: 1px solid var(--pos-border);
        border-radius: 11px;
    }

    .mm-band .mm-filter-field { flex: 1 1 100%; min-width: 0; }
    .mm-band .tdh-search { max-width: none !important; }

    /* 27/11 (sếp): mọi ô lọc trong modal Chọn mặt hàng RỘNG 100%, mỗi ô một hàng (khuôn mh-bar
       POS) — đè rule 16/11 "combo 38% + ô Tìm cùng hàng" và box 210px của app.css. Chỉ <768px. */
    #modalChonHang .tdh-modalbar .tdh-selwrap {
        flex: 1 1 100% !important;
        max-width: none !important;
    }

    /* select2 dựng width inline (px) từ lúc init → phải !important mới thắng; áp cả mh-f POS.
       Loại select2-hidden-accessible: select gốc được select2 ẩn bằng position:absolute+clip,
       width 100% của nó sẽ tính theo modal (390px) thay vì ô chứa — vô hình nhưng khỏi dính. */
    #modalChonHang .mm-filter-field :is(select.form-select:not(.select2-hidden-accessible), .select2-container) {
        width: 100% !important;
    }

    /* 27/11 (sếp): ô lọc select2 màn chứng từ lấy viền của POS. Thực tế POS ăn #dee2e6 !important
       của app.select2.css (viền #d3ddec trong .mh-f__ctl thua !important đó); bán lẻ bị .tdh
       (app.css) ép #c3cfdf !important. Bo 10px + cao 36px + nền trắng đã bằng POS sẵn (rule .tdh
       + sheet <768), chỉ thiếu đúng màu viền này — thắng .tdh bằng id + !important. */
    #modalChonHang .mm-filter-field .select2-container--default .select2-selection--single {
        border-color: #dee2e6 !important;
    }

    /* 27/11 (sếp): band màn chứng từ xếp như POS (pos.js prepend ô Tìm khi mobile):
       ô Tìm đứng đầu MỘT HÀNG, rồi nút Bộ lọc, rồi các trường lọc. Chỉ <768px. */
    .mm-band > .pos-mobile-search {
        order: -1;
        flex-basis: 100% !important; /* flex-grow-1 !important của Bootstrap chỉ ép grow, basis auto ăn theo nội dung */
    }
    .mm-band > .mm-filter-field { order: 1; }

    /* ---------- Card list khách hàng / mặt hàng / nhân viên ---------- */
    .pos-mobile-product-list, .pos-mobile-customer-list, .pos-mobile-nv-list {
        list-style: none;
        margin: 0;
        margin-top: .65rem;
        padding: 0;
    }

    .pos-mobile-customer-choice {
        position: relative;
        display: block;
        width: 100%;
        height: auto !important;
        min-height: 44px !important;
        padding: 7px 8px;
        border: 0;
        border-bottom: 1px solid var(--pos-border);
        border-radius: 0;
        background: #fff;
        color: var(--pos-ink);
        text-align: left;
    }

    .pos-mobile-customer-choice:is(:hover, [aria-current="true"]) { background: var(--pos-tint); }
    .pos-mobile-customer-choice:focus-visible { outline: 2px solid var(--pos-blue); outline-offset: -2px; }

    .pos-mobile-customer-choice > .bi {
        position: absolute;
        inset-block-start: 7px;
        inset-inline-end: 8px;
        color: var(--pos-blue);
    }

    .pos-mobile-customer-choice__info { display: block; min-width: 0; }
    .pos-mobile-customer-choice__name { display: block; }
    .pos-mobile-customer-choice[aria-current="true"] .pos-mobile-customer-choice__name { padding-inline-end: 22px; }

    .pos-mobile-customer-choice__address {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        overflow-wrap: anywhere;
        margin-top: 2px;
        color: var(--pos-muted);
        font-size: .75rem;
        line-height: 1.25;
    }

    .pos-mobile-product {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 8px;
        padding: 7px 8px;
        border-bottom: 1px solid var(--pos-border);
    }

    .pos-mobile-product.is-in-cart { background: var(--pos-tint); }
    .pos-mobile-product__info { min-width: 0; }

    .pos-mobile-product__name, .pos-mobile-customer-choice__name {
        font-size: .9rem;
        line-height: 1.25;
        font-weight: 700;
    }

    .pos-mobile-product__meta, .pos-mobile-customer-choice__meta {
        display: flex;
        align-items: baseline;
        gap: 5px;
        margin-top: 2px;
        font-size: .75rem;
        line-height: 1.25;
        white-space: nowrap;
        color: var(--pos-muted);
    }

    .pos-mobile-product :is(.pos-mobile-product__name, .pos-mobile-product__code, .pos-mobile-product__unit),
    .pos-mobile-customer-choice__name,
    .pos-mobile-customer-choice__meta > span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .pos-mobile-customer-choice__phone {
        flex-shrink: 0;
        max-width: 60%;
        margin-inline-start: auto;
        color: var(--pos-blue);
        font-weight: 700;
        text-align: right;
    }

    .pos-mobile-product__stock { flex: 0 0 auto; }

    .pos-mobile-product__meta > span + span::before {
        content: '·';
        margin-inline-end: 5px;
        color: var(--pos-muted);
    }

    .pos-mobile-product__price { margin-left: auto; color: var(--pos-blue); font-weight: 750; }

    .pos-mobile-product .pos-mobile-add-item {
        min-width: 28px !important;
        min-height: 28px !important;
        height: 28px !important;
        padding: 0 4px 4px !important;
        color: var(--pos-blue);
        border: 1px solid #aac3fa;
        border-radius: 999px !important;
        background: white;
        font-weight: 750;
    }

    .pos-mobile-product.is-in-cart .pos-mobile-add-item { display: none; }
    .pos-mobile-add-item:disabled { opacity: .55; }

    /* ---------- Bộ − / SL / + (pill) dùng chung mọi màn (khuôn ảnh mẫu POS) ---------- */
    /* 27/11 (sếp): neo id + một lớp class để thắng .tdh .mh-minus/.mh-plus và .tdh input
       32px !important cùng rule control 36px trong sheet. Màn chứng từ khoác pos-qty lên bộ
       mh-* cũ (giữ class btn/form-control cho desktop); wrapper d-flex gap-1 bị display/gap !important đè lại. */
    :is(#posWorkspace .pos-qty, #modalChonHang .pos-qty, #formLuu .pos-qty--line:where(:not(.ht-embed *))) {
        display: inline-flex !important;
        gap: 0 !important;
        align-items: stretch;
        height: 30px;
        border: 1px solid var(--pos-border);
        border-radius: 10px;
        background: #fff;
    }

    :is(#posWorkspace .pos-qty, #modalChonHang .pos-qty, #formLuu .pos-qty--line:where(:not(.ht-embed *))) .pos-qty__btn {
        display: inline-flex;
        align-items: center;
        width: 28px !important;
        min-width: 0 !important;
        height: 28px !important;
        min-height: 0 !important;
        padding: 0 !important;
        justify-content: center;
        gap: 0;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        color: var(--pos-blue);
        font-size: .9rem;
    }

    :is(#posWorkspace .pos-qty, #modalChonHang .pos-qty, #formLuu .pos-qty--line:where(:not(.ht-embed *))) .pos-qty__btn:active { background: var(--pos-tint) !important; }

    /* input.pos-qty__sl (1,2,1) để thắng rule control 36px !important (1,2,1) đứng TRƯỚC trong cùng file. */
    :is(#posWorkspace .pos-qty, #modalChonHang .pos-qty, #formLuu .pos-qty--line:where(:not(.ht-embed *))) input.pos-qty__sl {
        width: var(--pos-qty-input-width, 50px);
        min-width: 0;
        height: 28px !important;
        min-height: 0 !important;
        padding: 0 2px !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        color: var(--pos-ink);
        text-align: center;
        font-size: 16px; /* iOS auto-zoom khi focus input <16px */
        line-height: 30px;
    }

    :is(#posWorkspace .pos-qty, #modalChonHang .pos-qty, #formLuu .pos-qty--line:where(:not(.ht-embed *))) input.pos-qty__sl:focus { outline: 2px solid var(--pos-blue); outline-offset: -2px; border-radius: 4px; }
    /* Vạch kẻ mảnh chia 3 ô như ảnh mẫu; đặt sau border:0 !important để thắng chính nó. */
    :is(#posWorkspace .pos-qty, #modalChonHang .pos-qty, #formLuu .pos-qty--line:where(:not(.ht-embed *))) input.pos-qty__sl,
    :is(#posWorkspace .pos-qty, #modalChonHang .pos-qty, #formLuu .pos-qty--line:where(:not(.ht-embed *))) .pos-qty__btn:last-child { border-left: 1px solid var(--pos-border) !important; }

    /* ---------- Form thêm / sửa (mm-form) ---------- */
    .pos-mobile-customer-actions { display: flex; gap: 8px; margin-bottom: 10px; }

    .pos-mobile-form-heading {
        padding: 9px 11px;
        margin-bottom: -4px;
        color: var(--pos-ink);
        background: var(--pos-tint);
        border-radius: 9px;
        font-weight: 800;
    }

    .pos-mobile-form-heading i { color: var(--pos-blue); }

    .mm-form .modal-body > .row {
        --bs-gutter-y: 10px;
        margin-inline: 0;
        padding: 0 4px 6px;
    }

    .mm-form-layout {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
    }

    .mm-form .mm-form-layout .modal-body {
        max-height: none;
        overscroll-behavior-y: contain;
    }

    .mm-form-layout .modal-body > .row > div > .mb-2 {
        margin-bottom: 0 !important;
    }

    .mm-form .mm-form-layout .modal-title {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .mm-form .form-label {
        margin-bottom: 3px;
        color: var(--pos-muted);
        font-weight: 650;
        font-size: .85rem;
    }

    .mm-form .modal-footer > .btn { flex: 1; }

    .pos-mobile-code { position: relative; }
    .pos-mobile-code input { padding-right: var(--pos-control-height); }

    .pos-mobile-code .pos-scan-button {
        position: absolute;
        right: calc(var(--bs-gutter-x) * .5 + 2px);
        bottom: 1px;
        height: calc(var(--pos-control-height) - 2px);
        width: calc(var(--pos-control-height) - 2px);
        min-width: 0 !important;
        border: 0;
        border-radius: 8px !important;
    }

    /* ---------- Modal Thu tiền (pos-pay-modal) ---------- */
    :is(#posPayModal, #modalThuTien) .modal-header .btn-close {
        flex: 0 0 auto;
        margin: 0 0 0 auto;
        border: 1px solid var(--pos-border);
        border-radius: 9px !important;
        background-color: white;
    }

    .pos-pay-modal .pos-pay-grid { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }

    .pos-pay-modal .pos-pay-side {
        order: 0;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .pos-pay-modal .pos-pay-side > :not(.pos-pay-lydo, .pos-pay-nganhang) { grid-column: 1 / -1; }
    #modalThuTien .pos-pay-nganhang { grid-column: 1 / -1; }
    #modalThuTien #warnThuTien:empty { display: none; }

    .pos-pay-modal :is(.pos-pay-lydo, .pos-pay-nganhang) {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        min-width: 0;
        padding: 6px;
        margin: 0;
        border: 1px solid var(--pos-border);
        border-radius: 10px;
        background: var(--pos-bg);
    }

    .pos-pay-modal :is(.pos-pay-lydo, .pos-pay-nganhang) label {
        font-size: .78rem;
        color: var(--pos-muted);
        width: auto !important;
    }

    .pos-pay-modal .pos-pay-side :is(.pos-pay-phai-thu, .pos-pay-change) {
        gap: 8px;
        padding: 9px;
        margin: 0;
        border: 1px solid #b1c8fb;
        border-radius: 11px;
        background: var(--pos-tint);
    }

    .pos-pay-modal .pos-pay-phai-thu strong { font-size: clamp(1.05rem, 5vw, 1.55rem); }
    .pos-pay-modal .pos-pay-change strong { font-size: 1.15rem; }
    .pos-pay-modal .pos-pay-side > label {
        margin: 0 !important;
        color: inherit;
        font-size: inherit;
        font-weight: 800;
    }

    .pos-pay-modal .pos-pay-list { order: 1; min-height: 0; border-color: var(--pos-border); border-radius: 11px; }
    .pos-pay-modal .pos-pay-list__rows { max-height: none; }

    .pos-mobile-pay-heading {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 6px;
        padding: 8px;
    }

    .pos-mobile-pay-heading i { color: var(--pos-blue); }

    .pos-mobile-pay-heading span {
        font-size: .75rem;
        white-space: nowrap;
        color: var(--pos-blue);
        padding: 3px 6px;
        border-radius: 999px;
        background: var(--pos-tint);
    }

    .pos-pay-modal .pos-pay-sumrow { overflow-wrap: anywhere; }
    .pos-pay-modal .pos-pay-sumrow--total { color: var(--pos-blue); }
    #modalThuTien :is(.pos-pay-list__tt, .pos-pay-sumrow > span:last-child, .pos-pay-phai-thu strong, .pos-pay-change strong)::after {
        content: " ₫";
    }

    .pos-pay-modal .pos-mobile-paper > .pos-print-options {
        display: block;
        position: static;
        width: auto;
        max-width: none;
        margin-top: 10px;
        padding: 10px;
        border-color: var(--pos-border);
        border-radius: 11px;
        background: var(--pos-bg);
        box-shadow: none;
    }

    .pos-mobile-paper legend { font-weight: 800; color: var(--pos-ink); }
    .pos-mobile-paper .pos-print-options__papers label {
        justify-content: center;
        min-height: var(--pos-control-height);
        padding: 0 9px;
    }

    :is(#posPayModal, #modalThuTien) .pos-pay-print > .dropdown-toggle-split { display: none; }
    :is(#posPayModal, #modalThuTien) .pos-pay-print > .btn:first-child {
        border-radius: 999px !important;
        line-height: 1.1;
        white-space: normal;
    }
    #modalThuTien .pos-pay-print > .btn-primary:not(:focus-visible) { box-shadow: none; }
    :is(#posPrintPaperLabel, #blPrintPaperLabel) { white-space: nowrap; }

    .pos-pay-modal .pos-pay-footer {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 5px;
        padding-bottom: calc(7px + env(safe-area-inset-bottom));
    }

    .pos-pay-modal .pos-pay-footer .btn {
        width: 100%;
        min-width: 0 !important;
        padding-inline: 4px !important;
        font-size: .79rem;
    }
}
