.dxbl-row:not(:has(dxbl-form-layout-item)) {
    margin-bottom: calc(-1 * var(--dxbl-row-item-spacing-y));
}

/* Share the same neutral header background across search groups and grids. */
.dxbl-group > .dxbl-group-header,
.dxbl-grid .dxbl-grid-table > thead .dxbl-grid-header-row > th:not(.dxbl-grid-empty-cell),
.gmc-expand-panel-header,
.gmc-window__header {
    background-color: var(--gmc-palette-background-gray, #f5f5f5);
    font-weight: 600;
}

/* The theme overlay would otherwise darken the requested background color. */
.dxbl-group > .dxbl-group-header::before,
.dxbl-grid .dxbl-grid-table > thead .dxbl-grid-header-row > th:not(:hover)::before {
    opacity: 0;
}

.dxbl-grid {
    /* Use dark text so selected rows remain readable on the pale orange background. */
    --gmc-grid-selection-bg: #fff0df;
    --gmc-grid-selection-color: #212529;
    --dxbl-grid-selection-bg: var(--gmc-grid-selection-bg);
    --dxbl-grid-focus-bg: var(--gmc-grid-selection-bg);
    --dxbl-grid-selection-focus-bg: var(--gmc-grid-selection-bg);
    --dxbl-grid-selection-color: var(--gmc-grid-selection-color);
    --dxbl-grid-focus-color: var(--gmc-grid-selection-color);
    --dxbl-grid-selection-focus-color: var(--gmc-grid-selection-color);
}

/* DevExpress paints an additional overlay, including on fixed columns and hover. */
.dxbl-grid
    .dxbl-grid-table
    :is(.dxbl-grid-focused-row, .dxbl-grid-selected-row):not(.dxbl-grid-touch-selection):not(
        .dxbl-grid-touch-selection-edge
    )
    > td:not(.dxbl-grid-empty-cell):not(.dxbl-grid-indent-cell)::before {
    background-color: var(--gmc-grid-selection-bg) !important;
    opacity: 100% !important;
}

/* Focus + hover also paints the cell itself blue in the DevExpress theme. */
.dxbl-grid .dxbl-grid-table.dxbl-grid-row-hover-enabled > tbody
    > tr:is(.dxbl-grid-focused-row, .dxbl-grid-selected-row):hover
    > td:not(.gmc-grid-force-focused-row):not(.gmc-grid-prevent-focused-row):not(.dxbl-grid-edit-form):not(.dxbl-grid-indent-cell):not(.dxbl-grid-detail-cell):not(.dxbl-grid-empty-data-area):not(.dxbl-grid-empty-cell) {
    background-color: var(--gmc-row-hover, #e8eff3) !important;
}

/* Hover uses the same overlay on ordinary, focused, selected and fixed cells. */
.dxbl-grid .dxbl-grid-table.dxbl-grid-row-hover-enabled > tbody
    > tr:not(.dxbl-grid-group-row):not(.dxbl-grid-group-footer-row):not(.dxbl-grid-edit-row):not(.dxbl-grid-empty-row):hover
    > td:not(.dxbl-grid-edit-form):not(.dxbl-grid-indent-cell):not(.dxbl-grid-detail-cell):not(.dxbl-grid-empty-data-area):not(.dxbl-grid-empty-cell)::before {
    background-color: var(--gmc-row-hover, #e8eff3) !important;
    opacity: 100% !important;
}

/* Invalid cell highlight */
/* .dxbl-grid
    .dxbl-grid-table
    .dxbl-grid-focused-row.dxbl-grid-selected-row:not(.dxbl-grid-touch-selection):not(.dxbl-grid-touch-selection-edge)
    > td:not(.dxbl-grid-empty-cell):not(.dxbl-grid-indent-cell).invalid-cell::before,
.dxbl-grid
    .dxbl-grid-table
    .dxbl-grid-focused-row:not(.dxbl-grid-touch-selection):not(.dxbl-grid-touch-selection-edge)
    > td:not(.dxbl-grid-empty-cell):not(.dxbl-grid-indent-cell).invalid-cell::before,
.dxbl-grid .dxbl-grid-table td.invalid-cell {
    background-color: var(--bs-danger) !important;
    color: white !important;
} */

/* Keep the same focus highlight on the row with validation errors. */
.dxbl-grid .dxbl-grid-table td.gmc-grid-force-focused-row {
    background-color: var(--gmc-grid-selection-bg) !important;
    color: var(--gmc-grid-selection-color) !important;
}
.dxbl-grid .dxbl-grid-table td.gmc-grid-force-focused-row *,
.dxbl-grid .dxbl-grid-table td.gmc-grid-force-focused-row .dxbl-grid-cell-content,
.dxbl-grid .dxbl-grid-table td.gmc-grid-force-focused-row span,
.dxbl-grid .dxbl-grid-table td.gmc-grid-force-focused-row a {
    color: var(--gmc-grid-selection-color) !important;
}
.dxbl-grid .dxbl-grid-table td.gmc-grid-force-focused-row::before,
.dxbl-grid .dxbl-grid-table td.gmc-grid-force-focused-row::after {
    display: none !important;
    opacity: 0 !important;
    background: transparent !important;
}

/* Chặn không cho các dòng khác nhận highlight focus khi đang có dòng bị lỗi. */
.dxbl-grid .dxbl-grid-table tr.dxbl-grid-focused-row > td.gmc-grid-prevent-focused-row,
.dxbl-grid .dxbl-grid-table tr.dxbl-grid-selected-row > td.gmc-grid-prevent-focused-row,
.dxbl-grid .dxbl-grid-table tr.dxbl-row-focused > td.gmc-grid-prevent-focused-row,
.dxbl-grid .dxbl-grid-table tr.dxbl-row-selected > td.gmc-grid-prevent-focused-row,
.dxbl-grid .dxbl-grid-table tr:hover > td.gmc-grid-prevent-focused-row,
.dxbl-grid .dxbl-grid-table td.gmc-grid-prevent-focused-row {
    background-color: #ffffff !important;
    color: var(--bs-body-color, #212529) !important;
}
.dxbl-grid .dxbl-grid-table tr.dxbl-grid-focused-row > td.gmc-grid-prevent-focused-row *,
.dxbl-grid .dxbl-grid-table tr.dxbl-grid-selected-row > td.gmc-grid-prevent-focused-row *,
.dxbl-grid .dxbl-grid-table tr.dxbl-row-focused > td.gmc-grid-prevent-focused-row *,
.dxbl-grid .dxbl-grid-table tr.dxbl-row-selected > td.gmc-grid-prevent-focused-row *,
.dxbl-grid .dxbl-grid-table td.gmc-grid-prevent-focused-row *,
.dxbl-grid .dxbl-grid-table tr.dxbl-grid-focused-row > td.gmc-grid-prevent-focused-row .dxbl-grid-cell-content,
.dxbl-grid .dxbl-grid-table tr.dxbl-grid-selected-row > td.gmc-grid-prevent-focused-row .dxbl-grid-cell-content,
.dxbl-grid .dxbl-grid-table td.gmc-grid-prevent-focused-row .dxbl-grid-cell-content,
.dxbl-grid .dxbl-grid-table td.gmc-grid-prevent-focused-row span,
.dxbl-grid .dxbl-grid-table td.gmc-grid-prevent-focused-row a {
    color: var(--bs-body-color, #212529) !important;
}
.dxbl-grid .dxbl-grid-table tr.dxbl-grid-focused-row > td.gmc-grid-prevent-focused-row::before,
.dxbl-grid .dxbl-grid-table tr.dxbl-grid-selected-row > td.gmc-grid-prevent-focused-row::before,
.dxbl-grid .dxbl-grid-table tr.dxbl-row-focused > td.gmc-grid-prevent-focused-row::before,
.dxbl-grid .dxbl-grid-table tr.dxbl-row-selected > td.gmc-grid-prevent-focused-row::before,
.dxbl-grid .dxbl-grid-table tr:hover > td.gmc-grid-prevent-focused-row::before,
.dxbl-grid .dxbl-grid-table td.gmc-grid-prevent-focused-row::before,
.dxbl-grid .dxbl-grid-table tr.dxbl-grid-focused-row > td.gmc-grid-prevent-focused-row::after,
.dxbl-grid .dxbl-grid-table tr.dxbl-grid-selected-row > td.gmc-grid-prevent-focused-row::after,
.dxbl-grid .dxbl-grid-table tr.dxbl-row-focused > td.gmc-grid-prevent-focused-row::after,
.dxbl-grid .dxbl-grid-table tr.dxbl-row-selected > td.gmc-grid-prevent-focused-row::after,
.dxbl-grid .dxbl-grid-table tr:hover > td.gmc-grid-prevent-focused-row::after,
.dxbl-grid .dxbl-grid-table td.gmc-grid-prevent-focused-row::after {
    display: none !important;
    opacity: 0 !important;
    background: transparent !important;
}

.dxbl-image.dxbl-menu-dropdown-toggle,
.dxbl-image.dxbl-toolbar-dropdown-toggle {
    --dxbl-image-height: 0.75rem;
    --dxbl-image-width: 0.75rem;
}

.dxbl-dropdown > .dxbl-dropdown-dialog.dxbl-edit-dropdown .dxbl-edit-dropdown-footer > .dxbl-btn:nth-child(1),
.dxbl-modal
    > .dxbl-modal-root
    > .dxbl-popup.dxbl-edit-dropdown
    > .dxbl-modal-content
    .dxbl-edit-dropdown-footer
    > .dxbl-btn:nth-child(1) {
    margin-right: var(--dxbl-edit-dropdown-footer-button-margin-x);
}

/* Module UI customizations – trang module: chuỗi flex giãn lưới hết chiều cao (subform dùng bộ "fill" trong modules-new.css) */
#app-drawer__page-content > .ui-builder-container,
#app-drawer__page-content > .ui-builder-container .dxbl-tabs {
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

#app-drawer__page-content > .ui-builder-container .dxbl-tabs > .dxbl-tabs-content-panel {
    min-height: 0;
    flex: 1;
}

#app-drawer__page-content
    > .ui-builder-container
    .dxbl-tabs
    > .dxbl-tabs-content-panel
    > .dxbl-tabs-content.dxbl-active {
    display: flex;
    flex-direction: column;
}

#app-drawer__page-content
    > .ui-builder-container
    .dxbl-tabs
    > .dxbl-tabs-content-panel
    > .dxbl-tabs-content.dxbl-active
    > *:only-child {
    min-height: 0;
    flex: 1;
}

/* Chỉ lưới giãn: khối đầu tab (phần đầu phiếu) và các khối sau KHÔNG chứa lưới giữ chiều cao tự nhiên; chỉ khối từ thứ 2
   trở đi có chứa lưới (GMCAutoDataGrid hoặc DxGrid trong GMCTemplate) mới giãn hết phần còn lại. Module đặt dải nút / ghi chú
   lên đầu tab không còn bị khoảng trống. Khối chứa duy nhất nằm ngang (GMCStack flex-row, GMCGrid) vẫn chia bề ngang như cũ. */
#app-drawer__page-content
    > .ui-builder-container
    .dxbl-tabs
    > .dxbl-tabs-content-panel
    > .dxbl-tabs-content.dxbl-active
    > *:only-child:not(.flex-row):not(.gmc-grid)
    > *:not(:first-child):not(.gmc-grid-bottom-nav):has(.gmc-auto-data-grid, .dxbl-grid),
#app-drawer__page-content
    > .ui-builder-container
    .dxbl-tabs
    > .dxbl-tabs-content-panel
    > .dxbl-tabs-content.dxbl-active
    > *:only-child:is(.flex-row, .gmc-grid)
    > *:not(:first-child):not(.gmc-grid-bottom-nav),
#app-drawer__page-content
    > .ui-builder-container
    .dxbl-tabs
    > .dxbl-tabs-content-panel
    > .dxbl-tabs-content.dxbl-active
    > *:only-child
    > *:only-child,
#app-drawer__page-content
    > .ui-builder-container
    .dxbl-tabs
    > .dxbl-tabs-content-panel
    > .dxbl-tabs-content.dxbl-active
    > *:only-child
    > *:only-child
    > *:not(.dxbl-group-header):first-child {
    min-height: 0;
    flex: 1;
}

#app-drawer__page-content
    > .ui-builder-container
    .dxbl-tabs
    > .dxbl-tabs-content-panel
    > .dxbl-tabs-content.dxbl-active
    > *:only-child
    > *:not(:first-child):has(.gmc-auto-data-grid, .dxbl-grid)
    > * {
    min-height: 0;
}

#app-drawer__page-content
    > .ui-builder-container
    .dxbl-tabs
    > .dxbl-tabs-content-panel
    > .dxbl-tabs-content.dxbl-active
    > *:only-child
    > *:not(:first-child):has(.gmc-auto-data-grid, .dxbl-grid)
    > .dxbl-row {
    flex: 1;
    display: flex;
    flex-direction: column;
    /* .dxbl-row của DevExpress mặc định flex-wrap: wrap; xếp dọc mà còn wrap thì thiếu chỗ lưới nhảy sang "cột" bên phải */
    flex-wrap: nowrap;
    min-height: 0;
}

#app-drawer__page-content
    > .ui-builder-container
    .dxbl-tabs
    > .dxbl-tabs-content-panel
    > .dxbl-tabs-content.dxbl-active
    > *:only-child
    > *:not(:first-child):has(.gmc-auto-data-grid, .dxbl-grid)
    .dxbl-row
    > .dxbl-fl-group:only-child {
    min-height: 0;
    flex: 1;
}

#app-drawer__page-content > .ui-builder-container .gmc-form .dxbl-fl-group > .dxbl-group.expanded,
#app-drawer__page-content
    > .ui-builder-container
    .gmc-form
    .dxbl-fl-group
    > .dxbl-group.expanded
    .dxbl-group-body-content {
    height: 100%;
}

#app-drawer__page-content
    > .ui-builder-container
    .gmc-form
    .dxbl-fl-group
    > .dxbl-group.expanded
    .dxbl-group-body-content {
    display: flex;
    flex-direction: column;
}

#app-drawer__page-content
    > .ui-builder-container
    .gmc-form
    .dxbl-fl-group
    > .dxbl-group.expanded
    > .dxbl-expandable-container {
    min-height: 0;
    flex: 1;
}

#app-drawer__page-content > .ui-builder-container .dxbl-row:has(.gmc-auto-data-grid) {
    height: 100%;
    min-height: 0;
    flex: 1;

    display: flex;
    flex-direction: column;
    /* Không wrap (DevExpress mặc định wrap): xếp dọc + wrap thì khi hàng thiếu chỗ cho khối anh em (chip, nút) + lưới, lưới bị đẩy
       sang "cột" thứ hai bên phải thay vì nằm dưới. Chỗ thiếu do luật "giữ chỗ tối thiểu" của FullHD B2 bên dưới bù. */
    flex-wrap: nowrap;
}

/* ===== Lưới có chiều cao tối thiểu trên trang module (FullHD B2 / Đ5) =====
   Lưới (GMCAutoDataGrid) vẫn giãn hết chỗ còn lại, nhưng không bị ép dưới: tiêu đề cột + hàng lọc + 8 dòng + dòng tổng.
   Đây là MỘT chỗ đặt giá trị; chỉ đọc token cỡ lưới của :root (modules-new.css), nên đổi cỡ ở token, không sửa số ở đây
   (ngoại lệ: cỡ «Vừa» 34px, xem --gmc-auto-grid-row-h bên dưới).
   Khối phía trên cao làm thiếu chỗ thì lưới giữ mức tối thiểu và vùng nội dung màn (#app-drawer__page-content, overflow-y: auto)
   cuộn MỘT tầng; các tầng chứa lưới không có overflow riêng nên chỉ vùng nội dung màn cuộn.
   - Phần khung ngoài vùng cuộn của lưới do GMCAutoDataGrid.razor.cs báo bằng lớp trên phần tử gốc lưới:
       .gmc-auto-data-grid--chrome-panel  panel nhóm cột chiếm chỗ (dải nút nằm tuyệt đối trong panel, không tính) -> + --gmc-auto-grid-panel-h
       .gmc-auto-data-grid--chrome-nav    không panel, dải nút nằm trong luồng                                       -> + --gmc-auto-grid-nav-h
     B5 (ẩn panel, đưa dải nút lên tiêu đề) chỉ cần đổi hai token / hai lớp này.
   - Mọi tầng chứa lưới (GMCStack / FormLayout / Tabs, không chỉ khối chứa trực tiếp) giữ chỗ tối thiểu = min-content: phần lưới tính
     theo mức tối thiểu ở trên, CỘNG các khối anh em đứng cùng cột (chip, nút, tiêu đề nhóm). Nhờ đó lưới luôn nằm dưới khối anh em,
     khối đứng sau (lưới thứ hai, khối Kết quả, dải tổng) bị đẩy xuống chứ không bị lưới nhô ra đè lên. Trước đây chỉ khối chứa trực
     tiếp giữ đúng mức của lưới (thiếu phần khối anh em) → lưới nhô ra đè khối sau (WO Kế hoạch: khối Kết quả tạo hàng loạt).
     Khi đủ chỗ, min-content nhỏ hơn chỗ được chia nên lưới vẫn giãn đầy như cũ.
     Để min-content không tính cả nghìn dòng của lưới, thân lưới (dxbl-grid) lấy flex-basis 0px (thay 0% inline của DevExpress): lúc
     đo kích thước nội tại 0% bị coi là "theo nội dung", 0px thì không – khung lưới chỉ đóng góp mức tối thiểu của nó. Khung lưới có
     chiều cao xác định (chuỗi giãn của trang module) thì 0px và 0% như nhau; lưới nằm trong khối cao theo nội dung (không thuộc chuỗi
     giãn) thì nay cao đúng mức tối thiểu và cuộn trong lưới thay vì cao theo số dòng.
   - KHÔNG áp (giữ hành vi cũ):
       . lưới lồng trong lưới; lưới / khối trong nhóm đang thu gọn hoặc tab không hoạt động;
       . lưới hoặc khối bọc mang lớp gmc-grid-fixed-size (CÁCH CHUẨN để khai "lưới cỡ cố định": thêm lớp này vào "class" của lưới
         hoặc của khối bọc trong JSON – do cửa sổ phân hệ gắn; GMCAutoDataGrid chép lớp từ "class" của lưới lên phần tử gốc);
       . tạm thời, nhận diện theo chuỗi style inline của khối chứa: "flex: none", "flex: 0 0 <px>" (có / không dấu cách, trừ "auto"),
         "height: <px>" (trừ "height: 100%"). Sẽ bỏ khi các JSON đã gắn lớp.
       . popup / GMCWindow / subform: nằm ngoài #app-drawer__page-content, giữ luật riêng (_window.scss, modules-new.css).
   Chữ #app-drawer__page-content lặp hai lần để thắng (không cần !important) các luật "chuỗi giãn" ở trên đang đặt min-height: 0 lên đúng
   phần tử lưới; luật !important có chủ đích (.pr-product-details__columns…) vẫn thắng luật của lưới. Khối chứa cần !important vì có thể
   mang min-height inline (vd GMCStack "min-height: 180px" trong JSON); module muốn thoát thì dùng lớp gmc-grid-fixed-size, không viết lại !important. */
#app-drawer__page-content {
    /* Dòng lưới theo cỡ hiện hành: đọc token :root; cỡ «Vừa» (html.gmc-density--medium) lưới tự đặt 34px trên chính nó (_datagrid.scss),
       phần tử này ở ngoài lưới nên lặp lại 34px ở luật ngay dưới – đổi cỡ «Vừa» thì sửa cả hai chỗ. */
    --gmc-auto-grid-row-h: var(--gmc-grid-row-h, 26px);
    --gmc-auto-grid-body-min: calc(var(--gmc-auto-grid-row-h) * 10 + var(--gmc-grid-filter-h, 26px) + var(--gmc-grid-total-extra, 0px) + 2px);
    --gmc-auto-grid-panel-h: 42px;
    --gmc-auto-grid-nav-h: 38px;
}

html.gmc-density--medium #app-drawer__page-content {
    --gmc-auto-grid-row-h: 34px;
}

#app-drawer__page-content#app-drawer__page-content > .ui-builder-container
    .gmc-auto-data-grid:not(.gmc-auto-data-grid .gmc-auto-data-grid, .dxbl-group:not(.expanded) *, .dxbl-tabs-content:not(.dxbl-active) *, .gmc-grid-fixed-size, .gmc-grid-fixed-size *, :is([style*="flex: none"], [style*="flex:none"], [style*="flex: 0 0 "]:not([style*="flex: 0 0 auto"]), [style*="flex:0 0 "]:not([style*="flex:0 0 auto"]), :is([style^="height:"], [style*=" height:"], [style*=";height:"])[style*="px"]:not([style*="height: 100%"], [style*="height:100%"])) > .gmc-auto-data-grid) {
    min-height: calc(var(--gmc-auto-grid-body-min));
}

#app-drawer__page-content#app-drawer__page-content > .ui-builder-container
    .gmc-auto-data-grid.gmc-auto-data-grid--chrome-panel:not(.gmc-auto-data-grid .gmc-auto-data-grid, .dxbl-group:not(.expanded) *, .dxbl-tabs-content:not(.dxbl-active) *, .gmc-grid-fixed-size, .gmc-grid-fixed-size *, :is([style*="flex: none"], [style*="flex:none"], [style*="flex: 0 0 "]:not([style*="flex: 0 0 auto"]), [style*="flex:0 0 "]:not([style*="flex:0 0 auto"]), :is([style^="height:"], [style*=" height:"], [style*=";height:"])[style*="px"]:not([style*="height: 100%"], [style*="height:100%"])) > .gmc-auto-data-grid) {
    min-height: calc(var(--gmc-auto-grid-body-min) + var(--gmc-auto-grid-panel-h));
}

#app-drawer__page-content#app-drawer__page-content > .ui-builder-container
    .gmc-auto-data-grid.gmc-auto-data-grid--chrome-nav:not(.gmc-auto-data-grid .gmc-auto-data-grid, .dxbl-group:not(.expanded) *, .dxbl-tabs-content:not(.dxbl-active) *, .gmc-grid-fixed-size, .gmc-grid-fixed-size *, :is([style*="flex: none"], [style*="flex:none"], [style*="flex: 0 0 "]:not([style*="flex: 0 0 auto"]), [style*="flex:0 0 "]:not([style*="flex:0 0 auto"]), :is([style^="height:"], [style*=" height:"], [style*=";height:"])[style*="px"]:not([style*="height: 100%"], [style*="height:100%"])) > .gmc-auto-data-grid) {
    min-height: calc(var(--gmc-auto-grid-body-min) + var(--gmc-auto-grid-nav-h));
}

/* Mọi tầng chứa lưới giữ chỗ = min-content (mức tối thiểu của lưới + khối anh em). Thay ba luật cũ chỉ đặt đúng mức của lưới lên khối
   chứa trực tiếp (min-content luôn >= mức đó nên không màn nào bị thấp hơn trước). */
#app-drawer__page-content#app-drawer__page-content > .ui-builder-container
    :is(.gmc-stack, .gmc-container, .gmc-form, .dxbl-fl, .dxbl-row, .dxbl-fl-group, .dxbl-group, .dxbl-expandable-container, .dxbl-group-body, .dxbl-group-body-content, .dxbl-fl-item, .dxbl-fl-ctrl, .dxbl-tabs-content-panel, .dxbl-tabs-content.dxbl-active):not([style*="flex: none"], [style*="flex:none"], [style*="flex: 0 0 "]:not([style*="flex: 0 0 auto"]), [style*="flex:0 0 "]:not([style*="flex:0 0 auto"]), :is([style^="height:"], [style*=" height:"], [style*=";height:"])[style*="px"]:not([style*="height: 100%"], [style*="height:100%"]), .dxbl-group:not(.expanded) *, .dxbl-tabs-content:not(.dxbl-active) *, .gmc-grid-fixed-size, .gmc-grid-fixed-size *, .gmc-auto-data-grid *):has(.gmc-auto-data-grid:not(.gmc-auto-data-grid .gmc-auto-data-grid, .dxbl-group:not(.expanded) *, .dxbl-tabs-content:not(.dxbl-active) *, .gmc-grid-fixed-size, .gmc-grid-fixed-size *, :is([style*="flex: none"], [style*="flex:none"], [style*="flex: 0 0 "]:not([style*="flex: 0 0 auto"]), [style*="flex:0 0 "]:not([style*="flex:0 0 auto"]), :is([style^="height:"], [style*=" height:"], [style*=";height:"])[style*="px"]:not([style*="height: 100%"], [style*="height:100%"])) > .gmc-auto-data-grid)) {
    min-height: min-content !important;
}

/* Thân lưới: flex-basis 0px để min-content của các tầng trên chỉ tính mức tối thiểu của lưới, không tính số dòng (xem ghi chú đầu khối) */
#app-drawer__page-content#app-drawer__page-content > .ui-builder-container
    .gmc-auto-data-grid:not(.gmc-auto-data-grid .gmc-auto-data-grid, .dxbl-group:not(.expanded) *, .dxbl-tabs-content:not(.dxbl-active) *, .gmc-grid-fixed-size, .gmc-grid-fixed-size *, :is([style*="flex: none"], [style*="flex:none"], [style*="flex: 0 0 "]:not([style*="flex: 0 0 auto"]), [style*="flex:0 0 "]:not([style*="flex:0 0 auto"]), :is([style^="height:"], [style*=" height:"], [style*=";height:"])[style*="px"]:not([style*="height: 100%"], [style*="height:100%"])) > .gmc-auto-data-grid) > dxbl-grid {
    flex-basis: 0px !important;
}

/* End module UI customizations */

/* Carry the PR tab's remaining height through both columns to their grids. */
.pr-product-details,
.pr-product-details__columns {
    min-height: 0;
    flex: 1;
}

.pr-product-details > .gmc-stack:first-child {
    flex: 0 0 auto;
}

.pr-product-details__columns > *,
.pr-product-details__columns .gmc-form,
.pr-product-details__columns .gmc-form > .dxbl-row,
.pr-product-details__columns .dxbl-fl-group,
.pr-product-details__columns .dxbl-group.expanded {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.pr-product-details__columns .gmc-form,
.pr-product-details__columns .gmc-form > .dxbl-row,
.pr-product-details__columns .dxbl-fl-group {
    flex: 1;
}

.pr-product-details__columns .gmc-auto-data-grid {
    min-height: 0 !important;
}

/* QCProduction UI customizations */

.app-subscreen-layout--two-group
    > .dxbl-tabs
    > .dxbl-tabs-content-panel
    > .dxbl-tabs-content.dxbl-active
    > .gmc-stack:only-child {
    height: 100%;
}

.app-subscreen-layout--two-group .dxbl-tabs {
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.app-subscreen-layout--two-group .dxbl-tabs > .dxbl-tabs-content-panel {
    min-height: 0;
    flex: 1;
}

.app-subscreen-layout--two-group
    .dxbl-tabs
    > .dxbl-tabs-content-panel
    > .dxbl-tabs-content.dxbl-active
    > .gmc-stack:only-child {
    height: 100%;
}

.app-subscreen-layout--two-group
    .dxbl-tabs
    > .dxbl-tabs-content-panel
    > .dxbl-tabs-content.dxbl-active
    > .gmc-stack:only-child
    > * {
    min-height: 0;
    flex: 1;
}

.app-subscreen-layout--two-group
    .dxbl-tabs
    > .dxbl-tabs-content-panel
    > .dxbl-tabs-content.dxbl-active
    > .gmc-stack:only-child
    > *
    > .dxbl-row {
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    /* như luật .dxbl-row:has(.gmc-auto-data-grid) ở trên: xếp dọc thì không wrap */
    flex-wrap: nowrap;
}

.app-subscreen-layout--two-group
    .dxbl-tabs
    > .dxbl-tabs-content-panel
    > .dxbl-tabs-content.dxbl-active
    > .gmc-stack:only-child
    > *
    > .dxbl-row
    > .dxbl-fl-group:only-child {
    min-height: 0;
    flex: 1;
}

.app-subscreen-layout--two-group .gmc-form .dxbl-fl-group > .dxbl-group.expanded,
.app-subscreen-layout--two-group .gmc-form .dxbl-fl-group > .dxbl-group.expanded .dxbl-group-body-content {
    height: 100%;
}

.app-subscreen-layout--two-group .gmc-form .dxbl-fl-group > .dxbl-group.expanded .dxbl-group-body-content {
    display: flex;
    flex-direction: column;
}

.app-subscreen-layout--two-group .gmc-form .dxbl-fl-group > .dxbl-group.expanded > .dxbl-expandable-container {
    min-height: 0;
    flex: 1;
}

.app-subscreen-layout--two-group .dxbl-row:has(.gmc-auto-data-grid) {
    height: 100%;
    min-height: 0;
    flex: 1;
}
/* End module UI customizations */

/* Create From UI customizations */
/* Bố cục lưới trong popup "Tạo từ" (lưới giãn, tự cuộn, dải nút luôn thấy) do bộ luật chung GMCWindow Fit
   trong GMCControl (Styles/components/_window.scss) đảm nhiệm, cả popup CreateFrom lẫn GMCWindow JSON dùng
   class create-from__stack. Ở đây chỉ còn độ rộng khung và khoảng cách riêng của popup này. */

.create-from__container {
    width: 100%;
}

.create-from__container > .ui-builder-container > .gmc-stack > *:first-child:not(:has(dxbl-form-layout-group)),
.gmc-stack.create-from__stack > *:first-child:not(:has(dxbl-form-layout-group)) {
    margin-bottom: 0.5rem;
}

.create-from__container > .ui-builder-container > .gmc-stack > *:first-child:has(dxbl-form-layout-group),
.gmc-stack.create-from__stack > *:first-child:has(dxbl-form-layout-group) {
    margin-bottom: -0.5rem;
}

/* End Create From UI customizations */

/* MES module customizations */
.mes-subscreen {
    border-radius: 0.5rem !important;
    overflow: hidden;
}

.mes-subscreen-header-color {
    color: white !important;
}

.mes-subscreen-header-bg {
    background: none;
    background-color: #29375c !important;
}

.mes-subscreen__print-label-button {
    color: #43558d !important;
    background-color: #dae3f4 !important;
}

.mes-subscreen input:not([type="checkbox"]) {
    background-color: white !important;
}

.dxbl-popup-cell:has(.subscreen--always-on-top) {
    z-index: 2000 !important;
}

.mes-chipset .gmc-chip {
    font-weight: 600;
}

.mes__combobox input {
    /* padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important; */

    /* line-height: 1.25rem !important;
    font-size: 1.25rem !important; */

    font-weight: 700 !important;
}

.xl-input {
    line-height: 1 !important;
    font-size: 1.4375rem !important;
}

.xxl-input {
    line-height: 1 !important;
    font-size: 1.6875rem !important;
}

.gmc-input-control--label-hidden fieldset legend,
.gmc-input-control--label-hidden label {
    display: none !important;
}

.gmc-input-control--label-hidden {
    margin: 0px !important;
}

.mes-print-subscreen ~ .dxbl-window-body .base-print__grid td,
.mes-print-subscreen ~ .dxbl-window-body .base-print__grid th,
.mes__select-print-label .base-print__grid tr[role="row"] td,
.mes__select-print-label .base-print__grid th {
    padding: 0.875rem 0.625rem !important;
}

.mes-print-subscreen ~ .dxbl-window-body .base-print__grid td:not(.dxbl-grid-empty-data-area),
.mes__select-print-label .base-print__grid td:not(.dxbl-grid-empty-data-area) {
    font-size: 0.8125rem !important;
    line-height: 1 !important;
}

.mes__start-new-wo-button--flashing:not(:hover) {
    animation: flash 1s infinite;
}

.mes__downtime-btn {
    --btn-bg-color: var(--bs-white);
    background-color: var(--btn-bg-color);
}

.mes__downtime-btn:hover {
    background-color: var(--btn-bg-color) !important;
}

.mes__downtime-btn--flashing-red {
    animation: flash-red 1s infinite;
}

@keyframes flash {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

@keyframes flash-red {
    0%,
    100% {
        background-color: var(--btn-bg-color) !important;
    }

    50% {
        background-color: var(--bs-danger-bg-subtle) !important;
    }
}

/* End MES module customizations */

/* Start MES Dica module customizations */
.mes-dica__waste-type-chipset .gmc-chip {
    background-color: white !important;
    color: black !important;
}

.mes-dica__waste-type-chipset .gmc-chip.gmc-chip-selected {
    background-color: var(--bs-danger) !important;
    color: white !important;
}
/* End MES Dica module customizations */

/* Start MESTkmb KPI Card Customizations */
.mestkmb-kpi {
    padding: 14px 18px !important;
    background: #ffffff !important;
    box-shadow: none !important;
    flex: 1 1 0%;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.mest-container {
    padding: 16px 18px !important;
    background: #ffffff !important;
}
/* End MESTkmb KPI Card Customizations */

/* Start MESQC module customizations */
.mesqc-inline-container {
    width: fit-content;
    max-width: none !important;
    min-height: 2rem;
    display: inline-flex !important;
    flex: 0 0 auto;
    align-items: center !important;
    gap: 0.375rem;
    margin-right: 0 !important;
    margin-left: 0 !important;
    padding: 0.375rem 0.85rem !important;
    color: var(--bs-body-color) !important;
    background-color: #edeff2 !important;
    border-radius: var(--bs-border-radius) !important;
    font-weight: 700 !important;
}

.mesqc-inline-container--primary {
    color: var(--bs-primary) !important;
    background-color: var(--bs-primary-bg-subtle) !important;
    border-color: var(--bs-primary-border-subtle) !important;
}

.mesqc-inline-container--success {
    color: var(--bs-success) !important;
    background-color: var(--bs-success-bg-subtle) !important;
    border-color: var(--bs-success-border-subtle) !important;
}

.mesqc-inline-container .gmc-text,
.mesqc-inline-container .gmc-icon {
    flex: 0 0 auto;
}
/* End MESQC module customizations */

/* Compact quantity inputs in the MES box-output columns. */
.mes-module .col-5 .gmc-input-number-control .gmc-input-slot {
    height: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    font-size: 13px;
    font-weight: 400;
    line-height: 22px;
}

.mes-module .col-5 .gmc-input-number-control .gmc-input-outlined-border {
    border: 1px solid #d7dee8;
    border-radius: 4px;
}

/* Bỏ đường viền dưới thanh tab trong nội dung module. */
#app-drawer__page-content .dxbl-tabs.dxbl-tabs-top > .dxbl-tabs-tablist {
    border-bottom: solid 1px transparent !important;
}
