* {
    box-sizing: border-box;
}

html.preload body {
    display: none !important;
}

html,
body,
input,
textarea,
select,
button {
    margin: 0;
    height: 100%;
    padding: 0;
    font-family: "Exo 2", sans-serif;
    font-optical-sizing: auto;
    color: #3e3e3e;
    font-weight: 500;
    transition: background 0.3s ease, color 0.3s ease;
}

body {
    background: #e8e8e8;
}

/* Thanh cuộn dọc trang: dành gutter ổn định + hiện khi nội dung tràn (Windows/Linux; macOS vẫn phụ thuộc cài đặt OS) */
html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

:target {
    scroll-margin-top: 80px;
    /* điều chỉnh cho vừa với chiều cao <th> sticky */
}

.row-hidden {
    display: none !important;
}

.readonly-select {
    pointer-events: none;
    background-color: #eee;
    color: #555;
}

input:focus,
textarea:focus {
    background-color: #fffadd !important;
}



@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.pointer {
    cursor: pointer !important;
    user-select: none;
    /* ❌ không cho select chữ */
    -webkit-user-select: none;
    -moz-user-select: none;
}

.pointer[role="button"],
.pointer[tabindex] {
    cursor: pointer !important;
}

tr.bom-type-row-clickable,
tr.bom-type-row-clickable td {
    cursor: pointer;
}

tr.bom-type-row-clickable:hover td {
    background: var(--row-hover-bg, #e8f4fc);
}

tr.product-row-clickable,
tr.product-row-clickable td {
    cursor: pointer !important;
}

.product-child-preview-block {
    padding: 10px 12px;
    border-radius: 6px;
}

.product-child-preview-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 13px;
}

.product-child-preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
}

a.product-child-preview-item {
    flex: 0 0 auto;
    display: block;
    text-align: center;
    line-height: 1.25;
    min-width: 56px;
    text-decoration: none;
    color: inherit;
    border-radius: 4px;
}

.product-child-preview-photo {
    width: 56px;
    height: 56px;
    margin: 0 auto 4px;
    flex-shrink: 0;
}

.product-child-preview-photo img {
    display: block;
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #d0d7de;
    background: #fff;
}

.product-child-preview-code {
    font-size: 11px;
    font-weight: 600;
    color: #0077b6;
    white-space: nowrap;
    padding: 0 2px;
}

.expense-toggle-cell {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    line-height: 1.45;
    white-space: normal;
}

.expense-collapse-icon,
.expense-group-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    color: #0077b6;
}

.expense-collapse-icon i,
.expense-group-chevron i {
    transition: color 0.2s ease;
}

.expense-stats-table td,
.expense-stats-table th {
    vertical-align: middle;
}

.expense-stats-table th:first-child,
.expense-stats-table td:first-child {
    width: 64% !important;
}

.expense-stats-table th:last-child,
.expense-stats-table td:last-child {
    width: 36%;
    white-space: nowrap;
}

.expense-stats-table .expense-toggle-label {
    display: inline-block;
    line-height: 1.45;
    white-space: normal;
}

.expense-sub-row-content {
    display: block;
    overflow: visible;
    line-height: 1.45;
    padding: 1px 0;
}

@media (max-width: 768px) {

    .expense-stats-table th:first-child,
    .expense-stats-table td:first-child {
        width: 68% !important;
    }

    .expense-stats-table th:last-child,
    .expense-stats-table td:last-child {
        width: 32%;
    }

    .expense-stats-table .toggle-all-groups>th:first-child,
    .expense-stats-table .toggle-group>td:first-child {
        padding-left: 6px !important;
    }

    .expense-stats-table .expense-toggle-cell {
        display: flex;
        width: 100%;
        align-items: flex-start;
        gap: 6px;
    }

    .expense-stats-table .expense-collapse-icon,
    .expense-stats-table .expense-group-chevron {
        min-width: 12px;
        width: 12px;
        justify-content: flex-start;
        margin-left: 0;
    }

    .expense-stats-table .expense-toggle-label {
        padding-top: 1px;
    }
}


.container {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    min-width: 0;
    overflow-x: clip;
}

.main {
    background: #e8e8e8;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    box-sizing: border-box;
}


.main-content-card {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.topbar {
    background: rgba(0, 81, 128, 0.965);
    backdrop-filter: blur(10px);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    color: #fff;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    padding: 10px;
    gap: 10px;
}


.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    padding: 5px;
}

.theme-toggle {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
}

select,
textarea,
input[type="datetime-local"],
input[type="date"],
input[type="month"],
input[type="time"],
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="file"] {
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid #6cace4;
    font-size: 14px;
    background: #fdfdfd;
    color: #333;
    max-width: 100%;
    box-sizing: border-box;
}

input[type="datetime-local"],
input[type="date"],
input[type="month"],
input[type="time"],
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
select {
    height: 30px;
}


select:focus,
input[type="text"]:focus,
textarea:focus {
    border-color: #0077b6;
    outline: none;
    background: #fdfff3;
}

.batchInput {
    font-size: 20px !important;
    font-weight: bold !important;
    border: 1px solid #ccc !important;
    border-radius: 6px !important;
    height: 50px !important;
    text-align: center !important;
    width: 95% !important;
    display: inline-block !important;
    padding: 2px !important;
}


.stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 5px;
    background: #d8e4ed;
}


.stat-box {
    background: #ffffff;
    color: #0077b6;
    padding: 5px 15px;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-left: 4px solid #00b4d8;
}

/* Dòng link tải Excel mẫu (page product update): có gap khi xuống dòng */
.product-update-template-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    align-items: flex-start;
}

.stats .currency-stat-filter {
    cursor: pointer;
    user-select: none;
    transition: all 0.18s ease;
}

.stats .currency-stat-filter:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}

.stats .currency-stat-filter.active-currency-filter {
    background: #0077b6;
    color: #ffffff;
    border-left-color: #005f91;
}


table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    table-layout: fixed;
}

/* Override cho settings-table - không dùng fixed layout */
.settings-table {
    table-layout: auto !important;
}


th,
td {
    padding: 10px 5px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

td.description {
    text-align: left;
    white-space: normal;
    word-break: break-word;
}

/* bỏ viền dọc ở cột cuối cho đẹp */


tr.row-error input {
    border: 1px solid red !important;
    background: #ffecec;
}

tbody tr:hover {
    background: #f3faff;
    transition: background 0.2s ease;
}

.no-hover tbody tr:hover {
    background: inherit !important;
    cursor: default;
}

td img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

td label {
    margin-bottom: 4px;
}



thead th {
    position: sticky;
    top: 0;
    background: rgb(59, 130, 172);
    ;
    /* hoặc white */
    z-index: 9;
    color: #fff;
}

/*
 * Dropdown trong thead sticky: ô header đang mở nổi trên các th khác (không position:relative trên th).
 */
table thead,
table thead tr,
table thead th {
    overflow: visible;
}

table thead th:has(.dropdown-menu:hover),
table thead th:has(.dropdown-menu:focus-within),
table thead th:has(.dropdown-menu.is-open) {
    z-index: 10050;
}

table thead th .dropdown-menu .menu-content {
    z-index: 10060;
}

/* Orders: cho phép dropdown trong thead không bị cắt */
#orders-table,
#orders-table thead,
#orders-table thead tr,
#orders-table thead th {
    overflow: visible !important;
}

#orders-table thead th .dropdown-menu .menu-content {
    z-index: 10060;
}

/*
 * Cột dropdown (Lọc trạng thái): KHÔNG dùng position:relative — sẽ ghi đè thead th { sticky }
 * và làm ô không dính header. Giữ sticky + z-index khi hover như cũ.
 */
#orders-table thead th.orders-th-dropdown {
    position: sticky;
    top: 0;
}

#orders-table thead th.orders-th-dropdown:hover,
#orders-table thead th.orders-th-dropdown:focus-within {
    z-index: 10050;
}

/* Nút xuất Bank Charge Deduction Report (PDF) ở cột đầu */
#orders-table thead th .orders-bcdr-submit {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 16px;
    line-height: 1;
    vertical-align: middle;
}

#orders-table thead th .orders-bcdr-submit:hover {
    opacity: 0.85;
}

#orders-table tbody tr.order-row .order-checkbox-cell {
    position: relative;
    padding: 0;
    vertical-align: middle;
}

#orders-table .order-checkbox-cell-hit {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    inset: 0;
    margin: 0;
    box-sizing: border-box;
    cursor: pointer;
}

#orders-table .order-checkbox-cell-hit .order-checkbox {
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.tooltip.tooltip-inline-hit {
    display: inline-block;
    max-width: 100%;
    cursor: help;
}

#orders-table td .order-deposit-bank-fee {
    cursor: help;
}

/* Đóng dropdown theo JS (click) */
.dropdown-menu.force-close .menu-content {
    display: none !important;
}

/* Touch / mobile: mở bằng click (.dropdown-click), không dùng :hover (tránh menu tự bật lại sau khi chọn) */
@media (hover: none),
(pointer: coarse),
(max-width: 768px) {
    .dropdown-menu.dropdown-click:hover .menu-content {
        display: none !important;
        opacity: 0 !important;
    }

    .dropdown-menu.dropdown-click.is-open:not(.force-close) .menu-content {
        display: block !important;
        opacity: 1 !important;
        transform: scale(1) !important;
    }
}

#orders-table {
    margin-top: 0;
}

/* Danh sách hợp đồng khoán — cùng layout bảng đơn hàng */
#piecework-orders-table {
    margin-top: 0;
}

#piecework-orders-table,
#piecework-orders-table thead,
#piecework-orders-table thead tr,
#piecework-orders-table thead th {
    overflow: visible !important;
}

#piecework-orders-table thead th {
    position: sticky;
    top: 0;
}

@media (max-width: 1199px) {
    .piecework-list-scroll-hint {
        display: block;
    }
}

/* Danh sách SP (?page=products list): thead dính khi cuộn — border-collapse:gộp ô làm sticky thead lỗi trên một số trình duyệt */
table.product-list-table {
    border-collapse: separate;
    border-spacing: 0;
}

table.product-list-table thead th {
    position: sticky;
    top: 0;
    /* Dưới .order-tabs (10) — dropdown "Thêm mới" / "Cài đặt" không bị thead che */
    z-index: 8;
    background: rgb(59, 130, 172);
    color: #fff;
}


.no-border th,
.no-border td {
    border: 0;
}

/* ===== TABLE FULL BORDER STYLE ===== */
/* Bảng meta từng bản ghi sản xuất hàng mộc (ghi đè .table-bordered padding) */
.gw-greenware-entry-meta.table-bordered td:nth-child(1) {
    padding: 8px 8px 8px 12px !important;
    vertical-align: top;
}

.gw-greenware-entry-meta.table-bordered td:nth-child(2) {
    padding: 8px 12px 8px 10px !important;
}

.table-bordered {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #ccc;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid #ccc;
    padding: 8px !important;
    text-align: left;
    font-size: 14px;
}

.table-bordered td:first-child {
    padding-left: 8px !important;
}

.table-bordered th {
    background: #f5f6fa;
    font-weight: 600;
}

.table-bordered tr:nth-child(even) td {
    background: #fafafa;
}

.table-bordered tr:hover td {
    background: #f0f8ff;
}

/* ===== DARK MODE ===== */






/* Bảng lương Payroll */

.payroll-row {
    display: grid;
    grid-template-columns: 64% 34%;
    /* 👈 Tỉ lệ */
    gap: 10px;
    align-items: stretch;
}

@media (max-width: 768px) {
    .payroll-row {
        grid-template-columns: 1fr;
        /* 👈 Mobile: xuống dòng */
    }
}

.wrapper-payroll {
    position: relative;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-radius: 5px;
    padding: 10px;
}

/* Trang Giao hàng: gutter do .main (desktop); mobile chừa đáy bằng padding .main */
.shipment-page {
    padding: 0;
    box-sizing: border-box;
}

.shipment-page>.order-tabs {
    padding: 0;
    align-items: center;
    justify-content: space-between;
}

.shipment-page>.order-tabs>.filters {
    padding: 0;
    margin: 0;
}

.shipment-page .shipment-table-menu-filters {
    padding: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    box-sizing: border-box;
}

/* Thanh tab chuyến lồng trong thanh shipment (order-tabs > order-tabs), nếu có */
.shipment-page>.order-tabs>.order-tabs {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    margin: 0;
    box-sizing: border-box;
}

/* Danh sách phiếu giao: tránh bảng bị nén trên mobile (flex + table-layout fixed) */
.shipment-page .shipment-list-card {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.shipment-page .shipment-list-scroll-wrapper {
    max-width: 100%;
    min-width: 0;
}

.shipment-page .shipment-list-table tr.shipment-group-header td {
    font-size: larger;
}

.shipment-page .shipment-list-sheet {
    margin-top: 0;
}

.shipment-page .shipment-list-empty {
    padding: 20px 16px;
    text-align: center;
    font-size: 14px;
    line-height: 1.45;
}

.shipment-page .shipment-list-pagination {
    margin: 15px 0 0;
    text-align: center;
}

.shipment-page .shipment-list-pane .mould-detail-pane-body {
    padding-top: 12px;
}

.shipment-page .shipment-kind-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin: 0 0 12px 0;
}

.shipment-page .shipment-kind-filter-bar .mould-detail-field-label {
    margin: 0;
    flex: 0 0 auto;
}

.shipment-page .shipment-kind-filter-bar select.input {
    flex: 1 1 200px;
    max-width: 280px;
    min-width: 0;
    box-sizing: border-box;
}

@media (max-width: 599px) {
    .shipment-page .shipment-kind-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .shipment-page .shipment-kind-filter-bar select.input {
        max-width: none;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .shipment-page .shipment-list-table {
        table-layout: auto !important;
        width: max-content !important;
        min-width: 780px !important;
    }

    .shipment-page .shipment-list-table th,
    .shipment-page .shipment-list-table td {
        white-space: nowrap;
    }

    .shipment-page .shipment-list-table tr.bglightblue td {
        white-space: normal;
    }

    .shipment-page .shipment-list-table th:nth-child(5),
    .shipment-page .shipment-list-table td:nth-child(5) {
        white-space: normal;
        max-width: 220px;
    }
}

/* Form tạo chuyến: khoảng cách tiêu đề phía trên */
.oc-create-page-title {
    margin-top: 20px;
}

/* Form tạo chuyến (tàu biển): 2 cột desktop, xếp dọc trên mobile */
.oc-create-seal-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 15px 0;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .oc-create-seal-row {
        grid-template-columns: 1fr;
    }
}

/* Trang Cài đặt: nội dung tab sát thanh .order-tabs, không dùng .wrapper-payroll */
.settings-page {
    padding: 0;
    box-sizing: border-box;
}

.settings-page .order-tabs {
    align-items: center;
    border-radius: 0;
}

/* Tiêu đề trang Cài đặt: cùng cỡ chữ, đậm, căn mép trên khối nội dung */
.settings-page-title {
    display: block;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 12px 0;
    padding: 0;
}

.settings-page-title--section {
    margin-top: 16px;
    margin-bottom: 10px;
}

.settings-page-title-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 16px 0;
}

.settings-page-title-bar .settings-page-title {
    margin-bottom: 0;
    flex: 1 1 auto;
    min-width: 0;
}

.settings-page-title-bar .settings-page-title-actions {
    flex: 0 0 auto;
    padding-top: 2px;
}

/* Phân tách các form / khu vực cài đặt trong cùng một tab */
.settings-form-block {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 16px 18px;
    background: #fafbfc;
}

.settings-form-block+.settings-form-block {
    margin-top: 14px;
}

.settings-form-block+form {
    margin-top: 14px;
}

.settings-form-block>.settings-page-title.settings-page-title--section:first-child {
    margin-top: 0;
}

.settings-page-flash-msg {
    margin-bottom: 12px;
}

.settings-page-flash-msg .alert {
    margin-bottom: 0;
}

/* —— Trang Gói dịch vụ (license_info) —— */
.license-page .license-kpis--cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.license-page .license-kpis--cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.license-page .license-panel-body {
    padding: 0 12px 12px;
}

.license-page .license-connect__hint {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.45;
    color: #78909c;
}

.license-page .license-connect__label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #78909c;
}

.license-page .license-connect__input {
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.license-page .license-connect__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.license-page .license-connect__status {
    font-size: 13px;
}

.license-page .license-toggle-link {
    border: none;
    background: none;
    cursor: pointer;
    font: inherit;
}

.license-page .license-cms-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.2;
    white-space: nowrap;
}

.license-page .license-cms-badge.is-pending {
    background: #eceff1;
    color: #78909c;
}

.license-page .license-cms-badge.is-online {
    background: #e8f5e9;
    color: #2e7d32;
}

.license-page .license-cms-badge.is-offline {
    background: #ffebee;
    color: #c62828;
}

.license-page .license-feature-count {
    min-width: 28px;
    height: 26px;
    padding: 0 10px;
    font-size: 14px;
}

.license-page .license-panel-body > .license-feat-group:first-child {
    margin-top: 4px;
    padding-top: 12px;
}

.license-page .license-feat-group + .license-feat-group {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #eceff1;
}

.license-page .license-feat-group__label {
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #455a64;
}

.license-page .license-feat-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 4px 16px;
}

.license-page .license-feat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    line-height: 1.4;
    color: #90a4ae;
}

.license-page .license-feat-item i {
    flex: 0 0 auto;
    width: 14px;
    text-align: center;
    font-size: 12px;
}

.license-page .license-feat-item.is-on {
    color: #37474f;
}

.license-page .license-feat-item.is-on i {
    color: #43a047;
}

@media (max-width: 767px) {
    .license-page .license-kpis--cols-3,
    .license-page .license-kpis--cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .license-page .license-connect__input {
        max-width: none;
    }
}

.wrapper-payroll canvas {
    display: block;
    width: 100% !important;
    /* ✨ Quan trọng */
    height: auto !important;
    /* Cho co giãn theo tỉ lệ */
}


.table-payroll {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    table-layout: fixed;
}

.table-payroll th,
.table-payroll td {
    padding: 4px;
    border: 0;
    border-bottom: 1px solid #eee;
    font-size: 15px;
    padding: 10px 5px;
    overflow: visible !important;
    text-overflow: unset !important;
    white-space: normal !important;
}

.table-payroll tr.payroll-header {
    background: #dcf0fe;
}




.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}

.form-item {
    display: flex;
    flex-direction: column;
}

.form-item.full {
    grid-column: 1 / -1;
}

.form-item label {
    font-weight: 600;
    margin-bottom: 5px;
}

@media (max-width: 480px) {
    .form-item label {
        font-size: 14px;
    }
}

/* Form thêm tạm ứng lương (payroll → advance) — cột hẹp, ít khoảng trống */
.form-advance.advance-form .advance-form__inner {
    max-width: 480px;
}

.form-advance.advance-form .advance-form__grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-advance.advance-form .advance-form__pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px 12px;
    align-items: end;
}

.form-advance.advance-form .advance-form__worker-box {
    position: relative;
    width: 100%;
    min-width: 0;
}

.form-advance.advance-form .advance-form__control {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.form-advance.advance-form .advance-form__field-label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 13px;
}

.form-advance.advance-form .advance-form__deduct {
    padding: 8px 10px;
    background: #f7f9fc;
    border: 1px solid #e6eaf0;
    border-radius: 6px;
}

.form-advance.advance-form .advance-form__deduct-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    margin-bottom: 8px;
}

.form-advance.advance-form .advance-form__option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-weight: normal;
    cursor: pointer;
    line-height: 1.3;
    white-space: nowrap;
}

.form-advance.advance-form .advance-form__option input {
    flex-shrink: 0;
    margin: 0;
}

.form-advance.advance-form .advance-form__month-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 200px;
}

.form-advance.advance-form .advance-form__sub {
    font-size: 11px;
    color: #555;
    font-weight: 600;
}

.form-advance.advance-form .advance-form__actions {
    margin-top: 2px;
    padding-top: 10px;
    border-top: 1px solid #e8e8e8;
}

@media (max-width: 480px) {
    .form-advance.advance-form .advance-form__pair {
        grid-template-columns: 1fr;
    }

    .form-advance.advance-form .advance-form__inner {
        max-width: none;
    }

    .form-advance.advance-form .advance-form__option {
        white-space: normal;
    }
}

/* Định nghĩa bảng không tự ẩn chữ */
.table-nowrap {
    table-layout: auto;
    /* Để bảng tự động điều chỉnh theo nội dung */
    white-space: nowrap;
    /* Cấm tự động xuống dòng */
    overflow-x: auto;
    /* Nếu cần thiết, có thể kéo ngang để xem nội dung */
}

/* Cấu trúc cột để đảm bảo bảng mở rộng */
.table-nowrap td,
.table-nowrap th {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nowrap {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    word-break: break-word;
}

.progress-box .progress-container {
    height: 15px;
    border-radius: 10px;
    overflow: hidden;
    width: 100%;
}

.progress-container {
    height: 8px;
    background: #cecece;
    border-radius: 10px;
    overflow: hidden;
    width: 98%;
}

.progress-bar {
    height: 100%;
    background: #01be04;
}

/* Chi tiết HĐ khoán — header 3 cột (33/33/33), mobile 1 cột */
.piecework-detail-page .piecework-detail-hero-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: center;
    padding-bottom: 10px;
}

.piecework-detail-page .piecework-detail-hero-col--title {
    min-width: 0;
}

.piecework-detail-page .piecework-detail-hero-col--progress {
    min-width: 0;
    text-align: left;
}

.piecework-detail-page .piecework-detail-hero-progress__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.piecework-detail-page .piecework-detail-hero-progress__qty {
    min-width: 0;
    text-align: left;
}

.piecework-detail-page .piecework-detail-hero-progress__meta {
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
}

.piecework-detail-page .piecework-detail-hero-progress__meta-sep {
    font-weight: 700;
}

.piecework-detail-page .piecework-detail-hero-progress__bar {
    width: 100%;
    max-width: none;
}

.piecework-detail-page .piecework-detail-hero-col--actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .piecework-detail-page .piecework-detail-hero-grid {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .piecework-detail-page .piecework-detail-hero-col--progress {
        text-align: left;
    }

    .piecework-detail-page .piecework-detail-hero-col--actions {
        justify-content: flex-start;
    }
}

/* Chi tiết HĐ khoán — header: thanh SX mộc (danh sách sản phẩm chỉ hiển thị số + %) */
.piecework-detail-page .piecework-detail-hero-progress .progress-container.piecework-sxmoc-progress {
    width: 100%;
    max-width: none;
    margin: 0;
    height: 9px;
    border-radius: 9px;
    box-sizing: border-box;
}

.filter-option {
    display: inline-block;
    background: #f2f2f2;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 4px 10px;
    margin: 2px 2px 2px 0;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: normal;
    /* Cho phép xuống dòng */
    user-select: none;
}

.filter-option:hover {
    background: #e0f0ff !important;
    border-color: #66aaff !important;
    color: #0066cc !important;
}

.filter-option.active {
    background: #007bff !important;
    border-color: #006fe6 !important;
    color: #fff !important;
    font-weight: 600;
    box-shadow: 0 0 4px rgba(0, 123, 255, 0.4) !important;
}

.filter-option:active {
    transform: scale(0.97) !important;
}


/* Sidebar stacking — luôn trên nội dung trang (thead dropdown ~10060, modal nội trang ~10100) */
:root {
    --app-sidebar-z: 99999;
    --app-sidebar-edge-z: 99998;
    --app-sidebar-edge-strip-z: 99997;
    --app-popup-z: 100000;
}

/* ----------- BASE DESKTOP (≥1200px) ----------- */
/* Sidebar luôn cố định cạnh trái, cao bằng màn hình */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    /* top:0; left:0; bottom:0 */
    width: 180px;
    background: rgb(0, 81, 128);
    color: #fff;
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    /* header | profile | menu(scroll) | footer */
    z-index: var(--app-sidebar-z);

    /* slide in/out mượt nếu đang dùng off-canvas */
    transform: translateX(0);
    transition: transform .35s cubic-bezier(.4, 0, .2, 1);
}

/* Chỉ phần menu ở giữa được scroll; footer & header luôn “đặt dưới/đặt trên” đúng chỗ */
.sidebar-menu {
    overflow: auto;
    min-height: 0;
    padding-block: 6px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Footer KHÔNG fixed, KHÔNG overlay: nằm ở hàng 3, luôn ở đáy sidebar */
.sidebar-footer {
    text-align: center;
    padding: 10px 8px;
    font-size: 13px;
    color: rgba(255, 255, 255, .7);
    flex-shrink: 0;
    /* dư phòng nếu bạn đổi sang flex sau này */
}

/* Off-canvas trên màn nhỏ (nếu có) */
body.sidebar-closed .sidebar {
    transform: translateX(-100%);
}

.sidebar-toggle {
    display: none;
}

/* ----------- MOBILE & TABLET (≤1199px): sidebar off-canvas + bottom bar — đồng bộ order-tabs scroll ----------- */
@media (max-width: 1199px) {

    /* Sidebar mặc định ẩn */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.35s ease;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
        overflow-y: auto;
        /* cho phép cuộn nếu menu dài */
        z-index: var(--app-sidebar-z);
    }

    /* Khi mở sidebar (body có class sidebar-open) */
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    /* Main full width — chừa đúng chiều cao bottom bar (52px), không kéo giãn thừa chiều cao viewport */
    .main:not(:has(.news-page--thread)) {
        margin-left: 0;
        width: 100%;
        align-self: flex-start;
        padding: 0 0 52px;
        box-sizing: border-box;
    }

    .main-content-card:not(:has(.news-page--thread)) {
        padding: 0;
    }
}

/* ----------- PC (≥1200px): sidebar cố định trái ----------- */
@media (min-width: 1200px) {
    .sidebar {
        /* translateX(0) thay vì none: transition transform với trạng thái thu menu mượt hơn */
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: none;
    }

    .main {
        margin-left: 180px;
        width: calc(100% - 180px);
        /* Đồng bộ với .sidebar transform (~0.35s) — tránh giật khi bật/tắt sidebar PC */
        transition: margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
            width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Inset nội dung khỏi sidebar + mép phải (vùng xám .main là “viền”) */
    .main:not(:has(.news-page--thread)) {
        padding: 10px;
        box-sizing: border-box;
    }
}

/* ----------- Tùy chọn: màn hình thấp ----------- */
@media (max-height: 480px) {
    .sidebar-footer {
        padding: 6px 8px;
        font-size: 12px;
    }

    .sidebar-footer img {
        max-width: 64px;
    }
}

/* ----------- BOTTOM BAR (≤1199px) ----------- */
@media (max-width: 1199px) {

    /* Thanh bar cố định ở đáy màn hình */
    .bottom-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        padding: 0 10px;
        width: 100%;
        height: 52px;
        background: rgba(0, 81, 128, 0.97);
        display: flex;
        justify-content: space-around;
        align-items: center;
        z-index: 1900;
        box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.25);
        backdrop-filter: blur(6px);
        transition: opacity 0.35s ease, transform 0.35s ease;
        /* 🪄 smooth */
    }


    /* Link chung trong bottom bar */
    .bottom-bar .bar-link {
        color: white;
        text-decoration: none;
        font-size: 22px;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 52px;
        height: 52px;
        transition: background 0.25s ease, transform 0.15s ease;
    }

    .bottom-bar .bar-link:hover {
        background: #ffffff22;
    }

    /* Nút toggle ở giữa */
    .bottom-bar .sidebar-toggle {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 35px;
        height: 35px;
        border-radius: 8px;
        background: #ffffff22;
        color: white;
        border: 1px solid rgba(255, 255, 255, 0.3);
        font-size: 22px;
        cursor: pointer;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
        transition: background 0.3s ease, transform 0.15s ease;
    }

    .bottom-bar .sidebar-toggle:hover {
        background: #ffffff33;
    }

    .bottom-bar .bar-link.active {
        background: rgba(255, 255, 255, 0.25);
        transition: all 0.2s ease;
    }


    /* Khi sidebar mở => ẩn bottom bar bằng hiệu ứng slide & fade */
    body.sidebar-open .bottom-bar {
        opacity: 0;
        transform: translateY(100%);
        /* 🧊 trượt xuống mượt */
        pointer-events: none;
    }

    /* Khi sidebar đóng lại => bottom bar trượt ngược lên */
    body:not(.sidebar-open) .bottom-bar {
        opacity: 1;
        transform: translateY(0);
    }

    /* Khối cuối trang: không margin-bottom 10px (tránh khe xám trước bottom bar) */
    .main:not(:has(.news-page--thread)) .main-content-card > *:last-child,
    .ps-page-body > *:last-child,
    .page-shell > *:last-child,
    .settings-page > *:last-child,
    .shipment-page > *:last-child {
        margin-bottom: 0;
    }

}

/* Nút về đầu trang (index.php — toàn hệ thống) */
.app-scroll-top-btn {
    position: fixed;
    right: max(16px, env(safe-area-inset-right, 0px));
    bottom: max(20px, env(safe-area-inset-bottom, 0px));
    z-index: 10050;
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.38);
    background: rgba(30, 30, 30, 0.28);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px);
    pointer-events: none;
    transition:
        opacity 0.35s ease,
        transform 0.28s ease,
        visibility 0.28s ease,
        background 0.35s ease,
        border-color 0.35s ease,
        box-shadow 0.35s ease;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.app-scroll-top-btn.is-visible {
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Đang cuộn: đậm, dễ bấm */
.app-scroll-top-btn.is-visible.is-scrolling {
    opacity: 1;
    background: rgba(30, 30, 30, 0.58);
    border-color: rgba(255, 255, 255, 0.42);
    box-shadow: 0 3px 16px rgba(0, 0, 0, 0.22);
}

/* Dừng cuộn: mờ hơn, ít che nội dung */
.app-scroll-top-btn.is-visible.is-idle {
    opacity: 0.42;
    background: rgba(30, 30, 30, 0.14);
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: none;
}

.app-scroll-top-btn.is-visible.is-scrolling:hover {
    background: rgba(30, 30, 30, 0.72);
}

.app-scroll-top-btn.is-visible.is-idle:hover {
    opacity: 0.72;
    background: rgba(30, 30, 30, 0.32);
}

.app-scroll-top-btn:focus {
    outline: 2px solid rgba(0, 123, 255, 0.55);
    outline-offset: 2px;
}

/* Mobile/tablet: luôn nằm trên bottom-bar (52px) — rule phải đặt SAU .app-scroll-top-btn base */
@media (max-width: 1199px) {
    .app-scroll-top-btn {
        bottom: calc(52px + 16px + env(safe-area-inset-bottom, 0px));
    }
}

/* ----------- PC (ẩn bottom bar) + toggle sidebar (breakpoint 1200px đồng bộ order-tabs) ----------- */
@media (min-width: 1200px) {
    .bottom-bar {
        display: none;
    }

    body.sidebar-pc-collapsed .sidebar {
        transform: translateX(-100%) !important;
        pointer-events: none;
    }

    /* Hover mép trái (sidebar-pc-edge-hover): menu trượt ra đè content — giống mobile off-canvas */
    body.sidebar-pc-collapsed.sidebar-pc-hoverpeek .sidebar {
        transform: translateX(0) !important;
        pointer-events: auto;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
        z-index: var(--app-sidebar-z);
    }

    body.sidebar-pc-collapsed .main {
        margin-left: 0;
        width: 100%;
    }

    .sidebar-pc-toggle i {
        font-size: 13px;
        pointer-events: none;
    }

    /* Thanh xanh gợi ý — chỉ nhìn, không bắt chuột (hover xử lý ở lớp invisible phía trên) */
    body.sidebar-pc-collapsed .sidebar-pc-edge-strip {
        display: block;
        position: fixed;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 8px;
        height: 300px;
        margin: 0;
        padding: 0;
        border: none;
        z-index: var(--app-sidebar-edge-strip-z);
        pointer-events: none;
        background: rgb(0, 81, 128);
        border-radius: 0 5px 5px 0;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.18);
    }

    /* Invisible full cao — z-index cao hơn thanh xanh; hover = peek menu (không đổi localStorage) */
    body.sidebar-pc-collapsed .sidebar-pc-edge-hover {
        display: block;
        position: fixed;
        left: 0;
        top: 0;
        width: 8px;
        height: 100vh;
        height: 100dvh;
        z-index: var(--app-sidebar-edge-z);
        pointer-events: auto;
        background: transparent;
        cursor: default;
    }
}

/* Mép PC: ẩn mặc định */
.sidebar-pc-edge-strip,
.sidebar-pc-edge-hover {
    display: none;
}

@media (max-width: 1199px) {
    .sidebar-pc-toggle {
        display: none !important;
    }
}

#bottom-tab-tooltip {
    position: fixed;
    left: 50%;
    bottom: 60px;
    transform: translate(-50%, 8px);
    max-width: calc(100vw - 32px);
    padding: 9px 16px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 2005;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

#bottom-tab-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}


.sidebar-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 7px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}


.right-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Cùng hàng với Logout: căn giữa icon trong nút (FA hai chevron hay lệch baseline) */
.sidebar-header-actions .right-actions>.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.left-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-header-actions .button {
    background: transparent;
    border: none;
    color: white;
    font-size: 13px;
    padding: 2px;
    cursor: pointer;
}

.sidebar-header-actions .button:hover {
    color: #90e0ef;
}

/* Chế độ sáng (icon mặt trời): vàng nắng — tránh trùng icon trắng như menu Setting */
.sidebar-header-actions #toggle-darkmode.theme-toggle--sun-active i {
    color: #fbbf24;
}

.sidebar-header-actions #toggle-darkmode.theme-toggle--sun-active:hover i {
    color: #fcd34d;
}


.sidebar-profile {
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    text-align: center;
    padding: 10px 0;
}

.sidebar-profile .name {
    font-weight: bold;
    margin-top: 6px;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    /* Bóng chữ nhẹ */
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 20px;
    color: white;
    text-decoration: none;
    transition: background 0.3s, color 0.3s;
    border-left: 4px solid transparent;
    margin: 0 5px 1px 5px;
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-menu a i {
    width: 1.25em;
    text-align: center;
    flex-shrink: 0;
}

.bottom-bar .bar-link i {
    width: 1.25em;
    text-align: center;
}

.sidebar a:hover,
.sidebar a.active {
    background: rgba(255, 255, 255, 0.15);
    border-left: 4px solid #90e0ef;
    color: #90e0ef;
}

.sidebar a.active {
    font-weight: bold;
}

.sidebar a.selected {
    background: rgba(255, 255, 255, 0.15);
    border-left: 4px solid #90e0ef;
    color: #90e0ef;
    font-weight: bold;
}


.page-not-found {
    padding: 40px;
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    color: #d90429;
    background: #ffecec;
    border: 1px solid #f5b5b5;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    margin: 40px auto;
    width: 350px;
}


/* ===================== PAGINATION ===================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 20px auto;
    padding: 5px;
    font-size: 15px;
    user-select: none;
}

.pagination a {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    background: #f2f5f8;
    color: #004b80;
    text-decoration: none;
    border: 1px solid #d0d9e0;
    transition: all 0.2s ease;
}

.pagination a:hover {
    background: #0078d4;
    color: #fff !important;
    border-color: #0078d4;
}

.pagination a.active {
    background: #0078d4 !important;
    color: #fff !important;
    font-weight: 600;
    cursor: default;
}

.pagination a.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* 🌙 DARK MODE */



/* 🔹 Responsive tweak */
@media (max-width: 600px) {
    .pagination {
        gap: 4px;
        font-size: 14px;
    }

    .pagination a {
        padding: 5px 9px;
    }
}

.text-bold {
    font-weight: bold;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.text-white {
    color: #ffffff !important;
}


.text-blue {
    color: #0077b6 !important;
}


.text-green {
    color: #2e8b57 !important;
}

.text-gray {
    color: #666666 !important;
}


.text-orange {
    color: #ff8533 !important;
}

.text-red {
    color: #d90429 !important;
}

.xsmall-text {
    font-size: 12px;
}

.small-text {
    font-size: 14px;
}

.medium-text {
    font-size: 16px;
}

.large-text {
    font-size: 20px;
}

.xlarge-text {
    font-size: 24px;
}

.xxlarge-text {
    font-size: 28px;
}

.bold600 {
    font-weight: 600;
}

.bold700 {
    font-weight: 700;
}

.bold800 {
    font-weight: 800;
}

/* CSS chung cho Button */
/* BASE BUTTON STYLE */
.button {
    display: inline-block;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.3s ease, color 0.3s ease;
    white-space: nowrap;
}

/* SIZE */
.button.xsmall {
    font-size: 12px;
    padding: 1px 5px;
}

.button.small {
    font-size: 13px;
    padding: 5px 8px;
}

.button.medium {
    font-size: 14px;
    padding: 6px 14px;
}

.button.big {
    font-size: 18px;
    padding: 5px 10px;
}

/* COLOR THEMES */
.button.red {
    background-color: #e63946;
    color: white;
}

.button.green {
    background-color: #2a9d8f;
    color: white;
}

.button.blue {
    background-color: #0077b6;
    color: white;
}

.button.gray {
    background-color: #adb5bd;
    color: white;
}

.button.orange {
    background-color: #ff8533;
    color: white;
}

.button.purple {
    background-color: #e600ac;
    color: white;
}

.button.transparent {
    background: transparent;
    border: none;
    color: #ffffff;
    padding: 2px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.button.transparent:hover {
    color: #ff8533;
}

/* HOVER */
.button.red:hover {
    background-color: #c62e3c;
}



.button.gray:hover {
    background-color: #888;
}

.button.orange:hover {
    background-color: #d98e51;
}

.button {
    color: white;
    text-decoration: none;
}

.button:hover {
    color: white;
}

.button.transparent:hover {
    color: #90e0ef;
}

/* DARK MODE */




/* CSS CHO INPUT */
.input.small.tcenter {
    width: 50px;
    padding: 2px;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    border: 1px solid #ccc;
    border-radius: 6px;
    height: 34px;
}

.input-cell {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    padding: 6px !important;
}

.input-cell input {
    width: 40px;
    display: inline-block;
    text-align: center;
}

/* ============================ */
/* STYLES CHO THẺ <a> CHUNG TRONG MAIN CONTENT */
/* ============================ */

.main a,
.main-content-card a,
.scrollable a,
.content a {
    color: #0077b6;
    text-decoration: none;
    transition: color 0.2s ease;
}

.main a:hover,
.main-content-card a:hover,
.scrollable a:hover,
.content a:hover {
    color: #002e47;
    text-decoration: none;
}

.main a:focus,
.main-content-card a:focus,
.scrollable a:focus,
.content a:focus {
    outline: none;
    text-decoration: none;
}



a.button {
    color: white !important;
    text-decoration: none;
}

a.button:hover {
    color: white !important;
}

/* CSS cho header của đơn hàng */
#custom-tooltip {
    --tooltip-bg: #1e293b;
    --tooltip-fg: #f8fafc;
    --tooltip-arrow-x: 50%;
    --tooltip-arrow-size: 8px;
    position: fixed;
    left: 0;
    top: 0;
    transform: translateY(6px);
    opacity: 0;
    visibility: hidden;
    background: var(--tooltip-bg);
    color: var(--tooltip-fg);
    padding: 7px 11px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.28);
    pointer-events: none;
    white-space: nowrap;
    z-index: 10060;
    display: none;
    overflow: visible;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

#custom-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

#custom-tooltip.is-below:not(.is-visible) {
    transform: translateY(-6px);
}

#custom-tooltip.is-below.is-visible {
    transform: translateY(0);
}

/* Mũi tên nhọn giữa — W3Schools top tooltip (top: 100%, border-top = hướng xuống) */
#custom-tooltip::before {
    content: '';
    position: absolute;
    left: var(--tooltip-arrow-x, 50%);
    top: 100%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: var(--tooltip-arrow-size) var(--tooltip-arrow-size) 0 var(--tooltip-arrow-size);
    border-color: var(--tooltip-bg) transparent transparent transparent;
    filter: drop-shadow(0 2px 1px rgba(15, 23, 42, 0.2));
}

#custom-tooltip.is-below::before {
    top: auto;
    bottom: 100%;
    border-width: 0 var(--tooltip-arrow-size) var(--tooltip-arrow-size) var(--tooltip-arrow-size);
    border-color: transparent transparent var(--tooltip-bg) transparent;
}

#custom-tooltip.is-multiline {
    white-space: pre-line;
    max-width: min(92vw, 420px);
    text-align: left;
}

.order-header-grid.bigfont-mode {
    padding: 10px;
    margin: 0 0 5px;
    text-align: justify;
    font-size: 0;
    /* chống khoảng trắng thừa */
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
    min-height: 50px;
    background: linear-gradient(to top, #bbdcff, #ffffff);
}

.order-header-grid.bigfont-mode::after {
    content: "";
    display: inline-block;
    width: 100%;
}

.order-header-grid.bigfont-mode>div {
    display: inline-block;
    font-size: 14px;
    min-width: 120px;
    white-space: nowrap;
    cursor: pointer;
}

.order-header-grid.bigfont-mode span {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.order-header-grid.bigfont-mode strong {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
    word-break: break-word;
}

.order-header-grid.bigfont-mode strong:hover {
    color: #0077b6;
}

.order-header-delivery-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    line-height: 1;
}

.order-header-delivery-text {
    line-height: 1;
}

.order-header-grid.bigfont-mode .order-header-delivery-label .order-header-status-badge {
    margin-bottom: 0;
}

.order-delivery-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    cursor: pointer;
    color: #007bff;
    font-size: 13px;
    line-height: 1;
    flex-shrink: 0;
}

.order-delivery-edit-btn i {
    display: block;
    line-height: 1;
}

.order-header-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    margin: 0;
    padding: 2px 4px;
    border-radius: 2px;
    background: #05a62d;
    color: #fff !important;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    flex-shrink: 0;
}

.order-header-status-badge i {
    font-size: 8px;
    line-height: 1;
}

/* ✅ Dark mode */



.finance-col {
    transition: all 0.3s ease;
}

#orders-table.orders-finance-cols-hidden .finance-col {
    display: none !important;
}

/* CSS cho các tabs menu của đơn hàng background: #e3eef8 .tab color: #555 */
.order-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
    background: rgba(0, 81, 128, 0.956);
    padding: 5px;
    position: relative;
    z-index: 10;
    /* đảm bảo trên nội dung bảng; khi mở dropdown nhích lên trên thead sticky (vd. product-list) */
    overflow-x: visible;
    /* ✅ FIX dropdown bị che */
    overflow-y: visible;
    /* ✅ cần nếu dropdown mở xuống */
}

.order-tabs:has(.dropdown-menu:hover),
.order-tabs:has(.dropdown-menu:focus-within),
.order-tabs:has(.dropdown-menu.is-open) {
    z-index: 10080;
}

/* ✅ Dark mode */


.order-tabs .tab {
    flex: 0 0 auto;
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 600;
    padding: 6px 10px;
    cursor: pointer;
    color: #fcfcfc;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
    user-select: none;
    /* ❌ không cho select chữ */
    -webkit-user-select: none;
    -moz-user-select: none;
}

.order-tabs .tab:hover {
    color: #96dfff;
    border-color: #007bff;
}

.order-tabs .tab.active {
    color: #96dfff;
    border-color: #007bff;
}

/* Dropdown menu trong order-tabs */
.order-tabs .dropdown-menu {
    display: inline-flex;
    align-items: stretch;
    position: relative;
}

.order-tabs .dropdown-menu .menu-content {
    z-index: 10090;
}

.order-tabs .dropdown-menu .menu-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 600;
    padding: 6px 10px;
    cursor: pointer;
    color: #fcfcfc;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
    user-select: none;
    height: 100%;
    box-sizing: border-box;
}

.order-tabs .dropdown-menu .menu-trigger:hover,
.order-tabs .dropdown-menu .menu-trigger.active {
    color: #96dfff;
    border-color: #007bff;
}

.order-tabs .dropdown-menu .menu-content a i {
    margin-right: 8px;
    width: 1.1em;
    text-align: center;
}

/* Mobile: thanh tab ngang — wrapper overflow:visible để dropdown không bị cắt */
.order-tabs-scroll {
    position: relative;
    overflow: visible;
    max-width: 100%;
}

@media (max-width: 1199px) {
    .order-tabs-scroll .order-tabs {
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 4px;
        padding: 6px 8px;
        overflow-x: auto;
        overflow-y: hidden;
        touch-action: pan-x;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: auto;
        scrollbar-width: none;
        max-width: 100%;
    }

    /* Đủ chỗ hiển thị hết tab → không cuộn ảo */
    .order-tabs-scroll:not(.is-scrollable) .order-tabs {
        overflow-x: hidden;
    }

    .order-tabs-scroll .order-tabs::-webkit-scrollbar {
        display: none;
        height: 0;
    }

    .order-tabs-scroll .order-tabs>.tab,
    .order-tabs-scroll .order-tabs>.dropdown-menu,
    .order-tabs-scroll .order-tabs>.order-tabs-right {
        flex: 0 0 auto;
    }

    .order-tabs-scroll .order-tabs .tab,
    .order-tabs-scroll .order-tabs .dropdown-menu .menu-trigger {
        padding: 8px 12px;
        font-size: 14px;
        -webkit-tap-highlight-color: transparent;
        /* Không transition "all" — tránh giật khi vuốt ngang */
        transition: color 0.2s ease, border-color 0.2s ease;
    }

    .order-tabs-scroll .order-tabs .order-tabs-right {
        margin-left: auto;
    }

    /* Vuốt ngang: không tô :hover/:active giống tab đang chọn */
    .order-tabs-scroll .order-tabs>.tab:hover,
    .order-tabs-scroll .order-tabs>.tab:active {
        color: #fcfcfc;
        border-color: transparent;
    }

    .order-tabs-scroll .order-tabs>.tab.active {
        color: #96dfff;
        border-color: #007bff;
    }

    .order-tabs-scroll .order-tabs .dropdown-menu .menu-trigger:hover:not(.active) {
        color: #fcfcfc;
        border-color: transparent;
    }

    .order-tabs-scroll .dropdown-menu.dropdown-click:hover .menu-content {
        display: none !important;
        opacity: 0 !important;
    }

    .order-tabs-scroll .dropdown-menu.is-open:not(.force-close) .menu-content {
        display: block !important;
        opacity: 1 !important;
        transform: none !important;
        translate: none !important;
        position: fixed !important;
        z-index: 10100;
        margin-top: 0;
        position-anchor: none;
    }

    .order-tabs-scroll:has(.dropdown-menu.is-open) {
        z-index: 10080;
    }
}

/* Desktop: dropdown order-tabs mở bằng click (.dropdown-click) */
@media (min-width: 769px) {
    .order-tabs-scroll .dropdown-menu.dropdown-click:hover .menu-content {
        display: none !important;
        opacity: 0 !important;
    }

    .order-tabs-scroll .dropdown-menu.is-open:not(.force-close) .menu-content {
        display: block !important;
        opacity: 1 !important;
        transform: scale(1) !important;
        z-index: 10090;
    }

    .order-tabs-scroll:has(.dropdown-menu.is-open) {
        z-index: 10080;
    }
}

/* Module Khuôn: nội dung dưới tab, sát mép (gutter do .main) */
.mould-page-body {
    margin: 0;
    box-sizing: border-box;
}

/* Chi tiết khuôn: sát order-tabs, một khối bgwhite */
.mould-page-body-detail {
    margin: 0;
}

.mould-detail-sheet.bgwhite {
    padding: 0;
    box-sizing: border-box;
    overflow: visible;
}

.mould-detail-sheet>.mould-detail-pane:first-child {
    border-top: none;
}

.mould-catalog-filter-form {
    margin: 0;
}

.mould-catalog-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: flex-end;
}

.mould-catalog-filter-field {
    flex: 0 1 auto;
    min-width: 140px;
}

.mould-catalog-filter-field--search {
    flex: 1 1 200px;
    min-width: 0;
}

.mould-catalog-filter-field .input,
.mould-catalog-filter-field select.input {
    width: 100%;
    box-sizing: border-box;
}

.mould-catalog-filter-actions {
    flex: 0 0 auto;
}

.mould-catalog-pane-body--table {
    padding-top: 12px;
}

@media (max-width: 599px) {
    .mould-catalog-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .mould-catalog-filter-field,
    .mould-catalog-filter-field--search {
        width: 100%;
        flex: 1 1 auto;
    }

    .mould-catalog-filter-actions .button {
        width: 100%;
    }
}

.mould-detail-alert-wrap {
    padding: 12px 16px 0;
}

.mould-detail-overview-inner {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    align-items: stretch;
}

@media (min-width: 900px) {
    .mould-detail-overview-inner {
        grid-template-columns: minmax(0, 1fr) minmax(320px, 38%);
    }
}

@media (min-width: 1200px) {
    .mould-detail-overview-inner {
        grid-template-columns: minmax(0, 1.15fr) minmax(360px, 420px);
    }
}

.mould-detail-overview-main {
    display: flex;
    gap: 16px;
    padding: 16px;
    align-items: flex-start;
    min-width: 0;
}

.mould-detail-thumb-col {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 144px;
}

.mould-detail-thumb-upload-btn {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    justify-content: center;
    margin: 0;
}

.mould-detail-photo-form {
    margin: 0;
}

.mould-detail-photo-input {
    display: none;
}

.mould-detail-thumb-wrap {
    flex: 0 0 auto;
    width: 144px;
    height: 144px;
    border-radius: 8px;
    border: 1px solid #e0e6ed;
    overflow: hidden;
    background: #f5f7fa;
    position: relative;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.mould-detail-thumb-wrap:hover {
    border-color: #90caf9;
    box-shadow: 0 2px 8px rgba(21, 101, 192, 0.15);
}

.mould-detail-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mould-detail-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #90a4ae;
    font-size: 36px;
}

.mould-detail-thumb-zoom {
    position: absolute;
    bottom: 3px;
    right: 3px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border-radius: 4px;
    padding: 2px 5px;
    font-size: 9px;
    line-height: 1;
    pointer-events: none;
}

.mould-detail-identity {
    flex: 1 1 auto;
    min-width: 0;
}

.mould-detail-identity-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.mould-detail-head-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.mould-detail-head-actions .mould-detail-delete-form {
    margin: 0;
    padding: 0;
    border: none;
}

.mould-detail-code {
    font-size: 13px;
    font-weight: 700;
    color: #1565c0;
    letter-spacing: 0.02em;
    margin-bottom: 2px;
}

.mould-detail-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    color: #263238;
}

.mould-detail-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.mould-detail-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.mould-detail-badge--status-active {
    background: #e8f5e9;
    color: #2e7d32;
}

.mould-detail-badge--status-retired {
    background: #fff3e0;
    color: #ef6c00;
}

.mould-detail-badge--status-scrapped {
    background: #eceff1;
    color: #546e7a;
}

.mould-detail-badge--status-unknown {
    background: #eceff1;
    color: #78909c;
}

.mould-detail-badge--inhouse {
    background: #e3f2fd;
    color: #1565c0;
}

.mould-detail-badge--external {
    background: #f3e5f5;
    color: #6a1b9a;
}

.mould-detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px 20px;
    margin: 0;
}

.mould-detail-meta-item {
    min-width: 0;
}

.mould-detail-meta-item dt {
    margin: 0 0 3px 0;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #78909c;
}

.mould-detail-meta-item dd {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: #37474f;
    line-height: 1.35;
    word-break: break-word;
}

.mould-detail-meta-unit {
    font-size: 11px;
    font-weight: 400;
    color: #90a4ae;
}

.mould-detail-note {
    margin-top: 14px;
    padding: 10px 12px;
    background: #f5f7fa;
    border-radius: 6px;
    border-left: 3px solid #90caf9;
}

.mould-detail-note-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #78909c;
    margin-bottom: 4px;
}

.mould-detail-note-text {
    margin: 0;
    font-size: 13px;
    color: #546e7a;
    line-height: 1.45;
}

.mould-detail-delete-btn {
    background: #c0392b !important;
    color: #fff !important;
    border: none !important;
}

.mould-detail-price-panel {
    padding: 16px;
    border-top: 1px solid #e0e0e0;
    background: #fafbfc;
    box-sizing: border-box;
    min-width: 0;
}

@media (min-width: 900px) {
    .mould-detail-price-panel {
        border-top: none;
        border-left: 1px solid #e0e0e0;
    }
}

.mould-detail-price-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.mould-detail-price-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #78909c;
}

.mould-detail-price-label i {
    margin-right: 4px;
    color: #1565c0;
}

.mould-detail-price-current {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1565c0;
    line-height: 1.2;
    margin-bottom: 12px;
}

.mould-detail-price-hint {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: #90a4ae;
    margin-top: 2px;
}

.mould-detail-price-add-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.mould-detail-price-add-form .input {
    width: 100%;
    box-sizing: border-box;
}

.mould-detail-price-history-title {
    font-size: 12px;
    font-weight: 600;
    color: #546e7a;
    margin: 0 0 6px 0;
}

.mould-detail-pane {
    border-top: 1px solid #e0e0e0;
}

.mould-detail-row-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    background: #f5f7fa;
    font-weight: 700;
    font-size: 16px;
    color: #1565c0;
    border-bottom: 1px solid #eceff1;
}

.mould-detail-row-header i {
    opacity: 0.85;
    font-size: 15px;
}

/* legacy alias */
.mould-detail-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    background: #f5f7fa;
    font-weight: 700;
    font-size: 16px;
    color: #1565c0;
    border-bottom: 1px solid #eceff1;
}

.mould-detail-section-sub {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    color: #78909c;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mould-detail-section-count {
    margin-left: auto;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: #1565c0;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mould-detail-section-body,
.mould-detail-pane-body {
    padding: 16px;
    box-sizing: border-box;
}

.mould-detail-bom-intro {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: #78909c;
    line-height: 1.45;
}

.mould-detail-bom-total-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 14px;
    padding: 10px 14px;
    background: #e3f2fd;
    border-radius: 8px;
}

.mould-detail-bom-total-label {
    font-size: 13px;
    font-weight: 600;
    color: #546e7a;
}

.mould-detail-bom-total-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1565c0;
}

.mould-detail-bom-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 0 0;
}

.mould-detail-assign-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid #eceff1;
}

.mould-detail-assign-search {
    flex: 1 1 220px;
    position: relative;
    min-width: 0;
}

.mould-detail-field-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #546e7a;
    margin-bottom: 4px;
}

.mould-detail-assign-input {
    width: 100%;
    box-sizing: border-box;
}

.mould-detail-assign-suggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 400;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 0 0 6px 6px;
    max-height: 280px;
    overflow-y: auto;
    margin-top: 2px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mould-detail-assign-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.mould-detail-assign-actions form {
    margin: 0;
}

.mould-detail-assign-msg {
    margin: 0 0 12px 0;
}

.mould-detail-products-pane {
    scroll-margin-top: 16px;
}

.mould-detail-products-table-wrap {
    margin-top: 4px;
}

.mould-detail-products-table-wrap .mould-assign-products-table {
    table-layout: fixed;
    width: 100%;
}

.mould-assign-product-code-wrap {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.mould-assign-product-code-link {
    flex: 1 1 auto;
    min-width: 0;
    text-decoration: none;
}

.mould-assign-unassign-form {
    display: inline-flex;
    margin: 0;
    flex: 0 0 auto;
}

.mould-assign-unassign-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    color: #78909c;
    cursor: pointer;
    line-height: 1;
    font-size: 13px;
    transition: background .15s, color .15s, border-color .15s;
}

.mould-assign-unassign-btn:hover {
    background: #ffebee;
    border-color: #ef9a9a;
    color: #c62828;
}

.mould-assign-unassign-btn i {
    pointer-events: none;
}

.mould-detail-empty-state {
    text-align: center;
    padding: 28px 16px;
    color: #90a4ae;
}

.mould-detail-empty-state i {
    font-size: 28px;
    margin-bottom: 8px;
    opacity: 0.6;
}

.mould-detail-empty-state p {
    margin: 0;
    font-size: 14px;
}

.mould-detail-empty-state--compact {
    padding: 16px;
}

.mould-detail-inactive-notice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    background: #fff8e1;
    border-radius: 8px;
    border-left: 3px solid #ffb300;
    margin-bottom: 14px;
    color: #5d4037;
    font-size: 13px;
    line-height: 1.45;
}

.mould-detail-inactive-notice i {
    color: #f9a825;
    margin-top: 2px;
    flex-shrink: 0;
}

.mould-detail-inactive-notice p {
    margin: 0;
}

@media (max-width: 768px) {
    .mould-detail-edit-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 599px) {
    .mould-detail-overview-main {
        padding: 12px;
        gap: 12px;
    }

    .mould-detail-thumb-col {
        width: 112px;
    }

    .mould-detail-thumb-upload-btn {
        font-size: 11px;
        padding-left: 6px;
        padding-right: 6px;
    }

    .mould-detail-thumb-wrap {
        width: 112px;
        height: 112px;
    }

    .mould-detail-thumb-placeholder {
        font-size: 28px;
    }

    .mould-detail-title {
        font-size: 1.1rem;
    }

    .mould-detail-meta-grid {
        grid-template-columns: 1fr 1fr;
    }

    .mould-detail-assign-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .mould-detail-assign-actions {
        width: 100%;
    }

    .mould-detail-assign-actions .button {
        flex: 1 1 auto;
        text-align: center;
    }
}

/* Gán SP — bảng dưới #mould-assign-products: mã rộng (hai dòng nội bộ + khách), mô tả co lại phần còn lại */
#mould-assign-products .mould-assign-products-table col.mould-assign-products-code-col {
    width: 240px;
    min-width: 200px;
}

#mould-assign-products .mould-assign-products-table .mould-assign-products-code-td {
    padding-right: 12px;
}

#mould-assign-products .mould-assign-products-table .mould-assign-products-desc-td {
    font-size: 0.92em;
    line-height: 1.34;
}

@media (max-width: 768px) {
    #mould-assign-products .mould-assign-products-table col.mould-assign-products-code-col {
        width: 38vw;
        min-width: 120px;
        max-width: 200px;
    }
}

/* Chi tiết khuôn: PC — cột ảnh rất hẹp (legacy grid — giữ cho tương thích nếu còn dùng) */
@media (min-width: 769px) {
    .mould-detail-top-grid {
        grid-template-columns: minmax(0, 132px) minmax(0, 1fr) minmax(0, 1fr);
        gap: 12px;
        align-items: stretch;
    }

    /* Nội dung mỗi block kéo theo chiều cao hàng lưới */
    .mould-detail-top-grid>.data-block {
        box-sizing: border-box;
        min-height: 0;
        height: auto;
        display: flex;
        flex-direction: column;
    }

    .mould-detail-top-grid>.data-block:first-child #productPhotoPreview {
        text-align: center;
    }

    .mould-detail-top-grid>.data-block:first-child #productPhotoPreview img {
        margin: 0 auto;
        display: block;
        max-width: 100%;
    }
}

/* Lịch sử giá: nút icon thùng rác */
.scroll-table-wrapper.mould-price-history-scroll .mould-price-delete-th {
    width: 42px;
    padding-left: 4px !important;
    padding-right: 4px !important;
}

.scroll-table-wrapper.mould-price-history-scroll .mould-price-delete-td {
    width: 42px;
    padding: 6px 4px !important;
}

.mould-price-delete-btn {
    padding: 6px 8px !important;
    line-height: 1;
    min-height: auto;
}

.mould-price-delete-btn i {
    font-size: 12px;
    pointer-events: none;
}

/* Lịch sử giá khuôn: 2 cột (Ngày + Giá rộng), ghi chú dòng nhỏ dưới giá */
.scroll-table-wrapper.mould-price-history-scroll .scroll-table .mould-price-history-th-date,
.scroll-table-wrapper.mould-price-history-scroll .scroll-table .mould-price-history-td-date {
    /* Đủ cho dd/mm/yyyy + padding (table ~10pt) */
    width: 8.25rem;
    min-width: 8.25rem;
    max-width: 8.25rem;
    white-space: nowrap;
    vertical-align: middle;
    box-sizing: border-box;
}

.scroll-table-wrapper.mould-price-history-scroll .mould-price-history-price-cell {
    vertical-align: middle;
    word-break: break-word;
}

.scroll-table-wrapper.mould-price-history-scroll .mould-price-history-price-cell>.mould-price-history-amount {
    font-size: 12pt;
    line-height: 1.35;
}

.scroll-table-wrapper.mould-price-history-scroll .mould-price-history-note {
    margin-top: 4px;
    font-size: 9pt;
    line-height: 1.35;
}

.mould-detail-price-panel .scroll-table-wrapper.mould-price-history-scroll {
    width: 100%;
    max-width: 100%;
}

.mould-detail-price-panel .scroll-table-wrapper.mould-price-history-scroll .scroll-table {
    width: 100% !important;
    min-width: 0 !important;
}

.mould-page-body-detail .mould-detail-edit-form {
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.mould-page-body-detail .mould-detail-edit-form .mould-edit-field {
    margin-bottom: 0;
    min-width: 0;
}

.mould-detail-edit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
}

.mould-detail-edit-grid .mould-edit-field--full {
    grid-column: 1 / -1;
}

.mould-detail-edit-grid .mould-edit-actions-row {
    grid-column: 1 / -1;
    border-top: 1px solid #eceff1;
    padding-top: 12px;
    margin-top: 2px;
}

.mould-detail-edit-grid .mould-edit-actions-row .mould-edit-actions {
    margin-top: 0;
}

.mould-page-body-detail .mould-detail-edit-form .mould-edit-label {
    display: block;
    margin-bottom: 4px;
    line-height: 1.3;
}

.mould-page-body-detail .mould-detail-edit-form .mould-edit-control {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.mould-page-body-detail .mould-detail-edit-form .mould-edit-hint {
    margin: 6px 0 0 0;
}

.mould-page-body-detail .mould-detail-edit-form .mould-lifecycle-field--edit {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.mould-page-body-detail .mould-detail-edit-form .mould-edit-control--lifecycle {
    width: auto;
    min-width: 7em;
    max-width: 12em;
    flex: 0 1 auto;
}

.mould-page-body-detail .mould-detail-edit-form .mould-edit-actions {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.mould-page-body-detail .mould-detail-edit-form .mould-edit-field--supplier {
    overflow: visible;
    position: relative;
    z-index: 3;
}

/* Module Khuôn: nội dung Thêm thủ công / Import Excel full width */
.mould-fullwidth-wrap {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    margin: 0;
    padding: 0 0 20px;
}

.mould-fullwidth-inner {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.mould-fullwidth-inner .bgwhite {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

/* Form thêm khuôn thủ công (?page=mould&opt=add): cột tiêu đề ~30%, ô nhập ~70% */
.mould-fullwidth-inner table.mould-add-manual-table.settings-table {
    table-layout: fixed !important;
}

.mould-fullwidth-inner .mould-add-manual-table>tbody>tr>td:first-child:not([colspan]) {
    width: 30%;
    max-width: 30%;
    box-sizing: border-box;
    vertical-align: top;
}

.mould-fullwidth-inner .mould-add-manual-table>tbody>tr>td:nth-child(2) {
    width: 70%;
    box-sizing: border-box;
    vertical-align: top;
}

/* Form thêm khuôn: gợi ý NCC — tránh bị cắt vì rule global td { overflow: hidden } */
.mould-fullwidth-inner .settings-table tr.mould-supplier-autocomplete-row>td.mould-supplier-autocomplete-cell {
    overflow: visible !important;
    vertical-align: top;
}

.mould-fullwidth-inner .mould-supplier-autocomplete-wrap,
.mould-page-body-detail .mould-detail-edit-form .mould-supplier-autocomplete-wrap {
    overflow: visible;
}

.mould-fullwidth-inner .mould-supplier-field-row,
.mould-page-body-detail .mould-detail-edit-form .mould-supplier-field-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: visible;
    max-width: none;
}

.mould-fullwidth-inner .mould-supplier-input-wrap,
.mould-page-body-detail .mould-detail-edit-form .mould-supplier-input-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    overflow: visible;
}

.mould-fullwidth-inner .mould-supplier-search-input,
.mould-page-body-detail .mould-detail-edit-form .mould-supplier-search-input {
    width: 100%;
    max-width: none;
}

.mould-fullwidth-inner .mould-supplier-clear-btn,
.mould-page-body-detail .mould-detail-edit-form .mould-supplier-clear-btn {
    flex: 0 0 auto;
    width: auto !important;
    max-width: none !important;
    white-space: nowrap;
}

.mould-fullwidth-inner .mould-supplier-results.searchUsers,
.mould-page-body-detail .mould-detail-edit-form .mould-supplier-results.searchUsers {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 10050;
    margin-top: 5px;
    width: 100%;
    min-width: min(420px, calc(100vw - 48px));
    max-width: 420px;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    box-sizing: border-box;
}

body.dark .mould-fullwidth-inner .mould-supplier-results.searchUsers,
body.dark .mould-page-body-detail .mould-detail-edit-form .mould-supplier-results.searchUsers {
    background: #252525;
    border-color: #444;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

/* Trang thêm chi phí: chọn NCC — cùng pattern (overflow td + gợi ý + nút xóa chỉ khi đã chọn) */
.data-block .settings-table tr.expense-supplier-autocomplete-row>td.expense-supplier-autocomplete-cell {
    overflow: visible !important;
    vertical-align: top;
}

.expense-supplier-autocomplete-wrap {
    overflow: visible;
}

.expense-supplier-field-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: visible;
    max-width: min(420px, 100%);
}

.expense-supplier-input-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    overflow: visible;
}

.expense-supplier-search-input {
    width: 100%;
    max-width: none;
}

.expense-supplier-clear-btn {
    flex: 0 0 auto;
    width: auto !important;
    max-width: none !important;
    white-space: nowrap;
}

.expense-supplier-results.searchUsers {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 10050;
    margin-top: 5px;
    width: 100%;
    min-width: min(420px, calc(100vw - 48px));
    max-width: 420px;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    box-sizing: border-box;
}

body.dark .expense-supplier-results.searchUsers {
    background: #252525;
    border-color: #444;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}


/* Active state cho menu items trong dropdown */
.dropdown-menu .menu-content a.active {
    background: #e0f0ff;
    color: #007bff;
    font-weight: 600;
}


.order-tab-content {
    display: none;
    z-index: 0;
}

.order-tab-content.active {
    display: block;
}

/* Dropdown Menu Styles */
/* ===== Base style giữ nguyên vibe hiện tại ===== */
.dropdown-menu {
    position: relative;
    display: inline-block;
    z-index: 20;
}

/* Nút trigger sẽ là anchor */
.dropdown-menu .menu-trigger {
    /* để làm anchor */
    anchor-name: --trigger;
    cursor: pointer;
}

/* Menu ẩn mặc định */
.dropdown-menu .menu-content {
    display: none;
    position: absolute;
    z-index: 2100;
    /* Dropdown trong trang — thấp hơn sidebar (--app-sidebar-z: 99999) */
    min-width: 180px;
    width: max-content;
    max-width: min(480px, calc(100vw - 16px));
    /* chống tràn ngang viewport */
    max-height: min(60vh, 480px);
    /* chống tràn dọc viewport */
    overflow: auto;
    /* nhiều item thì cuộn */
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
    border-radius: 6px;
    padding: 5px;
    text-align: left;

    /* animation nhẹ */
    opacity: 0;
    transform: scale(.98);
    transition: opacity .15s ease, transform .15s ease;

    margin-top: 0;
    top: 100%;
    left: 0;
}

/* Tạo vùng đệm vô hình để giữ hover khi di chuột từ trigger xuống menu */
.dropdown-menu .menu-content::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
    background: transparent;
}

/* Hover để mở (như cách bạn đang dùng) */
.dropdown-menu:hover .menu-content {
    display: block;
    opacity: 1;
    transform: scale(1);
}

/* ====== Progressive enhancement: Anchor Positioning ======
   Nếu trình duyệt hỗ trợ, menu sẽ tự bám theo trigger và tự flip nếu tràn  */
@supports (position-anchor: --x) and (anchor-name: --x) {
    .dropdown-menu .menu-content {
        /* gắn vào anchor (menu-trigger) */
        position-anchor: --trigger;

        /* Mặc định: xổ xuống, canh giữa theo trigger */
        top: anchor(bottom);
        left: anchor(center);
        translate: -50% 0;

        /* Tự thử lật theo khối (trên/dưới) và theo trục inline (trái/phải) nếu tràn */
        position-try: flip-block, flip-inline;

        /* (tuỳ chọn) thêm lựa chọn ưa thích thứ tự khi thử */
        position-try-order: most-useful;

        /* Tạo khoảng cách giữa trigger và menu */
        position-area: bottom 6px;
    }

    /*
     * Tab bar (.order-tabs) flex-wrap: tab "Thêm khuôn" xuống dòng thường sát mép trái.
     * Căn giữa trigger (center + translate -50%) khiến menu tràn mép trái viewport.
     * Bám mép trái trigger + flip-inline/flop-block giữ menu trong khung như dropdown chuyên nghiệp.
     */
    .order-tabs .dropdown-menu .menu-content {
        left: anchor(left);
        translate: 0 0;
    }

    /* Dropdown trong .gw-workflow-tab-bar / .subtab-links: bám mép trái trigger */
    .gw-workflow-tab-bar .dropdown-menu .menu-content,
    .subtab-links .dropdown-menu .menu-content {
        left: anchor(left);
        translate: 0 0;
    }

    /* Orders thead: cột hẹp trên mobile — bám mép trái trigger, tránh tràn phải */
    #orders-table .dropdown-menu .menu-content {
        left: anchor(left);
        translate: 0 0;
    }
}

/* ===== Dark mode giữ nguyên ===== */



/* Item styles (như cũ) */
.dropdown-menu .menu-content a,
.dropdown-menu .menu-content label {
    display: block;
    padding: 10px 30px;
    text-decoration: none;
    color: #333;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 2px solid #eee;
    transition: background .3s;
    cursor: pointer;
}

.dropdown-menu .menu-content a:last-child {
    border-bottom: none;
}

.dropdown-menu .menu-content a:hover {
    background: #f0f0f0;
    color: #007bff;
    border-bottom: 2px solid #007bff;
}

/* CSS TAB Sản xuất */
.highlight-row {
    background-color: rgb(255, 246, 246) !important;
}


/* LOGIN FORM */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    background: #eef1f5;
}


.login-form {
    background: white;
    padding: 30px 40px;
    border-radius: 12px;
    border-color: #989898;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    text-align: center;
    width: 100%;
    max-width: 560px;
    margin-top: 10vh;
}


.login-form h2 {
    margin-bottom: 20px;
    font-size: 24px;
    color: #0077b6;
}

.login-form input[type="tel"],
.login-form input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 15px;
    border-radius: 8px;
    height: 40px !important;
    font-size: 20px !important;
    font-weight: bold !important;
    border: 1px solid #ccc;
    background: #fdfdfd;
    color: #333;
}


.login-form input[type="submit"] {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    background: #0077b6;
    color: white;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.login-form input[type="submit"]:hover {
    background: #005f91;
}

.login-form .error-message {
    color: red;
    font-weight: 500;
    margin-bottom: 10px;
}

/* Permission table */
.permission-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: white;
}

.permission-table th,
.permission-table td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    vertical-align: top;
    text-align: left;
}

.permission-table td label {
    background: #d5e9ff;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.permission-label {
    min-width: 200px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.dark .permission-table td label {
    background: rgba(255, 255, 255, 0.08);
    color: #eee;
}

#inactiveEmployees {
    min-height: 100px;
    overflow: hidden;
}

.invoice-header-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    width: 100%;
}

/* Tab Hợp đồng: phân tách sản phẩm bổ sung sau khi tạo đơn */
.invoice-supplement-separator td {
    background: linear-gradient(90deg, #fff8f0 0%, #ffe8cc 50%, #fff8f0 100%);
    border-top: 2px solid #f57c00;
    border-bottom: 2px solid #ffb74d;
    padding: 12px 10px !important;
    font-weight: 700;
    font-size: 15px;
    color: #bf360c;
    text-align: center;
}

.invoice-card {
    display: flex;
    flex-direction: column;
    background: linear-gradient(to bottom, #fff, #e0f2ff);
    padding: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    flex: 0 0 auto;
}

/* Width cố định cho 4 card (đã trừ gap) */
.invoice-card:first-child {
    width: 27%;
}

.invoice-card:nth-child(2) {
    width: 27%;
}

.invoice-card:nth-child(3) {
    width: 24%;
}

.invoice-card:nth-child(4) {
    width: 22%;
}

/* Responsive mobile */
@media (max-width: 768px) {
    .invoice-card {
        width: 100% !important;
        border-bottom: 2px solid #fff;
    }
}

.invoice-card h4 {
    margin-top: 0;
    margin-bottom: 8px;
}

/* Hàng tiêu đề card invoice (Hợp đồng + nút info) */
.invoice-card-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.invoice-card-head-row h4 {
    margin: 0;
    flex: 1;
    min-width: 0;
}

.invoice-card-head-action {
    flex-shrink: 0;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    cursor: pointer;
    color: #007bff;
    font-size: 17px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Gợi ý xem lịch sử thanh toán — cùng cỡ .xsmall-text như dòng tỉ giá */
.invoice-payment-history-hint {
    margin-top: 6px;
    color: #2e8b57;
    display: flex;
    align-items: center;
    gap: 5px;
}

.invoice-payment-history-hint .fas {
    font-size: 12px;
    opacity: 0.9;
}


.finance-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    border-bottom: 1px solid #cdcdcd;
    padding-bottom: 5px;
}


.finance-row span {
    font-weight: 500;
}

.money {
    font-weight: bold;
    color: #0077b6;
}


/* Thông tin chung */
.info-block {
    margin: 5px 0 5px 0;
}

.invoice-card label {
    display: inline-flex;
    align-items: center;
    margin-right: 10px;
}

/* ICON FILE */
.file-icons {
    display: flex;
    gap: 5px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.file-icons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #f0f7ff;
    border: 1px solid #cce5ff;
    border-radius: 6px;
    transition: all 0.2s ease;
    position: relative;
}

/* Cập nhật lại file icons để sử dụng class tooltip */
.file-icons a:hover {
    background: #0077b6;
    border-color: #0077b6;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.file-icons i {
    font-size: 16px;
    color: #0077b6;
    transition: all 0.2s ease;
}

.file-icons a:hover i {
    color: white;
    transform: scale(1.1);
}

/* Remove old file label since we now use tooltips */
.file-label {
    display: none;
}

/* Lịch sử cập nhật */

/* FORM CẬP NHẬT PAYMENT */
.history-payment-form form {
    display: inline-block;
    width: 100%;
    max-width: 420px;
    padding: 0px;
}

.history-payment-form table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.history-payment-form td {
    padding: 5px;
    vertical-align: middle;
}

.history-payment-form input,
.history-payment-form select {
    width: 100%;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 13px;
}


.suggestion-box {
    position: absolute;
    background: #fff;
    border: 1px solid #ccc;
    z-index: 9999;
    max-height: 180px;
    overflow-y: auto;
    min-width: 300px;
    font-size: 14px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Hover từng item trong gợi ý */
.suggestion-box div {
    padding: 6px 10px;
    cursor: pointer;
}

.suggestion-box div:hover {
    background: #f0f0f0;
}

/* ⚫ DARK MODE */


#qtyCheckMsg {
    position: absolute;
    background: #fff;
    color: #000;
    border: 1px solid #ccc;
    padding: 8px 12px;
    margin-top: 4px;
    font-size: 0.9em;
    z-index: 9999;
    display: none;
    max-width: 320px;
    width: max-content;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
}

/* Dark mode support */

/* CSS gợi ý số lượng đóng gói */
.qty-check-box {
    position: absolute;
    background: #fff;
    border: 1px solid #ccc;
    padding: 6px 10px;
    font-size: 0.9em;
    max-width: 300px;
    margin-top: 5px;
    z-index: 9999;
    display: none;
    right: 0;
    left: auto;
    text-align: left;
}

/* Dark mode */

/* Báo cáo hàng ra - Quality report */
.output-day-group {
    background: linear-gradient(to top, #f3faff, #e0f2ff);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    border-radius: 5px;
    margin: 0 0 10px;
    overflow: hidden;
    border: 1px solid #b4e0ff;
}

.output-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    color: #1a3e72;
    padding: 12px 16px;
    font-weight: 600;
    cursor: pointer;
}

.output-day-header:hover {
    background: linear-gradient(to top, #ffffff, #a3c8f0);
}

/* Greenware: từng bản ghi (topbar: ngày trái – nút phải; dưới: bảng + chữ ký) */
.gw-entry-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 8px;
}

.gw-entry-topbar-left {
    flex: 1 1 auto;
    min-width: 0;
}

.gw-entry-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
}

.gw-entry-body {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-start;
}

.gw-entry-col-meta {
    flex: 1 1 200px;
    min-width: 200px;
    padding-left: 2px;
}

.gw-entry-col-sig {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    flex: 0 1 auto;
    align-items: flex-start;
}

/* Greenware: ngày sản xuất (phía trên bảng) */
.gw-entry-production-date {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
}

/* Greenware: danh sách nhập liệu (compact, theo tháng) */
.gw-entry-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gw-entry-list-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: #546e7a;
    background: #f5f7f9;
    border: 1px solid #e0e4e8;
    border-radius: 8px;
}

.gw-entry-list-summary__count {
    font-weight: 700;
    color: #37474f;
}

.gw-entry-list-summary__prod {
    color: #1565c0;
    font-weight: 600;
}

.gw-entry-list-summary__def {
    color: #c62828;
    font-weight: 600;
}

.gw-entry-list-summary__sep {
    opacity: 0.45;
}

.gw-entry-month {
    border: 1px solid #d0dbe4;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.gw-entry-month-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;
    padding: 10px 12px;
    cursor: pointer;
    list-style: none;
    background: linear-gradient(180deg, #eef4f8 0%, #e6eef4 100%);
    border-bottom: 1px solid transparent;
    user-select: none;
}

.gw-entry-month[open]>.gw-entry-month-summary {
    border-bottom-color: #d0dbe4;
}

.gw-entry-month-summary::-webkit-details-marker {
    display: none;
}

.gw-entry-month-summary::before {
    content: '\f054';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 10px;
    color: #78909c;
    margin-right: 8px;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.gw-entry-month[open]>.gw-entry-month-summary::before {
    transform: rotate(90deg);
}

.gw-entry-month-title {
    font-size: 14px;
    font-weight: 700;
    color: #1565c0;
}

.gw-entry-month-meta {
    font-size: 12px;
    color: #607d8b;
    font-weight: 500;
}

.gw-entry-month-body {
    padding: 0;
}

.gw-entry-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.gw-entry-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    line-height: 1.35;
    table-layout: fixed;
}

.gw-entry-table col.gw-entry-col-exp {
    width: 36px;
}

.gw-entry-table col.gw-entry-col-datetime {
    width: 96px;
}

.gw-entry-table col.gw-entry-col-producer {
    width: auto;
    min-width: 108px;
}

.gw-entry-table col.gw-entry-col-kind {
    width: 88px;
    min-width: 88px;
}

.gw-entry-table col.gw-entry-col-num {
    width: 68px;
}

.gw-entry-table col.gw-entry-col-status {
    width: 52px;
    min-width: 52px;
}

.gw-entry-table col.gw-entry-col-actions {
    width: 96px;
}

.gw-entry-table thead th,
.gw-entry-table tbody td {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

.gw-entry-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 7px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #607d8b;
    background: #f8fafb;
    border-bottom: 1px solid #e0e4e8;
}

.gw-entry-table tbody td {
    padding: 6px 8px;
    border-bottom: 1px solid #eef1f3;
    vertical-align: middle;
}

.gw-entry-table tbody tr:last-child td,
.gw-entry-table tbody tr.gw-entry-detail:last-child td {
    border-bottom: none;
}

.gw-entry-table__exp {
    width: 36px;
    padding-left: 6px !important;
    padding-right: 2px !important;
    text-align: center;
}

.gw-entry-table__datetime {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #37474f;
    font-size: 12px;
}

.gw-entry-table__producer {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    max-width: 100%;
    padding-right: 10px !important;
}

.gw-entry-table__kind {
    white-space: nowrap;
    padding-left: 4px !important;
    padding-right: 6px !important;
}

.gw-entry-table__num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
}

.gw-entry-table__num--prod {
    color: #1565c0;
}

.gw-entry-table__num--def {
    color: #c62828;
}

.gw-entry-table__status {
    text-align: center;
    padding-left: 4px !important;
    padding-right: 4px !important;
}

.gw-entry-table__actions {
    text-align: right;
    white-space: nowrap;
    padding-right: 6px !important;
}

.gw-entry-row {
    cursor: pointer;
}

.gw-entry-row .gw-entry-table__actions {
    cursor: default;
}

.gw-entry-row--locked {
    background: #fffef5;
}

.gw-entry-row.is-expanded {
    background: #f3f8fc;
}

.gw-entry-row--focus {
    background: #fff8e1;
    box-shadow: inset 3px 0 0 #ffb300;
}

.gw-entry-row--focus.is-expanded {
    background: #fff3cd;
}

.gw-entry-row--warn .gw-entry-table__num--prod,
.gw-entry-row--warn .gw-entry-table__num--def {
    cursor: help;
}

.gw-entry-expand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #78909c;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.gw-entry-expand-btn:hover {
    background: rgba(21, 101, 192, 0.1);
    color: #1565c0;
}

.gw-entry-expand-btn.is-open {
    color: #1565c0;
}

.gw-entry-expand-btn.is-open i {
    transform: rotate(90deg);
}

.gw-entry-expand-btn i {
    font-size: 10px;
    transition: transform 0.15s ease;
}

.gw-entry-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.3;
}

.gw-entry-badge--daily {
    background: #eceff1;
    color: #546e7a;
}

.gw-entry-badge--pw {
    background: #e8eaf6;
    color: #3949ab;
}

.gw-entry-badge--staging {
    background: #fff3e0;
    color: #e65100;
}

.gw-entry-badge--lock {
    background: #fff3e0;
    color: #e65100;
    font-size: 11px;
    padding: 3px 8px;
}

.gw-entry-status {
    display: inline-block;
    font-size: 12px;
    line-height: 1;
}

.gw-entry-status--ok {
    color: #cfd8dc;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.gw-entry-status--lock {
    font-size: 11px;
}

.gw-entry-status--over,
.gw-entry-status--def {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
}

.gw-entry-status--over {
    background: #ff9800;
}

.gw-entry-status--def {
    background: #e53935;
}

.gw-entry-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
}

.gw-entry-act {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 5px;
    color: #78909c;
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
}

.gw-entry-act:hover {
    background: #eceff1;
    color: #37474f;
}

.gw-entry-act--edit:hover {
    background: #e3f2fd;
    color: #1565c0;
}

.gw-entry-act--del:hover {
    background: #ffebee;
    color: #c62828;
}

.gw-entry-act--lock:hover {
    background: #fff8e1;
    color: #f57c00;
}

.gw-entry-act--disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.gw-entry-act i {
    font-size: 12px;
}

.gw-entry-detail td {
    padding: 0 !important;
    background: #f8fafb;
    border-bottom: 1px solid #e0e4e8 !important;
    overflow: visible;
    white-space: normal;
    text-overflow: clip;
}

.gw-entry-detail-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    padding: 10px 12px 12px 38px;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.gw-entry-detail-block {
    flex: 0 1 auto;
    min-width: 140px;
    max-width: 100%;
}

.gw-entry-detail-block--full {
    flex: 1 1 100%;
}

.gw-entry-detail-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px 16px;
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
}

.gw-entry-detail-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #90a4ae;
    margin-bottom: 3px;
}

.gw-entry-detail-value {
    font-size: 12px;
    line-height: 1.45;
    color: #37474f;
}

.gw-entry-edit-line {
    margin-top: 4px;
    color: #5c6bc0;
    font-size: 11px;
    line-height: 1.35;
}

.gw-entry-detail-sigs {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px 16px;
    flex: 0 1 auto;
    min-width: 0;
    margin-left: auto;
    box-sizing: border-box;
}

.gw-entry-detail-sig {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
}

.gw-entry-detail-sig-media {
    width: 112px;
    max-width: 100%;
}

.gw-entry-detail-sig-empty {
    width: 100%;
    height: 52px;
    border: 1px dashed #cfd8dc;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #b0bec5;
    box-sizing: border-box;
}

.gw-entry-detail-sig-name {
    margin-top: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #607d8b;
    word-break: break-word;
}

.gw-entry-detail-sig .gw-sig-preview-box--entry-detail {
    display: block;
    width: 100%;
    max-width: 112px;
    height: 52px;
    padding: 4px 6px;
    overflow: hidden;
    box-sizing: border-box;
}

.gw-entry-detail-sig .gw-sig-preview-box--entry-detail img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 44px;
    object-fit: contain;
    object-position: left center;
}

.gw-sig-preview-box--compact {
    width: 100px;
    height: 48px;
}

.gw-sig-preview-box--compact img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

@media (max-width: 767px) {
    .gw-entry-table {
        min-width: 0;
        width: 100%;
        table-layout: auto;
        font-size: 12px;
    }

    .gw-entry-table col.gw-entry-col-exp {
        width: 32px;
    }

    .gw-entry-table col.gw-entry-col-datetime {
        width: 70px;
        min-width: 70px;
    }

    .gw-entry-table col.gw-entry-col-producer {
        width: auto;
        min-width: 88px;
    }

    .gw-entry-table col.gw-entry-col-kind {
        width: auto;
        min-width: 80px;
    }

    .gw-entry-table col.gw-entry-col-num {
        width: auto;
        min-width: 44px;
    }

    .gw-entry-table col.gw-entry-col-status {
        width: auto;
        min-width: 40px;
    }

    .gw-entry-table col.gw-entry-col-actions {
        width: auto;
        min-width: 72px;
    }

    .gw-entry-table thead th,
    .gw-entry-table tbody td {
        padding-inline: 5px;
    }

    .gw-entry-table thead th.gw-entry-table__status {
        font-size: 9px;
        letter-spacing: 0;
        white-space: normal;
        line-height: 1.2;
        padding-inline: 3px;
    }

    .gw-entry-table__producer {
        padding-right: 8px !important;
        max-width: none;
    }

    .gw-entry-table__kind {
        padding-left: 8px !important;
    }

    .gw-entry-table__datetime {
        font-size: 11px;
    }

    .gw-entry-badge {
        font-size: 9px;
        padding: 2px 5px;
        white-space: nowrap;
    }

    .gw-entry-table__actions {
        padding-right: 4px !important;
    }
}

@media (max-width: 640px) {
    .gw-entry-detail-inner {
        padding-left: 12px;
    }

    .gw-entry-detail-row {
        flex-direction: column;
        align-items: stretch;
    }

    .gw-entry-detail-sigs {
        margin-left: 0;
        flex-wrap: wrap;
    }
}

/* ✅ DARK MODE */



.header-left {
    font-size: 16px;
    white-space: nowrap;
    flex: 1 1 56%;
    min-width: 0;
    padding-right: 8px;
}

.arrow {
    font-size: 16px;
}

.output-day-content {
    padding: 5px 5px;
    display: none;
}

.header-right {
    display: grid;
    grid-template-columns: repeat(5, auto);
    justify-content: end;
    gap: 10px;
    flex: 1 1 44%;
    min-width: 0;
}

.metric {
    min-width: 130px;
    text-align: left;
}

@media (max-width: 600px) {
    .metric {
        min-width: 100px;
        /* Thu gọn khi ở mobile */
    }

    .header-left {
        flex-basis: 58%;
        white-space: normal;
    }

    .header-right {
        grid-template-columns: repeat(2, auto);
        justify-content: flex-end;
        gap: 8px;
    }
}

@media (max-width: 420px) {
    .output-day-header {
        gap: 8px;
        padding: 10px 12px;
    }

    .header-left {
        flex-basis: 60%;
    }

    .metric {
        min-width: 90px;
    }
}


/* CSS cho Customer Detail */
.subtab-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    align-items: center;
    position: relative;
    /* Để làm mốc cho dropdown */
}

.subtab-links a {
    position: relative;
    display: inline-block;
    font-weight: 600;
    color: #555;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    padding: 4px 6px;
    transition: all 0.2s ease;
    border-bottom-color: #ced8e2;
}

.subtab-links a:hover,
.subtab-links a.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

/* ===== Sub-tab bar: trigger + dropdown (.dropdown-menu dùng chung toàn hệ thống) ===== */
.menu-trigger {
    position: relative;
}

/* Chi tiết KH — panel compact (icon + text), max-width theo viewport */
.subtab-links .dropdown-menu .menu-content {
    top: calc(100% - 1px);
    padding: 10px 0;
    min-width: 0;
    max-width: min(480px, calc(100vw - 16px));
    overflow-wrap: anywhere;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.subtab-links .dropdown-menu .menu-content a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    white-space: normal;
    border-bottom: none;
    transition: background 0.2s;
}

.subtab-links .dropdown-menu .menu-content a:hover {
    background: #f2f6ff;
    color: #007bff;
    border-bottom: none;
}

.subtab-links .dropdown-menu .menu-content a:last-child {
    border-bottom: none;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .subtab-links {
        gap: 8px 10px;
    }
}

/* CSS cho báo cáo tài chính của khách hàng */
/* ========== Dashboard Layout ========== */
.dashboard-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    /* 👈 auto xuống dòng */
    gap: 10px;
    margin-bottom: 20px;
}

.dashboard-panel {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    min-width: 0;
    /* 👈 bắt buộc với grid */
}

.dashboard-panel canvas {
    height: 200px !important;
    max-height: 200px;
}

.dashboard-panel #categoryPieChart,
.dashboard-panel #defectPieChartCustomer {
    height: 240px !important;
    max-height: 240px;
}

@media (max-width: 768px) {
    .dashboard-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .dashboard-panel {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
    }

    .dashboard-panel canvas {
        width: 100% !important;
        max-width: 100%;
    }
}

.dashboard-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.dashboard-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    /* ✅ Cho responsive */
    gap: 10px;
    margin-top: 20px;
}

.dashboard-header-row .title h3 {
    margin: 0px;
    font-size: 20px;
    font-weight: bold;
}

.dashboard-header-row .filter {
    min-width: 150px;
}

/* ========== Table & Sorting ========== */
th.defect-detail-col,
td.defect-detail-col {
    display: none;
}

th.sortable-column.active {
    background: #ffebcc;
    /* Cam nhạt */
    color: #cc6600;
    /* Cam đậm */
}

td.highlight-col {
    background: #fff3e0;
    /* Vàng cam siêu nhạt */
}

html.dark th.sortable-column.active {
    background: #7f5539;
    /* Nâu nhạt trong darkmode */
    color: #ffe0b2;
    /* Cam sáng */
}

html.dark td.highlight-col {
    background: #483429;
    /* Màu nâu đậm cho dark mode */
}

/* ========== Dark Mode cho Panel ========== */
html.dark .dashboard-panel {
    background: #272c31;
    border-color: rgb(69, 69, 69);
    color: #cbd5e1;
}

.top-defect-table {
    width: 100%;
}

/* ========== CSS cho bảng danh sách sản phẩm ========== */
.sub-products {
    margin: 5px;
    font-size: 13px;
    background-color: #ecf5fe;
    padding: 8px;
}



.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    z-index: var(--app-popup-z, 100000);
    display: flex;
    /* luôn là flex */
    justify-content: center;
    align-items: flex-start;
}

/* Ẩn mặc định bằng 1 class riêng */
.popup-hidden {
    display: none !important;
}

.popup-box {
    background: #fff;
    color: #111;
    padding: 24px 30px;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    font-size: 16px;
    margin-top: 5vh;
    overflow-x: hidden;
    overflow-y: auto;
    width: 40%;
    max-width: 560px;
    min-width: 320px;
    box-sizing: border-box;
    max-height: 90vh;
}

/* Popup form (vd. sửa ngày giao hàng đơn) — đủ rộng cho lịch Flatpickr, không tràn mép phải */
.popup-box--form,
.order-delivery-date-modal {
    text-align: left;
    width: min(420px, calc(100vw - 32px));
    max-width: min(420px, calc(100vw - 32px));
}

.order-delivery-date-form {
    max-width: 100%;
    box-sizing: border-box;
}

.order-delivery-date-field {
    margin-bottom: 18px;
    max-width: 100%;
}

.order-delivery-date-field label {
    display: block;
    margin-bottom: 8px;
}

.order-delivery-date-input,
.order-delivery-date-modal input[type="date"],
.order-delivery-date-modal .lch-flatpickr-input {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    margin-top: 0;
}

.order-delivery-date-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    justify-content: flex-start;
}

.order-delivery-date-actions .button {
    margin: 0;
}

/* View order — lịch sử cập nhật đơn hàng (accordion header) */
.order-change-history {
    margin: 0;
    border-top: none;
    border-bottom: none;
}

.order-change-history + .order-tabs {
    margin-top: 0;
}

.order-change-history__toggle {
    width: 100%;
    margin: 0;
    border: none;
    border-bottom: none;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    background: #f5f7fa;
    box-sizing: border-box;
    transition: background 0.15s ease;
}

.order-change-history.is-open .order-change-history__toggle {
    border-bottom: 1px solid #eceff1;
}

.order-change-history__toggle:hover {
    background: #eef4ff;
}

.order-change-history__toggle:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: -2px;
}

.order-change-history__title {
    flex: 1 1 auto;
    min-width: 0;
}

.order-change-history__count {
    flex: 0 0 auto;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e3f2fd;
    color: #1565c0;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
}

.order-change-history__chevron {
    flex: 0 0 auto;
    margin-left: auto;
    font-size: 14px;
    opacity: 0.75;
    transition: transform 0.2s ease;
}

.order-change-history.is-open .order-change-history__chevron {
    transform: rotate(180deg);
}

.order-change-history__panel {
    padding: 0;
    border-bottom: 1px solid #cfd8dc;
}

.order-change-history__panel.mould-detail-pane-body {
    padding: 0;
}

.order-change-log-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.order-change-log-item {
    margin: 0;
    padding: 11px 16px 11px 13px;
    border-bottom: 1px solid #eceff1;
    border-left: 3px solid #90a4ae;
    font-size: 14px;
    line-height: 1.55;
    color: #37474f;
    box-sizing: border-box;
}

.order-change-log-item:last-child {
    border-bottom: none;
}

.order-change-log-item--add {
    border-left-color: #2e7d32;
}

.order-change-log-item--remove {
    border-left-color: #c62828;
}

.order-change-log-item--qty {
    border-left-color: #1565c0;
}

.order-change-log-item__line {
    margin: 0;
}

.order-change-log-item__user {
    font-weight: 700;
    color: #263238;
}

.order-change-log-item__code,
.order-change-log-item__qty {
    font-weight: 700;
    color: #1565c0;
}

.order-change-log-item__qty--new {
    color: #0d47a1;
}

@media (max-width: 1024px) {

    .popup-box.order-delivery-date-modal,
    .popup-box.popup-box--form {
        width: min(420px, calc(100vw - 32px)) !important;
        max-width: min(420px, calc(100vw - 32px)) !important;
    }
}

/* Tablet & mobile: full hơn */
@media (max-width: 1024px) {

    .popup-box:not(.popup-box--form):not(.order-delivery-date-modal) {
        width: 80% !important;
    }
}

/* Mobile nhỏ */
@media (max-width: 600px) {

    .popup-box:not(.popup-box--form):not(.order-delivery-date-modal) {
        width: 90% !important;
    }
}

.popup-box button {
    margin: 12px 6px 0;
    padding: 8px 16px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    border: none;
}

.popup-box .confirm-btn {
    background: #f87171;
    color: white;
}

.popup-box .confirm-btn:hover {
    background: #bb3333;
}

.popup-box .cancel-btn {
    background: #b8b8b8;
    color: white;
}

.popup-box .cancel-btn:hover {
    background: #656565;
}

.delivery-route-empty {
    text-align: center;
    margin: 24px 0 8px;
    color: #555;
}

.delivery-route-timeline {
    --dr-accent: #0077b6;
    --dr-pill-bg: #0077b6;
    --dr-body-bg: #f0f7fb;
    --dr-body-border: rgba(0, 119, 182, 0.38);
    position: relative;
    padding: 12px 0 8px;
    margin-top: 8px;
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
}

.delivery-route-timeline::before {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--dr-accent);
    border-radius: 2px;
    z-index: 0;
}

.delivery-route-row {
    display: grid;
    grid-template-columns: 1fr 22px 1fr;
    column-gap: 10px;
    margin-bottom: 16px;
    align-items: flex-start;
    position: relative;
    z-index: 1;
}

.delivery-route-track {
    grid-column: 2;
    grid-row: 1;
    width: 22px;
    justify-self: center;
    position: relative;
    z-index: 2;
}

.delivery-route-row--left .delivery-route-block {
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
    text-align: right;
    max-width: 100%;
    width: min(100%, 460px);
}

.delivery-route-row--right .delivery-route-block {
    grid-column: 3;
    grid-row: 1;
    justify-self: start;
    text-align: left;
    max-width: 100%;
    width: min(100%, 460px);
}

.delivery-route-pill {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--dr-pill-bg);
    color: #fff;
    font-size: 13px;
    line-height: 1.25;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.delivery-route-body {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--dr-body-bg);
    border: 1px solid var(--dr-body-border);
    line-height: 1.45;
    max-width: 340px;
    box-sizing: border-box;
}

.delivery-route-body .delivery-route-inline-link {
    color: inherit;
    font-weight: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.delivery-route-body .delivery-route-inline-link:hover {
    color: var(--dr-accent);
}

.delivery-route-row--left .delivery-route-body {
    margin-left: auto;
}

.delivery-route-row--right .delivery-route-body {
    margin-right: auto;
}

.delivery-route-node {
    display: block;
    width: 14px;
    height: 14px;
    margin: 10px auto 0;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--dr-accent);
    box-sizing: border-box;
    box-shadow: 0 0 0 2px #fff;
}

.delivery-route-item--late {
    --dr-accent: #d90429;
    --dr-pill-bg: #d90429;
    --dr-body-bg: #fff5f5;
    --dr-body-border: rgba(217, 4, 41, 0.45);
}

.delivery-route-item--soon {
    --dr-accent: #ff8533;
    --dr-pill-bg: #ff8533;
    --dr-body-bg: #fff7ed;
    --dr-body-border: rgba(255, 133, 51, 0.45);
}

.delivery-route-item--mid {
    --dr-accent: #0077b6;
    --dr-pill-bg: #0077b6;
    --dr-body-bg: #f0f7fb;
    --dr-body-border: rgba(0, 119, 182, 0.38);
}

.delivery-route-item--far {
    --dr-accent: #2a9d8f;
    --dr-pill-bg: #2a9d8f;
    --dr-body-bg: #eefbf7;
    --dr-body-border: rgba(42, 157, 143, 0.38);
}

@media (max-width: 700px) {
    .delivery-route-timeline::before {
        /* Căn giữa line (3px) vào giữa cột track 22px */
        left: calc(11px - 1.5px);
        transform: none;
    }

    .delivery-route-row {
        grid-template-columns: 22px 1fr;
        column-gap: 12px;
    }

    .delivery-route-track {
        grid-column: 1;
    }

    .delivery-route-row--left .delivery-route-block,
    .delivery-route-row--right .delivery-route-block {
        grid-column: 2;
        grid-row: 1;
        justify-self: stretch;
        text-align: left;
        max-width: none;
        width: 100%;
    }

    .delivery-route-row--left .delivery-route-body,
    .delivery-route-row--right .delivery-route-body {
        margin-left: 0;
        margin-right: 0;
        max-width: none;
        width: 100%;
    }
}

/* Desktop hẹp / laptop: chuyển 1 cột để đỡ lãng phí khoảng trống */
@media (max-width: 1100px) {
    .delivery-route-timeline::before {
        /* Căn giữa line (3px) vào giữa cột track 22px */
        left: calc(11px - 1.5px);
        transform: none;
    }

    .delivery-route-row {
        grid-template-columns: 22px 1fr;
        column-gap: 12px;
    }

    .delivery-route-track {
        grid-column: 1;
    }

    .delivery-route-row--left .delivery-route-block,
    .delivery-route-row--right .delivery-route-block {
        grid-column: 2;
        grid-row: 1;
        justify-self: start;
        text-align: left;
        max-width: none;
    }

    .delivery-route-row--left .delivery-route-body,
    .delivery-route-row--right .delivery-route-body {
        margin-left: 0;
        margin-right: 0;
        max-width: none;
    }
}

/* —— Orders: tab actions (float right) —— */
.order-tabs .order-tabs-right {
    margin-left: auto;
    display: inline-flex;
    gap: 10px;
    align-items: stretch;
}

.order-tabs .order-tabs-right .tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.order-filters-box {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    margin: 0;
    padding: 10px;
}

.orders-status-trigger {
    padding: 0 2px;
    text-align: right;
}

.orders-progress-head,
.orders-col-head {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.orders-col-head--right {
    justify-content: flex-end;
}

.orders-col-sort-btn,
.orders-progress-sort-btn {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 14px;
    line-height: 1;
    flex: 0 0 auto;
}

.orders-col-sort-btn:hover,
.orders-col-sort-btn.is-active,
.orders-progress-sort-btn:hover,
.orders-progress-sort-btn.is-active {
    color: #cc6600;
}

html.dark .orders-col-sort-btn:hover,
html.dark .orders-col-sort-btn.is-active,
html.dark .orders-progress-sort-btn:hover,
html.dark .orders-progress-sort-btn.is-active {
    color: #ffb74d;
}

#orders-table thead th.orders-th-progress {
    position: sticky;
    top: 0;
}

#orders-table thead th.orders-th-progress:hover,
#orders-table thead th.orders-th-progress:focus-within {
    z-index: 10050;
}

.orders-progress-trigger {
    padding: 0 2px;
    min-width: 0;
}

#orderProgressDropdown {
    flex: 1 1 auto;
    min-width: 0;
}

@media (hover: none),
(pointer: coarse),
(max-width: 768px) {
    #orders-table .dropdown-menu.dropdown-click.is-open:not(.force-close) .menu-content {
        z-index: 10070 !important;
    }

    #orders-table thead th.orders-th-progress:hover .dropdown-menu:not(.is-open) .menu-content,
    #orders-table thead th.orders-th-dropdown:hover .dropdown-menu:not(.is-open) .menu-content {
        display: none !important;
        opacity: 0 !important;
    }
}

/* —— Lịch sản xuất / Tạo đơn mới: layout chung —— */
.production-schedule-page,
.neworder-page,
.news-page,
.surplus-page,
.vks-page {
    padding: 0;
    box-sizing: border-box;
}

.ps-page-tabs-wrap {
    padding-top: 0;
}

.ps-page-body {
    margin-top: 0;
}

.ps-filter-bar {
    margin-bottom: 0;
    border: 1px solid #e0e0e0;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    padding: 0;
    box-sizing: border-box;
}

.ps-filter-bar__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 16px;
    padding: 12px 16px;
}

.ps-filter-bar__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
}

.ps-filter-bar__label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #78909c;
}

.ps-filter-bar__field select.input {
    min-width: 140px;
    box-sizing: border-box;
}

.ps-filter-bar__check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding-bottom: 6px;
}

.production-schedule-page .ps-sheet.bgwhite {
    padding: 0;
    border-radius: 0 0 5px 5px;
    overflow: visible;
}

.production-schedule-page .ps-filter-bar+.ps-sheet {
    border-radius: 0 0 5px 5px;
}

.production-schedule-page .ps-filter-bar[style*="display: none"]+.ps-sheet,
.production-schedule-page .ps-filter-bar:not(:visible)+.ps-sheet {
    border-radius: 5px;
}

.production-schedule-page .ps-sheet>.mould-detail-pane:first-child {
    border-top: none;
}

.production-schedule-page .ps-page-intro {
    margin: 0 0 12px;
    line-height: 1.45;
}

.production-schedule-page .ps-kpi-strip {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 14px;
}

.production-schedule-page .ps-month-section {
    margin-bottom: 12px;
}

.production-schedule-page .ps-month-section__title {
    margin: 0 0 8px;
}

.production-schedule-page .ps-alert-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fff5f5;
    border: 1px solid rgba(198, 40, 40, 0.2);
    color: #546e7a;
    line-height: 1.45;
    font-size: 13px;
}

.production-schedule-page .ps-alert-banner .fas {
    color: #c62828;
    margin-top: 2px;
    flex-shrink: 0;
}

.production-schedule-page .ps-priority-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.production-schedule-page .ps-priority-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 14px;
    background: #fafbfc;
    min-width: 0;
}

/* Greenware production summary: đồng bộ bo góc 5px */
.greenware-production-page .mould-detail-sheet,
.greenware-production-page .mould-detail-pane,
.greenware-production-page .scroll-table-wrapper,
.greenware-production-page .ps-kpi-strip,
.greenware-production-page .ps-alert-banner,
.greenware-production-page .ps-priority-card,
.greenware-production-page .gw-producer-stats-panel.gw-producer-stats-panel--in-tab,
.license-page.greenware-production-page .mould-detail-sheet,
.license-page.greenware-production-page .gw-producer-stats-panel.gw-producer-stats-panel--in-tab {
    border-radius: 5px;
}

.greenware-production-page .gwp-layout {
    padding: 10px;
}

.greenware-production-page .gwp-header {
    margin-bottom: 10px;
}

.greenware-production-page .gwp-header__title {
    margin-bottom: 0;
    padding-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.greenware-production-page .gwp-back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-right: 2px;
    border-radius: 5px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.greenware-production-page .gwp-back-link:hover {
    background: #eceff1;
    color: #1565c0 !important;
}

.greenware-production-page .gw-producer-stats-panel__head--actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.greenware-production-page .gwp-detail-link,
.greenware-production-page .gwp-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 5px;
    border: 1px solid #cfd8dc;
    background: #f7fafc;
    color: #455a64;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
    flex-shrink: 0;
    white-space: nowrap;
}

.greenware-production-page .gwp-detail-link:hover,
.greenware-production-page .gwp-action-link:hover {
    border-color: #90caf9;
    background: #eef5ff;
    color: #1565c0;
    text-decoration: none;
}

.greenware-production-page .gwp-detail-page .gwp-hbar-chart {
    padding: 8px 0 4px;
}

.greenware-production-page .gwp-header__subtitle {
    margin: 8px 0 0;
    line-height: 1.45;
}

.greenware-production-page .gwp-header .subtab-links.gwp-subtabs {
    margin-top: 8px;
    margin-bottom: 0;
    gap: 8px 18px;
}

.greenware-production-page .gwp-header .subtab-links.gwp-subtabs a {
    font-size: 14px;
    padding: 6px 4px 8px;
}

.greenware-production-page .gwp-header .subtab-links.gwp-subtabs a i {
    margin-right: 4px;
    font-size: 13px;
    opacity: 0.85;
}

.greenware-production-page .gwp-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin-bottom: 10px;
    padding: 8px 10px;
    border-radius: 5px;
    background: #f5f7f9;
    border: 1px solid #eceff1;
}

.greenware-production-page .gwp-toolbar__label {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #78909c;
}

.greenware-production-page .gwp-entries-head-filter {
    display: flex;
    align-items: center;
    margin: 0 0 0 auto;
    padding: 0;
    flex-shrink: 0;
}

.greenware-production-page .gwp-entries-head-filter__field {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.greenware-production-page .gwp-entries-head-filter__label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #78909c;
    white-space: nowrap;
}

.greenware-production-page .gwp-entries-head-filter select.input {
    min-width: 140px;
    max-width: 200px;
    font-size: 12px;
    margin: 0;
}

.greenware-production-page .gwp-entries-page .gw-entry-list {
    margin-top: 0;
}

.greenware-production-page .gwp-entries-table-wrap {
    overflow-x: auto;
}

.greenware-production-page .gwp-entries-table {
    min-width: 700px;
}

.greenware-production-page .gwp-entries-table__time {
    white-space: nowrap;
    font-weight: 600;
    text-align: center;
}

.greenware-production-page .gwp-entries-table .gw-entry-table__kind {
    text-align: center;
    padding-left: 6px !important;
    padding-right: 6px !important;
}

.greenware-production-page .gwp-entries-table .gw-entry-table__kind .gw-entry-badge {
    vertical-align: middle;
}

.greenware-production-page .gwp-entries-table__order,
.greenware-production-page .gwp-entries-table__product,
.greenware-production-page .gwp-entries-table__stage,
.greenware-production-page .gwp-entries-table__producer {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.greenware-production-page .gwp-entries-table tr.gwp-entry-row-clickable:hover {
    background: rgba(21, 101, 192, 0.04);
}

.greenware-production-page .gwp-entries-table tr.gwp-entry-row-clickable td {
    cursor: pointer;
}

.greenware-production-page .gwp-entries-table tr.gw-entry-row:not(.gwp-entry-row-clickable) td {
    cursor: default;
}

.greenware-production-page .gwp-entries-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #eceff1;
}

.greenware-production-page .gwp-period-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 0;
    flex: 1 1 auto;
    min-width: 0;
}

.greenware-production-page .gwp-period-mobile {
    display: none;
    margin-bottom: 10px;
}

.greenware-production-page .gwp-period-mobile__label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #78909c;
}

.greenware-production-page .gwp-period-mobile-menu {
    position: relative;
}

.greenware-production-page .gwp-period-mobile-menu__trigger {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid #cfd8dc;
    border-radius: 5px;
    background: #fff;
    color: #455a64;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.greenware-production-page .gwp-period-mobile-menu__trigger::-webkit-details-marker {
    display: none;
}

.greenware-production-page .gwp-period-mobile-menu[open] .gwp-period-mobile-menu__trigger {
    border-color: #90caf9;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.12);
}

.greenware-production-page .gwp-period-mobile-menu__list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 30;
    border: 1px solid #cfd8dc;
    border-radius: 5px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.greenware-production-page .gwp-period-mobile-menu__item {
    display: block;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #455a64;
    text-decoration: none;
    border-top: 1px solid #eceff1;
}

.greenware-production-page .gwp-period-mobile-menu__item:first-child {
    border-top: 0;
}

.greenware-production-page .gwp-period-mobile-menu__item:hover {
    background: #eef5ff;
    color: #1565c0;
}

.greenware-production-page .gwp-period-mobile-menu__item.is-active {
    background: #1976d2;
    color: #fff;
}

.greenware-production-page .gwp-period-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: #546e7a;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.greenware-production-page .gwp-period-tab:hover {
    border-color: #cfd8dc;
    background: #fff;
    color: #1565c0;
}

.greenware-production-page .gwp-period-tab.is-active {
    border-color: #90caf9;
    background: #fff;
    color: #1565c0;
    box-shadow: 0 0 0 1px rgba(25, 118, 210, 0.08);
}

.greenware-production-page .gwp-custom-range {
    display: block;
    margin-bottom: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 0 0 5px 5px;
    overflow: hidden;
}

.greenware-production-page .gwp-apply-btn.button.blue {
    border-color: #1976d2;
    background: #1976d2;
    color: #fff;
}

.greenware-production-page .gwp-apply-btn.button.blue:hover {
    border-color: #1565c0;
    background: #1565c0;
}

.greenware-production-page .gwp-section {
    margin-top: 0;
}

.greenware-production-page .gwp-section + .gwp-section {
    margin-top: 10px;
}

.greenware-production-page .gwp-kpi-panel {
    margin-bottom: 12px;
}

.greenware-production-page .gwp-kpi-intro {
    margin: 0 0 10px;
    line-height: 1.45;
}

.greenware-production-page .gwp-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.greenware-production-page .gwp-dashboard-grid .gwp-section {
    margin-top: 0;
    margin-bottom: 0;
    min-width: 0;
}

.greenware-production-page .gwp-hbar-intro {
    margin: 0 0 12px;
    line-height: 1.45;
}

.greenware-production-page .gwp-hbar-chart {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 2px 0 4px;
}

.greenware-production-page .gwp-hbar-row {
    display: grid;
    gap: 7px;
}

.greenware-production-page .gwp-hbar-row__head {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.greenware-production-page .gwp-hbar-row__rank {
    font-size: 12px;
    font-weight: 700;
    color: #90a4ae;
    text-align: center;
    line-height: 1;
}

.greenware-production-page .gwp-hbar-row--top .gwp-hbar-row__rank {
    color: #1565c0;
}

.greenware-production-page .gwp-hbar-row__label {
    min-width: 0;
}

.greenware-production-page .gwp-hbar-row__label .gw-producer-stats-worker,
.greenware-production-page .gwp-hbar-worker {
    min-width: 0;
    align-items: center;
}

.greenware-production-page .gwp-hbar-worker__text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    min-width: 0;
    line-height: 1.25;
}

.greenware-production-page .gwp-hbar-row__label .gw-producer-stats-worker__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.greenware-production-page .gwp-hbar-worker__dept {
    font-size: 11px;
    font-weight: 600;
    color: #78909c;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.greenware-production-page .gwp-hbar-row__label--stage {
    display: flex;
    align-items: center;
    min-height: 28px;
}

.greenware-production-page .gwp-hbar-row__stage-name {
    font-size: 13px;
    font-weight: 700;
    color: #37474f;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.greenware-production-page .gwp-hbar-row__stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    white-space: nowrap;
    line-height: 1.2;
}

.greenware-production-page .gwp-hbar-row__prod {
    font-size: 13px;
    font-weight: 700;
    color: #1565c0;
}

.greenware-production-page .gwp-hbar-row__def {
    font-size: 11px;
    font-weight: 600;
    color: #c62828;
}

.greenware-production-page .gwp-hbar-row__track {
    height: 8px;
    background: #eceff1;
    border-radius: 4px;
    overflow: hidden;
}

.greenware-production-page .gwp-hbar-row__fill {
    height: 100%;
    min-width: 0;
    border-radius: 4px;
    transition: width 0.55s ease;
}

.greenware-production-page .gwp-hbar-chart--workers .gwp-hbar-row__fill {
    background: linear-gradient(90deg, #42a5f5, #1565c0);
}

.greenware-production-page .gwp-hbar-chart--stages .gwp-hbar-row__fill {
    background: linear-gradient(90deg, #ba68c8, #6a1b9a);
}

.greenware-production-page .gwp-hbar-chart--stages .gwp-hbar-row--top .gwp-hbar-row__rank {
    color: #6a1b9a;
}

.greenware-production-page .gwp-hbar-chart--stages .gwp-hbar-row__prod {
    color: #6a1b9a;
}

@media (min-width: 768px) {
    .greenware-production-page .gwp-dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }
}

@media (max-width: 560px) {
    .greenware-production-page .gwp-toolbar {
        display: none;
    }

    .greenware-production-page .gwp-period-mobile {
        display: block;
    }
}

.production-schedule-page .ps-priority-card__title {
    margin-bottom: 8px;
    font-size: 13px;
}

.production-schedule-page .ps-priority-card--overdue .ps-priority-card__title {
    color: #c62828;
}

.production-schedule-page .ps-priority-card--soon .ps-priority-card__title {
    color: #1565c0;
}

.production-schedule-page .ps-empty-state {
    text-align: center;
    padding: 28px 16px;
    color: #78909c;
    font-size: 14px;
    font-weight: 600;
}

.production-schedule-page .ps-gantt-pane-body {
    padding-top: 12px;
}

.production-schedule-page .ps-gantt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 10px;
}

.production-schedule-page .ps-gantt-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.production-schedule-page .ps-gantt-legend__filter {
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 4px 10px 4px 6px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.production-schedule-page .ps-gantt-legend__filter:hover {
    background: #f0f2f5;
}

.production-schedule-page .ps-gantt-legend__filter.is-active {
    border-color: #90caf9;
    background: #eef4ff;
    color: #1565c0;
}

.production-schedule-page .ps-gantt-legend__swatch--all {
    background: linear-gradient(90deg, #2a9d8f 0 33%, #1565c0 33% 66%, #c62828 66% 100%);
}

.production-schedule-page .gantt-row.is-gantt-filter-hidden {
    display: none;
}

.production-schedule-page .ps-gantt-legend__swatch {
    width: 14px;
    height: 8px;
    border-radius: 3px;
    flex-shrink: 0;
}

.production-schedule-page .ps-gantt-legend__swatch--ok {
    background: #2a9d8f;
}

.production-schedule-page .ps-gantt-legend__swatch--soon {
    background: #1565c0;
}

.production-schedule-page .ps-gantt-legend__swatch--late {
    background: #c62828;
}

.production-schedule-page .ps-gantt-scroll.scroll-table-wrapper {
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    background: #fff;
}

.production-schedule-page .gantt-meta-check-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 900px) {
    .production-schedule-page .ps-priority-grid {
        grid-template-columns: 1fr;
    }

    .production-schedule-page .ps-kpi-strip.kpi-strip--cols-5 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 599px) {
    .production-schedule-page .ps-filter-bar__inner {
        flex-direction: column;
        align-items: stretch;
    }

    .production-schedule-page .ps-filter-bar__field,
    .production-schedule-page .ps-filter-bar__field select.input {
        width: 100%;
        min-width: 0;
    }

    .production-schedule-page .ps-kpi-strip.kpi-strip--cols-5 {
        grid-template-columns: 1fr;
    }

    .production-schedule-page .ps-priority-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .production-schedule-page .ps-priority-row-meta {
        text-align: left;
    }
}

/* —— Tồn dư thành phẩm —— */
.surplus-page .surplus-sheet.bgwhite {
    padding: 0;
    border-radius: 5px;
    overflow: visible;
    margin-bottom: 0;
}

.surplus-page .surplus-sheet>.mould-detail-pane:first-child {
    border-top: none;
}

.surplus-page .surplus-sheet--kpi {
    margin-bottom: 0;
    border-bottom: none;
}

.surplus-page .surplus-sheet--kpi+.surplus-sheet {
    border-top: none;
}

.surplus-page .surplus-sheet--filter+.surplus-sheet,
.surplus-page .surplus-filter-bar+.surplus-sheet {
    border-top: none;
}

.surplus-page .surplus-sheet--filter {
    padding: 0;
}

.surplus-page .surplus-sheet--filter .surplus-filter-bar {
    margin: 0;
    padding: 10px 14px;
}

.surplus-page .surplus-filter-bar__inner {
    align-items: flex-end;
}

.surplus-page .surplus-filter-bar__field--customer {
    min-width: 220px;
    flex: 1 1 220px;
}

.surplus-page .surplus-filter-bar__customer-search {
    position: relative;
}

.surplus-page .surplus-filter-bar__customer-search .input {
    width: 100%;
    box-sizing: border-box;
}

.surplus-page .surplus-filter-bar__customer-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border: 1px solid #ddd;
    max-height: 300px;
    overflow-y: auto;
}

.surplus-page .surplus-filter-bar__field--date {
    min-width: 150px;
    flex: 0 1 150px;
}

.surplus-page .surplus-filter-bar__field--date .input {
    width: 100%;
    box-sizing: border-box;
}

.surplus-page .surplus-filter-bar__actions {
    flex: 0 0 auto;
}

.surplus-page .surplus-page__intro {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: #546e7a;
}

.surplus-page .surplus-page__guide-link {
    margin-left: auto;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: #546e7a;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.surplus-page .surplus-page__guide-link:hover {
    color: #1976d2;
}

.surplus-page .surplus-page__info-btn,
.fs-surplus-order-sheet .surplus-page__info-btn {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #546e7a;
    text-decoration: none;
    flex-shrink: 0;
    font-size: 17px;
    line-height: 1;
}

.surplus-page .surplus-page__info-btn:hover,
.fs-surplus-order-sheet .surplus-page__info-btn:hover {
    background: rgba(21, 101, 192, 0.08);
    color: #1976d2;
}

.order-tabs .tab.surplus-tab-info {
    min-width: 36px;
    padding: 0 12px;
    font-size: 16px;
}

.surplus-page .surplus-page__back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #546e7a;
    text-decoration: none;
    flex-shrink: 0;
}

.surplus-page .surplus-page__back-link:hover {
    background: rgba(21, 101, 192, 0.08);
    color: #1976d2;
}

.surplus-page .surplus-page__alert {
    margin: 0;
}

.surplus-page .surplus-filter-bar__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
}

.surplus-page .surplus-kpi-strip {
    border-radius: 0;
    margin-bottom: 0;
}

.surplus-page .surplus-kpi-strip__mode {
    font-size: 1rem;
}

.surplus-page .surplus-pane-count {
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    color: #78909c;
}

.surplus-page .surplus-pane-body {
    padding-top: 12px;
}

.surplus-page .surplus-table-wrap {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.surplus-page .surplus-table {
    width: 100%;
    min-width: 860px;
    border-collapse: collapse;
    font-size: 13px;
}

.surplus-page .surplus-table thead th {
    padding: 10px 8px;
    background: #f5f7fa;
    border-bottom: 1px solid #e0e0e0;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #78909c;
    white-space: nowrap;
}

.surplus-page .surplus-table tbody td {
    padding: 10px 8px;
    border-bottom: 1px solid #eceff1;
    vertical-align: middle;
}

.surplus-page .surplus-table tbody tr:last-child td {
    border-bottom: none;
}

.surplus-page .surplus-table tbody tr:hover {
    background: #fafbfc;
}

.surplus-page .surplus-table td.surplus-table__photo {
    width: 92px;
    min-width: 92px;
    padding: 6px 8px;
}

.surplus-page .surplus-table td.surplus-table__photo img {
    display: block;
    width: 80px;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: 4px;
}

.surplus-page .surplus-table__row--active {
    background: #f3f9ff;
}

.surplus-page .surplus-empty {
    text-align: center;
    padding: 28px 16px !important;
    color: #78909c;
    font-weight: 600;
}

.surplus-page .surplus-link {
    color: #1976d2;
    text-decoration: none;
    font-weight: 600;
}

.surplus-page .surplus-link:hover {
    text-decoration: underline;
}

.surplus-page .surplus-link--pool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e3f2fd;
}

.surplus-page .surplus-qty {
    font-weight: 700;
    color: #1565c0;
}

.surplus-page .surplus-date {
    white-space: nowrap;
    color: #546e7a;
}

.surplus-page .surplus-note {
    max-width: 280px;
    font-size: 12px;
    line-height: 1.45;
    color: #546e7a;
}

.surplus-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.surplus-status--success {
    background: #e8f5e9;
    color: #2e7d32;
}

.surplus-status--info {
    background: #e3f2fd;
    color: #1565c0;
}

.surplus-status--primary {
    background: #ede7f6;
    color: #5e35b1;
}

.surplus-status--warning {
    background: #fff8e1;
    color: #f57f17;
}

.surplus-status--danger {
    background: #ffebee;
    color: #c62828;
}

.surplus-status--neutral {
    background: #eceff1;
    color: #546e7a;
}

.surplus-field-label {
    display: block;
    margin: 10px 0 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #78909c;
}

.surplus-reverse-modal__box {
    max-width: 480px;
}

.surplus-reverse-modal__intro {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.5;
    color: #546e7a;
}

.surplus-reverse-form__input,
.surplus-reverse-form__textarea {
    width: 100%;
    box-sizing: border-box;
}

.surplus-reverse-form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 14px;
}

.surplus-guide-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 0;
}

.surplus-guide-card .mould-detail-pane {
    height: 100%;
}

.surplus-guide-card__head {
    flex-wrap: wrap;
    gap: 8px 10px;
}

.surplus-guide-card__step {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(21, 101, 192, 0.12);
    color: #1565c0;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.surplus-guide-card__body {
    padding-top: 12px;
}

.surplus-guide-list {
    margin: 0;
    padding-left: 20px;
    line-height: 1.65;
    color: #37474f;
    font-size: 13px;
}

.surplus-guide-list li+li {
    margin-top: 8px;
}

.surplus-guide-list--bullet {
    list-style: disc;
}

.surplus-guide-tip {
    margin-top: 0;
}

/* —— Trung tâm thông báo —— */
.notifications-page {
    padding: 0;
    box-sizing: border-box;
}

.notifications-page .notif-sheet {
    border-radius: 5px;
    overflow: hidden;
}

.notifications-page .notif-toolbar {
    padding: 8px 10px 6px;
    border-bottom: 1px solid #e8edf2;
    background: #fff;
}

.notifications-page .notif-toolbar__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.notifications-page .notif-toolbar__title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #263238;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.notifications-page .notif-toolbar__title i {
    color: #546e7a;
    font-size: 16px;
}

.notifications-page .notif-toolbar__mark-all {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 999px;
    background: transparent;
    color: #1565c0;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.notifications-page .notif-toolbar__mark-all:hover {
    background: #eef4ff;
}

.notifications-page .notif-toolbar__filters {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 5px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 2px;
}

.notifications-page .notif-toolbar__sep {
    flex-shrink: 0;
    width: 1px;
    height: 16px;
    margin: 0 2px;
    background: #dfe3e8;
}

.notifications-page .notif-chip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 999px;
    background: #fff;
    color: #546e7a;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.notifications-page .notif-chip:hover {
    background: #f5f7fa;
    border-color: #cfd8dc;
}

.notifications-page .notif-chip.is-active {
    border-color: #90caf9;
    background: #eef4ff;
    color: #1565c0;
}

.notifications-page .notif-chip__n {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(21, 101, 192, 0.12);
    color: #1565c0;
    font-size: 12px;
    line-height: 18px;
}

.notifications-page .notif-feed {
    display: flex;
    flex-direction: column;
}

.notifications-page .notif-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid #eef1f4;
    cursor: pointer;
    transition: background 0.12s ease;
}

.notifications-page .notif-item:last-child {
    border-bottom: none;
}

.notifications-page .notif-item:hover {
    background: #f8fafc;
}

.notifications-page .notif-item--unread {
    background: #f5f9ff;
}

.notifications-page .notif-item--unread:hover {
    background: #eef4ff;
}

.notifications-page .notif-item__dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    margin-top: 5px;
    border-radius: 50%;
    background: transparent;
}

.notifications-page .notif-item--unread .notif-item__dot {
    background: #1565c0;
}

.notifications-page .notif-item__body {
    flex: 1 1 auto;
    min-width: 0;
}

.notifications-page .notif-item__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.notifications-page .notif-item__title-wrap {
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 5px;
}

.notifications-page .notif-item__module {
    flex-shrink: 0;
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.notifications-page .notif-item__module--greenware {
    background: #e8f5e9;
    border-color: #c8e6c9;
    color: #2e7d32;
}

.notifications-page .notif-item__module--order {
    background: #e3f2fd;
    border-color: #bbdefb;
    color: #1565c0;
}

.notifications-page .notif-item__module--other {
    background: #eceff1;
    border-color: #cfd8dc;
    color: #546e7a;
}

.notifications-page .notif-item__title {
    font-size: 15px;
    line-height: 1.35;
    font-weight: 700;
    color: #263238;
}

.notifications-page .notif-item--read .notif-item__title {
    font-weight: 600;
    color: #546e7a;
}

.notifications-page .notif-item--unread .notif-item__title {
    color: #1565c0;
}

.notifications-page .notif-item__time {
    flex-shrink: 0;
    font-size: 13px;
    line-height: 1.35;
    color: #90a4ae;
    white-space: nowrap;
}

.notifications-page .notif-item__summary,
.notifications-page .notif-item__message {
    margin-top: 2px;
    font-size: 14px;
    line-height: 1.4;
    color: #455a64;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.notifications-page .notif-item__meta {
    margin-top: 2px;
    font-size: 13px;
    color: #90a4ae;
}

.notifications-page .notif-item__mark-unread {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-top: -2px;
    border-radius: 50%;
    color: #90a4ae;
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.notifications-page .notif-item:hover .notif-item__mark-unread,
.notifications-page .notif-item:focus-within .notif-item__mark-unread {
    opacity: 1;
}

.notifications-page .notif-item__mark-unread:hover {
    background: #eceff1;
    color: #37474f;
}

.notifications-page .notif-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 28px 12px;
    text-align: center;
    color: #90a4ae;
}

.notifications-page .notif-empty i {
    font-size: 22px;
    opacity: 0.5;
}

.notifications-page .notif-empty p {
    margin: 0;
    font-size: 15px;
}

.notifications-page .notif-empty__link {
    font-size: 14px;
    font-weight: 600;
    color: #1565c0;
    text-decoration: none;
}

.notifications-page .notif-empty__link:hover {
    text-decoration: underline;
}

.notifications-page .notif-pagination.pagination {
    margin: 0;
    padding: 8px;
    border-top: 1px solid #eef1f4;
    font-size: 15px;
}

@media (max-width: 768px) {
    .notifications-page .notif-item {
        padding: 8px;
    }

    .notifications-page .notif-item__mark-unread {
        opacity: 1;
    }

    .notifications-page .notif-toolbar__mark-all span {
        display: none;
    }
}

/* —— Trang tài liệu hướng dẫn (manual) —— */
.manual-page {
    padding: 0;
    box-sizing: border-box;
}

.manual-page .ps-page-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.manual-page .manual-sheet.bgwhite {
    padding: 0;
    border-radius: 5px;
    overflow: visible;
    margin-bottom: 0;
}

.manual-page .manual-sheet>.mould-detail-pane:first-child {
    border-top: none;
}

.manual-page .manual-page__intro {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: #546e7a;
}

.manual-page .manual-page__back-link,
.manual-page .manual-page__module-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: #546e7a;
    font-size: 13px;
    font-weight: 600;
}

.manual-page .manual-page__back-link {
    margin-right: 4px;
    padding: 4px 8px;
    border-radius: 4px;
}

.manual-page .manual-page__back-link:hover,
.manual-page .manual-page__module-link:hover {
    color: #1565c0;
}

.manual-page .manual-page__module-link {
    margin-left: auto;
}

.manual-index-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}

.manual-index-card {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.manual-index-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.manual-index-card__head {
    gap: 8px;
}

.manual-index-card__body {
    padding-top: 0;
}

.manual-index-card__text {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: #546e7a;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.surplus-guide-tip__body {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px !important;
    background: #f3f9ff;
}

.surplus-guide-tip__icon {
    color: #1976d2;
    font-size: 18px;
    margin-top: 2px;
    flex-shrink: 0;
}

.surplus-guide-tip__title {
    font-size: 13px;
    font-weight: 700;
    color: #1565c0;
    margin-bottom: 4px;
}

.surplus-guide-tip__text {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: #546e7a;
}

@media (max-width: 768px) {
    .surplus-page .surplus-page__guide-link {
        margin-left: 0;
        margin-top: 8px;
        width: 100%;
    }

    .manual-page .manual-page__module-link {
        margin-left: 0;
        margin-top: 8px;
        width: 100%;
    }

    .manual-page .mould-detail-row-header {
        flex-wrap: wrap;
    }

    .surplus-page .mould-detail-row-header {
        flex-wrap: wrap;
    }

    .surplus-page .surplus-kpi-strip.kpi-strip--cols-3 {
        grid-template-columns: 1fr;
    }

    .surplus-guide-grid {
        grid-template-columns: 1fr;
    }
}

/* —— Vieworder: kiểm đếm tồn dư (order_warehouse_surplus.php) —— */
.fs-surplus-order-sheet {
    margin-bottom: 0;
}

.fs-surplus-order-sheet+.fs-surplus-order-sheet,
.fs-surplus-order-sheet+.alert,
.alert+.fs-surplus-order-sheet,
.fs-surplus-order-sheet+form,
form.fs-surplus-order-form,
.fs-surplus-order-form>.fs-surplus-order-sheet+.fs-surplus-order-sheet {
    margin-top: 0;
}

.fs-surplus-order-form {
    margin: 0;
}

.fs-surplus-order-sheet+.fs-surplus-order-sheet>.mould-detail-pane:first-child,
.fs-surplus-order-sheet.surplus-sheet--kpi+.fs-surplus-order-sheet>.mould-detail-pane:first-child {
    border-top: none;
}

.fs-surplus-order-sheet+.surplus-page__alert,
.surplus-page__alert+.fs-surplus-order-sheet,
.surplus-page__alert+form.fs-surplus-order-form {
    margin-top: 0;
}

.alert.success.surplus-page__alert {
    margin-top: 0;
    margin-bottom: 0;
    border-radius: 0;
}

.fs-surplus-order-form+.fs-surplus-order-sheet {
    margin-top: 0;
}

.fs-surplus-kpi {
    margin-bottom: 0;
}

.fs-surplus-kpi .kpi-strip__value.text-green,
.fs-surplus-kpi .kpi-strip__value.text-red {
    font-size: 18px;
    font-weight: 700;
}

.fs-surplus-kpi-cancel-reason {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: baseline;
    padding: 12px 18px 14px;
    border-top: 1px solid #e3e8ef;
    background: #f8fafc;
    font-size: 13px;
    line-height: 1.45;
}

.fs-surplus-kpi-cancel-reason__label {
    flex: 0 0 auto;
    font-weight: 700;
    color: #37474f;
}

.fs-surplus-kpi-cancel-reason__text {
    flex: 1 1 180px;
    min-width: 0;
    color: #546e7a;
}

.fs-surplus-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.fs-surplus-field label,
.fs-surplus-field .ps-filter-bar__label {
    margin: 0;
}

.fs-surplus-note-input {
    width: 100%;
    min-height: 72px;
    box-sizing: border-box;
    resize: vertical;
}

.fs-surplus-sig-row {
    margin-top: 4px;
}

.fs-surplus-sig-row .gw-sig-block {
    background: #f5f7fa;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    padding: 12px;
}

.fs-surplus-sig-title {
    font-size: 12px;
    font-weight: 700;
    color: #37474f;
    margin-bottom: 8px;
}

.fs-surplus-sig-tools {
    margin-top: 8px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.fs-surplus-sig-status {
    font-size: 12px;
    color: #78909c;
}

.fs-surplus-sig-status.is-signed {
    color: #2e7d32;
    font-weight: 600;
}

.fs-approver-dropdown {
    display: block;
    width: 100%;
    z-index: 30;
}

.fs-approver-dropdown__trigger {
    display: block;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    padding: 6px 10px;
    font: inherit;
    color: inherit;
    text-align: left;
}

.fs-approver-dropdown__trigger--readonly {
    cursor: default;
    pointer-events: none;
}

.fs-approver-dropdown__trigger-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.fs-approver-dropdown__label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fs-approver-dropdown__label.is-placeholder {
    color: #78909c;
}

.fs-approver-dropdown__caret {
    flex: 0 0 auto;
    margin-left: auto;
    color: #607d8b;
}

.fs-approver-dropdown__avatar .avatar-wrapper,
.fs-approver-dropdown__avatar {
    flex: 0 0 auto;
}

.fs-approver-dropdown__menu {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    max-height: 250px;
    overflow-y: auto;
    left: 0;
    right: 0;
    translate: none;
    box-sizing: border-box;
}

.fs-approver-dropdown__option {
    display: flex !important;
    align-items: center;
    gap: 8px;
    white-space: normal;
    line-height: 1.35;
}

.fs-approver-dropdown__option-av {
    flex: 0 0 auto;
}

.fs-approver-dropdown__option-text {
    flex: 1 1 auto;
    min-width: 0;
}

.fs-surplus-form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 0;
    padding: 14px 18px 18px;
    border-top: 1px solid #e3e8ef;
    background: #fff;
}

.fs-surplus-new-form-btn {
    display: inline-block;
    margin-bottom: 12px;
}

.fs-surplus-locked-msg {
    font-size: 13px;
    color: #2e7d32;
    font-weight: 600;
}

.fs-surplus-pool-table .fs-surplus-alloc-form {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    align-items: end;
    min-width: 320px;
}

.fs-surplus-pool-table .scroll-table td.fs-surplus-receive-action-cell,
.fs-surplus-pool-table .scroll-table td.fs-surplus-receive-action-cell {
    white-space: normal;
    vertical-align: top;
    min-width: 420px;
}

.fs-surplus-alloc-form__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fs-surplus-alloc-form__field label {
    font-size: 11px;
    color: #78909c;
    margin: 0;
}

.fs-surplus-alloc-form__field .input {
    width: 100%;
    box-sizing: border-box;
}

.fs-surplus-alloc-form__actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 4px;
}

.fs-surplus-alloc-form__field--error label {
    color: #c62828;
    font-weight: 600;
}

.fs-surplus-alloc-form__field--error .input {
    border-color: #e53935;
    background: #fffafa;
    box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.12);
}

.fs-surplus-note-cell--error,
.fs-surplus-qty-input--error {
    border-color: #e53935;
    background: #fffafa;
    box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.12);
}

.fs-receive-field-error {
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.35;
    color: #c62828;
    font-weight: 600;
}

.fs-receive-alert {
    margin-bottom: 12px;
}

.fs-surplus-inline-alert {
    margin: 0 0 12px;
}

.alert.error.fs-receive-alert,
.surplus-page__alert.alert.error.fs-receive-alert {
    font-size: 15px;
}

.fs-receive-alert__title {
    font-weight: 700;
    margin-bottom: 4px;
}

.fs-receive-alert__detail {
    font-size: 14px;
    line-height: 1.5;
}

/* Bảng kiểm đếm hàng dư — cùng pattern scroll-table + sticky-photo */
.scroll-table.fs-surplus-count-table.order-vieworder-tab-table {
    table-layout: fixed;
}

.scroll-table.fs-surplus-count-table col.fs-surplus-col-stt {
    width: 44px;
}

.scroll-table.fs-surplus-count-table col.fs-surplus-col-code {
    width: 118px;
}

.scroll-table.fs-surplus-count-table col.fs-surplus-col-photo {
    width: 92px;
}

.scroll-table.fs-surplus-count-table col.fs-surplus-col-desc {
    width: 26%;
}

.scroll-table.fs-surplus-count-table col.fs-surplus-col-qty {
    width: 102px;
}

.scroll-table.fs-surplus-count-table col.fs-surplus-col-confirm {
    width: 118px;
}

.scroll-table.fs-surplus-count-table col.fs-surplus-col-note {
    width: 168px;
}

.scroll-table.fs-surplus-count-table th.fs-surplus-col-stt,
.scroll-table.fs-surplus-count-table td.fs-surplus-col-stt,
.scroll-table.fs-surplus-count-table th.fs-surplus-col-code,
.scroll-table.fs-surplus-count-table td.fs-surplus-col-code,
.scroll-table.fs-surplus-count-table th.fs-surplus-col-qty,
.scroll-table.fs-surplus-count-table td.fs-surplus-col-qty,
.scroll-table.fs-surplus-count-table th.fs-surplus-col-confirm,
.scroll-table.fs-surplus-count-table td.fs-surplus-col-confirm {
    white-space: nowrap;
}

.scroll-table.fs-surplus-count-table td.fs-surplus-col-desc,
.scroll-table.fs-surplus-count-table td.description.fs-surplus-col-desc {
    text-align: left;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    overflow: visible;
    text-overflow: clip;
    vertical-align: top;
}

.scroll-table.fs-surplus-count-table td.fs-surplus-col-note {
    text-align: left;
    white-space: normal;
    vertical-align: middle;
}

.scroll-table.fs-surplus-count-table .fs-surplus-qty-input {
    width: 100px;
    max-width: 100%;
    box-sizing: border-box;
}

.scroll-table.fs-surplus-count-table .fs-surplus-note-cell {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* Kiểm đếm / nhập tồn: tô nền từng ô — tr.bglightred không hiện với border-collapse: separate */
.scroll-table.fs-surplus-count-table tbody tr.bglightred>td,
.fs-surplus-pool-table .scroll-table tbody tr.bglightred>td {
    background-color: #fbf0f0 !important;
}

.scroll-table.fs-surplus-count-table tbody tr.bglightred:hover>td,
.fs-surplus-pool-table .scroll-table tbody tr.bglightred:hover>td {
    background-color: #f0dbdb !important;
}

.scroll-table.fs-surplus-count-table tbody tr.bglightred>td.sticky-photo,
.fs-surplus-pool-table .scroll-table tbody tr.bglightred>td.sticky-photo {
    background-color: #fbf0f0 !important;
}

.scroll-table.fs-surplus-count-table tbody tr.bglightred:hover>td.sticky-photo,
.fs-surplus-pool-table .scroll-table tbody tr.bglightred:hover>td.sticky-photo {
    background-color: #f0dbdb !important;
}

.scroll-table.fs-receive-count-table col.fs-receive-col-qty {
    width: 88px;
}

.scroll-table.fs-receive-count-table col.fs-receive-col-input {
    width: 120px;
}

.scroll-table.fs-receive-count-table th.fs-receive-col-qty,
.scroll-table.fs-receive-count-table td.fs-receive-col-qty,
.scroll-table.fs-receive-count-table th.fs-receive-col-input,
.scroll-table.fs-receive-count-table td.fs-receive-col-input {
    white-space: nowrap;
}

.scroll-table.fs-receive-count-table td.fs-receive-col-input {
    vertical-align: middle;
}

.scroll-table.fs-receive-count-table .fs-receive-qty-input {
    width: 100%;
    min-width: 96px;
    max-width: 120px;
    text-align: center;
}

.fs-receive-order-form .fs-surplus-form-actions {
    border-top: 1px solid #eceff1;
}

@media (max-width: 768px) {
    .fs-surplus-kpi.kpi-strip--cols-4 {
        grid-template-columns: 1fr 1fr;
    }

    .fs-surplus-pool-table .fs-surplus-alloc-form {
        grid-template-columns: 1fr;
        min-width: 0;
    }

    .scroll-table.fs-receive-count-table .fs-receive-qty-input {
        min-width: 88px;
    }
}

/* —— Vieworder tab Ra lò (order_production.php) —— */
.op-prod-page {
    margin: 0;
}

.op-prod-sheet {
    margin-bottom: 0;
    border-radius: 0;
}

.op-prod-sheet+.scroll-hint {
    margin-top: 0;
}

.op-prod-page>.scroll-hint+.scroll-table-wrapper {
    margin-top: 0;
}

.op-prod-control-sheet {
    border-bottom: 1px solid #eceff1;
}

.op-prod-control-row {
    padding: 8px 12px;
    border-bottom: 1px solid #eceff1;
}

.op-prod-control-row:last-child {
    border-bottom: none;
}

.op-prod-progress-inline {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.op-prod-progress-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.op-prod-progress-label {
    font-size: 11px;
    font-weight: 700;
    color: #546e7a;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.op-prod-progress-bar-wrap {
    width: 100%;
    min-width: 0;
}

.op-prod-progress-bar {
    width: 100%;
    height: 7px;
    margin: 0;
    border-radius: 999px;
}

.op-prod-progress-pct {
    font-size: 20px;
    font-weight: 700;
    color: #1565c0;
    line-height: 1;
}

.op-prod-control-row--progress {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.op-prod-kpi-mini {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
}

.op-prod-kpi-chip {
    min-width: 72px;
    padding: 6px 10px;
    border-radius: 6px;
    background: #f5f7fa;
    border: 1px solid #e3e8ef;
    text-align: center;
}

.op-prod-kpi-chip__label {
    font-size: 10px;
    font-weight: 600;
    color: #78909c;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.op-prod-kpi-chip__value {
    margin-top: 2px;
    font-size: 14px;
    font-weight: 700;
    color: #37474f;
    line-height: 1.2;
}

.op-prod-kpi-chip--success {
    border-color: #c8e6c9;
    background: #f1f8f2;
}

.op-prod-kpi-chip--success .op-prod-kpi-chip__value {
    color: #2e7d32;
}

.op-prod-kpi-chip--warning {
    border-color: #ffe0b2;
    background: #fff8ef;
}

.op-prod-kpi-chip--warning .op-prod-kpi-chip__value {
    color: #ef6c00;
}

.op-prod-kpi-chip--danger {
    border-color: #ffcdd2;
    background: #fff5f5;
}

.op-prod-kpi-chip--danger .op-prod-kpi-chip__value {
    color: #c62828;
}

.op-prod-kpi-chip--neutral {
    border-color: #e3e8ef;
    background: #f5f7fa;
}

.op-prod-kpi-chip--neutral .op-prod-kpi-chip__value {
    color: #78909c;
}

.op-prod-control-row--notes {
    background: #fffbeb;
    padding: 10px 12px;
}

.op-prod-notes-compact {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 0;
    box-sizing: border-box;
}

.op-prod-notes-compact__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #e65100;
    flex-shrink: 0;
}

.op-prod-notes-compact__label i {
    font-size: 14px;
}

.op-prod-notes-compact__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.op-prod-notes__line {
    margin: 0;
    font-size: 14px;
    line-height: 1.35;
    color: #5d4037;
    word-break: break-word;
}

.op-prod-notes__type {
    font-weight: 700;
    color: #e65100;
    margin-right: 4px;
}

.op-prod-control-row--toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.op-prod-filters {
    min-width: 0;
}

.op-prod-filters__label {
    font-size: 11px;
    font-weight: 700;
    color: #546e7a;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.op-prod-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.op-prod-filter-chip {
    margin: 0;
}

.op-prod-actions {
    flex: 0 0 auto;
}

@media (min-width: 769px) {
    .op-prod-control-row {
        padding: 7px 14px;
    }

    .op-prod-control-row--progress {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
    }

    .op-prod-progress-inline {
        flex: 1;
        min-width: 0;
    }

    .op-prod-kpi-mini {
        flex: 0 0 auto;
        justify-content: flex-end;
        align-self: center;
    }

    .op-prod-progress-pct {
        flex: 0 0 auto;
        font-size: 17px;
        text-align: right;
    }

    .op-prod-control-row--notes {
        padding: 10px 14px;
    }

    .op-prod-notes-compact {
        flex-direction: row;
        align-items: flex-start;
        gap: 10px;
    }

    .op-prod-notes-compact__label {
        flex: 0 0 auto;
        padding-top: 1px;
        font-size: 13px;
    }

    .op-prod-notes-compact__body {
        flex: 1;
        gap: 2px;
    }

    .op-prod-control-row--toolbar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .op-prod-filters--inline {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
        min-width: 0;
    }

    .op-prod-filters--inline .op-prod-filter-chips {
        margin-top: 0;
    }
}

@media (max-width: 768px) {
    .op-prod-control-row--toolbar {
        gap: 10px;
    }

    .op-prod-actions,
    .op-prod-actions .op-prod-surplus-btn {
        width: 100%;
    }
}

.op-prod-cell-pct {
    margin-top: 3px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    color: #78909c;
}

.op-prod-cell-pct.text-red {
    color: #c62828;
}

/* Tab Ra lò — #opProdTable: width cột theo nội dung */
.op-prod-page #opProdTable.scroll-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
}

.op-prod-page #opProdTable .op-prod-col-stt {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    padding-inline: 4px;
}

.op-prod-page #opProdTable .op-prod-col-code {
    width: 108px;
    min-width: 108px;
    max-width: 108px;
    white-space: normal;
    word-break: break-word;
}

.op-prod-page #opProdTable .op-prod-col-photo,
.op-prod-page #opProdTable th.sticky-photo,
.op-prod-page #opProdTable td.sticky-photo {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
    box-sizing: border-box;
}

.op-prod-page #opProdTable .op-prod-col-desc,
.op-prod-page #opProdTable td.description.op-prod-col-desc {
    width: auto;
    min-width: 180px;
    max-width: none;
    white-space: normal;
    word-break: break-word;
    text-align: left;
}

.op-prod-page #opProdTable .op-prod-col-stat {
    width: 92px;
    min-width: 92px;
    max-width: 92px;
    white-space: normal;
    vertical-align: middle;
    box-sizing: border-box;
}

.op-prod-page #opProdTable td.op-prod-col-stat {
    font-size: 14px;
}

.op-prod-page #opProdTable .op-prod-col-stat .op-prod-cell-pct {
    font-size: 10px;
    white-space: nowrap;
}

@media (max-width: 1199px) {
    .op-prod-page #opProdTable.scroll-table {
        width: max-content !important;
        min-width: 980px !important;
    }
}

.op-prod-product-row {
    cursor: pointer;
    transition: background-color 0.12s ease;
}

.op-prod-product-row:hover {
    background: rgba(21, 101, 192, 0.04);
}

.op-prod-page .scroll-table-wrapper.is-row-focus-mode .op-prod-product-row:not(.op-prod-row--focus-target) {
    opacity: 0.38;
    filter: blur(2px);
    pointer-events: none;
    transition: opacity 0.22s ease, filter 0.22s ease;
}

.op-prod-page .scroll-table-wrapper.is-row-focus-mode .op-prod-product-row.op-prod-row--focus-target {
    position: relative;
    z-index: 2;
    box-shadow: inset 0 0 0 2px rgba(21, 101, 192, 0.28);
    background-color: #fff;
}

.op-prod-page .scroll-table-wrapper.is-row-focus-mode .op-prod-product-row.op-prod-row--focus-target td.sticky-photo {
    background: #fff !important;
}

.op-prod-page .scroll-table-wrapper.is-row-focus-mode .invoice-supplement-separator {
    opacity: 0.38;
    filter: blur(1px);
    pointer-events: none;
}

.op-prod-desc {
    line-height: 1.35;
    white-space: normal;
    word-break: break-word;
}

/* —— Tạo đơn hàng mới (cd-shell) —— */
.neworder-page > .cd-page {
    margin-top: 0;
    border-top: none;
}

.neworder-page .cd-panel--alert {
    padding: 12px 14px;
}

.neworder-page .cd-panel--alert .alert {
    margin: 0;
}

.neworder-page .cd-panel--compact {
    padding: 10px 14px;
}

.neworder-page .cd-body .cd-panel + .cd-panel,
.neworder-page .cd-body form .cd-panel + .cd-panel {
    border-top: 1px solid var(--cd-border, #e0e0e0);
}

.neworder-page .cd-panel--actions {
    padding: 14px;
}

.neworder-page .no-page-intro {
    margin: 0 0 14px;
    line-height: 1.45;
}

/* —— Bước chọn KH (trang đầu) —— */
.neworder-page .no-pick-panel {
    padding: 16px 18px 20px;
}

.neworder-page .no-pick-head {
    margin-bottom: 18px;
}

.neworder-page .no-pick-head .cd-panel__title {
    margin-bottom: 6px;
}

.neworder-page .no-pick-lead {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #607d8b;
}

.neworder-page .no-pick-step {
    padding: 14px 0;
    border-top: 1px solid var(--cd-border, #e0e0e0);
}

.neworder-page .no-pick-step:first-of-type {
    border-top: none;
    padding-top: 0;
}

.neworder-page .no-pick-step__head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.neworder-page .no-pick-step__num {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--cd-accent-soft, #e3f2fd);
    color: var(--cd-accent, #1565c0);
    font-size: 13px;
    font-weight: 700;
    line-height: 26px;
    text-align: center;
}

.neworder-page .no-pick-step__title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #263238;
}

.neworder-page .no-pick-search .no-customer-search-wrap {
    margin-bottom: 0;
}

.neworder-page .no-pick-search .no-customer-search-input {
    max-width: none;
}

.neworder-page .no-pick-search .no-customer-search-results {
    max-width: none;
}

.neworder-page .no-pick-selected {
    display: flex;
    align-items: center;
    gap: 12px 16px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid var(--cd-border, #e0e0e0);
    border-radius: 8px;
    background: var(--cd-stat-bg, #fafbfc);
}

.neworder-page .no-pick-selected__identity {
    flex: 1 1 240px;
    min-width: 0;
}

.neworder-page .no-pick-selected .cd-hero__photo {
    height: 80px;
    min-width: 0;
    max-width: min(280px, 45vw);
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    font-size: 28px;
}

.neworder-page .no-pick-selected .cd-hero__photo img {
    height: 80px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.neworder-page .no-pick-selected .cd-hero__title {
    margin: 0 0 4px;
    font-size: 17px;
}

.neworder-page .no-pick-selected .cd-hero__meta {
    margin-top: 2px;
}

.neworder-page .no-pick-hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: #90a4ae;
}

.neworder-page .no-pick-hint i {
    margin-right: 4px;
}

.neworder-page .no-pick-step--methods[aria-disabled="true"] .no-pick-methods {
    opacity: 0.45;
    pointer-events: none;
    filter: grayscale(0.15);
}

.neworder-page .no-pick-step--methods.is-ready .no-pick-step__num {
    background: var(--cd-success-bg, #e8f5e9);
    color: var(--cd-success-text, #2e7d32);
}

.neworder-page .no-pick-methods {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.neworder-page .no-pick-method {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 100%;
    padding: 14px;
    border: 1px solid var(--cd-border, #e0e0e0);
    border-radius: 8px;
    background: #fff;
    box-sizing: border-box;
}

.neworder-page .no-pick-step--methods.is-ready .no-pick-method {
    opacity: 1;
}

.neworder-page .no-pick-method__icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 18px;
}

.neworder-page .no-pick-method--excel .no-pick-method__icon {
    background: #e8f5e9;
    color: #2e7d32;
}

.neworder-page .no-pick-method--manual .no-pick-method__icon {
    background: #e3f2fd;
    color: #1565c0;
}

.neworder-page .no-pick-method__title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #263238;
}

.neworder-page .no-pick-method__desc {
    margin: 0;
    flex: 1 1 auto;
    font-size: 13px;
    line-height: 1.45;
    color: #607d8b;
}

.neworder-page .no-pick-method__link {
    display: inline-block;
}

.neworder-page .no-pick-method__action {
    margin: 4px 0 0;
}

.neworder-page .no-pick-method__btn {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.neworder-page .no-field-label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #78909c;
}

.neworder-page .no-customer-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 360px);
    gap: 16px;
    align-items: start;
}

.neworder-page .no-customer-search-wrap {
    position: relative;
    margin-bottom: 12px;
}

.neworder-page .no-customer-search-input {
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
}

.neworder-page .no-customer-search-results {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 20;
    max-width: 420px;
}

.neworder-page .no-customer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.neworder-page .no-inline-form {
    display: inline;
    margin: 0;
}

.neworder-page .no-customer-photo {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border: 1px dashed #d0dae6;
    border-radius: 8px;
    background: #fafbfc;
}

.neworder-page .no-customer-photo__img {
    max-width: 100%;
    max-height: 280px;
    border-radius: 8px;
    object-fit: contain;
}

.neworder-page .no-manual-add-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.neworder-page .no-manual-add-field {
    position: relative;
}

.neworder-page .no-manual-add-field--code {
    flex: 1 1 200px;
    min-width: 0;
    max-width: 280px;
}

.neworder-page .no-manual-code-input {
    width: 100%;
    text-transform: uppercase;
    box-sizing: border-box;
}

.neworder-page .no-manual-qty-input {
    width: 120px;
    box-sizing: border-box;
}

.neworder-page .no-manual-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 20;
    min-width: 300px;
}

.neworder-page .no-manual-add-msg {
    flex: 1 1 160px;
    min-width: 0;
}

.neworder-page .no-order-form {
    margin: 0;
}

.neworder-page .no-order-fields-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
}

.neworder-page .no-order-fields-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 12px;
}

.neworder-page .no-order-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.neworder-page .no-order-field--type {
    flex: 0 0 auto;
    width: 160px;
}

.neworder-page .no-order-field--invoice {
    flex: 1 1 180px;
    min-width: 140px;
    max-width: 280px;
}

.neworder-page .no-order-field--deposit,
.neworder-page .no-order-field--handling {
    flex: 0 0 auto;
    width: 120px;
}

.neworder-page .no-order-field .input,
.neworder-page .no-order-field select.input {
    width: 100%;
    box-sizing: border-box;
}

.neworder-page .no-order-fields-row .no-order-field .input,
.neworder-page .no-order-fields-row .no-order-field select.input {
    font-size: 13px;
    padding: 5px 8px;
    min-height: 32px;
}

.neworder-page .no-order-fields-row .no-order-field--type select.input {
    padding-right: 24px;
}

.neworder-page .no-order-field--wide {
    grid-column: span 2;
}

.neworder-page .no-kpi-strip {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 14px;
}

.neworder-page .no-kpi-date-input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    font-size: 12px;
    padding: 4px 6px;
}

.neworder-page .no-draft-actions {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
}

.neworder-page .no-notes-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px 14px;
    margin-bottom: 12px;
}

.neworder-page .no-weight-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f5f7fa;
    border: 1px solid #e8edf0;
    font-size: 13px;
    color: #546e7a;
}

.neworder-page .no-products-pane {
    padding-top: 0;
}

.neworder-page .no-product-table-wrap {
    margin-top: 0;
}

.neworder-page .cd-neworder-products-table tbody tr.highlight-row {
    background: #fff8e1;
}

.neworder-page .no-form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.neworder-page .no-form-actions--stacked {
    flex-direction: column;
    align-items: center;
}

.neworder-page .no-packaging-warning {
    text-align: center;
    line-height: 1.5;
    max-width: 640px;
    width: 100%;
}

@media (max-width: 900px) {
    .neworder-page .no-pick-methods {
        grid-template-columns: 1fr;
    }

    .neworder-page .no-order-fields-row {
        flex-wrap: wrap;
    }

    .neworder-page .no-order-field--invoice {
        max-width: none;
        flex: 1 1 100%;
    }

    .neworder-page .no-order-field--deposit,
    .neworder-page .no-order-field--handling {
        flex: 1 1 calc(50% - 6px);
        width: auto;
    }

    .neworder-page .no-order-field--wide {
        grid-column: span 2;
    }

    .neworder-page .no-notes-grid {
        grid-template-columns: 1fr;
    }

    .neworder-page .no-kpi-strip.kpi-strip--cols-6 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 599px) {
    .neworder-page .no-order-field--deposit,
    .neworder-page .no-order-field--handling {
        flex: 1 1 100%;
    }

    .neworder-page .no-order-field--wide {
        grid-column: auto;
    }

    .neworder-page .no-kpi-strip.kpi-strip--cols-6 {
        grid-template-columns: 1fr;
    }

    .neworder-page .no-manual-add-field--code {
        max-width: none;
        flex: 1 1 100%;
    }

    .neworder-page .no-manual-qty-input {
        width: 100%;
        flex: 1 1 100%;
    }
}

/* —— Bảng tin (news) —— */
.news-page .news-sheet.bgwhite {
    padding: 0;
    border-radius: 5px;
    overflow: visible;
    margin-bottom: 0;
}

.news-page .news-sheet--chat.bgwhite {
    padding: 0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 0;
}

.news-page .news-sheet>.mould-detail-pane:first-child {
    border-top: none;
}

.news-page .news-field-label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #78909c;
}

.news-page .news-back-link {
    margin-left: auto;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: #546e7a;
}

.news-page .news-back-link:hover {
    color: #1976d2;
}

.news-list-toolbar {
    margin-bottom: 12px;
}

.news-search-form__row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.news-search-input {
    flex: 1 1 220px;
    min-width: 0;
    max-width: 420px;
    box-sizing: border-box;
}

.news-thread-list.thread-list {
    gap: 8px;
    margin-top: 0;
}

.news-thread-card {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px 14px;
    padding: 12px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    box-sizing: border-box;
    width: 100%;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.news-thread-card__cover {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: 8px;
}

.news-thread-card:hover {
    border-color: #90caf9;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.08);
}

.news-thread-card--unread,
.news-thread-card.highlight {
    background: #f3f9ff;
    border-color: #bbdefb;
}

.news-thread-card__new-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: #1976d2;
    vertical-align: middle;
}

.news-thread-card__avatar,
.news-thread-card__main,
.news-thread-card__stats,
.news-thread-card__members {
    position: relative;
    z-index: 0;
}

.news-thread-card__main {
    flex: 1;
    min-width: 200px;
}

.news-thread-card__title-text {
    font-size: 15px;
    line-height: 1.35;
}

.news-thread-card__stats {
    flex: 0 0 150px;
    font-size: 13px;
    line-height: 1.5;
}

.news-thread-card__stat+.news-thread-card__stat {
    margin-top: 2px;
}

.news-thread-card__members {
    flex: 0 0 150px;
}

.news-page .thread-tags .tag-link {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 2px 6px 2px 0;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eceff1;
    color: #455a64;
    font-size: 12px;
    text-decoration: none;
}

.news-page .thread-tags .tag-link:hover {
    background: #e3f2fd;
    color: #1565c0;
}

.news-empty-state {
    padding: 28px 16px;
    text-align: center;
    color: #78909c;
    border: 1px dashed #cfd8dc;
    border-radius: 8px;
    background: #fafbfc;
}

.news-pagination.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #eceff1;
}

.news-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.news-page .news-form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    width: 100%;
}

.news-form-field--full {
    display: flex;
    flex-direction: column;
}

.news-form-content-editor {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    min-width: 0;
}

.news-form-content-editor__toolbar-wrap {
    flex-shrink: 0;
    width: 100%;
    min-width: 0;
    margin-top: 5px;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.news-form-content-editor__toolbar-wrap .editor-toolbar,
.news-editor-toolbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    margin-bottom: 0;
    padding: 2px 0;
    scrollbar-width: none;
}

.news-form-content-editor__toolbar-wrap .editor-toolbar::-webkit-scrollbar,
.news-editor-toolbar::-webkit-scrollbar {
    display: none;
}

.news-form-content-editor__toolbar-wrap .editor-toolbar button,
.news-editor-toolbar .fmt-btn {
    height: auto;
    min-height: 32px;
    flex: 0 0 auto;
    align-self: center;
    margin: 0;
    padding: 5px 8px;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
}

.news-page .news-newthread-form .news-form-input,
.news-page .news-newthread-form .news-member-picker__input,
.news-page .news-newthread-form .news-content-textarea {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    height: auto;
}

.news-form-field--content {
    margin-bottom: 0;
}

.news-form-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f5f7fa;
    border: 1px solid #e8edf0;
    box-sizing: border-box;
    cursor: pointer;
}

.news-form-check input[type="checkbox"] {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    cursor: pointer;
}

.news-form-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #eceff1;
}

.news-form-actions__submit {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.news-form-alert {
    margin-bottom: 12px;
}

/* —— News: member picker (tag user) —— */
.news-member-picker {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.news-member-picker__search-wrap {
    position: relative;
}

.news-member-picker__search {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.news-member-picker__search-label {
    position: relative;
    display: block;
    margin: 0;
}

.news-member-picker__search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #78909c;
    font-size: 14px;
    pointer-events: none;
}

.news-member-picker__input,
.news-member-picker__input.input {
    width: 100%;
    max-width: none;
    padding-left: 36px !important;
    min-height: 38px;
    box-sizing: border-box;
}

.news-member-picker__search.is-loading .news-member-picker__input {
    padding-right: 36px !important;
    background-image: linear-gradient(90deg, transparent, rgba(25, 118, 210, 0.08), transparent);
    background-size: 200% 100%;
    animation: news-member-picker-shimmer 1.1s ease-in-out infinite;
}

@keyframes news-member-picker-shimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

.news-member-picker__hint {
    font-size: 11px;
    color: #90a4ae;
    padding-left: 2px;
}

.news-member-picker__dropdown.searchUsers {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 120;
    margin-top: 0;
    min-width: 0;
    max-width: none;
    width: auto;
    padding: 6px;
    border: 1px solid #dce3ea;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    max-height: 240px;
    overflow-y: auto;
}

.news-member-picker__result.search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #263238;
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
}

.news-member-picker__result.search-item:hover,
.news-member-picker__result.search-item:focus {
    background: #e3f2fd;
    outline: none;
}

.news-member-picker__result-av {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #e0e0e0;
}

.news-member-picker__result-name {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.news-member-picker__result-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e3f2fd;
    color: #1976d2;
    flex-shrink: 0;
}

.news-member-picker__no-results {
    padding: 12px 10px;
    font-size: 13px;
    color: #78909c;
    text-align: center;
}

.news-member-picker__selected {
    border: 1px solid #e4e6eb;
    border-radius: 10px;
    background: #f8f9fb;
    overflow: hidden;
}

.news-member-picker__selected-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #e4e6eb;
    background: #fff;
}

.news-member-picker__selected-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #78909c;
}

.news-member-picker__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: #e3f2fd;
    color: #1565c0;
    font-size: 12px;
    font-weight: 700;
}

.news-member-picker__chips.taggedUsers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-height: 52px;
    padding: 10px 12px;
    margin: 0;
}

.news-member-picker__empty {
    width: 100%;
    padding: 6px 0;
    font-size: 13px;
    line-height: 1.45;
    color: #90a4ae;
    text-align: center;
}

.news-member-chip.tagged-box {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 4px 8px 4px 4px;
    border: 1px solid #cfe3fb;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(25, 118, 210, 0.06);
}

.news-member-chip__av {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.news-member-chip__name {
    font-size: 13px;
    font-weight: 600;
    color: #263238;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.news-member-chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #90a4ae;
    cursor: pointer;
    flex-shrink: 0;
}

.news-member-chip__remove:hover {
    background: #ffebee;
    color: #e41e3f;
}

.news-member-picker--compact {
    gap: 8px;
}

.news-member-picker--compact .news-member-picker__input,
.news-member-picker--compact .news-member-picker__input.input {
    min-height: 34px;
    font-size: 13px;
}

.news-member-picker--compact .news-member-picker__hint {
    display: none;
}

.news-member-picker--compact .news-member-picker__selected-head {
    padding: 6px 10px;
}

.news-member-picker--compact .news-member-picker__chips.taggedUsers {
    min-height: 44px;
    padding: 8px 10px;
    gap: 6px;
}

.news-member-picker--compact .news-member-chip__name {
    max-width: 120px;
    font-size: 12px;
}

.news-editor-toolbar {
    margin-bottom: 0;
}

.news-content-textarea {
    width: 100%;
    height: auto;
    min-height: 180px;
    flex: 0 1 auto;
    box-sizing: border-box;
    resize: vertical;
}

/* —— Chat thread: full height + fixed composer —— */
.main-content-card:has(.news-page--thread) {
    height: 100dvh;
    min-height: 100dvh;
    padding-bottom: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.news-page--thread {
    padding: 0;
    margin: 0;
    flex: 1;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.news-page--thread .ps-page-tabs-wrap {
    display: none;
}

.news-page--thread .ps-page-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.news-sheet--chat {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
    max-height: none;
    border-radius: 0;
}

.news-chat {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: #fff;
}

.news-chat-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid #e4e6eb;
    background: #fff;
    flex-shrink: 0;
}

.news-chat-back {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #0084ff;
    background: #f0f2f5;
    text-decoration: none;
    flex-shrink: 0;
}

.news-chat-back:hover {
    background: #e4e6eb;
}

.news-chat-topbar__info {
    flex: 1;
    min-width: 0;
}

.news-chat-topbar__title {
    font-size: 15px;
    font-weight: 700;
    color: #050505;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-chat-topbar__meta {
    font-size: 11px;
    color: #65676b;
    margin-top: 1px;
}

.news-chat-topbar__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}

.news-chat-topbar__tags .news-chat-tag {
    padding: 2px 8px;
    font-size: 11px;
}

.news-chat-settings-toggle {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #f0f2f5;
    color: #65676b;
    cursor: pointer;
    flex-shrink: 0;
}

.news-chat-settings-toggle:hover {
    background: #e4e6eb;
}

.news-chat-settings-toggle--active {
    background: #dbe7f3;
    color: #0084ff;
}

.news-chat-settings {
    flex-shrink: 0;
    border-bottom: 1px solid #e4e6eb;
    background: #f7f8fa;
    padding: 8px 10px;
}

.news-chat-settings__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.news-chat-settings__chip,
.news-chat-settings__seen-btn {
    min-height: 28px;
    box-sizing: border-box;
}

.news-chat-settings__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 3px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #e4e6eb;
    font-size: 12px;
    font-weight: 600;
    color: #050505;
    white-space: nowrap;
}

.news-chat-settings__chip--members {
    padding: 3px 10px 3px 10px;
    gap: 8px;
}

.news-chat-settings__chip-label {
    font-size: 12px;
    font-weight: 600;
    color: #050505;
    white-space: nowrap;
}

.news-chat-info-members__trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    min-height: 28px;
}

.news-chat-info-members__chevron {
    font-size: 9px;
    color: #65676b;
    transition: transform 0.18s ease;
    flex-shrink: 0;
    margin-right: -2px;
}

.news-chat-info-members__trigger--open .news-chat-info-members__chevron {
    transform: rotate(180deg);
}

.news-chat-settings__seen-chevron {
    font-size: 9px;
    color: #65676b;
    transition: transform 0.18s ease;
    flex-shrink: 0;
    margin-left: 2px;
}

.news-chat-settings__seen-btn--open .news-chat-settings__seen-chevron {
    transform: rotate(180deg);
}

.news-chat-settings__chip-av {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.news-chat-settings__dropdown {
    margin-top: 8px;
}

.news-chat-info-members__detail {
    padding: 12px 14px;
    border: 1px solid #e4e6eb;
    border-radius: 10px;
    background: #fff;
}

.news-chat-info-members__detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.news-chat-info-members__detail-title {
    font-size: 14px;
    font-weight: 700;
    color: #050505;
}

.news-chat-info-members__edit-btn {
    padding: 5px 12px;
    border: 1px solid #e4e6eb;
    border-radius: 999px;
    background: #f0f2f5;
    font-size: 12px;
    font-weight: 700;
    color: #0084ff;
    cursor: pointer;
}

.news-chat-info-members__edit-btn.is-active {
    background: #dbe7f3;
    border-color: #0084ff;
}

.news-chat-settings__member-stack {
    display: inline-flex;
    align-items: center;
}

.news-chat-settings__member-av {
    display: inline-flex;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #fff;
    margin-left: -6px;
    background: #e4e6eb;
    box-shadow: 0 0 0 1px #e4e6eb;
}

.news-chat-settings__member-av:first-child {
    margin-left: 0;
}

.news-chat-settings__member-av img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.news-chat-members--detail {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.news-chat-members--detail .news-chat-settings__chip {
    font-size: 14px;
    padding: 5px 14px 5px 5px;
    gap: 8px;
}

.news-chat-members--detail .news-chat-settings__chip-av {
    width: 36px;
    height: 36px;
}

.news-chat-member-chip .news-chat-member-remove {
    display: none;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-left: 4px;
    border-radius: 50%;
    background: #fee;
    color: #e41e3f;
    font-size: 12px;
    text-decoration: none;
    line-height: 1;
}

.news-chat-members--detail.is-editing .news-chat-member-remove,
.news-chat-info-members__detail.is-editing .news-chat-member-remove,
.news-chat-info-members__detail.is-editing .btn-remove-user {
    display: inline-flex !important;
    position: static;
    left: auto;
    top: auto;
    padding: 0;
    background: #fee;
    color: #e41e3f;
    font-size: 12px;
}

.news-chat-add-members {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #e4e6eb;
}

.news-chat-add-members__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.news-chat-settings__seen-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 12px;
    min-height: 28px;
    height: 28px;
    border: 1px solid #e4e6eb;
    border-radius: 999px;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    color: #65676b;
    cursor: pointer;
    white-space: nowrap;
}

.news-chat-seen-list--detail {
    padding: 12px 14px;
    border: 1px solid #e4e6eb;
    border-radius: 10px;
    background: #fff;
}

.news-chat-seen-list--detail .news-chat-seen-chip {
    font-size: 13px;
    padding: 6px 12px;
}

.news-chat-settings__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e4e6eb;
}

.news-chat-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #e4e6eb;
    color: #050505;
    font-size: 12px;
    text-decoration: none;
}

.news-chat-tag:hover {
    background: #dbe7f3;
    color: #0084ff;
}

.news-chat-seen-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.news-chat-seen-chip {
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #e4e6eb;
    color: #65676b;
}

.news-chat-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: #0084ff;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.news-chat-action:hover {
    text-decoration: underline;
}

.news-chat-action--danger {
    color: #e41e3f;
}

.news-chat-body {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column-reverse;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 12px 10px;
}

.news-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex-shrink: 0;
    width: 100%;
    background: transparent;
}

.news-chat-bottom-anchor {
    flex-shrink: 0;
    width: 100%;
    height: 1px;
    pointer-events: none;
    overflow-anchor: auto;
}

.news-chat-composer-spacer {
    flex-shrink: 0;
    width: 100%;
    height: 0;
    pointer-events: none;
}

.news-chat-orphan-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 8px 0 4px;
    padding: 14px 12px;
    border-radius: 12px;
    background: rgba(228, 30, 63, 0.08);
    border: 1px solid rgba(228, 30, 63, 0.22);
    text-align: center;
}

.news-chat-orphan-notice__text {
    font-size: 13px;
    line-height: 1.45;
    color: #65676b;
}

.news-chat-date-divider {
    display: flex;
    justify-content: center;
    align-self: center;
    width: 100%;
    margin: 2px 0;
}

.news-chat-date-divider span {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    color: #65676b;
    background: #f0f2f5;
    padding: 5px 12px;
    border-radius: 999px;
    box-shadow: none;
}

.news-chat-msg {
    display: flex;
    max-width: 100%;
    content-visibility: auto;
    contain-intrinsic-size: auto 88px;
}

.news-chat-msg--mine {
    justify-content: flex-end;
}

.news-chat-msg--other,
.news-chat-msg--starter.news-chat-msg--other {
    justify-content: flex-start;
}

.news-chat-msg__col {
    max-width: min(82%, 560px);
    min-width: 0;
}

.news-chat-msg--mine .news-chat-msg__col {
    margin-left: auto;
}

.news-chat-msg__row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.news-chat-msg__row>.news-chat-bubble {
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.news-chat-msg--mine .news-chat-msg__row {
    flex-direction: row-reverse;
}

.news-chat-msg__avatar {
    flex-shrink: 0;
    width: 28px;
    align-self: flex-end;
    line-height: 0;
}

.news-chat-msg__avatar .avatar-wrapper {
    margin: 0;
    width: 28px;
    height: 28px;
    box-sizing: border-box;
    border-width: 1px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.news-chat-msg__extras {
    margin-top: 2px;
    padding-left: 36px;
}

.news-chat-msg--mine .news-chat-msg__extras {
    padding-left: 0;
    padding-right: 36px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.news-chat-msg__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    padding: 0 36px;
    font-size: 11px;
    color: #65676b;
}

.news-chat-msg--mine .news-chat-msg__meta {
    justify-content: flex-end;
}

.news-chat-msg--other .news-chat-msg__meta,
.news-chat-msg--starter.news-chat-msg--other .news-chat-msg__meta {
    justify-content: flex-start;
}

.news-chat-msg__author {
    font-weight: 700;
    color: #0084ff;
}

.news-chat-bubble {
    padding: 8px 12px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
    overflow-wrap: anywhere;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
}

.news-chat-msg--other .news-chat-bubble,
.news-chat-msg--starter.news-chat-msg--other .news-chat-bubble {
    background: #e4e6eb;
    color: #050505;
    border-bottom-left-radius: 4px;
}

.news-chat-msg--mine .news-chat-bubble {
    background: #5a9fd4;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.news-chat-msg--mine .news-chat-bubble a:not(.news-chat-quote):not(.news-order-mention) {
    color: #fff;
    text-decoration: underline;
}

.news-chat-bubble--starter {
    background: #e4e6eb;
    color: #050505;
    border: none;
    border-bottom-left-radius: 4px;
    max-width: 100%;
}

.news-chat-msg--starter.news-chat-msg--mine .news-chat-bubble--starter {
    background: linear-gradient(135deg, #5a9fd4, #4a85c4);
    color: #fff;
    border: none;
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: 18px;
}

.news-chat-starter-title {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.news-chat-msg--starter.news-chat-msg--mine .news-chat-starter-title {
    border-bottom-color: rgba(255, 255, 255, 0.25);
}

.news-chat-bubble__text.post-content {
    padding: 0;
    border: none;
    margin: 0;
}

.news-chat-bubble:has(.news-chat-reply-stack) {
    padding: 8px 12px;
}

.news-chat-reply-stack {
    display: block;
    min-width: 0;
}

.news-chat-quote {
    display: block;
    margin: 0 0 8px;
    padding: 6px 10px;
    border: none;
    border-radius: 10px;
    background: #e8eaed;
    text-decoration: none !important;
    color: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
}

.news-chat-quote:hover {
    background: #dfe1e6;
    text-decoration: none !important;
}

.news-chat-quote__author {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #0084ff;
    margin-bottom: 2px;
    text-decoration: none;
}

.news-chat-quote__text {
    display: -webkit-box;
    font-size: 13px;
    line-height: 1.35;
    color: #65676b;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    text-decoration: none;
}

.news-chat-reply-body {
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.news-order-mention {
    display: inline;
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid rgba(37, 99, 235, 0.35);
    white-space: nowrap;
}

.news-order-mention:hover {
    color: #1d4ed8;
    border-bottom-color: currentColor;
}

.news-order-mention .fa-file-invoice {
    font-size: 0.92em;
    opacity: 0.9;
}

.news-chat-msg--mine .news-order-mention {
    color: #dbeafe;
    border-bottom-color: rgba(219, 234, 254, 0.45);
}

.news-chat-msg--mine .news-order-mention:hover {
    color: #fff;
}

.news-product-tag-block {
    display: block;
    clear: both;
    margin: 2px 0 0;
    text-align: left;
    line-height: 0;
}

.news-product-tag-block+*,
.news-product-tag-block~* {
    line-height: 1.45;
}

.news-product-tag {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    vertical-align: top;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    max-width: 96px;
    text-align: left;
    font: inherit;
    color: inherit;
    line-height: normal;
}

.news-product-tag__frame {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border: 2px solid #cfd8dc;
    border-radius: 10px;
    padding: 5px;
    background: #fff;
    line-height: normal;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.news-product-tag__img {
    display: block;
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 6px;
}

.news-product-tag__codes {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 72px;
    margin-top: 4px;
    gap: 1px;
}

.news-product-tag__code {
    display: block;
    width: 100%;
    padding: 0 2px;
    text-align: center;
    word-break: break-word;
    white-space: normal;
}

.news-product-tag__code--customer {
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    color: #333333;
}

.news-product-tag__code--internal {
    font-size: 9px;
    font-weight: 600;
    line-height: 1.2;
    color: #666666;
}

.news-product-tag:hover .news-product-tag__frame {
    border-color: #90caf9;
}

.news-product-tag:focus-visible {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
    border-radius: 10px;
}

.news-chat-msg--mine .news-product-tag__frame {
    background: #fff;
    border-color: rgba(255, 255, 255, 0.55);
}

.news-chat-msg--mine .news-chat-bubble .news-chat-quote {
    background: #e8eaed;
}

.news-chat-msg--mine .news-chat-bubble .news-chat-quote:hover {
    background: #dfe1e6;
}

.news-chat-msg--mine .news-chat-bubble .news-chat-quote__author {
    color: #0084ff;
}

.news-chat-msg--mine .news-chat-bubble .news-chat-quote__text {
    color: #65676b;
}

.news-chat-msg--other .news-chat-bubble .news-chat-quote,
.news-chat-msg--starter.news-chat-msg--other .news-chat-bubble .news-chat-quote {
    background: #fff;
}

.news-chat-msg--other .news-chat-bubble .news-chat-quote:hover,
.news-chat-msg--starter.news-chat-msg--other .news-chat-bubble .news-chat-quote:hover {
    background: #f7f8fa;
}

.news-chat-msg.is-quote-target .news-chat-bubble {
    animation: news-chat-quote-target 1.25s ease;
}

@keyframes news-chat-quote-target {

    0%,
    100% {
        filter: none;
    }

    20%,
    55% {
        filter: brightness(1.08);
    }
}

.news-chat-reply-quote {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex: 1 1 100%;
    width: 100%;
    margin-bottom: 8px;
    padding: 8px 10px;
    border-left: 3px solid #0084ff;
    border-radius: 10px;
    background: #f0f2f5;
    box-sizing: border-box;
}

.news-chat-reply-quote__body {
    flex: 1;
    min-width: 0;
}

.news-chat-reply-quote__author {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #0084ff;
    margin-bottom: 2px;
}

.news-chat-reply-quote__text {
    display: -webkit-box;
    font-size: 13px;
    line-height: 1.35;
    color: #65676b;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.news-chat-reply-quote__close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #e4e6eb;
    color: #65676b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.news-chat-reply-quote__close:hover {
    background: #d8dadf;
}

.news-chat-msg__actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    align-self: center;
    margin: 0 0 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.news-chat-msg__actions .news-chat-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 18px;
    border-radius: 50%;
    text-decoration: none;
}

.news-chat-msg__actions .news-chat-action:hover {
    text-decoration: none;
    background: rgba(0, 132, 255, 0.12);
}

.news-chat-msg__actions .news-chat-action--danger:hover {
    background: rgba(228, 30, 63, 0.12);
}

.news-chat-msg:hover .news-chat-msg__actions {
    opacity: 1;
    pointer-events: auto;
}

.news-chat-msg.is-actions-visible .news-chat-msg__actions {
    opacity: 1;
    pointer-events: auto;
}

.news-chat-edited {
    margin-top: 4px;
    padding: 0;
    border: none;
    background: none;
    font-size: 10px;
    color: #65676b;
    cursor: pointer;
}

.news-chat-history {
    display: none;
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e4e6eb;
    font-size: 12px;
}

.news-chat-history__time {
    font-size: 10px;
    color: #65676b;
    margin-bottom: 4px;
}

.news-chat-edit-form {
    width: 100%;
    margin-top: 6px;
    padding: 8px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e4e6eb;
    box-sizing: border-box;
}

.news-chat-edit-form textarea {
    width: 100%;
    min-height: 80px;
    box-sizing: border-box;
    margin-top: 6px;
    resize: vertical;
}

.news-chat-edit-form__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.news-edit-post-overlay {
    z-index: 10050;
}

.news-edit-post-modal {
    text-align: left;
    width: min(680px, calc(100vw - 32px));
    max-width: min(680px, calc(100vw - 32px));
}

.news-edit-post-form.edit-form textarea,
.news-edit-post-form .news-edit-post-form__textarea,
#newsEditPostContent {
    display: block;
    width: 100%;
    height: 200px;
    min-height: 200px;
    box-sizing: border-box;
    margin-top: 12px;
    resize: vertical;
    font-size: 14px;
    line-height: 1.45;
    transition: none;
}

.news-edit-post-form__actions .button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#newsEditPostModalTitle i {
    margin-right: 6px;
}

.news-edit-post-form .news-chat-fmt-toolbar {
    margin-top: 12px;
}

.news-edit-post-form__actions {
    margin-top: 16px;
}

.news-chat-fmt-toolbar {
    margin-bottom: 0;
}

.news-chat-composer {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 20;
    border-top: 1px solid #e4e6eb;
    background: #fff;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    margin-top: auto;
}

.news-chat-composer__form.reply-form {
    position: static;
    bottom: auto;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    z-index: auto;
}

.news-chat-composer__form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.news-chat-composer__input-row {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    flex: 1 1 100%;
    min-width: 0;
}

.news-chat-composer__expand {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #0084ff;
    cursor: pointer;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    font-size: 15px;
}

.news-chat-composer__help {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #65676b;
    cursor: pointer;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    font-size: 15px;
}

.news-chat-composer__help:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #0084ff;
}

.news-chat-composer__expand:hover {
    background: rgba(0, 132, 255, 0.08);
}

.news-chat-composer.is-fmt-open .news-chat-composer__expand i {
    transform: rotate(90deg);
}

.news-chat-composer__expand i {
    transition: transform 0.15s ease;
}

.news-chat-composer__toolbar-wrap {
    display: none;
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    margin: 0;
    overflow: hidden;
}

.news-chat-composer__toolbar-wrap .editor-toolbar {
    padding-top: 2px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0;
    gap: 4px;
}

.news-chat-composer__toolbar-wrap .editor-toolbar button {
    flex-shrink: 0;
    margin: 0;
    padding: 5px 8px;
    font-size: 12px;
}

.news-chat-composer__force-wrap {
    width: 100%;
    margin: 0;
    padding: 8px 4px 2px;
    box-sizing: border-box;
    border-top: 1px solid #e4e6eb;
}

.news-chat-composer__force {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #65676b;
    cursor: pointer;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.news-chat-composer__input-wrap {
    flex: 1;
    min-width: 0;
    position: relative;
}

.news-mention-input-wrap {
    position: relative;
}

.news-mention-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 6px);
    z-index: 40;
    max-height: 240px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #dce1e6;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
    padding: 4px;
    box-sizing: border-box;
}

.news-mention-dropdown.is-loading {
    opacity: 0.92;
}

.news-mention-dropdown__item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: 0;
    border-radius: 8px;
    background: transparent;
    padding: 6px 8px;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
    box-sizing: border-box;
}

.news-mention-dropdown__item.is-product {
    cursor: default;
    flex-wrap: wrap;
    align-items: flex-start;
}

.news-mention-dropdown__item.is-product:hover {
    background: transparent;
}

.news-mention-dropdown__product-head {
    display: flex;
    align-items: stretch;
    gap: 10px;
    flex: 1 1 calc(100% - 34px);
    min-width: 0;
}

.news-mention-dropdown__photo-wrap {
    flex-shrink: 0;
    display: flex;
    align-self: stretch;
}

.news-mention-dropdown__product-head .news-mention-dropdown__photo-wrap .news-mention-dropdown__photo,
.news-mention-dropdown__product-head .news-mention-dropdown__photo-wrap .news-mention-dropdown__photo--empty {
    width: auto;
    height: 100%;
    min-height: 100%;
    aspect-ratio: 1;
    min-width: 48px;
    max-width: 72px;
}

.news-mention-dropdown__product-head .news-mention-dropdown__code-badges {
    flex: 1;
    min-width: 0;
    justify-content: center;
}

.news-mention-dropdown__product-sub {
    flex: 1 1 100%;
    min-width: 0;
    padding: 0 2px 0 0;
}

.news-mention-dropdown__product-sub .news-mention-dropdown__sub {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-mention-dropdown__item:hover,
.news-mention-dropdown__item.is-active {
    background: #f0f2f5;
}

.news-mention-dropdown__code-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
}

.news-mention-dropdown__code-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    border: 1px solid #dce1e6;
    border-radius: 999px;
    padding: 3px 8px 3px 4px;
    background: #fff;
    cursor: pointer;
    font: inherit;
    color: inherit;
    box-sizing: border-box;
}

.news-mention-dropdown__code-badge.is-internal {
    background: #f7f8fa;
}

.news-mention-dropdown__code-badge:hover,
.news-mention-dropdown__code-badge.is-active {
    border-color: #0084ff;
    background: #eef6ff;
}

.news-mention-dropdown__badge-tag {
    flex-shrink: 0;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #65676b;
    background: #eef0f3;
    border-radius: 999px;
    padding: 2px 5px;
}

.news-mention-dropdown__code-badge.is-internal .news-mention-dropdown__badge-tag {
    color: #5f6368;
    background: #e8ecf1;
}

.news-mention-dropdown__badge-code {
    font-size: 12px;
    font-weight: 700;
    color: #111;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-mention-dropdown__photo {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #e4e6eb;
    background: #fff;
}

.news-mention-dropdown__photo--empty,
.news-mention-dropdown__photo--order {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #65676b;
    font-size: 13px;
}

.news-mention-dropdown__photo-wrap .news-mention-dropdown__photo--empty {
    display: flex;
    height: 100%;
    width: auto;
    aspect-ratio: 1;
}

.news-mention-dropdown__photo--order {
    color: #2563eb;
    background: #eef4ff;
}

.news-mention-dropdown__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.news-mention-dropdown__label {
    font-size: 13px;
    font-weight: 700;
    color: #111;
    line-height: 1.25;
    word-break: break-word;
}

.news-mention-dropdown__sub {
    font-size: 11px;
    color: #65676b;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-mention-dropdown__type {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #65676b;
    background: #eef0f3;
    border-radius: 999px;
    padding: 2px 6px;
}

.news-mention-dropdown__item.is-order .news-mention-dropdown__type {
    color: #1d4ed8;
    background: #dbeafe;
}

.news-mention-dropdown__empty {
    padding: 10px 12px;
    font-size: 12px;
    color: #65676b;
    text-align: center;
}

.news-edit-post-form__mention-wrap {
    margin-top: 8px;
}

.news-edit-post-form__mention-wrap .news-mention-dropdown {
    bottom: auto;
    top: calc(100% + 6px);
}

.news-chat-composer__input {
    width: 100%;
    min-height: 36px;
    max-height: 120px;
    padding: 8px 14px;
    border: 1px solid #e4e6eb;
    border-radius: 20px;
    background: #f0f2f5;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    box-sizing: border-box;
    font-family: inherit;
}

.news-chat-composer__input:focus {
    outline: none;
    border-color: #0084ff;
    background: #fff;
}

.news-chat-composer__send {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #0084ff;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.news-chat-composer__send:hover {
    background: #006fe6;
}

.news-composer-help-modal {
    width: min(400px, calc(100vw - 32px));
    max-width: min(400px, calc(100vw - 32px));
    padding: 18px 20px 20px;
}

.news-composer-help-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.news-composer-help-modal__close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #f0f2f5;
    color: #65676b;
    cursor: pointer;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 14px;
}

.news-composer-help-modal__close:hover {
    background: #e4e6eb;
    color: #111;
}

.news-composer-help-list {
    margin: 0;
    padding: 0 0 0 18px;
    text-align: left;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.news-composer-help-list li+li {
    margin-top: 8px;
}

.news-composer-help-list code {
    font-size: 12px;
    padding: 1px 5px;
    border-radius: 4px;
    background: #f0f2f5;
    color: #111;
}

.news-composer-help-modal__actions {
    margin-top: 16px;
    text-align: right;
}

.news-chat-composer__readonly {
    text-align: center;
    color: #65676b;
    font-size: 13px;
    padding: 8px;
}

@media (max-width: 900px) {
    .news-thread-card {
        display: grid;
        grid-template-columns: 56px 1fr;
        grid-template-areas:
            "avatar info"
            "stats stats"
            "users users";
        gap: 8px 12px;
    }

    .news-thread-card__avatar {
        grid-area: avatar;
    }

    .news-thread-card__main {
        grid-area: info;
        min-width: 0;
    }

    .news-thread-card__stats {
        grid-area: stats;
        flex: none;
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .news-thread-card__members {
        grid-area: users;
        flex: none;
    }

    .news-chat-msg__col {
        max-width: 92%;
        width: 100%;
    }

    .news-chat-msg__meta {
        padding: 0 4px 0 36px;
    }

    .news-chat-msg--mine .news-chat-msg__meta {
        padding: 0 36px 0 4px;
    }

    .news-chat-msg__extras {
        padding-left: 36px;
        padding-right: 4px;
    }

    .news-chat-msg--mine .news-chat-msg__extras {
        padding-right: 36px;
        padding-left: 4px;
    }

    .news-chat-msg__actions {
        display: none;
        order: 10;
        flex: 1 1 100%;
        width: 100%;
        justify-content: flex-start;
        align-self: stretch;
        padding-left: 36px;
        margin: 2px 0 0;
        box-sizing: border-box;
        opacity: 1;
        pointer-events: none;
        overflow: hidden;
    }

    .news-chat-msg:hover .news-chat-msg__actions {
        pointer-events: none;
    }

    .news-chat-msg.is-actions-visible .news-chat-msg__actions {
        pointer-events: auto;
    }

    .news-chat-msg__row {
        flex-wrap: wrap;
        gap: 6px 8px;
        width: 100%;
    }

    .news-chat-msg__row>.news-chat-bubble {
        flex: 0 1 auto;
        width: fit-content;
        max-width: calc(100% - 36px);
    }

    .news-chat-msg--mine .news-chat-msg__actions {
        justify-content: flex-end;
        padding-left: 0;
        padding-right: 36px;
    }
}

@media (max-width: 1199px) {
    .main:has(.news-page--thread) {
        padding-bottom: 0;
        overflow: hidden;
        height: calc(100dvh - 52px);
        box-sizing: border-box;
    }

    .main-content-card:has(.news-page--thread) {
        height: 100%;
        min-height: 0;
        max-height: 100%;
    }

    .news-page--thread .news-chat-composer {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 52px;
        width: auto;
        max-width: calc(100vw - 20px);
        margin: 0;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
        z-index: 1850;
        box-sizing: border-box;
    }

    .news-page--thread .news-mention-dropdown {
        border-left: 0;
        border-right: 0;
        max-height: min(44vh, 320px);
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    }

    .news-page--thread .news-mention-dropdown__item {
        padding: 8px 10px;
    }

    .news-page--thread .news-mention-dropdown__product-head {
        gap: 12px;
    }

    .news-page--thread .news-mention-dropdown__product-head .news-mention-dropdown__photo-wrap .news-mention-dropdown__photo,
    .news-page--thread .news-mention-dropdown__product-head .news-mention-dropdown__photo-wrap .news-mention-dropdown__photo--empty {
        min-width: 56px;
        max-width: 84px;
    }

    .news-page--thread .news-mention-dropdown__badge-code {
        max-width: none;
        white-space: normal;
        word-break: break-word;
    }

    .news-page--thread .news-mention-dropdown__code-badge {
        width: 100%;
        max-width: 100%;
    }
}

/* —— Lịch sản xuất: Gantt —— */
.gantt {
    width: 100%;
    box-sizing: border-box;
    --gantt-grid: #e8edf0;
    --gantt-header-bg: #f5f7fa;
    --gantt-row-alt: #fafbfc;
}

/* —— Lịch sản xuất: tổng quan theo tháng —— */
.ps-month-grid-wrapper {
    margin: 0;
    background: #fafbfc;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ps-month-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(88px, 1fr));
    gap: 8px;
    width: max-content;
    min-width: 100%;
}

.ps-month-chip {
    border: 1px solid #e0e0e0;
    background: #fff;
    border-radius: 8px;
    padding: 8px 10px;
    line-height: 1.3;
    text-align: left;
    box-sizing: border-box;
}

.ps-month-chip__head {
    margin-bottom: 4px;
    font-size: 13px;
}

.ps-month-chip__row {
    font-size: 12px;
    margin-top: 2px;
}

.ps-month-chip__row--remain {
    margin-top: 4px;
}

.ps-month-chip--peak {
    border-color: #1565c0;
    background: #f3f8ff;
    box-shadow: inset 0 0 0 1px rgba(21, 101, 192, 0.08);
}

/* Lịch SX: danh sách đơn quá hạn / sắp giao */
.ps-priority-list {
    display: flex;
    flex-direction: column;
}

.ps-priority-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #eceff1;
}

.ps-priority-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.ps-priority-row:first-child {
    padding-top: 0;
}

.ps-priority-row-main {
    min-width: 0;
    flex: 1 1 auto;
}

.ps-priority-row-order {
    line-height: 1.35;
}

.ps-priority-row-customer {
    margin-top: 2px;
    line-height: 1.3;
}

.ps-priority-row-meta {
    flex: 0 0 auto;
    text-align: right;
    font-size: 14px;
    line-height: 1.35;
    white-space: nowrap;
}

.gantt-header,
.gantt-row {
    display: grid;
    /* Meta column: đủ 2 dòng, không chiếm quá nhiều trên tablet/mobile landscape */
    grid-template-columns: clamp(220px, 28vw, 320px) 1fr;
    gap: 12px;
    align-items: stretch;
}

.gantt-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--gantt-header-bg);
    padding: 2px 0;
    border-bottom: 1px solid var(--gantt-grid);
    gap: 0;
    width: max-content;
    min-width: 100%;
    box-sizing: border-box;
}

.gantt-header .gantt-col--meta {
    display: flex;
    align-items: center;
    padding-top: 2px;
    padding-bottom: 2px;
}

.gantt-header .gantt-col--timeline {
    border-left: none;
    padding: 2px 0 2px 12px;
}

.gantt-header .gantt-col {
    background: inherit;
}

.gantt-row {
    border-bottom: 1px solid var(--gantt-grid);
    width: max-content;
    min-width: 100%;
    box-sizing: border-box;
    background: #fff;
}

.gantt-body .gantt-row:nth-child(even) {
    background: var(--gantt-row-alt);
}

.gantt-col--timeline {
    position: relative;
    border-left: 1px solid var(--gantt-grid);
    padding: 8px 0 8px 12px;
    background: transparent;
}

.gantt-body {
    margin-top: 0;
}

.gantt-col {
    box-sizing: border-box;
}

.gantt-col--meta {
    padding: 8px 8px 8px 4px;
    overflow: hidden;
    min-width: 220px;
}

/* Dòng 2 cột meta: tên KH trái, Thiếu/Còn phải */
.gantt-meta-subrow {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    width: 100%;
}

.gantt-meta-subrow-name {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gantt-meta-subrow-remaining {
    flex: 0 0 auto;
    text-align: right;
    white-space: nowrap;
}

.gantt-row.bglightblue .gantt-col--meta,
.gantt-row.bgwhite .gantt-col--meta {
    background-color: inherit;
}

.gantt-timeline-inner {
    position: relative;
    background: transparent;
}

.gantt-body .gantt-col--timeline,
.gantt-body .gantt-timeline-inner {
    background: inherit;
}

.gantt-remaining-total {
    padding: 0 8px 0 4px;
    line-height: 1.15;
    min-height: 18px;
    visibility: hidden;
    display: flex;
    align-items: center;
    font-size: 12px;
}

.gantt-remaining-total.is-visible {
    visibility: visible;
}

.gantt-month-axis {
    position: relative;
    height: 20px;
    overflow: visible;
    padding: 0 12px;
}

.gantt-month-tick {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 700;
    color: #666;
    white-space: nowrap;
    line-height: 20px;
}

.gantt-month-tick--edge-left {
    transform: translateX(0);
}

.gantt-month-tick--edge-right {
    transform: translateX(-100%);
}

.gantt-month-tick--current {
    z-index: 2;
}

.gantt-month-tick-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 18px;
    padding: 0 7px;
    border-radius: 999px;
    background: #1565c0;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
    box-shadow: 0 1px 3px rgba(21, 101, 192, 0.22);
    vertical-align: middle;
}

.gantt-month-lines {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.gantt-month-line {
    position: absolute;
    top: 0;
    bottom: 0;
    border-left: 1px dashed rgba(0, 0, 0, 0.25);
}

.gantt-line-dates {
    position: relative;
    height: 14px;
    margin-bottom: 4px;
    line-height: 1.1;
    overflow: visible;
}

.gantt-date-pin {
    position: absolute;
    top: 0;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.gantt-date-pin--start {
    transform: translateX(0);
}

.gantt-date-pin--end {
    transform: translateX(-100%);
}

.gantt-lane {
    position: relative;
    height: 22px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.04);
    overflow: hidden;
    z-index: 1;
    box-sizing: border-box;
}

.gantt-bar {
    position: absolute;
    top: 2px;
    height: 18px;
    border-radius: 4px;
    background: #2a9d8f;
    box-shadow: none;
    min-width: 10px;
    transition: width 0.9s ease-out;
    z-index: 2;
}

/* Trang Lịch sản xuất: chỉ scroll trên tablet/mobile */
@media (max-width: 1199px) {
    .gantt {
        min-width: 980px;
    }

    .gantt-timeline-inner {
        min-width: 980px;
    }

    #ganttScrollWrapper.scroll-table-wrapper,
    .production-schedule-page .ps-gantt-scroll.scroll-table-wrapper {
        max-width: 100%;
        overflow-x: auto;
        overflow-y: clip;
    }
}

@media (min-width: 1200px) {

    #ganttScrollWrapper.scroll-table-wrapper,
    .production-schedule-page .ps-gantt-scroll.scroll-table-wrapper {
        overflow-x: visible;
    }
}

.gantt-bar--late {
    background: #c62828;
}

.gantt-bar--soon {
    background: #1565c0;
}

.gantt-bar--ok {
    background: #2a9d8f;
}

.gantt-bar-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    pointer-events: none;
}

/* (Gantt) Mobile: giữ hành vi scroll bình thường (không sticky cột) */


#qrImage {
    opacity: 0;
    transition: opacity 0.4s ease;
}

#qrImage.loaded {
    opacity: 1;
}

.bgblue {
    background-color: #005c99 !important;
}


.bgwhite {
    background-color: #fff !important;
}


.bgxlightblue {
    background-color: #f0f7ff !important;
}


.bglightred {
    background-color: #fbf0f0 !important;
}


.bglightgreen {
    background-color: #e0ffe0 !important;
}


.bglightgray {
    background-color: #f1efef !important;
}


/* Piecework — panel thông số chi tiết (toggle); nền: .bglightyellow hoặc class nền khác trong file này */
.piecework-detail-expand-panel {
    margin-bottom: 15px;
    padding: 12px 10px;
    border-radius: 8px;
    border: 1px solid #eaeaea;
}

/* So sánh 4 cột — scroll ngang khi hẹp */
.piecework-detail-expand-panel .piecework-compare-scroll,
.piecework-compare-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 12px;
}

/* 4 cột so sánh: mỗi cột = 1 block, nội dung xếp dọc (panel + form đơn) */
.piecework-compare-columns--stat {
    --pw-stat-c1: #d9e8f5;
    --pw-stat-c2: #f3e4e6;
    --pw-stat-c3: #d9f0e3;
    --pw-stat-c4: #ffecd4;
    --pw-stat-col-border: rgba(20, 60, 100, 0.14);
    --pw-stat-title-stripe: rgba(0, 90, 140, 0.28);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    min-width: 680px;
    box-sizing: border-box;
}

.piecework-compare-columns--stat .piecework-compare-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 10px;
    border-radius: 8px;
    border: 1px solid var(--pw-stat-col-border);
    min-width: 0;
    box-sizing: border-box;
}

.piecework-compare-columns--stat .piecework-compare-col:nth-child(1) {
    background: var(--pw-stat-c1);
}

.piecework-compare-columns--stat .piecework-compare-col:nth-child(2) {
    background: var(--pw-stat-c2);
}

.piecework-compare-columns--stat .piecework-compare-col:nth-child(3) {
    background: var(--pw-stat-c3);
}

.piecework-compare-columns--stat .piecework-compare-col:nth-child(4) {
    background: var(--pw-stat-c4);
}

.piecework-detail-expand-panel .piecework-compare-columns--stat .pwc-title,
.piecework-compare-columns--stat .pwc-title {
    font-weight: 700;
    line-height: 1.35;
    padding: 0 0 8px 0;
    margin: 0;
    border-bottom: 2px solid var(--pw-stat-title-stripe);
}

.piecework-detail-expand-panel .piecework-compare-columns--stat .pwc-value,
.piecework-compare-columns--stat .pwc-value {
    font-size: 1.15rem;
    line-height: 1.4;
    margin: 0;
    padding: 0;
}

.piecework-detail-expand-panel .piecework-compare-columns--stat .pwc-extra,
.piecework-compare-columns--stat .pwc-extra {
    font-size: 0.85rem;
    line-height: 1.35;
    color: #4a5568;
    margin: 0;
    padding: 0;
}

.piecework-detail-expand-panel .piecework-compare-columns--stat .pwc-sub,
.piecework-detail-expand-panel .piecework-compare-columns--stat .pwc-foot,
.piecework-compare-columns--stat .pwc-sub,
.piecework-compare-columns--stat .pwc-foot {
    font-size: 0.88rem;
    line-height: 1.4;
    color: #333;
    margin: 0;
    padding: 0;
}

.piecework-detail-expand-panel .piecework-compare-columns--stat .pwc-muted,
.piecework-compare-columns--stat .pwc-muted {
    color: #999;
}

/* Piecework — nổi bật ô summary; khoảng cách giữa các block */
.summary-box-wrapper.piecework-expand-stats {
    gap: 10px;
    align-items: flex-start;
}

.piecework-expand-stats .summary-box {
    --pw-stat-summary-bg: #edf3f9;
    --pw-stat-summary-border: #c5d5e6;
    background: var(--pw-stat-summary-bg) !important;
    border: 1px solid var(--pw-stat-summary-border) !important;
    border-radius: 6px;
}

/* page-shell — tab sát mép trên (gutter do .main) */
.page-shell__tabs {
    padding: 0;
}

/* kpi-strip — tab sát dải KPI phía dưới; giữ bo góc trên của .order-tabs */
.page-shell--kpi-below .order-tabs--flush-below {
    margin-bottom: 0;
}

/* Gutter ngang 10px: bù padding shell/vieworder rồi inset lại (dùng chung mọi trang) */
.page-body-flush {
    --page-gutter: 10px;
    margin-inline: calc(-1 * var(--page-gutter));
    padding-inline: var(--page-gutter);
    padding-block: 0;
}

.page-body-flush>table,
.page-body-flush #piecework-orders-table {
    margin-top: 0;
}

.kpi-strip {
    --kpi-bg: #e8eef4;
    --kpi-card-bg: #ffffff;
    --kpi-card-border: #d0dae6;
    --kpi-label: #5c6b7a;
    --kpi-value: #1a2b3c;
    --kpi-unit: #6b7c8f;
    --kpi-accent: #0077b6;
    --kpi-accent-soft: rgba(0, 119, 182, 0.12);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    padding: 0;
    background: var(--kpi-bg);
    border-radius: 0;
    border-bottom: 1px solid var(--kpi-card-border);
    box-sizing: border-box;
}

.kpi-strip--cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi-strip--cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi-strip--cols-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.kpi-strip--cols-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.kpi-strip--cols-7 {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.kpi-strip--cols-8 {
    grid-template-columns: repeat(8, minmax(0, 1fr));
}

.packinglist-kpi-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    background: var(--kpi-bg, #e8eef4);
    border-bottom: 1px solid var(--kpi-card-border, #d0dae6);
    box-sizing: border-box;
}

.page-body-flush .scroll-table-hscroll-shell,
.page-body-flush+.scroll-table-hscroll-shell {
    margin-top: 0;
}

.kpi-strip__card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
    padding: 12px 14px;
    background: var(--kpi-card-bg);
    border: none;
    border-radius: 0;
    border-right: 1px solid var(--kpi-card-border);
    border-top: 3px solid var(--kpi-accent);
    box-shadow: none;
    box-sizing: border-box;
}

.kpi-strip__card:last-child {
    border-right: none;
}

.kpi-strip__card--primary {
    --kpi-accent: #1565c0;
    --kpi-accent-soft: rgba(21, 101, 192, 0.12);
}

.kpi-strip__card--danger {
    --kpi-accent: #c62828;
    --kpi-accent-soft: rgba(198, 40, 40, 0.12);
}

.kpi-strip__card--warning {
    --kpi-accent: #f9a825;
    --kpi-accent-soft: rgba(249, 168, 37, 0.14);
}

.kpi-strip__card--success {
    --kpi-accent: #2e7d32;
    --kpi-accent-soft: rgba(46, 125, 50, 0.12);
}

.kpi-strip__card--money {
    --kpi-accent: #00897b;
    --kpi-accent-soft: rgba(0, 137, 123, 0.12);
}

.kpi-strip__card--info {
    --kpi-accent: #0288d1;
    --kpi-accent-soft: rgba(2, 136, 209, 0.12);
}

.kpi-strip__icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 0;
    background: var(--kpi-accent-soft);
    color: var(--kpi-accent);
    font-size: 16px;
    line-height: 1;
}

.kpi-strip__body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-strip__label {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--kpi-label);
    letter-spacing: 0.01em;
}

.kpi-strip__value {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--kpi-value);
    font-variant-numeric: tabular-nums;
}

.kpi-strip__value--money {
    color: var(--kpi-accent);
}

.kpi-strip__unit {
    font-size: 13px;
    font-weight: 600;
    color: var(--kpi-unit);
}

/* KPI nhỏ gọn — trang có nhiều ô thống kê (vd. nhập kho: Ra lò + Đạt + nhiều loại lỗi)
 * Desktop: kpi-strip--cols-3 … --cols-8 (compact tối đa 8 ô / hàng) */
.kpi-strip--compact .kpi-strip__card {
    gap: 10px;
    padding: 10px 12px;
    border-top-width: 2px;
}

.kpi-strip--compact .kpi-strip__icon {
    width: 28px;
    height: 28px;
    font-size: 14px;
}

.kpi-strip--compact .kpi-strip__body {
    gap: 3px;
}

.kpi-strip--compact .kpi-strip__label {
    font-size: 12px;
    line-height: 1.35;
}

.kpi-strip--compact .kpi-strip__value {
    font-size: 15px;
    line-height: 1.25;
}

.kpi-strip--compact .kpi-strip__value--money {
    color: var(--kpi-accent);
}

.kpi-strip--compact .kpi-strip__unit {
    font-size: 11px;
}

.kpi-strip__label--with-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.kpi-strip__label--with-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.kpi-strip__label-text {
    min-width: 0;
    flex: 1 1 auto;
}

.kpi-strip__pct-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    margin-left: auto;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0.02em;
    color: #fff;
    white-space: nowrap;
}

.kpi-strip__pct-badge--ok {
    background: #2e7d32;
}

.kpi-strip__pct-badge--warn {
    background: #d90429;
}

.kpi-strip--compact .kpi-strip__pct-badge {
    font-size: 11px;
    padding: 3px 9px;
}

.kpi-strip__label-action {
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    line-height: 1;
    opacity: 0.85;
    text-decoration: none;
}

.kpi-strip__label-action:hover {
    opacity: 1;
}

/* KPI compact: value dạng chữ (trạng thái, link chuyến) */
.kpi-strip__value--text {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.kpi-strip--compact .kpi-strip__value--text {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.kpi-strip--compact .kpi-strip__value--text.kpi-strip__value--stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.kpi-strip--compact .kpi-strip__value--text .kpi-strip__value-link {
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
}

.kpi-strip--compact .kpi-strip__value--text .kpi-strip__value-link:hover {
    text-decoration: underline;
}

/* Tablet / màn hẹp: KPI 3 cột — đồng bộ breakpoint order-tabs (≤1199px) */
@media (max-width: 1199px) {

    .kpi-strip,
    .kpi-strip--cols-3,
    .kpi-strip--cols-4,
    .kpi-strip--cols-5,
    .kpi-strip--cols-6,
    .kpi-strip--cols-7,
    .kpi-strip--cols-8,
    .kpi-strip--compact.kpi-strip--cols-3,
    .kpi-strip--compact.kpi-strip--cols-4,
    .kpi-strip--compact.kpi-strip--cols-5,
    .kpi-strip--compact.kpi-strip--cols-6,
    .kpi-strip--compact.kpi-strip--cols-7,
    .kpi-strip--compact.kpi-strip--cols-8 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .kpi-strip__card {
        grid-column: span 1;
        border-bottom: 1px solid var(--kpi-card-border);
    }

    .kpi-strip__card:nth-child(3n) {
        border-right: none;
    }

    .kpi-strip--cols-5 .kpi-strip__card--money,
    .kpi-strip--cols-3.kpi-strip--mobile-last-full .kpi-strip__card:last-child,
    .kpi-strip--mobile-last-full .kpi-strip__card:last-child,
    .kpi-strip--cols-6.kpi-strip--mobile-last-full .kpi-strip__card:nth-child(5),
    .kpi-strip--cols-6.kpi-strip--mobile-last-full .kpi-strip__card:nth-child(6) {
        grid-column: span 1;
        border-right: none;
    }

    .kpi-strip--compact .kpi-strip__card:nth-child(2n),
    .kpi-strip--compact .kpi-strip__card:nth-child(4n) {
        border-right: 1px solid var(--kpi-card-border);
    }

    .kpi-strip--compact .kpi-strip__card:nth-child(3n) {
        border-right: none;
    }
}

/* Mobile KPI layout (mặc định ≤767px: 2 cột đều nhau)
 * — kpi-strip--mobile-1  → 1 card / dòng
 * — kpi-strip--mobile-2  → 2 card / dòng (ghi đè mặc định nếu cần rõ ràng)
 * — kpi-strip--mobile-last-full → card cuối full width (vd. Tổng giá trị 5 cột)
 * Desktop số cột: kpi-strip--cols-3 … --cols-8 (compact tối đa 8)
 */
@media (max-width: 767px) {

    .kpi-strip,
    .kpi-strip--cols-3,
    .kpi-strip--cols-5,
    .kpi-strip--cols-4,
    .kpi-strip--cols-6,
    .kpi-strip--cols-7,
    .kpi-strip--cols-8,
    .kpi-strip--mobile-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0;
        padding: 0;
    }

    .kpi-strip--mobile-1 {
        grid-template-columns: 1fr;
    }

    .kpi-strip__card {
        border-bottom: 1px solid var(--kpi-card-border);
    }

    .kpi-strip__card:nth-child(3n) {
        border-right: 1px solid var(--kpi-card-border);
    }

    .kpi-strip__card:nth-child(2n) {
        border-right: none;
    }

    .kpi-strip--mobile-1 .kpi-strip__card {
        border-right: none;
        grid-column: span 1;
    }

    .kpi-strip--mobile-1 .kpi-strip__card:nth-child(2n) {
        border-right: none;
    }

    /* cols-3/4/6/7/8 mặc định: 2 cột đều (không full-width ô money/cuối) */
    .kpi-strip--cols-3 .kpi-strip__card,
    .kpi-strip--cols-4 .kpi-strip__card,
    .kpi-strip--cols-6 .kpi-strip__card,
    .kpi-strip--cols-7 .kpi-strip__card,
    .kpi-strip--cols-8 .kpi-strip__card {
        grid-column: span 1;
    }

    /* cols-5: ô Tổng giá trị full 1 dòng (chỉ piecework 5 cột) */
    .kpi-strip--cols-5 .kpi-strip__card--money,
    .kpi-strip--cols-3.kpi-strip--mobile-last-full .kpi-strip__card:last-child,
    .kpi-strip--mobile-last-full .kpi-strip__card:last-child {
        grid-column: span 2;
        border-right: none;
    }

    /* cols-6: chỉ full-width khi bật --mobile-last-full */
    .kpi-strip--cols-6.kpi-strip--mobile-last-full .kpi-strip__card:nth-child(5),
    .kpi-strip--cols-6.kpi-strip--mobile-last-full .kpi-strip__card:nth-child(6) {
        grid-column: span 2;
        border-right: none;
    }

    .kpi-strip__value {
        font-size: 17px;
    }

    .kpi-strip--compact .kpi-strip__value {
        font-size: 14px;
    }

    /* Compact: mobile luôn 2 cột (kể cả cols-5…8 desktop) */
    .kpi-strip--compact.kpi-strip--cols-3,
    .kpi-strip--compact.kpi-strip--cols-4,
    .kpi-strip--compact.kpi-strip--cols-5,
    .kpi-strip--compact.kpi-strip--cols-6,
    .kpi-strip--compact.kpi-strip--cols-7,
    .kpi-strip--compact.kpi-strip--cols-8 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kpi-strip--compact .kpi-strip__card {
        grid-column: span 1;
    }

    .kpi-strip--compact.kpi-strip--cols-5 .kpi-strip__card--money {
        grid-column: span 1;
    }

    /* Ghi đè cols-5 money / mobile-last-full full-width — compact giữ 2 cột đều */
    .kpi-strip--compact.kpi-strip--cols-3.kpi-strip--mobile-last-full .kpi-strip__card:last-child,
    .kpi-strip--compact.kpi-strip--mobile-last-full .kpi-strip__card:last-child {
        grid-column: span 1;
        border-right: none;
    }

    .kpi-strip--compact .kpi-strip__card:nth-child(3n),
    .kpi-strip--compact .kpi-strip__card:nth-child(4n) {
        border-right: 1px solid var(--kpi-card-border);
    }

    .kpi-strip--compact .kpi-strip__card:nth-child(2n) {
        border-right: none;
    }
}

/* Tab đơn hàng (manage, shipping, viewshipment, greenware, production, warehouse, invoice, carton) */
.scroll-table.order-packing-manage-table,
.scroll-table.order-shipping-table,
.scroll-table.order-viewshipment-table,
.scroll-table.order-piecework-calc-table,
.scroll-table.order-kilnbatch-table,
.scroll-table.viewkilnslip-products-table,
.scroll-table.order-packinglist-table,
.scroll-table.order-vieworder-tab-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    table-layout: auto;
}

/* Tab đơn hàng: thead dính khi cuộn (cùng pattern thead th global) */
.scroll-table.order-vieworder-tab-table thead th {
    position: sticky;
    top: 0;
    z-index: 11;
    background-color: #f0f4f7 !important;
    color: #607d8b;
    border-top: none !important;
    box-shadow: none;
}

.scroll-table.order-vieworder-tab-table thead th.sticky-photo {
    top: 0;
    z-index: 16;
}

.scroll-table.order-vieworder-tab-table tbody td.sticky-photo {
    top: auto;
}

.scroll-table.order-packing-manage-table th.sticky-photo,
.scroll-table.order-packing-manage-table td.sticky-photo,
.scroll-table.order-shipping-table th.sticky-photo,
.scroll-table.order-shipping-table td.sticky-photo,
.scroll-table.order-viewshipment-table th.sticky-photo,
.scroll-table.order-viewshipment-table td.sticky-photo,
.scroll-table.order-piecework-calc-table th.sticky-photo,
.scroll-table.order-piecework-calc-table td.sticky-photo,
.scroll-table.order-kilnbatch-table th.sticky-photo,
.scroll-table.order-kilnbatch-table td.sticky-photo,
.scroll-table.viewkilnslip-products-table th.sticky-photo,
.scroll-table.viewkilnslip-products-table td.sticky-photo,
.scroll-table.order-packinglist-table th.sticky-photo,
.scroll-table.order-packinglist-table td.sticky-photo,
.scroll-table.order-vieworder-tab-table th.sticky-photo,
.scroll-table.order-vieworder-tab-table td.sticky-photo,
.scroll-table.kl-plan-products-table th.sticky-photo,
.scroll-table.kl-plan-products-table td.sticky-photo {
    width: 92px;
    min-width: 92px;
    max-width: 92px;
}

@media (min-width: 1200px) {

    /*
     * Desktop: KHÔNG cuộn trong wrapper → thead sticky theo cuộn trang.
     * (overflow-x:auto trên wrapper = scrollport → sticky hỏng; shipment dùng overflow:visible nên OK)
     */
    .scroll-table-wrapper:has(.order-vieworder-tab-table),
    .scroll-table-wrapper:has(.kl-plan-products-table) {
        overflow: visible;
    }

    /* Tab vieworder có shell cuộn ngang: wrapper visible, shell cuộn ngang */
    .scroll-table-hscroll-shell:not(.order-tab-hscroll-shell) .scroll-table-wrapper {
        overflow: visible !important;
    }
}

@media (max-width: 1199px) {
    .scroll-table.order-packing-manage-table {
        width: auto;
        min-width: 960px;
    }

    .scroll-table.order-shipping-table {
        width: auto;
        min-width: 880px;
    }

    .scroll-table.order-viewshipment-table {
        width: auto;
        min-width: 720px;
    }

    .scroll-table.order-vieworder-tab-table {
        width: auto;
        min-width: 960px;
    }

    .scroll-table.kl-plan-products-table.order-vieworder-tab-table {
        width: auto;
        min-width: 860px;
    }

    .scroll-table.order-piecework-calc-table.order-vieworder-tab-table {
        width: auto;
        min-width: 1200px;
    }

    .scroll-table.order-carton-table.order-vieworder-tab-table {
        min-width: 1100px;
    }

    .scroll-table.order-kilnbatch-table.order-vieworder-tab-table {
        width: auto;
        min-width: 1050px;
    }

    .scroll-table.viewkilnslip-products-table.order-vieworder-tab-table {
        width: auto;
        min-width: 960px;
    }

    .scroll-table.fs-surplus-count-table.order-vieworder-tab-table {
        width: auto;
        min-width: 1080px;
    }
}


.bglightyellow {
    background-color: #fffceb !important;
}


.bglightblue {
    background-color: #ddefff !important;
}


.bggradientblue {
    background: linear-gradient(to bottom, #c5e1ff, #f5faff);
}


.bggradientorange {
    background: linear-gradient(to bottom, #ffe4c0, #fff3e5);
}

/* ===================================
   KILN SLIP VIEW TABLE (LIGHT)
   =================================== */
/* (viewkilnslip uses inline layout like order_kilnslip) */
/* ✅ ViewKilnSlip Table Sticky Columns */
.viewkilnslip-table-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
}

/* ✅ Viewkilnslip table wrapper */
.viewkilnslip-table-wrapper {
    overflow-x: auto;
    border: none;
    /* Đảm bảo wrapper luôn có thể scroll khi cần */
}

/* ✅ Viewkilnslip table base styles */
.viewkilnslip-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 10pt;
    table-layout: fixed;
    /* Để set width cố định cho các cột */
    /* Tính min-width: STT(60) + Ảnh(100) + Thông tin SP(230) + VÀO LÒ(80) + RA LÒ(80) + ĐẠT(80) + các lỗi(80 mỗi cột) */
    /* Ước tính tối thiểu: 630px + (số lỗi * 80px) */
    /* Set min-width để table không bị co quá, tự động scroll khi viewport nhỏ hơn */
    min-width: 790px;
    /* Base width cho ít nhất 2 cột lỗi */
}

/* ✅ Set width cho các cột */
/* Cột 1: STT - nhỏ nhất */
.viewkilnslip-table th:nth-child(1),
.viewkilnslip-table td:nth-child(1) {
    width: 60px;
    min-width: 60px;
}

/* Cột 2: Ảnh - width bằng RA LÒ và các cột lỗi */
.viewkilnslip-table th:nth-child(2),
.viewkilnslip-table td:nth-child(2) {
    width: 100px;
    min-width: 100px;
}

/* Cột 3: Thông tin SP - width lớn hơn */
.viewkilnslip-table th:nth-child(3),
.viewkilnslip-table td:nth-child(3) {
    width: 230px;
    /* Set width cố định để không bị co quá */
    min-width: 230px;
}

/* Cột 4: VÀO LÒ - width nhỏ hơn */
.viewkilnslip-table th:nth-child(4),
.viewkilnslip-table td:nth-child(4) {
    width: 80px;
    min-width: 80px;
}

/* Cột 5: RA LÒ - width nhỏ hơn */
.viewkilnslip-table th:nth-child(5),
.viewkilnslip-table td:nth-child(5) {
    width: 80px;
    min-width: 80px;
}

/* Các cột lỗi (từ cột 6 đến cột cuối trừ 1) - width nhỏ hơn */
.viewkilnslip-table th:nth-child(n+6):not(:last-child),
.viewkilnslip-table td:nth-child(n+6):not(:last-child) {
    width: 80px;
    min-width: 80px;
}

/* Cột cuối: ĐẠT - width nhỏ hơn */
.viewkilnslip-table th:last-child,
.viewkilnslip-table td:last-child {
    width: 80px;
    min-width: 80px;
}

/* ✅ Responsive: Table tự động scroll khi viewport nhỏ hơn min-width */
/* Không phụ thuộc vào breakpoint cố định, table sẽ tự scroll khi cần */
/* Đảm bảo wrapper luôn có thể scroll và table không bị co quá */
.viewkilnslip-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll trên mobile */
}

/* Đảm bảo table không bị shrink khi viewport nhỏ */
.viewkilnslip-table {
    width: max-content;
    /* Table sẽ có width tối thiểu bằng min-width */
    min-width: 960px;
}

/* ✅ Viewkilnslip scroll hint */
.viewkilnslip-scroll-hint {
    text-align: center;
    padding: 5px;
    font-size: 9pt;
    color: #666;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-bottom: none;
    display: none;
    /* Mặc định ẩn, sẽ hiển thị bằng JavaScript khi table có scroll */
}

/* ✅ Viewkilnslip table cells - padding và border */
.viewkilnslip-table td,
.viewkilnslip-table th {
    padding: 8px;
    border: 1px solid #ddd;
}

/* ✅ Viewkilnslip table cells - white-space */
.viewkilnslip-table th {
    white-space: nowrap;
    word-wrap: normal;
}

/* ✅ Viewkilnslip table description cell */
.viewkilnslip-table td.description {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ✅ Viewkilnslip table image */
.viewkilnslip-table td.sticky-photo img {
    max-width: 70px;
    max-height: 70px;
    object-fit: contain;
}

/* ✅ Viewkilnslip table batch note */
.viewkilnslip-table .bglightred {
    padding: 10px;
}

/* ✅ Xử lý border cho border-collapse: separate - giống packinglist */

/* ✅ Override border-right cho cells không phải cuối cùng */
.viewkilnslip-table th:not(:last-child),
.viewkilnslip-table td:not(:last-child) {
    border-right: 1px solid #ddd;
}

/* ✅ Override border-left cho cells không phải đầu tiên */
.viewkilnslip-table th:not(:first-child),
.viewkilnslip-table td:not(:first-child) {
    border-left: none;
}

/* ✅ Đảm bảo không có khoảng trống giữa các sticky columns */
.viewkilnslip-table th.sticky-photo,
.viewkilnslip-table td.sticky-photo {
    border-left: none;
}

/* ✅ Override border-bottom cho header */
.viewkilnslip-table th {
    border-bottom: 1px solid #ddd;
}

/* ✅ Override border-bottom cho rows không phải cuối cùng */
.viewkilnslip-table tbody tr:not(:last-child) td {
    border-bottom: 1px solid #ddd;
}

/* ✅ Set width cố định cho 2 cột sticky đầu tiên - giống packinglist */
.viewkilnslip-table th.sticky-stt,
.viewkilnslip-table td.sticky-stt {
    width: 60px;
    min-width: 60px;
    position: relative;
}

.viewkilnslip-table th.sticky-photo,
.viewkilnslip-table td.sticky-photo {
    width: 100px;
    min-width: 100px;
    position: relative;
}

/* ✅ Sticky columns cho 2 cột đầu: STT, Ảnh - giống packinglist */
/* Background bắt buộc để che content phía sau khi scroll */
.viewkilnslip-table th.sticky-stt,
.viewkilnslip-table td.sticky-stt {
    position: sticky;
    left: 0;
    z-index: 1;
}

/* Bảng sản phẩm viewkilnslip: chỉ cột Ảnh sticky trái (dùng scroll-table) */
.scroll-table.viewkilnslip-products-table {
    table-layout: auto !important;
    width: 100% !important;
    max-width: 100%;
}

.scroll-table.viewkilnslip-products-table th.sticky-photo,
.scroll-table.viewkilnslip-products-table td.sticky-photo {
    position: sticky;
    left: 0 !important;
    z-index: 1;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.scroll-table-wrapper.is-sticky-photo-flush .scroll-table.viewkilnslip-products-table th.sticky-photo,
.scroll-table-wrapper.is-sticky-photo-flush .scroll-table.viewkilnslip-products-table td.sticky-photo {
    border-left: none !important;
    box-shadow: inset 1px 0 0 #ddd, 2px 0 5px rgba(0, 0, 0, 0.1);
}

.scroll-table.viewkilnslip-products-table thead th.sticky-photo {
    top: 0;
    z-index: 15;
}

.scroll-table.viewkilnslip-products-table tbody td.sticky-photo {
    top: auto;
}

.scroll-table.viewkilnslip-products-table td.sticky-photo img {
    display: block;
    width: 80px;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
}

.viewkilnslip-table th.sticky-photo,
.viewkilnslip-table td.sticky-photo {
    position: sticky;
    left: 60px;
    z-index: 1;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

/* ✅ Background mặc định cho header sticky columns */
/* Sticky header có z-index cao hơn để luôn ở trên các header scrollable */
.viewkilnslip-table thead th.sticky-stt,
.viewkilnslip-table thead th.sticky-photo {
    z-index: 10;
}

/* ✅ Đảm bảo background sticky columns đồng bộ với row background */
/* Normal mode: bgxlightblue = #f0f7ff */
.viewkilnslip-table tr.bgxlightblue td.sticky-stt,
.viewkilnslip-table tr.bgxlightblue td.sticky-photo,
.scroll-table.viewkilnslip-products-table tr.bgxlightblue td.sticky-photo {
    background-color: #f0f7ff !important;
}

/* Normal mode: bglightblue = #ddefff */
.viewkilnslip-table tr.bglightblue td.sticky-stt,
.viewkilnslip-table tr.bglightblue td.sticky-photo,
.scroll-table.viewkilnslip-products-table tr.bglightblue td.sticky-photo {
    background-color: #ddefff !important;
}

/* ✅ Hover effect - đồng bộ màu cho cả sticky và non-sticky cells */
.viewkilnslip-table tbody tr:hover td {
    background: #f6fcff !important;
}

.viewkilnslip-table tbody tr:hover td.sticky-stt,
.viewkilnslip-table tbody tr:hover td.sticky-photo,
.scroll-table.viewkilnslip-products-table tbody tr:hover td.sticky-photo {
    background: #f6fcff !important;
}

/* ===================================
   ORDER KILN SLIP - RESPONSIVE TABLE
   Moved from modules/order_kilnslip.php
   =================================== */
/* ===================================
   TABLE SCROLL - Apply cho màn hình nhỏ (< 1200px)
   Bao gồm: Mobile portrait, Mobile landscape, Tablet
   Breakpoint 1200px đồng bộ order-form, order-tabs scroll và bottom-bar
   =================================== */
@media (max-width: 1199px) {

    .main,
    .main-content-card {
        overflow-x: clip;
    }

    .settings-table-wrapper,
    .gw-producer-stats-table-wrap,
    .piecework-detail-products-table-wrap {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ===================================
   TABLE COLUMN ALIGNMENT - Đồng bộ width cột giữa các table
   =================================== */
/* Desktop: Dùng table-layout: fixed để đảm bảo các table có cùng column widths */
@media (min-width: 1200px) {
    .order-form table {
        table-layout: fixed !important;
        width: 100% !important;
    }

    /* Input fill để cột số đồng đều theo colgroup */
    .order-form .ralo-input,
    .order-form .defect-input {
        width: 100% !important;
        box-sizing: border-box;
    }
}

/* Tablet/Mobile: Giữ table-layout: auto để responsive */
@media (max-width: 1199px) {
    .order-form table {
        table-layout: auto !important;
    }
}

/* Override style.css global: th, td { overflow: hidden; text-overflow: ellipsis; } */
.order-form table thead td,
.order-form table thead th,
.order-form table th {
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
    word-wrap: normal !important;
}

/* Desktop: Đảm bảo các cột header không bị cắt */
@media (min-width: 1200px) {

    .order-form table thead td[width],
    .order-form table thead th[width] {
        min-width: auto !important;
        width: auto !important;
    }
}

@media (max-width: 1199px) {

    /* Force table to be wider than viewport để trigger horizontal scroll */
    .order-form table {
        width: auto !important;
        min-width: 1000px !important;
        font-size: 9pt;
        /* Border-left được xử lý bởi sticky column - PRIORITY 2 */
    }

    /* Wrapper phải có overflow-x */
    .order-form>div[style*="overflow-x"] {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        /* Smooth scroll iOS */
        background: #fff;
        /* Background để che content scroll bên dưới - PRIORITY 1 */
    }

    /* Dark mode cho wrapper */
    body.dark .order-form>div[style*="overflow-x"] {
        background: #2d2d2d;
    }

    /* Sticky column: Cột ẢNH (cột thứ 2 sau STT) */
    /* PRIORITY 1: Che content scroll - left: -1px để che border và content */
    /* Loại trừ viewkilnslip-table khỏi CSS sticky chung của order-form */
    .order-form table:not(.viewkilnslip-table) td:nth-child(2),
    .order-form table:not(.viewkilnslip-table) th:nth-child(2) {
        position: sticky;
        left: -1px;
        /* Bù lại để che border và content scroll - PRIORITY 1 */
        z-index: 15;
        /* Cao hơn để che content scroll */
        background: #fff !important;
        /* Đảm bảo background đủ mạnh để che content - PRIORITY 1 */
        border-left: 1px solid #ddd;
        /* Border trái */
        box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
    }

    /* Header sticky: Giữ màu nền lightblue chính xác */
    .order-form table:not(.viewkilnslip-table) thead tr.bglightblue th:nth-child(2),
    .order-form table:not(.viewkilnslip-table) thead tr.bglightblue td:nth-child(2) {
        background-color: #ddefff !important;
        /* Màu bglightblue chính xác */
    }

    /* Dark mode support */
    body.dark .order-form table:not(.viewkilnslip-table) td:nth-child(2),
    body.dark .order-form table:not(.viewkilnslip-table) th:nth-child(2) {
        background: #2d2d2d !important;
        /* Đảm bảo background đủ mạnh để che content */
        border-left: 1px solid #555 !important;
        /* Dark mode border */
    }

    body.dark .order-form table:not(.viewkilnslip-table) thead tr.bglightblue th:nth-child(2),
    body.dark .order-form table:not(.viewkilnslip-table) thead tr.bglightblue td:nth-child(2) {
        background-color: #ddefff !important;
        /* Giữ màu lightblue ngay cả dark mode */
        border-left: 1px solid #555 !important;
        /* Dark mode border */
    }

    /* Submitted rows - sticky background */
    .order-form table:not(.viewkilnslip-table) tr[style*="background:#f0f8ff"] td:nth-child(2),
    .order-form table:not(.viewkilnslip-table) tr.bgxlightblue td:nth-child(2) {
        background: #f0f8ff !important;
    }

    /* Supplement rows - sticky background */
    .order-form table:not(.viewkilnslip-table) tr.bglightyellow td:nth-child(2) {
        background: #fffacd !important;
    }

    /* Scroll indicator hint - Ẩn pseudo-element cũ */
    .order-form>div[style*="overflow-x"]::after {
        display: none;
    }

    body.dark .viewkilnslip-scroll-hint {
        background: #333 !important;
        color: #aaa !important;
        border-color: #555 !important;
    }
}

/* Giảm padding cells cho compact view */
.order-form table td,
.order-form table th {
    padding: 6px 4px !important;
}

/* Input width optimization */
.order-form .ralo-input,
.order-form .defect-input {
    width: 50px !important;
}

/* Phiếu ra lò — header từng đơn (Nhập liệu / Xóa sản phẩm / Xóa đơn) */
.order-form .kiln-slip-order-heading {
    flex-wrap: wrap;
    gap: 10px;
}

.order-form .kiln-slip-order-actions-col {
    text-align: right;
    min-width: 0;
}

.order-form .kiln-slip-order-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 100%;
    box-sizing: border-box;
}

.order-form .kiln-slip-order-actions .button,
.order-form .kiln-slip-order-actions button.submit-order-btn {
    box-sizing: border-box;
}

/* ===================================
   MOBILE PORTRAIT - Ultra compact (< 768px)
   =================================== */
@media (max-width: 768px) {

    /* ===== KILN SLIP HEADER ===== */
    /* Header: Stack vertically */
    .kiln-slip-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    /* Actions: Full width buttons */
    .kiln-slip-actions {
        flex-direction: column !important;
        width: 100% !important;
    }

    .kiln-slip-actions .button {
        width: 100% !important;
        text-align: center !important;
    }

    /* Header từng đơn hàng trong phiếu: xếp chồng nút full width */
    .order-form .kiln-slip-order-heading {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .order-form .kiln-slip-order-actions-col {
        width: 100% !important;
        max-width: 100% !important;
        text-align: left !important;
    }

    .order-form .kiln-slip-order-actions {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        justify-content: flex-start !important;
    }

    .order-form .kiln-slip-order-actions>.button,
    .order-form .kiln-slip-order-actions>button.submit-order-btn {
        width: 100% !important;
        max-width: 100% !important;
        text-align: center !important;
        justify-content: center;
    }

    /* Font size nhỏ hơn */
    .order-form table {
        font-size: 8pt !important;
    }

    /* Padding cells siêu compact */
    .order-form table td,
    .order-form table th {
        padding: 4px 2px !important;
    }

    /* Input siêu nhỏ */
    .order-form .ralo-input,
    .order-form .defect-input {
        width: 45px !important;
        padding: 2px !important;
        font-size: 8pt !important;
    }

    /* Ảnh nhỏ hơn */
    .order-form table td img {
        max-width: 50px !important;
        max-height: 50px !important;
    }

    /* Button nhỏ */
    .order-form .button.small {
        padding: 2px 4px !important;
        font-size: 8pt !important;
    }

    /* ===== ORDER HEADER & BUTTONS RESPONSIVE ===== */
    /* Order header: Stack vertically */
    .order-form .bglightgray>div[style*="display:flex"]:first-child {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    /* Order title */
    .order-form h3 {
        font-size: 13pt !important;
        margin-bottom: 8px !important;
    }

    /* Buttons container */
    .order-form .bglightgray>div[style*="display:flex"]:first-child>div[style*="text-align:right"] {
        text-align: left !important;
    }

    .order-form .bglightgray>div[style*="display:flex"]:first-child>div[style*="display:flex"] {
        flex-direction: column !important;
        width: 100% !important;
    }

    /* Submit/Delete buttons: Full width */
    .order-form .submit-order-btn,
    .order-form .button.medium {
        width: 100% !important;
        font-size: 11pt !important;
        padding: 10px !important;
        text-align: center !important;
        display: block !important;
    }

    /* Toggle buttons */
    .toggle-finish-btn,
    .toggle-notes-btn {
        font-size: 10pt !important;
        padding: 6px 12px !important;
    }

    /* Chi tiết đơn hàng (submitted): Stack vertically */
    .order-form .bglightgray>div[style*="justify-content:space-between"] {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .order-form .bglightgray>div[style*="justify-content:space-between"]>div[style*="text-align:right"] {
        text-align: left !important;
    }

    /* Giảm width các cột số */
    .order-form table td:nth-child(n+5):nth-child(-n+20) {
        min-width: 50px;
    }

    /* Note input */
    .batch-note-input {
        font-size: 9pt !important;
    }
}

/* ===================================
   TABLET LANDSCAPE (769-889px)
   Giữ layout desktop cho header, chỉ optimize table
   =================================== */
@media (min-width: 769px) and (max-width: 889px) {

    /* Table scroll đã được apply ở media query max-width:889px */
    /* Chỉ cần fine-tune font size */
    .order-form table {
        font-size: 9pt !important;
    }

    .order-form .ralo-input,
    .order-form .defect-input {
        width: 55px !important;
    }
}



.bggradientpurple {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}


.bgorange {
    background-color: #ff8533;
}

.bggreen {
    background-color: #2a9d3b;
    color: #fff;
}


input::placeholder,
textarea::placeholder {
    color: #333;
    /* hoặc bất kỳ màu nào mày thích */
    opacity: 1;
    /* tránh bị mờ quá */
}


/* Style cho radio buttons */
.invoice-card input[type="radio"] {
    display: none;
}

.invoice-card label[for] {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: #f0f7ff;
    border: 1px solid #cce5ff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: #555;
    position: relative;
    padding-left: 24px;
}

.invoice-card label[for]:before {
    content: '';
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 9px;
    height: 9px;
    border: 1.5px solid #0077b6;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.invoice-card label[for]:hover {
    background: #e6f3ff;
    border-color: #0077b6;
}

.invoice-card input[type="radio"]:checked+label {
    background: #0077b6;
    border-color: #0077b6;
    color: white;
}

.invoice-card input[type="radio"]:checked+label:before {
    background: white;
    box-shadow: inset 0 0 0 2px #0077b6;
}

.editQty {
    cursor: pointer;
}

.editQty:hover,
.editQty:focus,
.editQty:active {
    background-color: #fbe1c2;
}

.qty-cell {
    position: relative;
    overflow: visible;
}

.edit-icon {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 6px 8px;
    border: none;
    cursor: pointer;
    display: none;
}

.qty-cell:hover .edit-icon {
    display: block;
}

.product-code-cell {
    position: relative;
}

.product-code-cell:hover {
    background-color: #fbe1c2;
}

.delete-icon {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: none;
}

.product-code-cell:hover .delete-icon {
    display: block;
}

/* Dark mode */





/* Custom Radio Button Style */
.custom-radio input[type="radio"] {
    display: none;
}

.custom-radio label {
    display: inline-flex;
    align-items: center;
    padding: 3px 6px;
    background: #f0f7ff;
    border: 1px solid #cce5ff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: #555;
    position: relative;
    padding-left: 24px;
}

.custom-radio label:before {
    content: '';
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 9px;
    height: 9px;
    border: 1.5px solid #0077b6;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.custom-radio label:hover {
    background: #e6f3ff;
    border-color: #0077b6;
}

.custom-radio input[type="radio"]:checked+label {
    background: #0077b6;
    border-color: #0077b6;
    color: white;
}

.custom-radio input[type="radio"]:checked+label:before {
    background: white;
    box-shadow: inset 0 0 0 2px #0077b6;
}

/* Custom checkbox — cùng tông màu / hành vi với .custom-radio */
.custom-checkbox input[type="checkbox"] {
    display: none;
}

.custom-checkbox label {
    display: inline-flex;
    align-items: center;
    padding: 3px 6px;
    background: #f0f7ff;
    border: 1px solid #cce5ff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: #555;
    position: relative;
    padding-left: 24px;
}

.custom-checkbox label:before {
    content: "";
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 11px;
    height: 11px;
    border: 1.5px solid #0077b6;
    border-radius: 3px;
    transition: all 0.2s ease;
    background: #fff;
    box-sizing: border-box;
}

.custom-checkbox label:hover {
    background: #e6f3ff;
    border-color: #0077b6;
}

.custom-checkbox input[type="checkbox"]:checked+label {
    background: #0077b6;
    border-color: #0077b6;
    color: #fff;
}

.custom-checkbox input[type="checkbox"]:checked+label:before {
    content: "✓";
    font-size: 9px;
    font-weight: 700;
    line-height: 10px;
    text-align: center;
    color: #0077b6;
    background: #fff;
    border-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tương đương .button.medium (14px, padding 6px 14px) — công đoạn mộc, phân công nhập liệu */
.custom-checkbox.custom-checkbox--medium label {
    padding: 6px 14px 6px 32px;
    font-size: 14px;
    line-height: 1.4;
    box-sizing: border-box;
    align-items: center;
}

.custom-checkbox.custom-checkbox--medium label:before {
    left: 7px;
    width: 14px;
    height: 14px;
    border-width: 1.5px;
    border-radius: 3px;
}

.custom-checkbox.custom-checkbox--medium input[type="checkbox"]:checked+label:before {
    font-size: 9px;
    line-height: 1;
    font-weight: 700;
}

/* Phân công nhập liệu: tên công đoạn in hoa */
.gw-assign-stages-checkboxes .custom-checkbox label {
    text-transform: uppercase;
}

/* Dạng sản xuất: cột 1 cột, full width khi màn hẹp */
@media (max-width: 600px) {
    .gw-stage-prod-filters--custom {
        flex-direction: column;
        align-items: stretch;
    }

    .settings-table .gw-stage-prod-filters--custom .custom-checkbox.custom-checkbox--medium,
    .gw-stage-prod-filters--custom .custom-checkbox--medium {
        width: 100%;
        max-width: none;
    }

    .settings-table .gw-stage-prod-filters--custom .custom-checkbox--medium label {
        width: 100%;
        max-width: none;
    }
}

/* Chi tiết sản phẩm — form sửa: công đoạn hàng mộc (tránh ô td overflow:hidden của bảng cắt mất phần dưới / không cuộn trên mobile) */
.settings-table td.gw-product-greenware-stages-td {
    overflow: visible !important;
}

@media (max-width: 768px) {

    /* Một dòng một checkbox; đủ cao không cần khung cuộn */
    .settings-table .gw-stage-prod-filters--product-form.gw-stage-prod-filters--scroll {
        max-height: none !important;
        overflow-x: visible !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: auto;
    }

    .settings-table .gw-stage-prod-filters--product-form.gw-stage-prod-filters--custom {
        flex-direction: column !important;
        align-items: stretch !important;
        flex-wrap: nowrap !important;
        gap: 10px 0;
    }

    .settings-table .gw-stage-prod-filters--product-form .custom-checkbox.custom-checkbox--medium,
    .settings-table .gw-stage-prod-filters--product-form .custom-checkbox--medium {
        width: 100% !important;
        max-width: none !important;
        flex: 0 0 auto !important;
    }

    .settings-table .gw-stage-prod-filters--product-form .custom-checkbox--medium label {
        white-space: normal !important;
        width: 100% !important;
        max-width: none !important;
        overflow-wrap: anywhere;
    }
}

/* Dark mode */







/* CSS cho bài viết trên board */
.board-post {
    margin: 10px 0 10px 0;
    border-radius: 5px;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 5px;
}

.post-content {
    padding: 10px;
    border-top: 1px solid #d0d0d0;
    word-wrap: break-word;
    /* cũ nhưng hỗ trợ rộng */
    overflow-wrap: anywhere;
    /* chuẩn hiện đại */
    word-break: break-word;
    /* backup cho iOS Safari */
}



.searchUsers {
    position: absolute;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
    margin-top: 5px;
    max-height: 200px;
    overflow-y: auto;

    /* Default (desktop) */
    width: 100%;
    max-width: 450px;
    min-width: 300px;
}

/* Tablet */
@media (max-width: 1024px) {
    .searchUsers {
        max-width: 320px;
        min-width: 260px;
    }
}

/* Mobile portrait */
@media (max-width: 480px) {
    .searchUsers {
        position: relative;
        /* cho mobile không bị tràn khỏi màn */
        width: 100% !important;
        /* full width */
        max-width: 100% !important;
        min-width: 100% !important;
        left: 0 !important;
    }
}

.search-item {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    gap: 8px;
}

.search-item-empty {
    padding: 10px 12px;
    color: #666;
    font-size: 13px;
    line-height: 1.4;
}

.search-item:hover {
    background-color: #66adff;
    color: #fff;
}

.search-item img.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

/* Đăng sản phẩm mới — layout 2 bước */
.product-addnew-page {
    margin: 10px;
}

.product-addnew-block--intro {
    margin-bottom: 14px;
}

.product-addnew-page-title {
    margin: 0 0 14px 0;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.25;
    color: #1a1a1a;
}

.product-addnew-block--intro+.gw-settings-workflow-outer {
    margin-top: 14px;
    margin-inline: 0;
}

.product-addnew-step {
    margin-bottom: 14px;
}

.product-addnew-step__head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.product-addnew-step__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 13px;
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

.product-addnew-step__title {
    font-weight: 700;
    font-size: 1.05rem;
}

.product-addnew-hint {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: #666;
    line-height: 1.45;
}

.product-addnew-customer-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 16px;
}

.product-addnew-customer-row .customer-search-wrapper {
    flex: 1 1 260px;
    min-width: 220px;
    max-width: 420px;
    position: relative;
}

.product-addnew-customer-row .currency-field {
    flex: 0 1 200px;
    min-width: 160px;
}

.product-addnew-customer-preview {
    margin-top: 8px;
    min-height: 0;
}

.product-addnew-customer-preview:has(.product-addnew-customer-card) {
    padding: 0;
    display: flex;
    justify-content: flex-start;
}

.product-addnew-customer-card {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    max-width: min(100%, 320px);
}

.product-addnew-customer-card__fullname {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.35;
    text-align: left;
    color: #1a1a1a;
    word-break: break-word;
}

/* Viền + padding nằm trong cùng box; ảnh căn trái với tên công ty */
.product-addnew-customer-card__thumb {
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background: #fff;
    line-height: 0;
}

.product-addnew-customer-card__thumb img {
    max-width: 160px;
    width: auto;
    height: auto;
    border-radius: 4px;
    border: 0;
    display: block;
}

.product-addnew-workflow .gw-workflow-tab:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.product-addnew-workflow.product-addnew-workflow--locked .gw-workflow-tab-bar {
    opacity: 0.72;
}

.product-addnew-excel-panel {
    margin-top: 12px;
}

/* Chưa chọn khách + tiền: chặn chọn Excel, nhưng vẫn cho phép tải mẫu */
.product-addnew-excel-panel--gated {
    pointer-events: none;
    opacity: 0.72;
}

.product-addnew-excel-panel--gated .product-addnew-template-dl {
    pointer-events: auto;
    opacity: 1;
    cursor: pointer;
}

.product-addnew-excel-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.select-currency--from-customer {
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.92;
}

.product-addnew-manual-panel {
    margin-top: 4px;
}

.product-import-preview-wrapper {
    margin-top: 10px;
}

.scroll-table.product-import-preview-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    table-layout: auto;
}

.product-import-preview__cell--error {
    color: #b91c1c;
    background-color: #fecaca;
}

.product-import-preview__cell--error strong {
    color: #7f1d1d;
    font-weight: 700;
}

.taggedUsers {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    padding-top: 5px;
}


.tagged-box {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    background: #d3e7ff;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.tagged-box .avatar {
    width: 28px;
    height: 28px;
}


.tagged-box span.remove-tag {
    margin-left: 6px;
    color: #d00;
    cursor: pointer;
}

.avatar-wrapper {
    margin: 0 auto;
    aspect-ratio: 1/1;
    width: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: #f0f0f0;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* ✅ không méo, crop gọn trong khung */
    object-position: center;
    display: block;
}

/* Các kích cỡ tùy chọn */
.avatar-wrapper.small {
    width: 28px;
}

.avatar-wrapper.medium {
    width: 36px;
}

.avatar-wrapper.large {
    width: 48px;
}

.avatar-wrapper.xlarge {
    width: 64px;
}

.avatar-wrapper.xxlarge {
    width: 80px;
}

.avatar-wrapper.superlarge {
    width: 100px;
}

/* Trang Tài khoản (?page=account): preview ảnh ~ gấp 3 .large (48px → 144px), nút dưới, mobile full-width */
.account-photo-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
}

.account-photo-block .account-photo-preview.avatar-wrapper {
    width: 144px;
    margin: 0;
    flex-shrink: 0;
}

.account-photo-actions {
    width: 100%;
    max-width: 100%;
}

.account-photo-actions .account-photo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.account-photo-hint {
    margin-top: 8px;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .account-photo-actions .account-photo-btn {
        width: 100%;
        box-sizing: border-box;
    }
}

.avatar-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.avatar-list .avatar-wrapper {
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease;
    margin: 0;
    display: inline-flex;
}

.avatar-list .avatar-wrapper:hover {
    transform: translateY(-2px) scale(1.05);
    z-index: 2;
}

.btn-remove-user {
    position: absolute;
    left: -2px;
    top: -5px;
    background: #fcb8b3;
    color: #fff;
    font-size: 20px;
    border-radius: 50%;
    padding: 5px 6px 4px 3px;
    text-decoration: none;
    display: none;
    /* ẩn mặc định */
}


.alert {
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
}

.alert.success {
    background-color: #dff0d8;
    border-color: #d6e9c6;
    color: #3c763d;
}

.alert.error {
    background-color: #f2dede;
    border-color: #ebccd1;
    color: #a94442;
}

.alert.warning {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-left: 4px solid #ffc107;
    color: #856404;
}

/* Ẩn trên mobile portrait */
@media screen and (max-width: 767px) and (orientation: portrait) {
    .hide-mobile-portrait {
        display: none;
    }
}

/* Ẩn trên tablet trở xuống */
@media screen and (max-width: 1024px) {
    .hide-tablet {
        display: none;
    }
}

/* ===============================
   SUMMARY AUTO GRID
================================*/
.summary-box-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0px;
}

/* Box co giãn hoàn toàn theo nội dung */
.summary-box {
    flex: 1 1 auto;
    /* co giãn linh hoạt */
    min-width: fit-content;
    /* đủ nội dung thì đứng 1 box */
    max-width: 100%;
    /* không vượt quá chiều rộng hàng */
    padding: 10px;
    background: #fff;
    box-sizing: border-box;
}

/* Box dài chiếm 2 cột tự động */
.summary-box.span-2 {
    flex: 2 1 auto;
}

/* Box chiếm full dòng */
.summary-box.full {
    flex: 0 0 100%;
}

/* MOBILE PORTRAIT: 2 cột */
@media (max-width: 600px) {
    .summary-box {
        flex: 1 1 calc(50% - 10px);
    }

    .summary-box.span-2 {
        flex: 1 1 100%;
    }
}

/* TABLET PORTRAIT: 3 cột */
@media (min-width: 600px) and (max-width: 900px) {
    .summary-box {
        flex: 1 1 calc(33.33% - 10px);
    }

    .summary-box.span-2 {
        flex: 1 1 calc(66.66% - 10px);
    }
}

/* TABLET LANDSCAPE: 4 cột */
@media (min-width: 900px) and (max-width: 1200px) {
    .summary-box {
        flex: 1 1 calc(25% - 10px);
    }

    .summary-box.span-2 {
        flex: 1 1 calc(50% - 10px);
    }
}

/* ===============================
   CHI TIẾT KHÁCH HÀNG — trang (.cd-page)
   Token theme: dark.css (html.dark|body.dark .cd-page)
================================= */
.customer-page {
    max-width: 100%;
}

.customer-page > .order-tabs {
    align-items: center;
    border-radius: 0;
    margin-bottom: 0;
}

.customer-page > .cd-page {
    margin-top: 0;
    border-top: none;
}

.customer-page .cd-page > .cd-hero + .cd-body .cd-tab-scroll .cd-tab-bar {
    border-top: none;
}

/* —— Làm khoán (cd-shell) —— */
.piecework-page {
    max-width: 100%;
}

.piecework-page > .order-tabs {
    align-items: center;
    border-radius: 0;
    margin-bottom: 0;
}

.piecework-page > .cd-page {
    margin-top: 0;
    border-top: none;
}

.piecework-page .pw-list-panel {
    padding: 0;
}

.piecework-page .pw-list-filters {
    margin: 0;
    padding: 10px 12px;
    border: none;
    border-bottom: 1px solid var(--cd-border, #e0e0e0);
    border-radius: 0;
    background: var(--cd-stat-bg, #fafbfc);
}

.piecework-page .pw-list-filters__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
}

.piecework-page .pw-list-filters__inner .input {
    min-width: 130px;
    box-sizing: border-box;
}

.piecework-page .pw-list-kpis {
    margin: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--cd-border, #e0e0e0);
}

.piecework-page .pw-list-panel .scroll-hint {
    margin: 8px 12px 0;
}

.piecework-page .pw-list-table-wrap {
    margin: 0;
}

.piecework-page .pw-list-panel .cd-empty--inline {
    margin: 16px 12px;
}

.piecework-page .pw-list-pagination {
    padding: 12px;
    text-align: center;
}

.piecework-page .cd-page > .piecework-detail-page {
    margin: 0;
}

.cd-page .scroll-table.pw-list-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
}

.cd-page .scroll-table.pw-list-table .pw-list-col-stt {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    padding-inline: 4px;
}

.cd-page .scroll-table.pw-list-table .pw-list-col-code,
.cd-page .scroll-table.pw-list-table th.sticky-code,
.cd-page .scroll-table.pw-list-table td.sticky-code {
    width: 130px !important;
    min-width: 130px !important;
    max-width: 130px !important;
    box-sizing: border-box;
    position: sticky;
    left: 0;
    z-index: 2;
}

.cd-page .scroll-table.pw-list-table thead th.sticky-code,
.cd-page .scroll-table.pw-list-table thead th.pw-list-col-code {
    top: 0;
    z-index: 16;
    background-color: #f0f4f7 !important;
    white-space: normal;
    line-height: 1.25;
}

.cd-page .scroll-table.pw-list-table tbody td.sticky-code,
.cd-page .scroll-table.pw-list-table tbody td.pw-list-col-code {
    background: var(--cd-surface, #fff);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cd-page .scroll-table.pw-list-table tbody tr:hover td.sticky-code,
.cd-page .scroll-table.pw-list-table tbody tr:hover td.pw-list-col-code {
    background: #f0f4f8;
}

.cd-page .scroll-table.pw-list-table .pw-list-col-customer {
    width: 150px;
    min-width: 150px;
    max-width: 150px;
    white-space: normal;
    word-break: break-word;
    overflow: hidden;
}

.cd-page .scroll-table.pw-list-table .pw-list-col-dept {
    width: auto;
    min-width: 200px;
    max-width: none;
    white-space: normal;
}

.cd-page .scroll-table.pw-list-table .pw-list-col-date {
    width: 110px;
    min-width: 110px;
    max-width: 110px;
    white-space: nowrap;
}

.cd-page .scroll-table.pw-list-table .pw-list-col-money,
.cd-page .scroll-table.pw-list-table .finance-col.pw-list-col-money {
    width: 112px;
    min-width: 100px;
    max-width: 120px;
    white-space: nowrap;
}

.cd-page .scroll-table-wrapper.is-sticky-code-flush .scroll-table.pw-list-table th.sticky-code,
.cd-page .scroll-table-wrapper.is-sticky-code-flush .scroll-table.pw-list-table td.sticky-code {
    box-shadow: inset 1px 0 0 #ddd, 2px 0 5px rgba(0, 0, 0, 0.1);
}

@media (max-width: 1199px) {
    .cd-page .scroll-table.pw-list-table {
        width: auto;
        min-width: 980px;
    }

    .cd-page .scroll-table.pw-list-table th.sticky-code,
    .cd-page .scroll-table.pw-list-table td.sticky-code {
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    }
}

.cd-customers-head,
.cd-addnew-head {
    margin-bottom: 10px;
}

.cd-customers-head .cd-panel__title,
.cd-addnew-head .cd-panel__title {
    margin-bottom: 0;
}

.cd-customers-view-toggle {
    margin-left: auto;
}

.cd-customer-list__no-photo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 56px;
    color: var(--cd-muted);
    font-size: 22px;
}

.cd-customer-list__name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cd-customer-list__status {
    margin-top: 3px;
}

.cd-customer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.cd-customer-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--cd-border);
    background: var(--cd-stat-bg);
    text-decoration: none;
    color: inherit;
    transition: background .15s, border-color .15s;
}

.cd-customer-card:hover {
    background: var(--cd-accent-soft);
    border-color: var(--cd-accent);
}

.cd-customer-card__photo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 90px;
    padding: 5px;
    box-sizing: border-box;
    border-bottom: 1px solid var(--cd-border);
    background: var(--cd-surface);
}

.cd-customer-card__photo img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.cd-customer-card__photo i {
    font-size: 25px;
    color: var(--cd-muted);
}

.cd-customer-card__body {
    padding: 10px 12px;
}

.cd-customer-card__name {
    font-size: 15px;
    font-weight: 700;
    color: var(--cd-accent);
    margin-bottom: 4px;
}

.cd-customer-card__meta {
    font-size: 12px;
    color: var(--cd-muted);
    line-height: 1.45;
}

.cd-customer-card__revenue {
    margin-top: 4px;
    font-weight: 700;
    color: var(--cd-accent);
}

.cd-addnew-form .settings-table {
    width: 100%;
}

.cd-page .scroll-table.cd-customer-list-table {
    table-layout: fixed;
}

.cd-page .scroll-table.cd-customer-list-table th.sticky-code,
.cd-page .scroll-table.cd-customer-list-table td.sticky-code {
    width: 140px !important;
    min-width: 140px !important;
    max-width: 140px !important;
    box-sizing: border-box;
    padding-left: 6px;
    padding-right: 6px;
    position: static;
    left: auto;
    z-index: auto;
    box-shadow: none;
}

.cd-page .scroll-table.cd-customer-list-table td.sticky-code {
    overflow: hidden;
    text-align: left;
}

.cd-page .scroll-table.cd-customer-list-table th.sticky-photo,
.cd-page .scroll-table.cd-customer-list-table td.sticky-photo {
    width: 92px !important;
    min-width: 92px !important;
    max-width: 92px !important;
    position: sticky;
    left: 0;
    z-index: 2;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.cd-page .scroll-table.cd-customer-list-table thead th.sticky-photo {
    top: 0;
    z-index: 17;
    background-color: #f0f4f7 !important;
}

.cd-page .scroll-table.cd-customer-list-table tbody td.sticky-photo {
    background-color: #fff !important;
}

.cd-page .scroll-table.cd-customer-list-table tbody tr:hover td.sticky-photo {
    background: #f6fcff !important;
}

.cd-page .scroll-table-wrapper.is-sticky-photo-flush .scroll-table.cd-customer-list-table th.sticky-photo,
.cd-page .scroll-table-wrapper.is-sticky-photo-flush .scroll-table.cd-customer-list-table td.sticky-photo {
    border-left: none !important;
    box-shadow: inset 1px 0 0 #ddd, 2px 0 5px rgba(0, 0, 0, 0.1);
}

.cd-page .scroll-table-wrapper.is-sticky-photo-scrolled .scroll-table.cd-customer-list-table th.sticky-photo,
.cd-page .scroll-table-wrapper.is-sticky-photo-scrolled .scroll-table.cd-customer-list-table td.sticky-photo {
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.12);
}

@media (max-width: 1199px) {
    .cd-page .scroll-table.cd-customer-list-table {
        width: auto;
        min-width: 880px;
    }

    .cd-page .scroll-table.cd-neworder-products-table {
        width: auto;
        min-width: 900px;
    }
}

.cd-page {
    --cd-border: #e0e0e0;
    --cd-surface: #ffffff;
    --cd-muted: #546e7a;
    --cd-text: #263238;
    --cd-accent: #1565c0;
    --cd-accent-soft: #e3f2fd;
    --cd-tab-bg: #f5f7fa;
    --cd-shadow: none;
    --cd-chip-bg: #eceff1;
    --cd-stat-bg: #fafbfc;
    --cd-success-bg: #e8f5e9;
    --cd-success-text: #2e7d32;
    --cd-danger-bg: #ffebee;
    --cd-danger-text: #c62828;
    --cd-inactive-bg: #fff3e0;
    --cd-inactive-text: #e65100;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--cd-border);
    background: var(--cd-surface);
}

.cd-hero {
    margin: 0;
    padding: 12px 14px;
    border: none;
    border-bottom: 1px solid var(--cd-border);
    border-radius: 0;
    background: var(--cd-surface);
    box-shadow: none;
    box-sizing: border-box;
}

.cd-hero__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    min-width: 0;
}

.cd-hero__identity {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1 1 280px;
    min-width: 0;
}

.cd-hero__photo {
    flex: 0 0 auto;
    width: auto;
    height: 90px;
    min-width: 48px;
    max-width: min(240px, 40vw);
    padding: 5px;
    box-sizing: border-box;
    border-radius: 8px;
    border: 1px solid var(--cd-border);
    background: var(--cd-stat-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--cd-muted);
    font-size: 28px;
}

.cd-hero__photo img {
    width: auto;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

.cd-hero__text {
    flex: 1 1 auto;
    min-width: 0;
}

.cd-hero__title {
    margin: 0 0 2px;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--cd-text);
    word-break: break-word;
}

.cd-hero__subtitle {
    margin: 0 0 8px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--cd-muted);
    word-break: break-word;
}

.cd-hero__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
}

.cd-hero__badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.cd-hero__badge--active {
    background: var(--cd-success-bg);
    color: var(--cd-success-text);
}

.cd-hero__badge--inactive {
    background: var(--cd-inactive-bg);
    color: var(--cd-inactive-text);
}

.cd-hero__chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--cd-chip-bg);
    font-size: 12px;
    font-weight: 600;
    color: var(--cd-text);
    max-width: 100%;
    word-break: break-word;
}

.cd-hero__chip i {
    color: var(--cd-muted);
    font-size: 11px;
}

.cd-hero__chip--muted {
    color: var(--cd-muted);
}

.cd-hero__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 0 0 auto;
    margin-left: auto;
}

.cd-hero__stat {
    min-width: 88px;
    padding: 8px 12px;
    border: 1px solid var(--cd-border);
    border-radius: 8px;
    background: var(--cd-stat-bg);
    text-align: center;
    box-sizing: border-box;
}

.cd-hero__stat-val {
    display: block;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--cd-accent);
}

.cd-hero__stat-label {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    font-weight: 600;
    color: var(--cd-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.cd-tab-scroll {
    position: relative;
    overflow: visible;
    max-width: 100%;
}

.cd-body {
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    /* overflow:visible — hidden/clip trên .cd-body phá position:sticky của bảng con */
    overflow: visible;
}

.cd-body .cd-tab-scroll {
    margin-bottom: 0;
}

.cd-tab-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0;
    border: none;
    border-bottom: 1px solid var(--cd-border);
    border-radius: 0;
    background: var(--cd-tab-bg);
    overflow: visible;
    position: relative;
    z-index: 1;
}

.cd-tab-bar > .cd-tab {
    flex: 1 1 0;
    min-width: 0;
}

.cd-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 12px;
    border: none;
    border-bottom: 3px solid transparent;
    background: transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--cd-muted);
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

.cd-tab:hover {
    background: #eceff1;
    color: var(--cd-accent);
}

.cd-tab.is-active {
    background: var(--cd-surface);
    color: var(--cd-accent);
    border-bottom-color: var(--cd-accent);
    margin-bottom: -1px;
    padding-bottom: 12px;
}

.cd-tab--danger {
    color: #c62828;
}

.cd-tab--danger:hover {
    background: var(--cd-danger-bg);
    color: #b71c1c;
}

.cd-panel {
    padding: 14px 16px;
    border: none;
    border-radius: 0;
    background: var(--cd-surface);
    box-shadow: none;
    box-sizing: border-box;
    min-width: 0;
}

.cd-panel__title {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 700;
    color: var(--cd-text);
}

.cd-panel__title i {
    margin-right: 6px;
    color: var(--cd-accent);
}

.cd-panel .customer-detail-readonly {
    margin-top: 0;
}

.cd-panel .cd-edit-form {
    margin-top: 0;
}

.cd-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 32px 16px;
    text-align: center;
    color: var(--cd-muted);
}

.cd-empty__icon {
    font-size: 28px;
    line-height: 1;
}

.cd-orders-head {
    margin-bottom: 10px;
}

.cd-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--cd-border);
    border-radius: 6px;
}

.cd-orders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.cd-orders-table th,
.cd-orders-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #eceff1;
}

.cd-orders-table tbody tr:last-child td {
    border-bottom: none;
}

.cd-orders-table tbody tr:hover {
    background: #f5f7fa;
}

.cd-stats-insight {
    margin: 0 0 12px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.6;
}

.cd-stats-insight--compact {
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.5;
    border-radius: 0;
}

.cd-stats-insight-list {
    margin: 0;
    padding: 0 0 0 18px;
}

.cd-stats-insight-list li {
    margin: 0 0 6px;
}

.cd-stats-insight-list li:last-child {
    margin-bottom: 0;
}

.cd-panel.cd-panel--stats {
    padding-top: 0;
}

.cd-panel.cd-panel--stats > .cd-stats-top:first-child {
    margin: 0 -16px 14px;
    border-bottom: 1px solid var(--cd-border);
}

.cd-stats-top {
    background: var(--cd-surface);
}

.cd-stats-top .cd-stats-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin: 0;
    padding: 10px 16px;
    border-bottom: 1px solid var(--cd-border);
}

.cd-stats-year-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.cd-stats-year-form__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--cd-muted);
    margin: 0;
}

.cd-stats-year-form__label i {
    color: var(--cd-accent);
}

.cd-stats-top .cd-stats-kpis {
    margin: 0;
    border-bottom: none;
}

.cd-stats-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    background: var(--cd-border);
}

.cd-stats-kpi {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 72px;
    padding: 10px 8px;
    background: var(--cd-stat-bg);
    text-align: center;
    box-sizing: border-box;
}

.cd-stats-kpi__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--cd-accent-soft);
    color: var(--cd-accent);
    font-size: 13px;
    line-height: 1;
}

.cd-stats-kpi__label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--cd-muted);
    line-height: 1.25;
}

.cd-stats-kpi__value {
    font-size: 15px;
    font-weight: 700;
    color: var(--cd-text);
    line-height: 1.2;
    word-break: break-word;
}

@media (max-width: 1199px) {
    .cd-stats-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .cd-panel.cd-panel--stats > .cd-stats-top:first-child {
        margin-inline: -14px;
    }

    .cd-stats-top .cd-stats-toolbar {
        padding-inline: 14px;
    }

    .cd-stats-kpi__value {
        font-size: 14px;
    }
}

.cd-stats-insight .analysis-box h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.cd-stats-insight .analysis-box p {
    margin: 0 0 8px;
}

.cd-stats-insight .analysis-box p:last-child {
    margin-bottom: 0;
}

.cd-stats-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 14px;
}

.cd-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.cd-stats-grid--full {
    grid-template-columns: 1fr;
}

.cd-stats-grid .dashboard-panel {
    margin: 0;
}

.cd-stats-grid .dashboard-panel.cd-stats-panel--table {
    padding: 0 0 10px;
    overflow: hidden;
}

.cd-stats-grid .dashboard-panel.cd-stats-panel--table > h4 {
    margin: 20px 0;
    padding: 0 10px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}

.cd-stats-grid .dashboard-panel.cd-stats-panel--table .scroll-hint,
.cd-stats-grid .dashboard-panel.cd-stats-panel--table .scroll-table-wrapper {
    width: auto;
    max-width: none;
    margin-inline: 10px;
}

.cd-stats-grid .dashboard-panel.cd-stats-panel--table .scroll-hint {
    margin-top: 0;
    margin-bottom: 0;
}

.cd-panel .alert {
    margin-bottom: 12px;
}

.cd-products-head {
    margin-bottom: 10px;
}

.cd-products-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.cd-products-filters__search {
    flex: 1 1 180px;
    min-width: 140px;
    max-width: 280px;
}

.cd-products-table__photo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--cd-border);
    background: var(--cd-stat-bg);
}

.cd-products-table__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cd-empty--inline {
    padding: 24px 12px;
}

.cd-download-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin-bottom: 14px;
}

.cd-download-head .cd-panel__title {
    margin-bottom: 0;
}

.cd-download-year {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cd-download-year__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--cd-muted);
    white-space: nowrap;
}

.cd-download-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.cd-download-group {
    border: 1px solid var(--cd-border);
    border-radius: 8px;
    background: var(--cd-stat-bg);
    overflow: hidden;
}

.cd-download-group__head {
    padding: 12px 14px;
    border-bottom: 1px solid var(--cd-border);
    background: var(--cd-tab-bg);
}

.cd-download-group__title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--cd-text);
}

.cd-download-group__title i {
    margin-right: 6px;
    color: var(--cd-accent);
}

.cd-download-group__desc {
    margin: 4px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--cd-muted);
}

.cd-download-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cd-download-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--cd-border);
    text-decoration: none;
    color: var(--cd-text);
    transition: background .15s;
}

.cd-download-list li:last-child .cd-download-link {
    border-bottom: none;
}

.cd-download-link:hover {
    background: var(--cd-accent-soft);
    color: var(--cd-accent);
}

.cd-download-link__icon {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--cd-surface);
    border: 1px solid var(--cd-border);
    color: var(--cd-accent);
    font-size: 14px;
}

.cd-download-link__text {
    flex: 1 1 auto;
    min-width: 0;
}

.cd-download-link__label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
}

.cd-download-link__note {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--cd-muted);
}

.cd-download-link__action {
    flex: 0 0 auto;
    font-size: 12px;
    color: var(--cd-muted);
}

.cd-download-link:hover .cd-download-link__action {
    color: var(--cd-accent);
}

@media (max-width: 900px) {
    .cd-download-grid {
        grid-template-columns: 1fr;
    }
}

/* Chi tiết KH — cột mã hợp đồng gọn 120px, ellipsis nếu dài */
.cd-page .scroll-table.cd-customer-orders-table {
    table-layout: fixed;
}

.cd-page .scroll-table.cd-customer-orders-table th.sticky-code,
.cd-page .scroll-table.cd-customer-orders-table td.sticky-code {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    box-sizing: border-box;
    padding-left: 6px;
    padding-right: 6px;
}

.cd-page .scroll-table.cd-customer-orders-table thead th.sticky-code {
    white-space: normal;
    line-height: 1.25;
    font-size: 13px;
}

.cd-page .scroll-table.cd-customer-orders-table td.sticky-code {
    overflow: hidden;
    max-width: 120px !important;
}

.cd-page .scroll-table.cd-customer-orders-table .cd-customer-orders-code {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* Chi tiết KH — bảng đơn hàng / sản phẩm: scroll ngang + sticky cột (mobile/tablet) */
@media (max-width: 1199px) {
    .cd-page .scroll-table.cd-customer-orders-table {
        width: auto;
        min-width: 820px;
    }

    .cd-page .scroll-table.cd-customer-products-table {
        width: auto;
        min-width: 900px;
    }

    .cd-page .scroll-table.cd-customer-orders-table th.sticky-code,
    .cd-page .scroll-table.cd-customer-orders-table td.sticky-code {
        position: sticky;
        left: 0;
        z-index: 1;
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    }

    .cd-page .scroll-table.cd-customer-orders-table thead th.sticky-code {
        top: 0;
        z-index: 16;
        background-color: #f0f4f7 !important;
    }

    .cd-page .scroll-table.cd-customer-orders-table tbody td.sticky-code {
        top: auto;
        background-color: #fff !important;
    }

    .cd-page .scroll-table.cd-customer-orders-table tbody tr:hover td.sticky-code {
        background: #f6fcff !important;
    }

    .cd-page .scroll-table-wrapper.is-sticky-code-flush .scroll-table.cd-customer-orders-table th.sticky-code,
    .cd-page .scroll-table-wrapper.is-sticky-code-flush .scroll-table.cd-customer-orders-table td.sticky-code {
        border-left: none !important;
        box-shadow: inset 1px 0 0 #ddd, 2px 0 5px rgba(0, 0, 0, 0.1);
    }

    .cd-page .scroll-table.cd-customer-defects-table th.sticky-code,
    .cd-page .scroll-table.cd-customer-defects-table td.sticky-code {
        position: sticky;
        left: 0;
        z-index: 1;
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    }

    .cd-page .scroll-table.cd-customer-defects-table thead th.sticky-code {
        top: 0;
        z-index: 16;
        background-color: #f0f4f7 !important;
    }

    .cd-page .scroll-table.cd-customer-defects-table tbody td.sticky-code {
        top: auto;
        background-color: #fff !important;
    }

    .cd-page .scroll-table.cd-customer-defects-table tbody tr:hover td.sticky-code {
        background: #f6fcff !important;
    }

    .cd-page .scroll-table-wrapper.is-sticky-code-flush .scroll-table.cd-customer-defects-table th.sticky-code,
    .cd-page .scroll-table-wrapper.is-sticky-code-flush .scroll-table.cd-customer-defects-table td.sticky-code {
        border-left: none !important;
        box-shadow: inset 1px 0 0 #ddd, 2px 0 5px rgba(0, 0, 0, 0.1);
    }

    .cd-page .scroll-table.cd-customer-top-orders-table th.sticky-code,
    .cd-page .scroll-table.cd-customer-top-orders-table td.sticky-code {
        position: sticky;
        left: 0;
        z-index: 1;
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    }

    .cd-page .scroll-table.cd-customer-top-orders-table thead th.sticky-code {
        top: 0;
        z-index: 16;
        background-color: #f0f4f7 !important;
    }

    .cd-page .scroll-table.cd-customer-top-orders-table tbody td.sticky-code {
        top: auto;
        background-color: #fff !important;
    }

    .cd-page .scroll-table.cd-customer-top-orders-table tbody tr:hover td.sticky-code {
        background: #f6fcff !important;
    }

    .cd-page .scroll-table-wrapper.is-sticky-code-flush .scroll-table.cd-customer-top-orders-table th.sticky-code,
    .cd-page .scroll-table-wrapper.is-sticky-code-flush .scroll-table.cd-customer-top-orders-table td.sticky-code {
        border-left: none !important;
        box-shadow: inset 1px 0 0 #ddd, 2px 0 5px rgba(0, 0, 0, 0.1);
    }
}

/* Chi tiết KH — bảng lỗi nhiều nhất */
.cd-page .scroll-table.cd-customer-defects-table {
    table-layout: fixed;
    width: 100%;
    min-width: 780px;
}

.cd-page .scroll-table.cd-customer-defects-table th.sticky-code,
.cd-page .scroll-table.cd-customer-defects-table td.sticky-code {
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
    box-sizing: border-box;
    padding-left: 6px;
    padding-right: 6px;
}

.cd-page .scroll-table.cd-customer-defects-table td.sticky-code {
    overflow: hidden;
}

.cd-page .scroll-table.cd-customer-defects-table .cd-customer-defects-code {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    font-weight: 700;
}

/* Chi tiết KH — bảng đặt nhiều nhất */
.cd-page .scroll-table.cd-customer-top-orders-table {
    table-layout: fixed;
    width: 100%;
    min-width: 100%;
}

.cd-page .scroll-table.cd-customer-top-orders-table th.sticky-code,
.cd-page .scroll-table.cd-customer-top-orders-table td.sticky-code {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    box-sizing: border-box;
    padding-left: 6px;
    padding-right: 6px;
}

.cd-page .scroll-table.cd-customer-top-orders-table td.sticky-code {
    overflow: hidden;
}

.cd-page .scroll-table.cd-customer-top-orders-table .cd-customer-top-orders-code {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    font-weight: 700;
}

@media (max-width: 900px) {
    .cd-hero__stats {
        margin-left: 0;
        width: 100%;
    }

    .cd-hero__stat {
        flex: 1 1 calc(50% - 4px);
    }

    .cd-stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1199px) {
    .cd-tab-scroll .cd-tab-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        touch-action: pan-x;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: auto;
        scrollbar-width: none;
        border-radius: 0;
    }

    .cd-tab-scroll:not(.is-scrollable) .cd-tab-bar {
        overflow-x: hidden;
    }

    .cd-tab-scroll .cd-tab-bar::-webkit-scrollbar {
        display: none;
        height: 0;
    }

    .cd-tab-scroll .cd-tab-bar > .cd-tab {
        flex: 0 0 auto;
        min-width: max-content;
    }

    .cd-tab-scroll .cd-tab-bar > .cd-tab {
        white-space: nowrap;
        padding-left: 14px;
        padding-right: 14px;
    }

    .cd-tab-scroll .cd-tab-bar > .cd-tab:hover:not(.is-active),
    .cd-tab-scroll .cd-tab-bar > .cd-tab:active:not(.is-active) {
        background: transparent;
        color: var(--cd-muted);
    }
}

@media (max-width: 520px) {
    .cd-hero__identity {
        flex-direction: row;
        align-items: center;
    }

    .cd-hero__title {
        font-size: 18px;
    }

    .cd-panel {
        padding: 12px;
    }

    .cd-products-filters__search {
        max-width: none;
        flex-basis: 100%;
    }
}

/* ===============================
   CHI TIẾT KHÁCH HÀNG (view=detail)
   Token theme: dark.css (html.dark|body.dark .customer-detail-readonly)
================================*/
.customer-detail-readonly {
    margin-top: 0;
    --cd-card-bg: #ffffff;
    --cd-card-border: #d8dee6;
    --cd-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --cd-preview-bg: #fafbfc;
    --cd-preview-border: #e5e9ef;
    --cd-title-border: #e8edf3;
    --cd-title-color: rgb(0, 81, 128);
    --cd-row-sep: #f0f3f7;
    --cd-label: #5a6570;
    --cd-value: #1a1a1a;
    --cd-value-mobile-label: #7a8490;
}

.customer-detail-status-banner {
    margin-top: 16px;
}

.customer-detail-status-banner__hint {
    margin-top: 10px;
}

.customer-detail-photo-form {
    display: none;
}

.customer-detail-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin: 0 0 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--cd-row-sep);
}

.customer-detail-toolbar__btn {
    margin: 0;
}

.customer-detail-main {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    min-width: 0;
}

.customer-detail-card {
    background: var(--cd-card-bg);
    border: 1px solid var(--cd-card-border);
    border-radius: 8px;
    padding: 14px 16px;
    box-shadow: var(--cd-card-shadow);
    min-width: 0;
}

.customer-detail-card--span2 {
    grid-column: 1 / -1;
}

.customer-detail-card__title {
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--cd-title-border);
    font-size: 15px;
    font-weight: 700;
    color: var(--cd-title-color);
}

.customer-detail-kv {
    margin: 0;
}

.customer-detail-kv__row {
    display: grid;
    grid-template-columns: minmax(100px, 34%) 1fr;
    gap: 8px 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--cd-row-sep);
    font-size: 14px;
    line-height: 1.45;
}

.customer-detail-kv__row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.customer-detail-kv__row dt {
    margin: 0;
    color: var(--cd-label);
    font-weight: 600;
}

.customer-detail-kv__row dd {
    margin: 0;
    color: var(--cd-value);
    font-weight: 600;
    word-break: break-word;
}

.customer-detail-block-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--cd-value);
    font-weight: 600;
    word-break: break-word;
}

@media (max-width: 900px) {
    .customer-detail-main {
        grid-template-columns: 1fr;
    }

    .customer-detail-toolbar {
        justify-content: stretch;
    }

    .customer-detail-toolbar__btn {
        flex: 1 1 calc(50% - 4px);
        justify-content: center;
        text-align: center;
    }

    .customer-detail-card--span2 {
        grid-column: auto;
    }
}

@media (max-width: 520px) {
    .customer-detail-kv__row {
        grid-template-columns: 1fr;
        gap: 2px 0;
    }

    .customer-detail-kv__row dt {
        font-size: 12px;
        color: var(--cd-value-mobile-label);
    }
}

/* DARK MODE */

/* Bộ sưu tập (album) */
.collection-album {
    display: grid;
    gap: 10px;
}

.collection-album.small {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.collection-album.medium {
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
}

.collection-album.large {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

/* Giống .product-grid.large: mobile 2 cột, siêu hẹp 1 cột */
@media (max-width: 640px) {
    .collection-album.large {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .collection-album.large>.collection-item {
        width: 100%;
        max-width: none;
        min-width: 0;
    }
}

@media (max-width: 339px) {
    .collection-album.large {
        grid-template-columns: 1fr;
    }
}

.collection-item {
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    padding: 5px;
    box-sizing: border-box;
    transition: all 0.2s ease-in-out;
    max-width: 250px;
    position: relative;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}


/* hover card = đổi border + bóng đổ */
.collection-item:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    border-color: #006fe6;
}

/* ✅ khi hover card, ảnh phóng nhẹ */
.collection-item:hover .cover-photo-wrapper img {
    transform: scale(1.05);
}


.worker-grid {
    display: grid;
    gap: 10px;
    justify-content: flex-start !important;
}

.worker-grid.small {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.worker-grid.medium {
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
}

.worker-grid.large {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

/* card trong grid nên fill hết chiều ngang ô để tránh "lọt" 1 cột */
.worker-grid.large>.collection-item,
.worker-grid.large>.customer-card,
.worker-grid.large>.worker-card {
    width: 100%;
    max-width: none;
    min-width: 0;
}

/* mobile portrait: ưu tiên 2 cột ổn định, chỉ fallback khi màn quá hẹp */
@media (max-width: 640px) {
    .worker-grid.large {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
}

@media (max-width: 339px) {
    .worker-grid.large {
        grid-template-columns: 1fr;
    }
}


/* ===========================
   📇 CUSTOMER CARD GRID VIEW
   =========================== */
.customer-card,
.worker-card {
    background: #fff;
    border-radius: 5px;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    transition: transform .2s ease, box-shadow .2s ease;
    max-width: 250px;
}

/* hover card = đổi border + bóng đổ */
.worker-card:hover,
.customer-card:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    border-color: #006fe6;
}

/* ✅ khi hover card, ảnh phóng nhẹ */
.worker-card:hover .cover-photo-wrapper img,
.customer-card:hover .cover-photo-wrapper img {
    transform: scale(1.05);
}

/* --- Trường hợp không có ảnh --- */
.no-cover {
    font-size: 50px;
    color: #bbb;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

/* --- Thông tin chi tiết --- */
.customer-card .collection-info {
    padding: 10px 12px;
    flex-grow: 1;
}

.customer-card h4 {
    margin: 0 0 5px;
    font-size: 16px;
    color: #111;
}

.customer-card .sub {
    color: #666;
    font-size: 13px;
    margin-top: 3px;
}

.customer-card .sub.email {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* --- Nút hành động --- */
.customer-card .collection-actions {
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
}

.customer-card .collection-actions .button {
    flex: 1;
    text-align: center;
    margin: 0 3px;
}


.edit-cover-form .cover-input {
    display: none;
}

.edit-cover-form .edit-icon {
    position: absolute;
    top: 20px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    display: none;
    font-size: 14px;
    text-align: center;
}


.cover-photo-wrapper:hover .edit-icon {
    display: block;
}

.collection-info {
    padding: 0;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    margin-top: 10px;
}

.collection-info .manage-btn {
    margin-top: auto;
    /* 👈 đẩy xuống đáy */
    align-self: flex-start;
    /* hoặc center nếu muốn căn giữa */
}

.collection-info h4 {
    margin: 0;
    font-size: 16px;
    color: #333;
}


.sub {
    color: #555;
    font-size: 13px;
    margin-bottom: 5px;
}


.note {
    font-size: 13px;
    color: #666;
    margin-top: 6px;
    margin-bottom: 6px;
}


.icon-link {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: inherit;
}

.icon-link i {
    width: 20px;
    /* 👈 fix width để thẳng hàng */
    text-align: center;
}


/* Chi phí */
.expense-detail-grid {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 6px 12px;
    font-size: 14px;
    line-height: 1.6;
    text-align: left;
}

.expense-detail-grid div:nth-child(odd) {
    font-weight: 600;
    color: #555;
}

/* Bảng danh sách chi phí: giữ full số tiền trên mobile */
.expenses-list-table .expense-total-col {
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

@media (max-width: 768px) {
    .expenses-list-table .expense-total-col {
        min-width: 95px;
        font-size: 13px;
    }

    /* Thông tin hóa đơn chi phí: giảm khoảng cách block trên mobile */
    .expense-info-table tr {
        margin-bottom: 4px !important;
    }

    .expense-info-table td {
        padding: 2px 0 !important;
        line-height: 1.35 !important;
    }

    .expense-info-table td:first-child {
        padding-bottom: 1px !important;
    }
}


/* 👇 Responsive khi dưới 500px: chuyển thành 1 cột */
@media (max-width: 500px) {
    .expense-detail-grid {
        grid-template-columns: 1fr;
    }

    .expense-detail-grid div:nth-child(odd) {
        margin-top: 10px;
        color: #999;
    }
}

#expensesChart {
    width: auto !important;
    height: 320px !important;
}

.expense-stat-flex {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
    margin-top: 0;
}

.expense-stat-half {
    flex: 1 1 calc(50% - 10px);
    box-sizing: border-box;
    min-width: 300px;
    max-width: 100%;
}

@media (max-width: 768px) {
    .expense-stat-half {
        flex: 1 1 100%;
    }
}

/* Cài đặt hệ thống */
.system-settings-form {
    display: block;
    /* ✅ bỏ flex hoàn toàn */
    width: 100%;
    margin: 0 auto;
}

.system-settings-form fieldset {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px 16px 16px 16px;
    margin-bottom: 20px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    height: auto;
    /* ✅ co theo nội dung */
    box-sizing: border-box;
}


.system-settings-form legend {
    font-weight: 700;
    color: #0077b6;
    font-size: 16px;
    padding: 0 8px;
}



/* Form table styles (2 cột - label và input) */
.settings-form-table {
    width: 100%;
    border-collapse: collapse;
}

.settings-form-table td {
    border-bottom: 1px solid #eee;
    padding: 10px 6px;
    vertical-align: middle;
    font-size: 14px;
}

.settings-form-table input,
.settings-form-table select {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}


.form-footer {
    text-align: right;
    margin-top: 15px;
}

/* ✅ responsive – auto fit mọi màn hình (chỉ cho form table, không áp dụng cho data table) */
@media (max-width: 768px) {

    /* Chỉ áp dụng cho form table trong system-settings-form */
    .system-settings-form .settings-table td {
        display: block;
        width: 100%;
    }

    .system-settings-form .settings-table tr {
        display: block;
    }

    .system-settings-form fieldset {
        margin-bottom: 15px;
        padding: 10px;
    }

    .system-settings-form .settings-table input,
    .system-settings-form .settings-table select {
        font-weight: bold;
    }

    /* Settings table (form table 2 cột) - responsive trên mobile */
    .settings-table {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        table-layout: auto !important;
        box-sizing: border-box !important;
        border: none !important;
    }

    .settings-table td {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        border: none !important;
        border-bottom: none !important;
    }

    .settings-table tr {
        display: block !important;
        margin-bottom: 10px;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .settings-table td:first-child {
        padding-bottom: 5px;
        font-weight: 600;
    }

    .settings-table td:last-child {
        padding-top: 0;
    }

    .settings-table input,
    .settings-table select,
    .settings-table textarea {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    /* Override height cho input trong settings-table trên mobile */
    .settings-table input[type="text"],
    .settings-table input[type="password"],
    .settings-table input[type="email"],
    .settings-table input[type="number"],
    .settings-table input[type="tel"],
    .settings-table input[type="url"],
    .settings-table input[type="search"],
    .settings-table select {
        height: auto !important;
        min-height: 36px !important;
        line-height: normal !important;
    }

    /* Force override mọi width cố định */
    .settings-table td input,
    .settings-table td select {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .settings-table tr.setting-holiday-dept-row[hidden],
    .settings-table tr.setting-holiday-dept-row.is-collapsed {
        display: none !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
    }

    .settings-table .setting-holiday-dept-pick {
        max-width: 100%;
        height: auto;
        max-height: 220px;
    }
}

/* Suggestion box */
.orderSearchResults {
    position: absolute;
    background: #fcfcde;
    border: 1px solid #ddd;
    width: 30%;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 100;
}

@media (max-width: 768px) {
    .orderSearchResults {
        inset: auto 20px auto 20px;
        /* tương đương top:auto; right:20px; bottom:auto; left:20px */
        width: auto !important;
    }
}

.order-item {
    padding: 10px;
    cursor: pointer;
}

.order-item:hover {
    background: rgb(181, 221, 253);
}



.notification-container {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 9999;
    display: none;
    /* mặc định ẩn */
}

.notification {
    min-width: 280px;
    padding: 12px 18px;
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    animation: fadeIn 0.3s ease;
}

.notification.success {
    background-color: #4caf50;
    /* xanh lá */
}

.notification.error {
    background-color: #e53935;
    /* đỏ lỗi */
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== THREAD UNREAD STYLE ========== */

/* Bôi đậm và nổi bật thread chưa đọc */
.unread {
    transition: background-color 0.3s ease;
}

/* Badge nhỏ hiển thị số lượng tin mới */
#unreadmsg {
    color: #0b62d4;
}

.unread a {
    color: #0a58ca;
}

.badge {
    display: inline-block;
    background: #ff3b3b;
    color: white;
    font-size: 12px;
    border-radius: 10px;
    padding: 2px 6px;
    margin-left: 6px;
    min-width: 18px;
    text-align: center;
    font-weight: 400;
}

.tag-link {
    display: inline-block;
    text-decoration: none !important;
    color: #003049 !important;
    transition: all 0.2s ease;
    padding: 2px 4px;
    border-radius: 3px;
    white-space: nowrap;
}

.tag-link:hover {
    color: #0077b6 !important;
    background-color: #f0f8ff;
    transform: translateY(-1px);
}

.thread-header {
    display: grid;
    grid-template-columns: 35% 40% 25%;
    align-items: start;
    padding: 10px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

/* 🔹 Các block con */
.thread-header>div {
    background: transparent;
    min-width: 0;
    overflow-wrap: break-word;
}

/* 🔹 Khi chỉ còn 1 cột hiển thị (mobile portrait) */
@media (max-width: 767px) and (orientation: portrait) {
    .thread-header {
        display: grid;
        grid-template-columns: 1fr;
        /* full 100% width cho block còn lại */
    }

    .hide-mobile-portrait {
        display: none !important;
    }
}

/* 🔹 Tablet portrait (800x1280 chẳng hạn) vẫn 3 cột mượt, không vỡ bố cục */
@media (min-width: 768px) and (max-width: 1023px) {
    .thread-header {
        grid-template-columns: 35% 40% 25%;
    }
}

/* ===== Reply form sticky bottom ===== */
.reply-form {
    position: sticky;
    bottom: 0;
    background: #f0f7ff;
    padding: 10px;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

/* chỉ khi có bottom-bar (≤1199px) => chừa 52px */
@media (max-width: 1199px) {
    .reply-form:not(.news-chat-composer__form) {
        bottom: 52px;
    }
}

/* dark mode */

/* textarea cơ bản */
.reply-form textarea,
.edit-form textarea {
    width: 100%;
    height: 70px;
    min-height: 50px;
    resize: none;
    transition: height 0.25s ease;
    font-family: inherit;
    font-size: 16px;
    box-sizing: border-box;
}

/* Popup sửa tin nhắn — override rule .edit-form textarea ở trên */
.news-edit-post-form.edit-form textarea,
.news-edit-post-form .news-edit-post-form__textarea,
#newsEditPostContent {
    height: 200px;
    min-height: 200px;
    resize: vertical;
    transition: none;
}

/* Composer chat — override rule .reply-form textarea ở trên */
.news-chat-composer__form.reply-form .news-chat-composer__input {
    width: 100%;
    height: auto;
    min-height: 40px;
    max-height: 120px;
    padding: 9px 14px;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    transition: none;
    border: none;
    background: #f0f2f5;
}

.news-chat-composer__form.reply-form .news-chat-composer__input:focus {
    outline: none;
    border: none;
    background: #f0f2f5;
    box-shadow: none;
}



.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.editor-toolbar button {
    margin-right: 2px;
    cursor: pointer;
    border: none;
    background: #eee;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
}


.editor-toolbar button:hover {
    background: #ddd;
}


.edit-history-list {
    display: none;
    margin-top: 8px;
    border-left: 3px solid #ccc;
    padding-left: 20px;
    margin-left: 20px;
}

.inline-user {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    /* ép chiều cao text */
    height: 20px;
    /* hoặc auto theo avatar */
    padding: 0 5px 0 0;
    /* có thể giảm padding để gọn hơn */
    /* bỏ padding trái để avatar sát mép */
    border-radius: 20px;
    background: #ff8533;
    margin-right: 6px;
    position: relative;
    overflow: visible;
    color: #fff;
    text-indent: 3px;
}



/* New order search customer */
.search-dropdown {
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    border-radius: 6px;
    max-height: 220px;
    overflow-y: auto;
    width: 280px;
    z-index: 10;
    display: none;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}


.search-dropdown div {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    cursor: pointer;
}

.search-dropdown div:hover {
    background: #f0f7ff;
}


/* === GRID VIEW CHO PRODUCT LIST === */
.product-grid {
    display: grid;
    gap: 10px;
    margin-top: 0;
}

.product-grid.small {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
}

.product-grid.medium {
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)) !important;
}

.product-grid.large {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)) !important;
}

.product-grid.large>.product-card {
    width: 100%;
    max-width: none;
    min-width: 0;
}

@media (max-width: 640px) {
    .product-grid.large {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px;
    }
}

@media (max-width: 339px) {
    .product-grid.large {
        grid-template-columns: 1fr !important;
    }
}

/* Riêng tab tài liệu đơn hàng (vieworder → documents): 3 cột đều trên PC; mobile một cột/dòng */
.order-documents-grid.product-grid.large {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 16px;
}

@media (max-width: 768px) {
    .order-documents-grid.product-grid.large {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
}

.product-grid.xlarge {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)) !important;
}

.product-grid.xxlarge {
    grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)) !important;
}

.product-grid.superlarge {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
}

.product-card {
    position: relative;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    padding: 4px;
    box-sizing: border-box;
    transition: all 0.2s ease-in-out;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}


/* hover card = đổi border + bóng đổ */
.product-card:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    border-color: #006fe6;
}

/* ✅ khi hover card, ảnh phóng nhẹ */
.product-card:hover .cover-photo-wrapper img {
    transform: scale(1.05);
}

/* ảnh có hiệu ứng chuyển động */
.cover-photo-wrapper img {
    transition: transform 0.3s ease;
}


.product-card .select-product {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    z-index: 20 !important;
    /* tăng cao hơn ảnh */
    transform: scale(1.2);
    cursor: pointer;
    accent-color: #007bff;
}

.product-card form {
    margin-top: auto;
    /* đẩy form xuống đáy */
}

.cover-photo-wrapper,
.cover-photo,
.cover-photo img {
    position: relative;
    z-index: auto;
    background-color: #fff;
}

.cover-photo-wrapper {
    width: 100%;
    overflow: hidden;
}

.product-card .code {
    font-size: 15px;
    font-weight: 700;
    color: #0d6efd;
    margin-top: 10px;
}


.product-card .desc {
    font-size: 13px;
    margin-bottom: 10px;
    font-weight: 600;
}

.product-card .info {
    font-size: 13px;
    margin-bottom: 2px;
    font-weight: 500;
}

.product-card .finish {
    font-size: 12px;
    margin-bottom: 5px;
    color: #666;
}


.product-card .price {
    margin-top: auto;
    /* 👈 đẩy xuống đáy */
    align-self: flex-start;
    /* hoặc center nếu muốn căn giữa */
}

.view-toggle .active {
    background: #0d6efd;
    color: #fff;
}

.data-block-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    position: relative;
}

/* Chi tiết SP: 3 ô đóng gói luôn chia đều 1/3; khối khuôn full width bên dưới (tránh auto-fit tạo cột trống làm co 3 ô). */
.product-detail-packaging-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-detail-packaging-row3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

@media (max-width: 768px) {
    .data-block-grid {
        grid-template-columns: 1fr !important;
    }

    .product-detail-packaging-row3 {
        grid-template-columns: 1fr;
    }
}

/* responsive tweak */
@media (max-width: 600px) and (orientation: portrait) {
    .data-block-grid {
        grid-template-columns: repeat(1, 1fr);
    }
}

/* Trang quản lý bộ lọc sản phẩm: mỗi cột có scroll riêng khi danh sách dài */
.product-filters-page .product-filters-category-block {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.product-filters-page .product-filters-category-title {
    margin-bottom: 15px;
    flex-shrink: 0;
}

.product-filters-page .product-filters-list-scroll {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: min(52vh, 420px);
    overflow-y: scroll;
    overflow-x: hidden;
    padding-right: 4px;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
    /* Firefox: luôn hiện thanh (mỏng), màu có thể chỉnh */
    scrollbar-width: thin;
    scrollbar-color: #bdbdbd #ebebeb;
}

@media (max-width: 768px) {
    .product-filters-page .product-filters-list-scroll {
        max-height: min(45vh, 360px);
    }
}

/* Chromium / Safari: thanh cuộn có kích thước cố định → luôn thấy rãnh + nút kéo */
.product-filters-page .product-filters-list-scroll::-webkit-scrollbar {
    width: 10px;
}

.product-filters-page .product-filters-list-scroll::-webkit-scrollbar-track {
    background: #ebebeb;
    border-radius: 5px;
}

.product-filters-page .product-filters-list-scroll::-webkit-scrollbar-thumb {
    background: #bdbdbd;
    border-radius: 5px;
    border: 2px solid #ebebeb;
}

.product-filters-page .product-filters-list-scroll::-webkit-scrollbar-thumb:hover {
    background: #9e9e9e;
}

body.dark .product-filters-page .product-filters-list-scroll {
    scrollbar-color: #757575 #353535;
}

body.dark .product-filters-page .product-filters-list-scroll::-webkit-scrollbar-track {
    background: #353535;
}

body.dark .product-filters-page .product-filters-list-scroll::-webkit-scrollbar-thumb {
    background: #757575;
    border-color: #353535;
}

body.dark .product-filters-page .product-filters-list-scroll::-webkit-scrollbar-thumb:hover {
    background: #909090;
}

/* mỗi block riêng biệt */
.data-block {
    position: relative;
    border-radius: 5px;
    padding: 15px;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.data-block.span-2,
.data-block.wide-block {
    grid-column: span 2;
}

.data-block.full {
    grid-column: span 3;
}

.data-block-blank {
    padding: 0;
    position: relative;
}

.data-block-blank.full {
    grid-column: span 3;
}

/* --- responsive fix --- */
@media (max-width: 1199px) {

    .data-block.span-2,
    .data-block.wide-block,
    .data-block.full {
        grid-column: span 1 !important;
    }

    .data-block-blank.full {
        grid-column: span 1 !important;
    }
}



#productPhotoPreview {
    display: flex;
    justify-content: center;
    /* căn giữa ngang */
    align-items: center;
    /* căn giữa dọc */
    height: 100%;
    /* phải có chiều cao cố định hoặc auto theo parent */
    min-height: 200px;
    /* có thể tùy chọn */
    padding: 10px;
}

#productPhotoPreview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}



/* ảnh bên trong */
.cover-photo-wrapper img {
    display: block;
    transition: transform 0.3s ease;
}

/* option size (chỉ cần thêm class) */
.cover-photo-wrapper.small {
    width: 100%;
    height: 90px;
}

.cover-photo-wrapper.medium {
    width: 100%;
    height: 120px;
}

.cover-photo-wrapper.large {
    width: 100%;
    height: 200px;
}

.cover-photo-wrapper.xlarge {
    width: 100%;
    height: 300px;
}

/* option style cho ảnh */
.cover-photo-wrapper.cover-fill {
    overflow: hidden;
}

.cover-photo-wrapper.cover-fill img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* fill kín khung, crop nhẹ */
}

/* Khung cố định + ảnh % height: cần <a> fill chiều cao (vd. card bộ sưu tập, danh sách SP) */
.cover-photo-wrapper.cover-fill>a {
    display: block;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.cover-photo-wrapper.cover-contain {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.cover-photo-wrapper.cover-contain img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    /* giữ tỉ lệ thật, không crop */
}

.cover-photo-wrapper.small-image {
    width: 100%;
    height: 90px;
    /* Cùng height với .small để đồng nhất */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.cover-photo-wrapper.small-image img {
    width: 80%;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* placeholder khi chưa có ảnh */
.cover-photo-wrapper.no-image {
    background: #eee;
    color: #666;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* =====================
   THREAD LIST LAYOUT
   ===================== */
.thread-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 0;
}

/* ---- CARD ---- */
.thread-card {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-radius: 5px;
    padding: 12px 16px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    gap: 10px;
}

.thread-card:hover {
    border-color: #0078ff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.thread-card.highlight {
    background: #eaf5ff;
}

/* ---- LEFT: Avatar ---- */
.thread-left {
    flex: 0 0 70px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ---- INFO (title, poster, tags) ---- */
.thread-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 200px;
}

.thread-title a {
    text-decoration: none;
    font-size: 16px;
    line-height: 1.3;
}

.thread-title a:hover {
    color: #0078ff;
}

.thread-meta {
    font-size: 14px;
    color: #444;
}

.thread-tags {
    margin-top: 2px;
}

.thread-tags a {
    font-size: 13px;
    text-decoration: none;
    margin-right: 6px;
    padding: 1px 5px;
}

.thread-tags a:hover {
    color: #0078ff;
}

/* ---- STATS (date, replies) ---- */
.thread-stats {
    flex: 0.1 0 160px;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

/* ---- USERS (avatars tagged) ---- */
.thread-users {
    flex: 0.2 0 160px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.thread-users .small-text {
    font-size: 13px;
}

.thread-users .avatar-list {
    justify-content: flex-end;
}

/* =====================
   RESPONSIVE MOBILE
   ===================== */
@media (max-width: 900px) {
    .thread-card {
        display: grid;
        grid-template-columns: 60px 1fr;
        /* Avatar + Info cùng hàng */
        grid-template-areas:
            "avatar info"
            "stats stats"
            "users users";
        gap: 8px 12px;
    }

    .thread-left {
        grid-area: avatar;
        justify-content: flex-start;
    }

    .thread-info {
        grid-area: info;
    }

    .thread-stats {
        grid-area: stats;
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
        font-size: 13px;
    }

    .thread-users {
        grid-area: users;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 8px;
    }

    .thread-users .avatar-list {
        justify-content: flex-start;
    }
}

/* =====================
   DARK MODE SUPPORT
   ===================== */





.op-info {
    padding: 5px;
    font-size: 15px;
}

/* Combined Profile & Stats Card */
.profile-card-container {
    display: flex;
    gap: 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 10px;
    margin: 10px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    align-items: flex-start;
}

.pc-avatar {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #e0e0e0;
    margin-bottom: 10px;
    background: #f0f0f0;
}

.pc-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.pc-right {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.profile-card-container .pc-right>h2 {
    margin: 0 0 4px 0;
    font-size: 22px;
    color: #0050b3;
}

.profile-card-container .pc-worker-dept {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 15px;
}

/* Compact Stats Grid */
.compact-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
}

.c-stat-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.c-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #888;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.c-stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    min-width: 0;
    word-break: break-word;
}

.c-stat-item.highlight {
    background: #e6f7ff;
    border-color: #91d5ff;
    grid-column: span 2;
}

.c-stat-item.highlight .c-stat-value {
    color: #0050b3;
    font-size: 20px;
}

/* Dark Mode */









/* Mobile Responsive for Profile Card */
@media (max-width: 600px) {
    .profile-card-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
        padding: 15px;
    }

    .profile-card-container>.pc-avatar {
        margin-left: auto;
        margin-right: auto;
    }

    .pc-right {
        width: 100%;
        min-width: 0;
    }

    .compact-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Force 3 cols on mobile */
    .c-stat-item.highlight {
        grid-column: 1 / -1;
    }
}

/* Màn hình rất hẹp: giảm số cột thống kê để không tràn mép */
@media (max-width: 394px) {
    .compact-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* =====================
   BẢO ÔN STATS - KILNLOAD PROFILE
   ===================== */
.bao-on-title {
    margin: 20px 0 15px 0;
}

.bao-on-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.bao-on-card {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
}

.bao-on-card-header {
    text-align: center;
    margin-bottom: 12px;
}

.bao-on-card-header-title {
    font-size: 24px;
    font-weight: bold;
    color: #0d6efd;
}

.bao-on-main-stat {
    text-align: center;
    margin-bottom: 15px;
    padding: 12px;
    background: #e7f5e7;
    border-radius: 6px;
}

.bao-on-main-stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    text-transform: uppercase;
    font-weight: 600;
}

.bao-on-main-stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #2ca02c;
}

.bao-on-main-stat-unit {
    font-size: 18px;
    color: #888;
}

.bao-on-secondary-stats {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
}

.bao-on-stat-item {
    flex: 1;
    text-align: center;
    padding: 8px;
    border-radius: 6px;
}

.bao-on-stat-item.count {
    background: #fff3cd;
}

.bao-on-stat-item.min {
    background: #ffe6e6;
}

.bao-on-stat-item.max {
    background: #e6f2ff;
}

.bao-on-stat-label {
    font-size: 11px;
    margin-bottom: 3px;
    font-weight: 600;
}

.bao-on-stat-item.count .bao-on-stat-label {
    color: #856404;
}

.bao-on-stat-item.min .bao-on-stat-label {
    color: #721c24;
}

.bao-on-stat-item.max .bao-on-stat-label {
    color: #004085;
}

.bao-on-stat-value {
    font-weight: bold;
}

.bao-on-stat-item.count .bao-on-stat-value {
    font-size: 18px;
    color: #d62728;
}

.bao-on-stat-item.min .bao-on-stat-value {
    font-size: 16px;
    color: #d62728;
}

.bao-on-stat-item.max .bao-on-stat-value {
    font-size: 16px;
    color: #1f77b4;
}

.bao-on-stat-unit-small {
    font-size: 12px;
}

/* Mobile First - Single Column */
@media (max-width: 600px) {
    .bao-on-stats-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .bao-on-card {
        padding: 12px !important;
    }

    .bao-on-card-header-title {
        font-size: 20px !important;
    }

    .bao-on-main-stat-value {
        font-size: 28px !important;
    }
}

/* Tablet */
@media (min-width: 601px) and (max-width: 900px) {
    .bao-on-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Utility Colors */
/* Utility Colors */
.text-danger {
    color: #d93025 !important;
}

.text-success {
    color: #188038 !important;
}

.text-warning {
    color: #f1c232 !important;
}




/* Chấm công ngày — ô chọn ngày gọn vừa nội dung */
#filterDate.att-daily-filter-date,
input.att-daily-filter-date[type="date"] {
    width: 9.75rem;
    min-width: 0;
    max-width: 100%;
    padding: 6px 8px;
    box-sizing: border-box;
}

/* Chấm công ngày — danh sách nhân viên */
.worker-row {
    position: relative;
    box-sizing: border-box;
    padding: 10px 36px 10px 10px;
    gap: 10px;
    align-items: flex-start;
}

.worker-row-edit {
    position: absolute;
    top: 8px;
    right: 6px;
    z-index: 2;
    padding: 6px;
    font-size: 1.125rem;
    line-height: 1;
}

.worker-row .row-number {
    flex: 0 0 30px;
    width: 30px;
    min-width: 30px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 2px;
    font-weight: 700;
    font-size: 1.25rem;
    color: #666;
}

.worker-row .row-number .row-number-value {
    font-weight: 700;
}

.worker-row-name {
    flex: 1 1 0;
    min-width: 0;
}

.worker-row-name .worker-row-name-line {
    line-height: 1.35;
}

.worker-row-shifts {
    flex: 0 1 auto;
    min-width: 130px;
}

.worker-row-shifts .session-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 6px;
    margin-bottom: 4px;
}

.worker-row-shifts .session-line:last-child {
    margin-bottom: 0;
}

.worker-row-notes {
    flex: 1 1 120px;
    min-width: 120px;
    padding-right: 4px;
}

.worker-row-notes>div {
    margin-bottom: 4px;
}

.worker-row-notes>div:last-child {
    margin-bottom: 0;
}

@media (min-width: 769px) {
    .worker-row {
        display: grid;
        grid-template-columns: 30px minmax(130px, 2.35fr) minmax(130px, 1.35fr) minmax(120px, 2.4fr);
        column-gap: 10px;
        row-gap: 6px;
        align-items: start;
    }

    .worker-row .row-number {
        grid-column: 1;
        grid-row: 1;
    }

    .worker-row-name {
        grid-column: 2;
        grid-row: 1;
        flex: none;
        min-width: 0;
    }

    .worker-row-shifts {
        grid-column: 3;
        grid-row: 1;
        flex: none;
        min-width: 0;
    }

    .worker-row-notes {
        grid-column: 4;
        grid-row: 1;
        flex: none;
        min-width: 0;
    }
}

@media (max-width: 768px) {
    .worker-row {
        display: grid;
        grid-template-columns: 28px minmax(0, 1fr);
        column-gap: 8px;
        row-gap: 8px;
        padding: 10px 40px 10px 10px;
    }

    .worker-row .row-number {
        grid-column: 1;
        grid-row: 1;
        width: 28px;
        min-width: 28px;
        flex: none;
        padding-top: 3px;
    }

    .worker-row-name {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
    }

    .worker-row-name .worker-row-name-line {
        font-size: 0.9375rem;
    }

    .worker-row-shifts {
        grid-column: 1 / -1;
        grid-row: 2;
        min-width: 0;
        width: 100%;
        padding: 6px 8px;
        background: #f8fafc;
        border: 1px solid #e8ecf1;
        border-radius: 6px;
        box-sizing: border-box;
    }

    .worker-row-notes {
        grid-column: 1 / -1;
        grid-row: 3;
        min-width: 0;
        width: 100%;
        padding: 8px 0 0;
        margin: 0;
        border-top: 1px solid #e8ecf1;
    }
}

/* Attendance Monthly Table - New Responsive Design */
/* Biến theme: light mặc định; dark.css ghi đè trong body.dark .attendance-monthly-table */
.attendance-monthly-table {
    width: 100%;
    margin-top: 20px;
    border: 1px solid var(--att-table-border, #e0e0e0);
    background: var(--att-table-bg, #fff);
    --att-table-border: #e0e0e0;
    --att-table-bg: #fff;
    --att-row-sep: #f0f0f0;
    --att-card-border: #eee;
    --att-card-bg: #fff;
    --att-shift-panel-bg: #f9f9f9;
    --att-shift-panel-border: transparent;
    --att-stat-tile-bg: #f7f9fc;
    --att-stat-tile-border: #e8ecf1;
    --att-stat-label: #666;
    --att-wage-bg: #e3f2fd;
    --att-wage-label: #666;
    --att-note-border: #eee;
    --att-note-text: #666;
    --att-header-bg: #e3f2fd;
    --att-header-border: #90caf9;
    --att-header-text: inherit;
    --att-cell-text: inherit;
    --att-shift-link-hover: #0066cc;
    /* PC: một template dùng chung cho header + dòng (tránh lệch cột giữa 2 grid) */
    --att-grid-desktop: 2.35fr 1.35fr 1fr 1fr 1fr 1fr 2.4fr;
}


/* Header (Desktop only) */
.attendance-header {
    display: none;
}

/* Row — cột PC: grid-template gán trong @media (min-width: 769px) để khớp header */
.attendance-row {
    display: grid;
    gap: 8px;
    padding: 12px 8px;
    border-bottom: 1px solid var(--att-row-sep, #f0f0f0);
    align-items: center;
    color: var(--att-cell-text, inherit);
}

.attendance-row:last-child {
    border-bottom: none;
}


.attendance-row.is-weekend {
    background: #fcfcfc;
}


.attendance-row.has-flag {
    background: #fff5f5;
    border-left: 3px solid #d90429;
}


/* Columns */
.att-col-date {
    font-size: inherit;
}

/* Ngày trong bảng chấm công cá nhân: to, đậm, thứ tiếng Việt */
.att-col-date .att-day-link {
    text-decoration: none;
    color: inherit;
    line-height: 1.35;
}

.att-col-date .att-day-link:hover {
    text-decoration: underline;
    color: #0066cc;
}

.att-col-date .att-day-week {
    font-weight: inherit;
    margin-left: 6px;
}

.att-col-shift {
    font-size: inherit;
    line-height: 1.6;
    font-weight: 600;
}

/* Stats wrapper - chỉ dùng trên mobile */
.att-stats-wrapper {
    display: contents;
}

/* Dòng nghỉ: dòng 1 = ngày, dòng 2 = thông báo (có phép / không phép / …) */
.attendance-leave-row {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.attendance-leave-row .att-col-date {
    width: 100%;
    text-align: left;
}

.attendance-leave-row .att-col-shift {
    width: 100%;
    padding: 0;
    background: transparent;
    border: 0;
}

.shift-emoji {
    display: inline-block;
    width: 24px;
    text-align: center;
}

.shift-time {
    margin-left: 2px;
}

/* Red flag for check-in/check-out times */
.att-col-shift .text-red,
.shift-time .text-red,
.shift-time a .text-red,
span.text-red {
    color: #d90429 !important;
    font-weight: 600;
}

/* Link styling in shift time */
.shift-time a,
.att-map-link {
    text-decoration: none;
    color: inherit;
}

.shift-time a:hover .text-red {
    text-decoration: underline;
}

.shift-time a:hover span:not(.text-red) {
    text-decoration: underline;
    color: var(--att-shift-link-hover, #0066cc);
}


.att-col-normal,
.att-col-ot,
.att-col-piece {
    text-align: center;
    font-size: inherit;
}

.att-col-wage {
    text-align: right;
    font-size: inherit;
    font-weight: 600;
}

.att-col-note {
    font-size: inherit;
    color: var(--att-note-text, #666);
    white-space: normal;
}

.att-col-note--indented {
    padding-left: 20px;
}

/* Dòng trạng thái nghỉ / chờ phép */
.att-leave-msg {
    padding: 6px 10px;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    border-radius: 4px;
    background: var(--att-shift-panel-bg, #f9f9f9);
    border: 1px solid var(--att-shift-panel-border, transparent);
}

/* Tên ngày lễ — dòng riêng căn giữa (Chấm công cá nhân) */
.attendance-leave-row .att-holiday-name-line {
    width: 100%;
    box-sizing: border-box;
    margin-top: 2px;
    padding: 10px 8px 6px;
    text-align: center;
    line-height: 1.45;
    border-top: 1px solid #e3f2fd;
}


/* Mobile */
@media (max-width: 768px) {
    .attendance-header {
        display: none;
    }

    .attendance-monthly-table {
        border: none;
        background: transparent;
    }

    .attendance-row {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 12px;
        border: 1px solid var(--att-card-border, #eee);
        border-radius: 8px;
        margin-bottom: 12px;
        background: var(--att-card-bg, #fff);
    }


    .attendance-leave-row .att-col-shift {
        /* Không dùng nền panel “ca” của ngày làm — chỉ .att-leave-msg có nền */
        padding: 0;
        background: transparent;
        border: 0;
    }

    .attendance-row:last-child {
        margin-bottom: 0;
    }


    /* Dòng 1: Ngày - 100% width */
    .att-col-date {
        grid-column: 1;
        grid-row: 1;
        font-weight: 600;
        font-size: inherit;
        width: 100%;
    }

    /* Dòng 2: Các ca làm việc có emoji - 100% width */
    .att-col-shift {
        grid-column: 1;
        grid-row: 2;
        width: 100%;
        padding: 8px;
        background: var(--att-shift-panel-bg, #f9f9f9);
        border-radius: 4px;
        border: 1px solid var(--att-shift-panel-border, transparent);
    }


    /* Dòng 3: Wrapper cho 3 block: Chính Thêm Khoán */
    .att-stats-wrapper {
        grid-column: 1;
        grid-row: 3;
        display: flex;
        gap: 6px;
        width: 100%;
    }

    .att-col-normal,
    .att-col-ot,
    .att-col-piece {
        flex: 1;
        padding: 8px;
        background: var(--att-stat-tile-bg, #f7f9fc);
        border: 1px solid var(--att-stat-tile-border, #e8ecf1);
        border-radius: 4px;
        text-align: center;
        font-size: inherit;
        font-weight: 600;
        color: var(--att-cell-text, inherit);
    }


    .att-col-normal::before {
        content: "🗓️ Chính";
        display: block;
        font-size: inherit;
        color: var(--att-stat-label, #666);
        margin-bottom: 4px;
        font-weight: 600;
    }


    .att-col-ot::before {
        content: "⏰ Thêm";
        display: block;
        font-size: inherit;
        color: var(--att-stat-label, #666);
        margin-bottom: 4px;
        font-weight: 600;
    }


    .att-col-piece::before {
        content: "🧩 Khoán";
        display: block;
        font-size: inherit;
        color: var(--att-stat-label, #666);
        margin-bottom: 4px;
        font-weight: 600;
    }


    .att-col-normal,
    .att-col-ot,
    .att-col-piece {
        font-weight: 600;
        text-align: center;
    }

    /* Dòng 4: Lương - 100% width */
    .att-col-wage {
        grid-column: 1;
        grid-row: 4;
        width: 100%;
        text-align: left;
        font-weight: 600;
        padding: 8px;
        background: var(--att-wage-bg, #e3f2fd);
        border-radius: 4px;
        font-size: 1.1em;
        color: var(--att-cell-text, inherit);
        border: 1px solid var(--att-stat-tile-border, transparent);
    }



    .att-col-wage::before {
        content: "💰 Lương: ";
        display: block;
        font-size: 0.9em;
        color: var(--att-wage-label, #666);
        margin-bottom: 4px;
        font-weight: 600;
    }

    /* Dòng 5: Hiển thị nếu có note, ẩn nếu note = empty - 100% width */
    .att-col-note {
        grid-column: 1;
        grid-row: 5;
        width: 100%;
        margin-top: 4px;
        padding-top: 8px;
        border-top: 1px solid var(--att-note-border, #eee);
        color: var(--att-note-text, #666);
    }

    .att-col-note:empty {
        display: none;
    }

}

/* Desktop */
@media (min-width: 769px) {

    .attendance-header,
    .attendance-row:not(.attendance-leave-row) {
        grid-template-columns: var(--att-grid-desktop);
    }

    .attendance-header {
        display: grid;
        gap: 8px;
        padding: 12px 8px;
        background: var(--att-header-bg, #e3f2fd);
        font-weight: 600;
        font-size: inherit;
        text-transform: uppercase;
        border-bottom: 2px solid var(--att-header-border, #90caf9);
        position: sticky;
        top: 0;
        z-index: 10;
        color: var(--att-header-text, inherit);
    }

    .attendance-monthly-table .att-col-date {
        white-space: nowrap;
    }

}

/* OLD CSS - REMOVED - Responsive Table-like Divs */
.r-table {
    display: flex;
    flex-direction: column;
    width: 100%;
    border: 1px solid #e0e0e0;
    margin-top: 20px;
}

.r-row {
    display: flex;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
    align-items: center;
    transition: background 0.3s ease, color 0.3s ease;
}

.r-row:last-child {
    border-bottom: none;
}

.r-row.header {
    font-weight: 700;
    color: #495057;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e9ecef;
    position: sticky;
    z-index: 100;
    top: 0;
}

/* Desktop Columns */
.r-cell {
    padding: 12px 8px;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #333;
}

.r-cell.left {
    justify-content: flex-start;
    text-align: left;
}

.r-cell.right {
    justify-content: flex-end;
    text-align: right;
}

/* Column Widths (Desktop) */
.r-cell.w-date {
    flex: 0 0 120px;
}

.r-cell.w-shift {
    flex: 0 0 60px;
    font-size: 15px;
}

.r-cell.w-time {
    flex: 0 0 140px;
    flex-direction: column;
    gap: 2px;
    font-size: 15px;
    font-weight: 700;
}

/* Shift emoji alignment */
.shift-emoji {
    display: inline-block;
    width: 24px;
    text-align: center;
}

.r-cell.w-num {
    flex: 0 0 90px;
    font-weight: 500;
}

.r-cell.w-money {
    flex: 0 0 120px;
    font-weight: 700;
}

.r-cell.w-note {
    flex: 1;
    color: #666;
    font-size: 14px;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Dark Mode - Desktop & General */






/* Weekend Row Styles */
.r-row.is-weekend {
    background: #fcfcfc;
}

.r-row.is-weekend .w-date {
    color: #d93025;
}



/* Input/Select Dark Mode */

/* Mobile Optimization */
@media (max-width: 768px) {
    .r-table {
        border: none;
        background: transparent;
        gap: 12px;
    }

    .r-row.header {
        display: none;
    }

    /* Card Style for Mobile Row */
    .r-row {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-areas:
            "date shift income"
            "time time time"
            "stats stats stats"
            "note note note";
        gap: 8px 12px;
        padding: 16px;
        border: 1px solid #eee;
        border-radius: 10px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
        align-items: start;
    }

    /* Dark Mode Mobile Card */

    /* Reset Flex properties for Grid items */
    .r-cell {
        flex: unset;
        width: auto;
        padding: 0;
        border: none;
        justify-content: flex-start;
        text-align: left;
        min-height: 0;
    }

    /* Area Assignments & Larger Fonts */
    .r-cell.w-date {
        grid-area: date;
        font-weight: 700;
        font-size: 17px;
        color: #000;
    }


    .r-cell.w-shift {
        grid-area: shift;
        justify-content: center;
        font-size: 22px;
    }

    .r-cell.w-money {
        grid-area: income;
        justify-content: flex-end;
        font-size: 17px;
    }

    .r-cell.w-time {
        grid-area: time;
        flex-direction: row;
        align-items: center;
        gap: 20px;
        background: #f9f9f9;
        padding: 10px 12px;
        border-radius: 6px;
        font-size: 15px;
        color: #444;
        font-weight: 500;
    }


    /* Group Stats (Normal, OT, Piece) */
    .mobile-stats-group {
        grid-area: stats;
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 8px;
        background: #f0f5ff;
        padding: 10px 12px;
        border-radius: 6px;
    }

    /* Stats Cells Placement */
    .r-cell.w-num:nth-child(4) {
        grid-row: 3;
        grid-column: 1;
        justify-content: center;
        flex-direction: column;
        gap: 4px;
    }

    /* Normal */
    .r-cell.w-num:nth-child(5) {
        grid-row: 3;
        grid-column: 2;
        justify-content: center;
        flex-direction: column;
        gap: 4px;
    }

    /* OT */
    .r-cell.w-num:nth-child(6) {
        grid-row: 3;
        grid-column: 3;
        justify-content: center;
        flex-direction: column;
        gap: 4px;
    }

    /* Piece */
    /* Labels for stats */
    .r-cell.w-num::before {
        content: attr(data-label);
        font-size: 11px;
        text-transform: uppercase;
        color: #777;
        font-weight: 700;
    }


    .r-cell.w-num {
        background: #f7f7f7;
        padding: 8px;
        border-radius: 6px;
        font-size: 15px;
        font-weight: 600;
    }


    .r-cell.w-note {
        grid-area: note;
        font-size: 14px;
        color: #666;
        margin-top: 6px;
        white-space: normal;
        font-style: normal;
    }


    .r-cell.w-note:empty {
        display: none;
    }

    .filter-group {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .filter-label {
        font-size: 13px;
        font-weight: 600;
        color: #555;
    }

    .filter-select {
        padding: 8px 12px;
        border: 1px solid #ddd;
    }

}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
}

.badge-blue {
    background: #e3f2fd;
    color: #1976d2;
}

.badge-orange {
    background: #fff3e0;
    color: #f57c00;
}

.badge-green {
    background: #05a62d;
    color: #fff;
}

.badge-red {
    background: #f8d7da;
    color: #721c24;
}

.badge-gray {
    background: #f0f0f0;
    color: #666;
}

/* Toggle switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
    overflow: hidden;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #4CAF50;
}

input:checked+.slider:before {
    transform: translateX(26px);
}

/* ====================================
   .mobile-large - Mobile Responsive Input
   Reusable class for large inputs on mobile
   ==================================== */
/* Mobile: Slightly larger input for easy typing, but still consistent with system */
@media only screen and (max-width: 768px) {
    .mobile-large {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: 36px !important;
        font-size: 16px !important;
        padding: 5px 12px !important;
        box-sizing: border-box !important;
    }

    /* Override cho mobile-large trong settings-table */
    .settings-table .mobile-large {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 20px 0;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-group small {
    color: #666;
    font-size: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.radio-group {
    display: flex;
    gap: 20px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 5px;
}

.condition-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 60px;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

#conditionsContainer {
    margin: 15px 0;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .condition-row {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   LEAVE REQUEST - VIEW MODE TOGGLE & LIST VIEW
   Styles for attendance leave request page
   ============================================ */

/* ============================================
   RESPONSIVE LEAVE REQUEST - MOBILE FIRST
============================================ */
@media (max-width: 768px) {
    .leave-card-header {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .leave-card-header>div:last-child {
        width: 100% !important;
        text-align: center;
    }
}

/* ============================================
   VIEW MODE TOGGLE STYLES
============================================ */
.view-mode-toggle {
    display: inline-flex;
    background: #f5f5f5;
    border-radius: 5px;
    padding: 3px;
    gap: 3px;
}

.view-mode-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    transition: all 0.2s ease;
}

.view-mode-btn:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.05);
}

.view-mode-btn.active {
    background: #fff;
    color: #2196F3;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Size variants similar to .button small/medium/big */
.view-mode-toggle.small {
    padding: 2px;
    gap: 2px;
}

.view-mode-toggle.small .view-mode-btn,
.view-mode-btn.small {
    padding: 5px 8px;
    font-size: 13px;
}

.view-mode-toggle.medium .view-mode-btn,
.view-mode-btn.medium {
    padding: 8px 16px;
    font-size: 14px;
}

.view-mode-toggle.big .view-mode-btn,
.view-mode-btn.big {
    padding: 9px 18px;
    font-size: 16px;
}

/* ============================================
   LIST VIEW STYLES - CLEAN 2-LINE DESIGN
============================================ */
.leave-list-view {
    display: block !important;
}

.leave-list-view .data-block {
    margin-bottom: 10px !important;
    width: 100% !important;
    padding: 10px 15px !important;
    border-left: 3px solid transparent;
}

/* Border color by status */
.leave-list-view .data-block:has(.bglightyellow) {
    border-left-color: #ff9800;
}

.leave-list-view .data-block:has(.bglightgreen) {
    border-left-color: #4caf50;
}

.leave-list-view .data-block:has(.bglightred) {
    border-left-color: #f44336;
}

/* Hide inline elements in Grid view */
.product-grid .leave-inline-info,
.product-grid .leave-actions-inline,
.product-grid .leave-approver-info,
.product-grid .leave-status-badge,
.product-grid .leave-line2-actions {
    display: none !important;
}

/* Hide elements not needed in list view */
.leave-list-view .leave-info-table,
.leave-list-view .bgxlightblue:not(.leave-reason-section),
.leave-list-view .leave-gridview-info {
    display: none !important;
}

/* Hide bottom actions in list view */
.leave-list-view .data-block>div:last-child {
    display: none !important;
}

/* ============================================
   LINE 2: Reason | Approver | Status + Actions
============================================ */
.leave-list-view .leave-line2-wrapper {
    display: flex !important;
    align-items: center;
    gap: 15px;
    margin-left: 55px;
    /* Align with worker name */
}

/* Reason section */
.leave-list-view .leave-info-section {
    display: block !important;
    flex: 1;
    min-width: 0;
}

/* Additional info wrapper: Approver + Status */
.leave-list-view .leave-additional-info-wrapper {
    display: flex !important;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    margin-left: auto;
}

/* Approver info */
.leave-list-view .leave-approver-info {
    display: flex !important;
    align-items: baseline;
    gap: 5px;
    padding: 6px 12px;
    background: #f5f5f5;
    border-radius: 3px;
    font-size: 12px;
    line-height: 1.5;
    white-space: nowrap;
}

.leave-list-view .leave-approver-info>span {
    line-height: 1.5;
}

.leave-list-view .leave-approver-info>strong {
    line-height: 1.5;
}

/* Status badge in line 2 */
.leave-list-view .leave-status-badge {
    display: flex !important;
    align-items: baseline;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

.leave-list-view .leave-status-badge>span {
    line-height: 1.5;
    font-weight: 400;
}

/* Status colors */
.leave-list-view .leave-status-badge.status-pending {
    background: #fff3e0;
    color: #f57c00;
}

.leave-list-view .leave-status-badge.status-approved {
    background: #e8f5e9;
    color: #2e7d32;
}

.leave-list-view .leave-status-badge.status-rejected {
    background: #ffebee;
    color: #c62828;
}

/* Actions in line 2 (list view): chiều cao khớp .leave-status-badge (padding/font/line-height) */
.leave-list-view .leave-line2-actions {
    display: flex !important;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.leave-list-view .leave-line2-actions .leave-line2-action-form {
    display: flex;
    align-items: center;
    margin: 0;
}

.leave-list-view .leave-line2-actions .leave-line2-action-form .button {
    flex: 1 1 auto;
}

.leave-list-view .leave-line2-actions .button {
    box-sizing: border-box;
    min-height: 0;
    height: auto;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    align-self: center;
    padding: 6px 12px !important;
    font-size: 12px !important;
    font-weight: 600;
    line-height: 1.5 !important;
    white-space: nowrap;
}

/* Responsive - Tablet */
@media (max-width: 1200px) {
    .leave-list-view .leave-header-section>div:nth-child(2) {
        flex: 0 0 200px;
    }

    .leave-list-view .leave-inline-info {
        gap: 8px;
        font-size: 12px;
    }

    .leave-list-view .leave-additional-info-wrapper {
        gap: 8px;
    }

    .leave-list-view .leave-status-badge span {
        display: none;
        /* Hide timestamp on tablet */
    }
}

/* ============================================
   LINE 1: Avatar | Worker | Leave Info
============================================ */
.leave-list-view .leave-header-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

/* Hide status badge in line 1 for list view */
.leave-list-view .leave-header-section>div:first-child {
    display: none !important;
}

/* Worker section: Avatar + Name + Department */
.leave-list-view .leave-header-section>div:nth-child(2) {
    display: flex !important;
    align-items: center;
    gap: 10px;
    flex: 0 0 250px;
    margin-bottom: 0 !important;
}

.leave-list-view .avatar-wrapper {
    width: 60px !important;
    height: 60px !important;
    flex-shrink: 0;
}

.leave-list-view .leave-header-section>div:nth-child(2)>div:last-child {
    flex: 1;
    min-width: 0;
}

.leave-list-view .leave-header-section .large-text {
    font-size: 15px !important;
    font-weight: 700 !important;
    margin-bottom: 2px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leave-list-view .leave-header-section .text-gray {
    font-size: 12px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #666 !important;
}

/* Leave Info: Type + Dates + Days - Align Right */
.leave-list-view .leave-inline-info {
    display: flex !important;
    align-items: center;
    gap: 12px;
    flex: 1;
    font-size: 13px;
    justify-content: flex-end;
    margin-left: auto;
}

.leave-list-view .leave-inline-info>span {
    white-space: nowrap;
}

/* Hide actions inline in list view - will show in line 2 */
.leave-list-view .leave-actions-inline {
    display: none !important;
}

/* Reason text */
.leave-list-view .leave-reason-section {
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
    display: inline-flex !important;
    align-items: baseline;
    gap: 5px;
}

.leave-list-view .leave-reason-section .bold700 {
    font-size: 12px !important;
    margin: 0 !important;
    color: #888 !important;
    font-weight: 600 !important;
    flex-shrink: 0;
    line-height: 1.5;
}

.leave-list-view .leave-reason-section .small-text {
    font-size: 13px !important;
    line-height: 1.5 !important;
    color: #333 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Rejection reason inline (after leave reason) - simple text only */
.leave-list-view .leave-rejection-inline {
    display: inline-flex !important;
    align-items: baseline;
    gap: 5px;
    margin-left: 12px;
    vertical-align: baseline;
}

.leave-list-view .leave-rejection-inline .rejection-label {
    font-size: 12px;
    font-weight: 600;
    color: #d32f2f;
    flex-shrink: 0;
    line-height: 1.5;
}

.leave-list-view .leave-rejection-inline .rejection-text {
    font-size: 12px;
    color: #d32f2f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 350px;
    line-height: 1.5;
}

/* Hide extra info in list view */
.leave-list-view .leave-info-section {
    display: block !important;
}

/* Responsive - Tablet */
@media (max-width: 1400px) {
    .leave-list-view .leave-inline-info {
        gap: 10px;
        font-size: 12px;
    }

    .leave-list-view .leave-actions-inline .button {
        padding: 5px 10px !important;
        font-size: 11px !important;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .leave-list-view .data-block {
        padding: 8px !important;
    }

    /* Line 1: Stack vertically */
    .leave-list-view .leave-header-section {
        flex-wrap: wrap;
    }

    .leave-list-view .leave-header-section>div:nth-child(2) {
        flex: 1 1 auto;
        width: 100%;
    }

    .leave-list-view .leave-inline-info {
        width: 100%;
        flex-wrap: wrap;
        gap: 6px;
        font-size: 12px;
    }

    /* Line 2: Stack vertically */
    .leave-list-view .leave-line2-wrapper {
        flex-direction: column;
        align-items: flex-start;
        margin-left: 0;
        gap: 8px;
    }

    .leave-list-view .leave-info-section {
        width: 100%;
    }

    .leave-list-view .leave-additional-info-wrapper {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .leave-list-view .leave-approver-info,
    .leave-list-view .leave-status-badge {
        flex: 1 1 auto;
    }

    /* Show timestamp on mobile (override tablet hide) */
    .leave-list-view .leave-status-badge span {
        display: inline !important;
    }

    .leave-list-view .leave-line2-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .leave-view-toggle {
        width: 100%;
        justify-content: center;
    }

    .leave-view-toggle .view-mode-btn {
        flex: 1;
    }
}

/* ====================================
   USER ACTION LOGS STYLES
   ==================================== */

.logs-filters {
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.logs-filters .filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.logs-filters label {
    font-size: 12px;
    font-weight: 600;
}

.log-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.log-badge.insert {
    background: #d4edda;
    color: #155724;
}

.log-badge.update {
    background: #fff3cd;
    color: #856404;
}

.log-badge.delete {
    background: #f8d7da;
    color: #721c24;
}

.log-badge.approve {
    background: #d1ecf1;
    color: #0c5460;
}

.log-badge.reject {
    background: #f8d7da;
    color: #721c24;
}

.log-badge.finalize {
    background: #cce5ff;
    color: #004085;
}

.log-detail-section {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.log-detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.log-detail-section h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    text-transform: uppercase;
    padding-bottom: 8px;
    border-bottom: 2px solid #dee2e6;
}

.log-detail-grid {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 12px 15px;
    font-size: 13px;
    line-height: 1.6;
}

.log-detail-grid .label {
    font-weight: 600;
}

.log-detail-grid .value {
    word-break: break-word;
}

.log-diff-container {
    padding: 15px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.log-diff-row {
    padding: 5px 0;
}

.log-diff-label {
    font-weight: 600;
    display: inline-block;
    min-width: 150px;
}

.log-diff-old {
    color: #dc3545;
    text-decoration: line-through;
}

.log-diff-new {
    color: #28a745;
    font-weight: 600;
}

.log-diff-empty {
    text-align: center;
    font-style: italic;
    padding: 20px;
}

.no-logs-message {
    text-align: center;
    padding: 40px;
    font-size: 16px;
}

.no-logs-message i {
    font-size: 48px;
    margin-bottom: 10px;
    display: block;
    opacity: 0.3;
}

.log-json-data {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    font-size: 12px;
    overflow-x: auto;
    max-height: 300px;
    border: 1px solid #dee2e6;
}

.log-record-detail-box {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    margin-top: 10px;
}


.log-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #dee2e6;
}

.log-modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.log-modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

.log-loading {
    text-align: center;
    padding: 40px;
}

.log-modal-box {
    width: 80%;
    max-width: 900px;
    text-align: left;
}

/* ===================================
   SCROLL TABLE - Table nhiều cột, auto scroll trên mobile
   =================================== */

/* ✅ Scroll Table Wrapper
 * Sticky thead cần ancestor KHÔNG tạo scrollport dọc.
 * Desktop: overflow visible. Mobile: overflow-x auto (chỉ ngang).
 * KHÔNG thêm rule :has(.order-vieworder-tab-table) { overflow-x:auto } không media — sẽ ghi đè desktop và phá sticky.
 */
.scroll-table-wrapper {
    width: 100%;
    border: none;
    position: relative;
}

@media (max-width: 1199px) {
    .scroll-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (min-width: 1200px) {
    .scroll-table-wrapper {
        overflow: visible;
    }
}

/* Chi tiết khuôn: lịch sử giá nhiều dòng → cuộn dọc (ghi đè overflow-y của .scroll-table-wrapper) */
.scroll-table-wrapper.mould-price-history-scroll {
    max-height: min(350px, 42vh);
    overflow-y: auto;
    border-radius: 5px;
}

.mould-price-header-row::after {
    content: '';
    display: table;
    clear: both;
}

.mould-price-header-row .mould-price-add-toggle-btn {
    float: right;
    margin-left: 10px;
}

.mould-price-header-row .mould-price-current-text {
    overflow: hidden;
}

/* ✅ Scroll Table Base Styles */
.scroll-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10pt;
    table-layout: fixed;
}

.scroll-table td,
.scroll-table th {
    padding: 8px;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    border-left: none !important;
    border-right: none !important;
}

.scroll-table th {
    white-space: nowrap;
    word-wrap: normal;
}

.scroll-table thead th {
    position: sticky;
    top: 0;
    z-index: 11;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.35;
    color: #607d8b;
    background: #f0f4f7 !important;
    border-top: none !important;
    border-bottom: 1px solid #dce3e8;
    border-left: none !important;
    border-right: none !important;
    box-shadow: none;
}

/* Khe 1px khi header dính sát top — che content cuộn phía dưới */
.scroll-table-wrapper.is-thead-stuck .scroll-table thead th {
    box-shadow: inset 0 1px 0 #dce3e8;
}

.scroll-table-sticky-sentinel {
    height: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    pointer-events: none;
    visibility: hidden;
}

/* ✅ Đảm bảo border-bottom cho tất cả rows (override rule chung tr:last-child td) */
.scroll-table tbody tr td {
    border-bottom: 1px solid #ddd !important;
}

/* Sticky ảnh — scroll-table (tab Hàng mộc / Ra lò vieworder) */
.scroll-table th.sticky-photo,
.scroll-table td.sticky-photo {
    position: sticky;
    left: 0;
    z-index: 1;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    overflow: visible;
}

.scroll-table-wrapper.is-sticky-photo-flush .scroll-table th.sticky-photo,
.scroll-table-wrapper.is-sticky-photo-flush .scroll-table td.sticky-photo {
    border-left: none !important;
    box-shadow: inset 1px 0 0 #ddd, 2px 0 5px rgba(0, 0, 0, 0.1);
}

.scroll-table thead th.sticky-photo {
    top: 0;
    z-index: 15;
    background-color: #f0f4f7 !important;
    color: #607d8b !important;
}

.scroll-table tbody td.sticky-photo {
    top: auto;
    background-color: #fff !important;
}

.scroll-table tbody tr:hover td.sticky-photo {
    background: #f5f9fd !important;
}

.scroll-table td.description {
    text-align: left;
    white-space: normal;
}

.scroll-table td.total {
    font-weight: bold;
    background: #f0f8ff;
}

.scroll-table tbody tr:hover {
    background: #f6fcff;
}

.scroll-table td.sticky-photo img {
    display: block;
    width: 80px;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

/* Trang Packing list — bảng 16 cột, cuộn ngang trong shell + nút ‹ › */
.scroll-table.order-packinglist-table {
    width: max-content;
    min-width: 1800px;
    max-width: none;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
}

.scroll-table.order-packinglist-table th,
.scroll-table.order-packinglist-table td {
    border-top: none !important;
}

.scroll-table.order-packinglist-table .pl-col-carton {
    width: 120px;
    min-width: 120px;
}

.scroll-table.order-packinglist-table .pl-col-packed {
    width: 100px;
    min-width: 100px;
}

.scroll-table.order-packinglist-table .pl-col-code {
    width: 120px;
    min-width: 120px;
}

.scroll-table.order-packinglist-table .pl-col-desc {
    min-width: 200px;
    white-space: normal;
    text-align: left;
}

.scroll-table.order-packinglist-table th.sticky-photo,
.scroll-table.order-packinglist-table td.sticky-photo {
    width: 92px;
    min-width: 92px;
    max-width: 92px;
    box-sizing: border-box;
    padding-left: 6px;
    padding-right: 6px;
}

/* Tab vieworder (Nhập kho, Đóng hàng, …): shell cuộn ngang — cột ảnh dính trái */
.order-tab-hscroll-shell .scroll-table.order-vieworder-tab-table th.sticky-photo,
.order-tab-hscroll-shell .scroll-table.order-vieworder-tab-table td.sticky-photo {
    box-shadow: none;
}

.order-tab-hscroll-shell .scroll-table-wrapper.is-sticky-photo-scrolled .scroll-table.order-vieworder-tab-table th.sticky-photo,
.order-tab-hscroll-shell .scroll-table-wrapper.is-sticky-photo-scrolled .scroll-table.order-vieworder-tab-table td.sticky-photo {
    box-shadow: inset -1px 0 0 #ddd;
    border-left: none !important;
    border-right: none !important;
}

.order-tab-hscroll-shell .scroll-table.order-vieworder-tab-table th.sticky-photo::after,
.order-tab-hscroll-shell .scroll-table.order-vieworder-tab-table td.sticky-photo::after {
    content: none !important;
    display: none !important;
}

/*
 * Cuộn ngang trong shell. overflow-y: clip — không tạo scrollport dọc → thead sticky theo viewport.
 */
.order-tab-hscroll-shell {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: clip;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: #3b82ac #f0f0f0;
}

.order-tab-hscroll-shell.is-photo-col-stuck::before {
    content: "";
    position: absolute;
    top: 0;
    left: var(--pl-photo-col-width, 92px);
    bottom: 12px;
    width: 10px;
    pointer-events: none;
    z-index: 12;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.02) 55%, transparent);
}

.order-tab-hscroll-block {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.order-tab-hscroll-block > .scroll-hint {
    width: 100%;
    box-sizing: border-box;
}

.order-tab-hscroll-shell .scroll-table-wrapper {
    overflow: visible !important;
    width: 100%;
    min-width: 0;
    max-width: none;
}

.order-tab-hscroll-shell.is-table-expanded .scroll-table-wrapper {
    width: auto;
}

@media (max-width: 1199px) {
    .order-tab-hscroll-shell .scroll-table-wrapper {
        overflow-x: visible !important;
        overflow-y: visible !important;
    }
}

.order-tab-hscroll-shell .scroll-table.order-vieworder-tab-table {
    table-layout: auto;
    width: 100%;
    min-width: 0;
}

.order-tab-hscroll-shell.is-table-expanded .scroll-table.order-vieworder-tab-table {
    width: max-content;
}

@media (max-width: 1199px) {
    .order-tab-hscroll-shell:not(.is-table-expanded) .scroll-table.order-vieworder-tab-table {
        width: 100% !important;
        min-width: 0 !important;
    }

    .order-tab-hscroll-shell.is-table-expanded .scroll-table.order-vieworder-tab-table {
        width: max-content !important;
        min-width: 0 !important;
    }
}

.order-tab-hscroll-shell.is-table-expanded .scroll-table.order-warehouse-table th.wh-col-stt,
.order-tab-hscroll-shell.is-table-expanded .scroll-table.order-warehouse-table td.wh-col-stt {
    min-width: 46px;
    width: 46px;
}

.order-tab-hscroll-shell.is-table-expanded .scroll-table.order-warehouse-table th.wh-col-check,
.order-tab-hscroll-shell.is-table-expanded .scroll-table.order-warehouse-table td.wh-col-check {
    min-width: 44px;
    width: 44px;
}

.order-tab-hscroll-shell.is-table-expanded .scroll-table.order-warehouse-table th.wh-col-code,
.order-tab-hscroll-shell.is-table-expanded .scroll-table.order-warehouse-table td.wh-col-code {
    min-width: 96px;
}

.order-tab-hscroll-shell.is-table-expanded .scroll-table.order-warehouse-table th.wh-col-desc,
.order-tab-hscroll-shell.is-table-expanded .scroll-table.order-warehouse-table td.wh-col-desc {
    min-width: 260px;
    white-space: normal;
    word-wrap: break-word;
}

.order-tab-hscroll-shell.is-table-expanded .scroll-table.order-warehouse-table th.wh-col-qty,
.order-tab-hscroll-shell.is-table-expanded .scroll-table.order-warehouse-table td.wh-col-qty,
.order-tab-hscroll-shell.is-table-expanded .scroll-table.order-warehouse-table th.wh-col-ralo,
.order-tab-hscroll-shell.is-table-expanded .scroll-table.order-warehouse-table td.wh-col-ralo,
.order-tab-hscroll-shell.is-table-expanded .scroll-table.order-warehouse-table th.wh-col-dc,
.order-tab-hscroll-shell.is-table-expanded .scroll-table.order-warehouse-table td.wh-col-dc {
    min-width: 76px;
}

.order-tab-hscroll-shell.is-table-expanded .scroll-table.order-warehouse-table th.wh-col-defect,
.order-tab-hscroll-shell.is-table-expanded .scroll-table.order-warehouse-table td.wh-col-defect {
    min-width: 88px;
}

.order-tab-hscroll-shell .scroll-table.order-warehouse-table td.wh-col-desc {
    white-space: normal;
    word-wrap: break-word;
}

.order-tab-hscroll-shell .scroll-table.order-vieworder-tab-table tbody td.sticky-photo {
    position: sticky;
    left: 0;
    z-index: 4;
    background-color: #fff;
}

.order-tab-sticky-sentinel {
    height: 0;
    width: 0;
    overflow: hidden;
    pointer-events: none;
}

/* Thead sticky thuần CSS — cuộn dọc theo trang, cuộn ngang theo shell */
.order-tab-hscroll-shell .scroll-table.order-vieworder-tab-table thead th {
    position: sticky;
    top: 0;
    z-index: 11;
    background-color: #f0f4f7 !important;
    color: #607d8b;
    border-top: none !important;
    box-shadow: none;
}

.order-tab-hscroll-shell.is-thead-stuck .scroll-table.order-vieworder-tab-table thead th {
    box-shadow: inset 0 1px 0 #dce3e8;
}

.order-tab-hscroll-shell .scroll-table.order-vieworder-tab-table thead th.sticky-photo {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 16;
    background-color: #f0f4f7 !important;
    color: #607d8b !important;
}

/* Header clone cố định khi cuộn dọc (đồng bộ scroll ngang shell) */
.packinglist-thead-floater {
    position: fixed;
    top: 0;
    z-index: 90;
    overflow: hidden;
    pointer-events: none;
    box-sizing: border-box;
    background: #f0f4f7;
    border-top: 1px solid #dce3e8;
    box-shadow: inset 0 1px 0 #f0f4f7, 0 1px 0 #dce3e8;
}

.packinglist-thead-floater[hidden] {
    display: none !important;
}

.packinglist-thead-floater__clip {
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    box-sizing: border-box;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.packinglist-thead-floater__clip::-webkit-scrollbar {
    display: none;
    height: 0;
}

.packinglist-thead-clone {
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.packinglist-thead-clone thead th {
    border-top: none !important;
    box-shadow: none;
}

.packinglist-thead-clone thead th:not(.sticky-photo) {
    position: static;
}

.packinglist-thead-clone thead th.sticky-photo {
    position: sticky;
    left: 0;
    top: 0;
    z-index: 2;
    background-color: #f0f4f7 !important;
    color: #607d8b !important;
}

.order-tab-hscroll-shell::-webkit-scrollbar {
    height: 12px;
}

.order-tab-hscroll-shell::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 6px;
}

.order-tab-hscroll-shell::-webkit-scrollbar-thumb {
    background: #3b82ac;
    border-radius: 6px;
}

.order-tab-hscroll-shell::-webkit-scrollbar-thumb:hover {
    background: #2d6a8a;
}

.scroll-table-hscroll-shell {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.scroll-hint.scroll-hint--before-hscroll-shell,
.scroll-hint:has(+ .order-tab-hscroll-shell) {
    margin-bottom: 6px;
}

.scroll-hint.scroll-hint--before-hscroll-shell + .scroll-table-hscroll-shell,
.scroll-hint:has(+ .order-tab-hscroll-shell) + .scroll-table-hscroll-shell {
    margin-top: 0;
}

/* legacy: hint từng nằm trong shell */
.scroll-table-hscroll-shell > .scroll-hint {
    margin-top: 0;
}

/* Fixed: bên trái nút về đầu trang — cùng cao 44px, opacity 0.8, hover đậm */
.scroll-table-hscroll-controls {
    position: fixed;
    right: calc(max(16px, env(safe-area-inset-right, 0px)) + 44px + 10px);
    bottom: max(20px, env(safe-area-inset-bottom, 0px));
    z-index: 10049;
    display: flex;
    align-items: center;
    height: 44px;
    gap: 5px;
    pointer-events: auto;
    opacity: 0.8;
    transition:
        opacity 0.35s ease,
        visibility 0.28s ease;
}

.scroll-table-hscroll-controls:hover {
    opacity: 1;
}

.scroll-table-hscroll-shell:not(.needs-scroll) .scroll-table-hscroll-controls {
    display: none;
}

.scroll-table-hscroll-shell .scroll-btn {
    background: rgba(59, 130, 172, 0.72);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 4px;
    padding: 0 12px;
    height: 36px;
    min-width: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition:
        background 0.35s ease,
        border-color 0.35s ease,
        color 0.35s ease,
        transform 0.2s ease,
        box-shadow 0.35s ease;
    box-shadow: none;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.scroll-table-hscroll-controls:hover .scroll-btn {
    background: rgba(59, 130, 172, 0.92);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.38);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.scroll-table-hscroll-shell .scroll-btn:hover {
    background: rgba(45, 106, 138, 1);
    transform: scale(1.04);
}

.scroll-table-hscroll-shell .scroll-btn:active {
    transform: scale(0.96);
}

.scroll-table-hscroll-shell .scroll-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

@media (max-width: 1199px) {
    .scroll-table-hscroll-controls {
        bottom: calc(52px + 16px + env(safe-area-inset-bottom, 0px));
    }
}

.scroll-table-hscroll-shell .scroll-table-wrapper {
    overflow: visible !important;
    width: auto;
    min-width: 0;
    max-width: none;
}

/* Cột ảnh dính trái khi cuộn — bóng gradient (::after), không viền dọc */
.scroll-table-wrapper.is-sticky-photo-scrolled .scroll-table th.sticky-photo,
.scroll-table-wrapper.is-sticky-photo-scrolled .scroll-table td.sticky-photo {
    box-shadow: inset -1px 0 0 #ddd;
    border-left: none !important;
    border-right: none !important;
}

.scroll-table-wrapper.is-sticky-photo-scrolled .scroll-table th.sticky-photo::after,
.scroll-table-wrapper.is-sticky-photo-scrolled .scroll-table td.sticky-photo::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 8px;
    transform: translateX(100%);
    pointer-events: none;
    z-index: 4;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.07), rgba(0, 0, 0, 0.02) 60%, transparent);
}

.scroll-table-wrapper.is-sticky-photo-flush.is-sticky-photo-scrolled .scroll-table th.sticky-photo,
.scroll-table-wrapper.is-sticky-photo-flush.is-sticky-photo-scrolled .scroll-table td.sticky-photo {
    box-shadow: inset -1px 0 0 #ddd;
    border-left: none !important;
    border-right: none !important;
}

/* tfoot là tr:last-child toàn bộ → global tr:last-child td xóa border; khôi phục cho scroll-table */
.scroll-table tfoot tr td {
    border-bottom: 1px solid #ddd !important;
}

/* ✅ Scroll Hint */
.scroll-hint {
    text-align: center;
    padding: 5px;
    font-size: 9pt;
    color: #666;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-bottom: none;
    display: none;
    margin-bottom: 0;
}

/* ✅ Responsive: Mobile — min-width bảng (trừ tab vieworder dùng order-tab-hscroll-shell) */
@media (max-width: 1199px) {
    .scroll-table:not(.order-vieworder-tab-table) {
        width: max-content !important;
        min-width: 600px !important;
    }

    .scroll-table-wrapper:not(.order-tab-hscroll-shell .scroll-table-wrapper) > .scroll-table.order-vieworder-tab-table {
        width: max-content !important;
        min-width: 960px !important;
    }
}

/* Đơn hàng - tab Hàng mộc: cùng pattern scroll ngang (không dùng .settings-table
   cho bảng tổng quan này — tránh quy tắc mobile display:block trên từng <td> của form) */

/* Thanh trạng thái nhập liệu mộc — gọn 1 dòng, form mở lại thu gọn */
.gw-order-ops-flash {
    margin: 8px 10px;
    font-size: 14px;
    line-height: 1.45;
}

.gw-order-ops-bar {
    margin: 0 0 8px;
    padding: 8px 11px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #f8f9fa;
    font-size: 14px;
    line-height: 1.4;
    box-sizing: border-box;
}

.gw-order-ops-bar--open {
    background: #f1f8f4;
    border-color: #c8e6c9;
}

.gw-order-ops-bar--closed {
    background: #fff8e1;
    border-color: #ffe082;
}

.gw-order-ops-bar__main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 30px;
}

.gw-order-ops-bar__left {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.gw-order-ops-bar__title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    color: #37474f;
    white-space: nowrap;
}

.gw-order-ops-bar__status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
}

.gw-order-ops-bar__status--open {
    color: #2e7d32;
    background: rgba(46, 125, 50, 0.12);
}

.gw-order-ops-bar__status--closed {
    color: #e65100;
    background: rgba(230, 81, 0, 0.12);
}

.gw-order-ops-bar__meta,
.gw-order-ops-bar__hint {
    font-size: 12px;
    font-weight: 500;
    color: #78909c;
}

.gw-order-ops-bar__actions {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: auto;
}

.gw-order-ops-bar__form {
    margin: 0;
    display: inline-flex;
}

.gw-order-ops-bar__btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    padding: 5px 11px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.gw-order-ops-bar__btn--close {
    background: #fff3e0;
    border-color: #ffcc80;
    color: #e65100;
}

.gw-order-ops-bar__btn--close:hover {
    background: #ffe0b2;
    border-color: #ffb74d;
    color: #bf360c;
}

.gw-order-ops-bar__btn--reopen-toggle {
    background: #e8f5e9;
    border-color: #a5d6a7;
    color: #2e7d32;
}

.gw-order-ops-bar__btn--reopen-toggle:hover,
.gw-order-ops-bar__btn--reopen-toggle.is-open {
    background: #c8e6c9;
    border-color: #81c784;
    color: #1b5e20;
}

.gw-order-ops-bar__btn--reopen-submit {
    background: #2e7d32;
    border-color: #2e7d32;
    color: #fff;
}

.gw-order-ops-bar__btn--reopen-submit:hover {
    background: #1b5e20;
    border-color: #1b5e20;
}

.gw-order-ops-bar__chev {
    font-size: 9px;
    opacity: 0.8;
    transition: transform 0.15s ease;
}

.gw-order-ops-bar__btn--reopen-toggle.is-open .gw-order-ops-bar__chev {
    transform: rotate(180deg);
}

.gw-order-ops-bar__reopen {
    display: none;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.gw-order-ops-bar__reopen.is-open {
    display: block;
}

.gw-order-ops-bar__reopen-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 480px;
}

.gw-order-ops-bar__reopen-label {
    font-size: 12px;
    font-weight: 700;
    color: #546e7a;
}

.gw-order-ops-bar__reopen-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 14px;
    padding: 7px 9px;
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    resize: vertical;
    min-height: 52px;
}

.gw-order-ops-bar__reopen-actions {
    display: flex;
    justify-content: flex-end;
}

/* Toolbar: trạng thái nhập mộc + nhập dư theo đơn */
.gw-order-toolbar {
    margin: 0 10px 10px;
    padding: 8px 11px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #f8f9fa;
    font-size: 14px;
    line-height: 1.4;
    box-sizing: border-box;
}

.gw-order-toolbar--open {
    background: #f1f8f4;
    border-color: #c8e6c9;
}

.gw-order-toolbar--closed {
    background: #fff8e1;
    border-color: #ffe082;
}

.gw-order-toolbar__row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    min-height: 30px;
}

.gw-order-toolbar__section {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.gw-order-toolbar__divider {
    width: 1px;
    align-self: stretch;
    min-height: 28px;
    background: rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.gw-order-toolbar__label {
    font-size: 12px;
    font-weight: 700;
    color: #546e7a;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.gw-order-toolbar__pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
}

.gw-order-toolbar__pill--open {
    color: #2e7d32;
    background: rgba(46, 125, 50, 0.12);
}

.gw-order-toolbar__pill--closed {
    color: #e65100;
    background: rgba(230, 81, 0, 0.12);
}

.gw-order-toolbar__pill--on {
    color: #1565c0;
    background: rgba(21, 101, 192, 0.12);
}

.gw-order-toolbar__pill--off {
    color: #546e7a;
    background: rgba(84, 110, 122, 0.12);
}

.gw-order-toolbar__meta,
.gw-order-toolbar__hint {
    font-size: 12px;
    font-weight: 500;
    color: #78909c;
}

.gw-order-toolbar__actions {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: auto;
}

.gw-order-toolbar__form {
    margin: 0;
    display: inline-flex;
}

.gw-order-toolbar__btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    padding: 5px 11px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.gw-order-toolbar__btn--close {
    background: #fff3e0;
    border-color: #ffcc80;
    color: #e65100;
}

.gw-order-toolbar__btn--close:hover {
    background: #ffe0b2;
    border-color: #ffb74d;
    color: #bf360c;
}

.gw-order-toolbar__btn--toggle {
    background: #e3f2fd;
    border-color: #90caf9;
    color: #1565c0;
}

.gw-order-toolbar__btn--toggle:hover {
    background: #bbdefb;
    border-color: #64b5f6;
    color: #0d47a1;
}

.gw-order-toolbar__btn--reopen-toggle {
    background: #e8f5e9;
    border-color: #a5d6a7;
    color: #2e7d32;
}

.gw-order-toolbar__btn--reopen-toggle:hover,
.gw-order-toolbar__btn--reopen-toggle.is-open {
    background: #c8e6c9;
    border-color: #81c784;
    color: #1b5e20;
}

.gw-order-toolbar__btn--reopen-submit {
    background: #2e7d32;
    border-color: #2e7d32;
    color: #fff;
}

.gw-order-toolbar__btn--reopen-submit:hover {
    background: #1b5e20;
    border-color: #1b5e20;
}

.gw-order-toolbar__chev {
    font-size: 9px;
    opacity: 0.8;
    transition: transform 0.15s ease;
}

.gw-order-toolbar__btn--reopen-toggle.is-open .gw-order-toolbar__chev {
    transform: rotate(180deg);
}

.gw-order-toolbar__reopen {
    display: none;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.gw-order-toolbar__reopen.is-open {
    display: block;
}

.gw-order-toolbar__reopen-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 480px;
}

.gw-order-toolbar__reopen-label {
    font-size: 12px;
    font-weight: 700;
    color: #546e7a;
}

.gw-order-toolbar__reopen-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 14px;
    padding: 7px 9px;
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    resize: vertical;
    min-height: 52px;
}

.gw-order-toolbar__reopen-actions {
    display: flex;
    justify-content: flex-end;
}

.gw-order-toolbar__switch-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.gw-order-toolbar__switch.switch {
    width: 42px;
    height: 22px;
    flex-shrink: 0;
}

.gw-order-toolbar__switch .slider:before {
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
}

.gw-order-toolbar__switch input:checked + .slider:before {
    transform: translateX(20px);
}

.gw-order-toolbar__switch-state {
    font-size: 12px;
    font-weight: 700;
    color: #37474f;
    min-width: 28px;
}

.gw-order-toolbar__form-hidden {
    display: none !important;
}

/* Bộ lọc bảng hàng mộc (tìm kiếm + chip) */
.gw-order-filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 12px;
    padding: 8px 11px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafbfc;
    box-sizing: border-box;
}

.gw-order-filter-bar__search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 200px;
    min-width: 0;
}

.gw-order-filter-bar__search .gw-order-search-input {
    flex: 1;
    min-width: 0;
    max-width: 420px;
}

.gw-order-filter-bar__count {
    flex-shrink: 0;
    white-space: nowrap;
}

.gw-order-filter-bar__filters {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}

.gw-order-filter-bar__bulk {
    flex-shrink: 0;
    margin-left: auto;
}

.gw-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 5px 12px;
    border: 1px solid #90a4ae;
    border-radius: 999px;
    background: #fff;
    color: #455a64;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.gw-filter-chip:hover,
.gw-filter-chip:focus {
    border-color: #607d8b;
    background: #eceff1;
    color: #263238;
}

.gw-filter-chip.is-active {
    color: #fff;
    background: #546e7a;
    border-color: #546e7a;
}

.gw-filter-chip--warn.is-active {
    background: #e65100;
    border-color: #e65100;
}

.gw-filter-chip.is-active i {
    opacity: 0.95;
}

.gw-filter-chip--piecework.is-active,
#gwPieceworkFilterBtn.is-active {
    background: #6a1b9a;
    border-color: #6a1b9a;
    color: #fff;
}

#gwPieceworkFilterBtn.is-active i {
    color: #e1bee7;
}

.gw-bulk-pick--filter-hidden {
    visibility: hidden;
    pointer-events: none;
}

.gw-bulk-cap-warn {
    margin-left: 0;
    margin-right: 0;
}

.gw-order-ops-wip-alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 8px;
    padding: 8px 11px;
    border: 1px solid #ffcc80;
    border-left: 3px solid #f57c00;
    border-radius: 6px;
    background: #fff8e1;
    font-size: 13px;
    line-height: 1.45;
    color: #5d4037;
}

.gw-order-ops-wip-alert .fa-exclamation-triangle {
    color: #f57c00;
    margin-top: 2px;
    flex-shrink: 0;
}

/* Tab Hàng mộc vieworder — #gwProductTable trong .scroll-table (không thêm class modifier) */
#gwProductTable th:nth-child(1),
#gwProductTable td:nth-child(1),
#gwProductTable th:nth-child(2),
#gwProductTable td:nth-child(2) {
    white-space: nowrap;
}

#gwProductTable th.gw-order-product-col,
#gwProductTable td.gw-order-product-col {
    text-align: left;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    overflow: visible;
    text-overflow: clip;
}

#gwProductTable th:nth-child(4),
#gwProductTable td:nth-child(4) {
    white-space: nowrap;
    min-width: 3.25em;
    text-align: center;
}

.scroll-table-wrapper.is-row-focus-mode #gwProductTable .gw-product-row--focus-target td.sticky-photo {
    background: #fff !important;
}

.scroll-table-wrapper.is-row-focus-mode #gwProductTable .gw-product-row:not(.gw-product-row--focus-target) {
    opacity: 0.38;
    filter: blur(2px);
    pointer-events: none;
    transition: opacity 0.22s ease, filter 0.22s ease;
}

.scroll-table-wrapper.is-row-focus-mode #gwProductTable .gw-product-row--focus-target {
    position: relative;
    z-index: 2;
    box-shadow: inset 0 0 0 2px rgba(21, 101, 192, 0.28);
    background-color: #fff;
}

.scroll-table-wrapper.is-row-focus-mode #gwProductTable .invoice-supplement-separator {
    opacity: 0.38;
    filter: blur(1px);
    pointer-events: none;
}

.gw-order-product-info {
    line-height: 1.35;
    white-space: normal;
    word-break: break-word;
}

.gw-order-product-info__code a {
    font-weight: 700;
}

.gw-order-product-info__title,
.gw-order-product-info__finish {
    color: inherit;
}

.gw-order-product-info__title {
    margin-top: 2px;
    font-weight: 700;
}

.gw-order-product-info__finish {
    margin-top: 4px;
}

.gw-order-product-info__size {
    margin-top: 4px;
    font-size: 12px;
}

/* Bảng lồng công đoạn: tự co giãn, không tạo thêm khung tràn màn hình (scroll ở bảng ngoài) */
.gw-order-stages-col {
    min-width: 0;
    padding: 8px 10px !important;
    vertical-align: top;
}

.gw-order-stages-panel {
    border: 1px solid #dce3e8;
    border-radius: 0;
    overflow: hidden;
    background: #fff;
    box-shadow: none;
}

.gw-order-greenware-stages {
    width: 100%;
    max-width: 100%;
    min-width: 240px;
    table-layout: auto;
    border-collapse: collapse;
    box-sizing: border-box;
    font-size: 13px;
    line-height: 1.35;
    margin: 0;
    border: none;
    background: #fff;
}

/* Gỡ thead xanh #3b82ac + viền ô #ddd của packinglist/stats trên bảng lồng */
.gw-producer-stats-table .gw-order-stages-panel .gw-order-greenware-stages th,
.gw-producer-stats-table .gw-order-stages-panel .gw-order-greenware-stages td,
.scroll-table .gw-order-stages-panel .gw-order-greenware-stages th,
.scroll-table .gw-order-stages-panel .gw-order-greenware-stages td,
.scroll-table .gw-order-stages-panel .gw-order-greenware-stages th,
.scroll-table .gw-order-stages-panel .gw-order-greenware-stages td {
    border: none !important;
    min-width: 0;
}

.gw-producer-stats-table .gw-order-greenware-stages thead th,
.gw-producer-stats-table .gw-order-greenware-stages thead th.gw-ost-h,
.scroll-table .gw-order-greenware-stages thead th,
.scroll-table .gw-order-greenware-stages thead th.gw-ost-h,
.scroll-table .gw-order-greenware-stages thead th,
.scroll-table .gw-order-greenware-stages thead th.gw-ost-h {
    position: static !important;
    top: auto !important;
    z-index: auto !important;
    background: #f0f4f7 !important;
    background-color: #f0f4f7 !important;
    color: #607d8b !important;
    border: none !important;
    border-bottom: 1px solid #dce3e8 !important;
    box-shadow: none !important;
}

.gw-order-greenware-stages thead .gw-ost-head {
    background: #f0f4f7;
}

.gw-order-greenware-stages .gw-ost-h {
    padding: 8px 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #607d8b;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
}

.gw-order-greenware-stages .gw-ost-h--stage {
    text-align: left;
    padding-left: 10px;
    width: 22%;
}

.gw-order-greenware-stages .gw-ost-h--stage.gw-ost-focus-trigger {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.gw-order-greenware-stages .gw-ost-focus-head-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    width: 100%;
    box-sizing: border-box;
}

.gw-order-greenware-stages .gw-ost-focus-trigger__label {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
}

.gw-order-greenware-stages .gw-ost-focus-trigger__badge {
    flex-shrink: 0;
    color: #607d8b;
    font-size: 12px;
    line-height: 1;
}

.gw-order-greenware-stages .gw-ost-focus-trigger:hover,
.gw-order-greenware-stages .gw-ost-focus-trigger:focus-visible {
    background: rgba(21, 101, 192, 0.08);
    color: #1565c0;
    outline: none;
}

.gw-order-greenware-stages .gw-ost-focus-trigger:hover .gw-ost-focus-trigger__badge,
.gw-order-greenware-stages .gw-ost-focus-trigger:focus-visible .gw-ost-focus-trigger__badge {
    color: #1565c0;
}

.gw-order-greenware-stages .gw-ost-focus-trigger.is-active {
    background: rgba(21, 101, 192, 0.14);
    color: #0d47a1;
}

.gw-order-greenware-stages .gw-ost-focus-trigger.is-active .gw-ost-focus-trigger__badge {
    color: #0d47a1;
}

.gw-order-greenware-stages .gw-ost-h--act {
    width: 88px;
    min-width: 88px;
    max-width: 88px;
}

.gw-order-greenware-stages .gw-ost-row {
    transition: background-color 0.12s ease;
}

.gw-order-greenware-stages .gw-ost-row:hover {
    background: rgba(21, 101, 192, 0.04);
}

.gw-order-greenware-stages tr.gw-ost-row-clickable td:not(.gw-ost-act) {
    cursor: pointer;
}

.gw-order-greenware-stages .gw-ost-act {
    cursor: default;
}

.gw-order-greenware-stages .gw-ost-act .button {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
    padding-left: 4px;
    padding-right: 4px;
}

.gw-order-greenware-stages .gw-ost-row:last-child .gw-ost-metric,
.gw-order-greenware-stages .gw-ost-row:last-child .gw-stage-name-cell,
.gw-order-greenware-stages .gw-ost-row:last-child .gw-ost-act {
    border-bottom: none;
}

.gw-order-greenware-stages .gw-ost-metric {
    text-align: center;
    vertical-align: middle;
    padding: 8px 10px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 13px;
    color: #546e7a;
    border-bottom: 1px solid #eceff1;
    white-space: nowrap;
    background: transparent;
}

.gw-order-greenware-stages .gw-ost-metric.tooltip {
    cursor: help;
}

.gw-order-greenware-stages .gw-ost-metric--has-val.gw-ost-metric--in {
    color: #00838f;
    font-weight: 700;
}

.gw-order-greenware-stages .gw-ost-metric--has-val.gw-ost-metric--prod {
    color: #1565c0;
    font-weight: 700;
}

.gw-order-greenware-stages .gw-ost-metric--prod-done {
    color: #2e7d32;
    font-weight: 700;
}

.gw-order-greenware-stages .gw-ost-metric--has-val.gw-ost-metric--def {
    color: #c62828;
    font-weight: 700;
}

.gw-order-greenware-stages .gw-ost-metric--def-warn {
    background: #fff5f5;
}

.gw-order-greenware-stages .gw-ost-metric--has-val.gw-ost-metric--out {
    color: #6a1b9a;
    font-weight: 700;
}

.gw-order-greenware-stages .gw-ost-metric--has-val.gw-ost-metric--stock {
    color: #2e7d32;
    font-weight: 700;
}

.gw-order-greenware-stages .gw-ost-empty {
    color: #cbd5e1;
    font-weight: 400;
}

.gw-order-greenware-stages .gw-ost-act {
    text-align: center;
    vertical-align: middle;
    padding: 6px 6px;
    white-space: nowrap;
    border-bottom: 1px solid #eceff1;
    background: transparent;
    width: 88px;
    min-width: 88px;
    max-width: 88px;
    box-sizing: border-box;
}

.gw-order-greenware-stages .gw-stage-name-cell.gw-stage-name-cell {
    position: relative;
    vertical-align: top;
    box-sizing: border-box;
    padding: 0 !important;
    padding-top: 0 !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 0 !important;
    background: transparent;
    border-bottom: 1px solid #eceff1;
}

.gw-order-greenware-stages th,
.gw-order-greenware-stages td {
    overflow: visible;
    text-overflow: clip;
}

.gw-order-greenware-stages thead th {
    white-space: nowrap;
}

.gw-order-greenware-stages td.gw-col-produced,
.gw-order-greenware-stages th.gw-col-produced,
.gw-order-greenware-stages td.gw-col-defect,
.gw-order-greenware-stages th.gw-col-defect {
    text-align: center !important;
    vertical-align: middle;
}

.gw-order-greenware-stages .gw-stage-name-label {
    color: #1565c0;
    font-weight: 700;
}

.gw-order-greenware-stages .gw-stage-name-issue {
    flex-shrink: 0;
    line-height: 1;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
}

.gw-order-greenware-stages .gw-stage-name-issue--issue {
    color: #f57c00;
    cursor: help;
}

.gw-order-greenware-stages .gw-stage-name-issue--qtywarn {
    color: #c62828;
    cursor: help;
}

.gw-order-greenware-stages .gw-stage-name-issue--defwarn {
    color: #e65100;
    cursor: help;
}

.gw-order-greenware-stages tbody tr.gw-order-stage-row-qtywarn .gw-stage-name-issue--defwarn {
    color: #e65100 !important;
}

.gw-order-greenware-stages .gw-stage-name-hit {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    line-height: 1.3;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}

/* Có thanh: không padding a — tên cách cạnh bởi label, thanh full-bleed trái/phải/đáy */
.gw-order-greenware-stages .gw-stage-name-hit:not(.gw-stage-name-hit--no-progress) {
    padding-top: 1px;
}

/* Không thanh: tên cân giữa dọc, lề giống các cột 8px */
.gw-order-greenware-stages .gw-stage-name-hit--no-progress {
    justify-content: center;
    padding: 2px 8px;
}

/* Hàng tên + cảnh báo (cùng dòng): thanh tiến độ vẫn là flex-item riêng bên dưới */
.gw-order-greenware-stages .gw-stage-name-hit .gw-stage-name-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.gw-order-greenware-stages .gw-stage-name-hit:not(.gw-stage-name-hit--no-progress) .gw-stage-name-row {
    flex: 1 1 auto;
    min-height: 0;
    padding: 1px 8px 2px 8px;
}

.gw-order-greenware-stages .gw-stage-name-hit:not(.gw-stage-name-hit--no-progress) .gw-stage-name-label {
    flex: 1 1 auto;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    text-align: left;
    box-sizing: border-box;
}

.gw-order-greenware-stages .gw-stage-name-hit:not(.gw-stage-name-hit--no-progress) .gw-stage-name-issue {
    flex-shrink: 0;
    line-height: 1;
    white-space: nowrap;
}

.gw-order-greenware-stages .gw-stage-name-issue--piecework {
    color: #6a1b9a;
    font-size: 13px;
    cursor: help;
}

.gw-order-greenware-stages .gw-stage-name-issue--piecework i {
    vertical-align: -1px;
}

/* Không thanh: hàng tên full width — icon cảnh báo/khoán đẩy sang phải giống khi có thanh */
.gw-order-greenware-stages .gw-stage-name-hit--no-progress .gw-stage-name-row {
    width: 100%;
    max-width: 100%;
    padding: 0;
}

.gw-order-greenware-stages .gw-stage-name-hit--no-progress .gw-stage-name-label {
    flex: 1 1 auto;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    text-align: left;
    box-sizing: border-box;
}

.gw-order-greenware-stages .gw-order-stage-btn-transfer {
    background-color: #6a1b9a;
    border: 1px solid #5e1788;
    color: #fff;
}

.gw-order-greenware-stages .gw-order-stage-btn-transfer:hover {
    background-color: #5e1788;
    border-color: #4a148c;
    color: #fff;
}

.gw-order-greenware-stages .gw-ost-h--bulk-pick,
.gw-order-greenware-stages .gw-ost-bulk-pick-cell {
    width: 28px;
    min-width: 28px;
    max-width: 28px;
    padding: 4px 2px !important;
    box-sizing: border-box;
    vertical-align: middle;
}

.gw-order-greenware-stages .gw-ost-h--bulk-pick {
    border-bottom: 1px solid #e0e6ed;
}

.gw-ost-bulk-pick-cell .gw-bulk-pick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    cursor: pointer;
    vertical-align: middle;
}

.gw-bulk-pick-cb {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: #2e7d32;
}

.gw-order-greenware-stages .gw-stage-name-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
}

.gw-bulk-entry-btn.is-visible {
    display: inline-flex !important;
}

.gw-bulk-entry-btn--disabled,
.gw-bulk-entry-btn[aria-disabled="true"] {
    opacity: 0.65;
    cursor: default;
    pointer-events: auto;
}

/* Nhập liệu hàng loạt — bảng SP: scroll ngang + cột ảnh sticky */
.gw-bulk-products-wrap {
    margin-bottom: 12px;
}

.gw-bulk-products-wrap--done .gw-bulk-td-qty {
    font-size: 15px;
}

.gw-bulk-done-meta td:first-child {
    vertical-align: top;
}

.gw-bulk-products-wrap .gw-bulk-products-table {
    width: 100%;
    min-width: 640px;
    table-layout: fixed;
}

.gw-bulk-products-wrap .gw-bulk-col-stt,
.gw-bulk-products-wrap .gw-bulk-th-stt,
.gw-bulk-products-wrap .gw-bulk-td-stt {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
}

.gw-bulk-products-wrap .gw-bulk-col-photo {
    width: 92px;
    min-width: 92px;
}

.gw-bulk-products-wrap .gw-bulk-col-product {
    width: auto;
    min-width: 200px;
}

.gw-bulk-products-wrap .gw-bulk-col-order,
.gw-bulk-products-wrap .gw-bulk-th-order,
.gw-bulk-products-wrap .gw-bulk-td-order {
    width: 72px;
    min-width: 72px;
    max-width: 88px;
}

.gw-bulk-products-wrap .gw-bulk-col-produced,
.gw-bulk-products-wrap .gw-bulk-col-defect,
.gw-bulk-products-wrap .gw-bulk-th-qty,
.gw-bulk-products-wrap .gw-bulk-td-qty {
    width: 96px;
    min-width: 88px;
    max-width: 110px;
}

.gw-bulk-products-wrap .gw-bulk-th-product {
    text-align: left !important;
}

.gw-bulk-products-wrap .gw-bulk-td-product {
    white-space: normal;
    word-break: break-word;
}

.gw-bulk-products-wrap .gw-bulk-products-table input[type="number"] {
    width: 100%;
    max-width: 88px;
    margin: 0 auto;
    box-sizing: border-box;
}

.gw-bulk-products-wrap .gw-bulk-tfoot-label {
    text-align: right !important;
}

.gw-bulk-products-wrap .scroll-table thead th.sticky-photo {
    z-index: 16;
}

.gw-bulk-products-wrap .scroll-table tbody td.sticky-photo {
    z-index: 2;
}

.gw-order-greenware-stages .gw-order-stage-action-cell {
    width: 88px;
    min-width: 88px;
    max-width: 88px;
}

.gw-order-greenware-stages .gw-stage-name-hit--no-progress .gw-stage-name-issue {
    flex-shrink: 0;
    line-height: 1;
    white-space: nowrap;
}

.gw-order-greenware-stages .gw-stage-name-hit--no-progress .gw-stage-name-issue--piecework {
    flex-shrink: 0;
}

.gw-order-greenware-stages .gw-stage-name-hit .progress-container.gw-hangmoc-progress {
    position: static;
    flex: 0 0 5px;
    width: 100% !important;
    max-width: 100% !important;
    height: 5px;
    min-height: 5px;
    border-radius: 0;
    background: #e8f5e9;
    overflow: hidden;
    box-sizing: border-box;
    margin: 0;
    align-self: stretch;
}

.gw-order-greenware-stages .gw-hangmoc-progress .progress-bar {
    background: linear-gradient(90deg, #81c784, #43a047);
}

.gw-order-greenware-stages .gw-hangmoc-progress .progress-bar--gw-warn {
    background: linear-gradient(90deg, #ffb74d, #f57c00) !important;
}

/* Cảnh báo sản lượng (dung sai hoặc > công đoạn trước): cả hàng đỏ + thanh tiến độ đỏ */
.gw-order-greenware-stages tbody tr.gw-order-stage-row-qtywarn td {
    color: #c62828 !important;
}

.gw-order-greenware-stages tbody tr.gw-order-stage-row-qtywarn .gw-stage-name-label,
.gw-order-greenware-stages tbody tr.gw-order-stage-row-qtywarn td a:not(.button) {
    color: #c62828 !important;
}

.gw-order-greenware-stages tbody tr.gw-order-stage-row-qtywarn .gw-ost-metric--prod-done {
    color: #c62828 !important;
}

.gw-order-greenware-stages tbody tr.gw-order-stage-row-qtywarn .gw-hangmoc-progress .progress-bar--gw-warn {
    background: linear-gradient(90deg, #ef5350, #c62828) !important;
}

/* Viền dòng cuối — panel tự bo góc */
.gw-order-greenware-stages tbody tr:last-child td {
    border-bottom: none !important;
}

@media (max-width: 1199px) {
    #gwProductTable {
        min-width: 700px !important;
    }
}

/* Cài đặt: bảng này dùng %, không cần min-width: 600px của .scroll-table (gây bảng quá rộng) */
@media (max-width: 1199px) {
    .scroll-table.gw-stages-settings-table {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }
}

/* Cài đặt: danh sách công đoạn hàng mộc (setting_greenware_stages) — bảng 100% khung, không tràn PC */
#gwSettingsGreenwareStagesScrollWrapper {
    max-width: 100%;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    /* Tránh bảng đẩy vỡ layout: nếu nội dung rộng, cuộn ngang trong vùng này (cả PC) */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* width colgroup: chỉ dùng % (không dùng rem) để tổng 100% khớp vùng cha */
.gw-stages-settings-table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
    box-sizing: border-box;
}

/* Cột công đoạn (nhiều dòng): căn trên; cột bộ phận / tỉ lệ: căn giữa cả 2 trục */
.gw-stages-settings-table th,
.gw-stages-settings-table td {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
    box-sizing: border-box;
    vertical-align: middle;
}

.gw-stages-settings-table th.gw-stages-th-stage,
.gw-stages-settings-table td.gw-stage-name-cell {
    vertical-align: top;
}

/* Cột bộ phận / tỉ lệ: căn giữa ô (ngang + dọc) */
.gw-stages-settings-table th.gw-stages-th-dept,
.gw-stages-settings-table tr td:nth-child(3),
.gw-stages-settings-table th.gw-stages-th-pct,
.gw-stages-settings-table tr td:nth-child(4),
.gw-stages-settings-table tr td:nth-child(5) {
    text-align: center;
    vertical-align: middle;
}

/* Cột chỉ mũi tên: cột hẹp, xếp 2 button theo cột dọc */
.gw-stages-settings-table th.gw-stages-th-sort,
.gw-stages-settings-table td.gw-stage-sort-cell {
    text-align: center;
    white-space: nowrap;
    padding: 6px 2px;
    vertical-align: middle;
}

.gw-stages-settings-table .gw-stage-sort-arrows {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 2px;
}

/* Tiêu đề: tỉ lệ / bật / thao tác — một dòng cho đủ chữ */
.gw-stages-settings-table th.gw-stages-th-pct,
.gw-stages-settings-table th.gw-stages-th-toggle,
.gw-stages-settings-table th.gw-stages-th-actions {
    white-space: nowrap;
    line-height: 1.2;
    text-align: center;
    font-weight: 600;
    padding: 6px 4px;
    vertical-align: middle;
}

/* Header cột bộ phận, công đoạn: 1 dòng */
.gw-stages-settings-table th.gw-stages-th-dept,
.gw-stages-settings-table th.gw-stages-th-stage {
    white-space: nowrap;
}

/* Cột bật/tắt: vừa phần tử switch, không kéo giãn cả bảng */
.gw-stages-settings-table td.gw-stage-toggle-cell {
    width: 1%;
    white-space: nowrap;
    vertical-align: middle;
    text-align: center;
    padding: 6px 4px;
}

/* Thao tác: 2 nút, không bắt cả bảng phình ngang */
.gw-stages-settings-table th:last-child,
.gw-stages-settings-table td:last-child {
    width: 1%;
    min-width: 0;
    white-space: nowrap;
    vertical-align: middle;
    text-align: center;
    padding: 6px 4px;
}

/* Chi tiết nhập liệu hàng mộc (greenware_stage_detail) */
.gw-stage-detail-shell {
    display: flow-root;
    --gw-detail-gutter: 8px;
    box-sizing: border-box;
}

.gw-stage-detail-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: var(--gw-detail-gutter);
    box-sizing: border-box;
}

.gw-stage-detail-title {
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.gw-stage-detail-shell .gw-ledger-stats-banner-outer,
.gw-stage-detail-shell .gw-issues-panel-outer {
    margin-bottom: var(--gw-detail-gutter);
}

.gw-stage-detail-alert-wrap {
    margin: var(--gw-detail-gutter);
}

/* Settings — users / groups / greenware: gutter do .main */
.gw-settings-page {
    padding: 0;
    box-sizing: border-box;
}

.gw-settings-page>.settings-page-title {
    margin-inline: 0;
    margin-bottom: 12px;
}

/* Tab bar trong khối bgwhite: top + bottom border (không bọc gw-workflow-section) */
.gw-settings-page>.gw-workflow-tab-bar,
.wrapper-payroll.bgwhite>.gw-workflow-tab-bar {
    border-top: 1px solid #e0e0e0;
}

.gw-settings-workflow-outer {
    margin-inline: 0px;
    box-sizing: border-box;
}

.gw-settings-workflow-outer .gw-workflow-section {
    width: 100%;
}

/* Vùng thông báo redirect (?msg=): .alert bên trong không margin kép */

.gw-stage-detail-alert-wrap .alert {
    margin: 0;
}

.gw-stage-detail-alert-wrap .alert+.alert {
    margin-top: 10px;
}

/* Alert trực tiếp trong shell (vd. cảnh báo sản phẩm thiếu công đoạn): tránh collapse margin-top */
.gw-stage-detail-shell>.alert:first-child {
    margin-top: 0 !important;
}

.gw-form-product-confirm {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border: 2px solid #90caf9;
    border-radius: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    box-sizing: border-box;
}

.gw-form-product-confirm .gw-form-product-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    flex-shrink: 0;
}

/* Trần nạp sản xuất (form thêm/sửa bản ghi) — còn lại cập nhật bằng JS */
.gw-produce-cap-hint--exhausted #gwProduceCapRemainVal {
    color: #c62828;
}

#gwEntryForm input[name="qty_defective"]:disabled {
    background: #f5f5f5;
    color: #9e9e9e;
    cursor: not-allowed;
}

/* Canvas vẽ chữ ký: kích thước hiển thị do JS (280×120); buffer pixel nhiều hơn theo DPR */
.gw-sig-canvas {
    box-sizing: border-box;
    border: 2px solid #90caf9;
    border-radius: 6px;
    background: #fff;
    touch-action: none;
    cursor: crosshair;
    display: block;
    vertical-align: top;
    pointer-events: auto;
}

/* Khung xem trước chữ ký (form sửa + danh sách bản ghi) */
.gw-sig-preview-box {
    display: inline-block;
    background: #fff;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.gw-sig-preview-box img {
    max-width: 280px;
    max-height: 100px;
    display: block;
    background: #fff;
    vertical-align: middle;
}

.gw-entry-col-sig .gw-sig-preview-box--list img {
    max-width: 180px;
}

/* Khối chữ ký form nhập liệu mộc — tên đặt dưới canvas */
.gw-sig-block {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.gw-sig-block .gw-sig-canvas,
.gw-sig-block .gw-sig-preview-box {
    width: 100%;
    max-width: 280px;
}

.gw-sig-name-field {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    max-width: 280px;
}

.gw-sig-name-field label {
    margin: 0;
}

.gw-sig-name-input {
    width: 100%;
    max-width: 280px;
    box-sizing: border-box;
}

.gw-sig-name-input:disabled {
    opacity: 1;
    cursor: default;
    background: #f0f2f5;
    color: #333;
}

/* Greenware stage detail — ledger KPI + workflow tabs (greenware_stage_detail.php) */
.gw-ledger-stats-banner .gw-transfer-drill-btn {
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    font: inherit;
    font-size: inherit;
    line-height: inherit;
    font-weight: 700;
    color: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.gw-ledger-stats-banner .gw-transfer-drill-btn:hover {
    opacity: 0.85;
}

.gw-ledger-stats-banner .kpi-strip__card--product {
    align-items: center;
    --kpi-accent: #5e35b1;
    border-top-color: var(--kpi-accent);
}

.gw-ledger-stats-banner .gw-kpi-product-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    width: 100%;
}

.gw-ledger-stats-banner .gw-kpi-product-thumb {
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    max-width: 50px;
    max-height: 50px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    background: #fff;
    flex-shrink: 0;
    cursor: pointer;
    box-sizing: border-box;
    vertical-align: middle;
}

.gw-ledger-stats-banner .gw-kpi-product-thumb:hover {
    opacity: 0.88;
}

.gw-ledger-stats-banner .gw-kpi-product-thumb:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: 0;
}

.gw-ledger-stats-banner .gw-kpi-product-thumb--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9e9e9e;
    font-size: 20px;
}

.gw-ledger-stats-banner .gw-kpi-product-meta {
    min-width: 0;
    flex: 1;
    line-height: 1.35;
}

.gw-ledger-stats-banner .gw-kpi-product-code {
    font-size: 15px;
    line-height: 1.3;
}

.gw-ledger-stats-banner .gw-kpi-product-qty {
    margin-top: 4px;
    font-size: 13px;
    color: #5c6b7a;
}

.gw-stats-kpi-area {
    min-width: 0;
}

.gw-stage-detail-shell .gw-workflow-section--stage-detail {
    margin-bottom: 0;
    border-left: none;
    border-right: none;
    border-radius: 0;
}

.gw-stage-detail-shell .gw-workflow-tab {
    padding: 10px 8px;
    font-size: 14px;
}

.gw-workflow-section {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    box-sizing: border-box;
    width: 100%;
}

.gw-workflow-tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 1px solid #e0e0e0;
    background: #f5f7fa;
}

.gw-workflow-tab,
button.gw-workflow-tab,
a.gw-workflow-tab {
    flex: 1 1 auto;
    min-width: 0;
    padding: 12px 14px;
    border: none;
    border-bottom: 3px solid transparent;
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    font-size: 15px;
    color: #546e7a;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
    transition: background .15s, color .15s, border-color .15s;
}

button.gw-workflow-tab,
a.gw-workflow-tab {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gw-workflow-tab:hover,
button.gw-workflow-tab:hover,
a.gw-workflow-tab:hover {
    background: #eceff1;
    color: #1565c0;
}

.gw-workflow-tab.is-active,
button.gw-workflow-tab.is-active,
a.gw-workflow-tab.is-active {
    background: #fff;
    color: #1565c0;
    border-bottom-color: #1565c0;
}

.gw-workflow-tab-bar .dropdown-menu.gw-workflow-tab-dropdown {
    flex: 0 0 auto;
    display: flex;
    align-items: stretch;
}

.gw-workflow-tab-bar .dropdown-menu .menu-trigger.gw-workflow-tab {
    flex: 0 0 auto;
}

/* Chi tiết KH: mọi tab (kể cả Download, Xóa) cùng width */
.customer-detail-tab-bar>a.gw-workflow-tab,
.customer-detail-tab-bar>.dropdown-menu.gw-workflow-tab-dropdown {
    flex: 1 1 0;
    min-width: 0;
}

.customer-detail-tab-bar>.dropdown-menu.gw-workflow-tab-dropdown {
    display: flex;
    align-items: stretch;
}

.customer-detail-tab-bar>.dropdown-menu.gw-workflow-tab-dropdown .menu-trigger.gw-workflow-tab {
    flex: 1 1 auto;
    width: 100%;
}

/* Chi tiết KH: cuộn ngang tab trên tablet/mobile — đồng bộ order-tabs-scroll */
.customer-detail-tab-bar-scroll {
    position: relative;
    overflow: visible;
    max-width: 100%;
}

@media (max-width: 1199px) {
    .customer-detail-tab-bar-scroll .customer-detail-tab-bar {
        flex-wrap: nowrap;
        align-items: stretch;
        overflow-x: auto;
        overflow-y: hidden;
        touch-action: pan-x;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: auto;
        scrollbar-width: none;
        max-width: 100%;
    }

    .customer-detail-tab-bar-scroll:not(.is-scrollable) .customer-detail-tab-bar {
        overflow-x: hidden;
    }

    .customer-detail-tab-bar-scroll .customer-detail-tab-bar::-webkit-scrollbar {
        display: none;
        height: 0;
    }

    .customer-detail-tab-bar-scroll .customer-detail-tab-bar>a.gw-workflow-tab,
    .customer-detail-tab-bar-scroll .customer-detail-tab-bar>.dropdown-menu.gw-workflow-tab-dropdown {
        flex: 0 0 auto;
        min-width: max-content;
        white-space: nowrap;
    }

    .customer-detail-tab-bar-scroll .customer-detail-tab-bar>.dropdown-menu.gw-workflow-tab-dropdown .menu-trigger.gw-workflow-tab {
        flex: 0 0 auto;
        width: auto;
    }

    .customer-detail-tab-bar-scroll .customer-detail-tab-bar>a.gw-workflow-tab,
    .customer-detail-tab-bar-scroll .customer-detail-tab-bar .dropdown-menu .menu-trigger.gw-workflow-tab {
        padding: 10px 14px;
        font-size: 14px;
        -webkit-tap-highlight-color: transparent;
        transition: background .15s, color .15s, border-color .15s;
    }

    .customer-detail-tab-bar-scroll .customer-detail-tab-bar>a.gw-workflow-tab:hover:not(.is-active),
    .customer-detail-tab-bar-scroll .customer-detail-tab-bar>a.gw-workflow-tab:active:not(.is-active) {
        background: transparent;
        color: #546e7a;
        border-bottom-color: transparent;
    }

    .customer-detail-tab-bar-scroll .customer-detail-tab-bar .dropdown-menu .menu-trigger.gw-workflow-tab:hover:not(.is-active) {
        background: transparent;
        color: #546e7a;
        border-bottom-color: transparent;
    }

    .customer-detail-tab-bar-scroll .dropdown-menu.dropdown-click:hover .menu-content {
        display: none !important;
        opacity: 0 !important;
    }

    .customer-detail-tab-bar-scroll .dropdown-menu.is-open:not(.force-close) .menu-content {
        display: block !important;
        opacity: 1 !important;
        transform: none !important;
        translate: none !important;
        position: fixed !important;
        z-index: 10100;
        margin-top: 0;
        position-anchor: none;
    }

    .customer-detail-tab-bar-scroll:has(.dropdown-menu.is-open) {
        z-index: 10080;
    }
}

@media (min-width: 769px) {
    .customer-detail-tab-bar-scroll .dropdown-menu.dropdown-click:hover .menu-content {
        display: none !important;
        opacity: 0 !important;
    }

    .customer-detail-tab-bar-scroll .dropdown-menu.is-open:not(.force-close) .menu-content {
        display: block !important;
        opacity: 1 !important;
    }

    .customer-detail-tab-bar-scroll:has(.dropdown-menu.is-open) {
        z-index: 10080;
    }
}

@media (max-width: 640px) {
    .customer-detail-tab-bar-scroll .customer-detail-tab-bar>a.gw-workflow-tab,
    .customer-detail-tab-bar-scroll .customer-detail-tab-bar>.dropdown-menu.gw-workflow-tab-dropdown .menu-trigger.gw-workflow-tab {
        flex: 0 0 auto;
        width: auto;
        justify-content: center;
        text-align: center;
    }
}

.gw-workflow-tab-bar .dropdown-menu .menu-content {
    top: calc(100% - 1px);
    padding: 10px 0;
    min-width: 0;
    max-width: min(480px, calc(100vw - 16px));
    overflow-wrap: anywhere;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.gw-workflow-tab-bar .dropdown-menu .menu-content a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    white-space: normal;
    border-bottom: none;
    transition: background 0.2s;
}

.gw-workflow-tab-bar .dropdown-menu .menu-content a:hover {
    background: #f2f6ff;
    color: #007bff;
    border-bottom: none;
}

a.gw-workflow-tab.gw-workflow-tab--danger {
    color: #c62828;
    flex: 0 1 auto;
}

.customer-detail-tab-bar>a.gw-workflow-tab.gw-workflow-tab--danger {
    flex: 1 1 0;
}

a.gw-workflow-tab.gw-workflow-tab--danger:hover {
    background: #ffebee;
    color: #b71c1c;
    border-bottom-color: #ef5350;
}

.bgwhite>.gw-workflow-section,
.wrapper-payroll.bgwhite>.gw-workflow-section {
    margin-bottom: 0;
}

.gw-workflow-tab-panels {
    padding: 8px var(--gw-detail-gutter, 8px);
    box-sizing: border-box;
    min-width: 0;
}

.gw-stage-detail-shell .gw-workflow-tab-panels {
    padding-inline: var(--gw-detail-gutter);
}

.gw-workflow-tab-panel {
    box-sizing: border-box;
    min-width: 0;
}

.gw-workflow-tab-panel[hidden] {
    display: none !important;
}

/* Nội dung tab — spacing thống nhất (thay margin inline rời rạc) */
.gw-workflow-tab-intro {
    margin: 0 0 10px;
    line-height: 1.45;
}

.gw-workflow-tab-heading {
    margin: 0 0 10px;
    line-height: 1.35;
}

.gw-workflow-tab-panel>.alert:first-child,
.gw-workflow-tab-panel>.gw-workflow-tab-intro:first-child,
.gw-workflow-tab-panel>.gw-workflow-tab-heading:first-child {
    margin-top: 0;
}

.gw-workflow-tab-panel .settings-table.gw-workflow-form-table {
    margin: 0;
}

.gw-workflow-tab-panel .gw-workflow-sig-row {
    margin-top: 15px;
}

.gw-workflow-form-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.gw-workflow-tab-panel .piecework-detail-expand-panel {
    margin-bottom: 12px;
}

.gw-workflow-tab-panel .gw-entry-list {
    margin-bottom: 0;
}

.gw-workflow-tab-panel .gw-entry-month:last-child {
    margin-bottom: 0;
}

.gw-workflow-tab-panel .piecework-detail-expand-panel:last-child {
    margin-bottom: 0;
}

.gw-producer-stats-panel--in-tab {
    border: 1px solid #dce3e8;
    border-radius: 10px;
    background: #fff;
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin: 0 0 14px;
}

.gw-producer-stats-panel--in-tab:last-child {
    margin-bottom: 0;
}

.gw-producer-stats-panel--in-tab .gw-producer-stats-panel__head {
    padding: 0 0 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid #e8edf0;
}

.gw-producer-stats-panel--in-tab .gw-producer-stats-kpis {
    margin-inline: 0;
    margin-bottom: 8px;
}

.gw-producer-stats-panel--in-tab .gw-producer-stats-kpi__label {
    font-size: 12px;
}

.gw-producer-stats-panel--in-tab .gw-producer-stats-kpi__value {
    font-size: 17px;
}

.gw-producer-stats-panel--in-tab .gw-producer-stats-kpi__unit {
    font-size: 12px;
}

.gw-producer-stats-panel--in-tab .gw-producer-stats-table-wrap {
    margin-inline: 0;
}

.gw-producer-stats-panel--in-tab .gw-producer-stats-table:not(.piecework-detail-products-table) {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    font-size: 14px;
}

.gw-producer-stats-panel--in-tab .gw-producer-stats-table:not(.piecework-detail-products-table) thead th {
    font-size: 11px;
    padding: 9px 10px;
}

.gw-producer-stats-panel--in-tab .gw-producer-stats-table:not(.piecework-detail-products-table) tbody td,
.gw-producer-stats-panel--in-tab .gw-producer-stats-table:not(.piecework-detail-products-table) tfoot td {
    padding: 9px 10px;
}

.gw-producer-stats-panel--in-tab .gw-producer-stats-table:not(.piecework-detail-products-table):not(.piecework-detail-worker-stats-table) .gw-producer-stats-table__rank {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
}

.gw-producer-stats-panel--in-tab .gw-producer-stats-table:not(.piecework-detail-products-table):not(.piecework-detail-worker-stats-table) .gw-producer-stats-table__name {
    width: auto;
    min-width: 120px;
    max-width: none;
}

.gw-producer-stats-panel--in-tab .gw-producer-stats-table:not(.piecework-detail-products-table):not(.piecework-detail-worker-stats-table) .gw-producer-stats-table__num {
    width: 72px;
    min-width: 72px;
    max-width: 72px;
}

.gw-producer-stats-panel--in-tab .gw-producer-stats-table:not(.piecework-detail-products-table):not(.piecework-detail-worker-stats-table) .gw-producer-stats-table__share {
    width: 148px;
    min-width: 148px;
    max-width: 148px;
}

.gw-producer-stats-panel--in-tab .gw-producer-stats-worker {
    gap: 8px;
}

.gw-producer-stats-panel--in-tab .gw-producer-stats-worker__avatar {
    width: 32px;
    height: 32px;
}

.gw-producer-stats-panel--in-tab .gw-producer-stats-worker__name {
    font-size: 14px;
    font-weight: 600;
}

.gw-producer-stats-panel--in-tab .gw-producer-stats-share {
    gap: 8px;
}

.gw-producer-stats-panel--in-tab .gw-producer-stats-progress.progress-container {
    flex: 1 1 auto;
    width: auto;
    min-width: 72px;
    height: 9px;
    margin: 0;
}

.gw-producer-stats-panel--in-tab .gw-producer-stats-share__pct {
    min-width: 34px;
    font-size: 11px;
    font-weight: 700;
}

.gw-producer-stats-panel--in-tab .gw-producer-stats-panel__title {
    font-size: 15px;
}

.gw-producer-stats-panel--daily .gw-producer-stats-progress .progress-bar {
    background: linear-gradient(90deg, #42a5f5, #1565c0);
}

.gw-producer-stats-panel--piecework .gw-producer-stats-progress .progress-bar {
    background: linear-gradient(90deg, #ba68c8, #6a1b9a);
}

.gw-stage-detail-shell a.gw-workflow-tab {
    text-decoration: none;
}

.gw-stage-detail-shell a.gw-workflow-tab:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: -2px;
}


.gw-stage-detail-shell .gw-issues-panel-outer {
    margin-bottom: var(--gw-detail-gutter);
}

.gw-stage-detail-shell .gw-issues-panel-outer>.piecework-detail-expand-panel {
    margin: 0;
    padding: 8px var(--gw-detail-gutter);
    border-radius: 0;
    border-left: none;
    border-right: none;
}

/* Panel thông báo tắc SX — card gọn, typography thống nhất */
.gw-issues-panel {
    font-size: 13px;
    line-height: 1.45;
}

.gw-issues-panel__title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #e65100;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.gw-issues-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 28px;
}

.gw-issues-panel__head-right {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-left: auto;
}

.gw-issues-panel__counts {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.gw-issues-panel__count {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
}

.gw-issues-panel__count--open {
    color: #e65100;
    background: rgba(230, 81, 0, 0.1);
}

.gw-issues-history-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    padding: 3px 8px 3px 7px;
    border: 1px solid #c5e1a5;
    border-radius: 999px;
    background: rgba(85, 139, 47, 0.08);
    color: #558b2f;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.gw-issues-history-toggle:hover,
.gw-issues-history-toggle:focus-visible {
    background: rgba(85, 139, 47, 0.14);
    border-color: #aed581;
    color: #33691e;
    outline: none;
}

.gw-issues-history-toggle__icon {
    font-size: 10px;
    opacity: 0.85;
}

.gw-issues-history-toggle__chev {
    font-size: 9px;
    opacity: 0.75;
    transition: transform 0.15s ease;
}

.gw-issues-history-toggle.is-open .gw-issues-history-toggle__chev {
    transform: rotate(180deg);
}

.gw-issues-panel--resolved-only:not(.gw-issues-panel--history-open) {
    padding-bottom: 6px;
}

.gw-issues-panel--resolved-only .gw-issues-panel__head {
    margin-bottom: 0;
}

.gw-issues-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.gw-issues-panel--resolved-only:not(.gw-issues-panel--history-open) .gw-issues-list--open {
    margin-top: 0;
}

.gw-issues-list--resolved {
    display: none;
    margin-top: 10px;
}

.gw-issues-list--resolved.is-open {
    display: flex;
}

.gw-issues-panel--resolved-only .gw-issues-list--resolved.is-open {
    margin-top: 8px;
}

.gw-issue-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 12px;
    box-sizing: border-box;
}

.gw-issue-card--open {
    border-left: 3px solid #f57c00;
}

.gw-issue-card--resolved {
    border-left: 3px solid #9e9e9e;
    background: #fafafa;
}

.gw-issue-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.gw-issue-card__head-left {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.gw-issue-card__status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.2;
}

.gw-issue-card__status--open {
    color: #e65100;
}

.gw-issue-card__status--open .fa-circle {
    font-size: 7px;
    vertical-align: middle;
}

.gw-issue-card__status--resolved {
    color: #558b2f;
}

.gw-issue-card__priority {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
}

.gw-issue-card__priority--urgent {
    color: #b71c1c;
    background: #ffebee;
}

.gw-issue-card__priority--high {
    color: #e65100;
    background: #fff3e0;
}

.gw-issue-card__priority--normal {
    color: #1565c0;
    background: #e3f2fd;
}

.gw-issue-card__priority--low {
    color: #546e7a;
    background: #eceff1;
}

.gw-issue-card__issue-date {
    font-size: 12px;
    font-weight: 500;
    color: #78909c;
    white-space: nowrap;
}

.gw-issue-card__product {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 700;
    color: #263238;
    line-height: 1.35;
}

.gw-issue-card__message {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 400;
    color: #424242;
    line-height: 1.45;
}

.gw-issue-card__meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-top: 8px;
    border-top: 1px solid #eceff1;
}

.gw-issue-card__meta-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 12px;
    line-height: 1.4;
    min-width: 0;
}

.gw-issue-card__meta-row--resolve .gw-issue-card__meta-value {
    color: #558b2f;
    font-weight: 600;
}

.gw-issue-card__meta-label {
    flex: 0 0 42px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #90a4ae;
}

.gw-issue-card__meta-value {
    flex: 1 1 auto;
    min-width: 0;
    color: #607d8b;
    word-break: break-word;
}

.gw-issue-card__actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
}

.gw-stage-detail-shell .gw-ledger-stats-banner-outer {
    margin-bottom: var(--gw-detail-gutter);
}

.gw-workflow-form-table {
    width: 100%;
    max-width: 100%;
}

.gw-workflow-form-table td input[type="text"],
.gw-workflow-form-table td input[type="number"],
.gw-workflow-form-table td input[type="date"],
.gw-workflow-form-table td select,
.gw-workflow-form-table td textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.gw-workflow-sig-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.gw-workflow-sig-row .gw-sig-block {
    flex: 1 1 calc(50% - 14px);
    min-width: 260px;
    max-width: none;
    box-sizing: border-box;
}

/* Chuyển đi / Nhận tồn: 3 chữ ký trên một hàng (PC) */
@media (min-width: 641px) {
    .gw-workflow-sig-row--cols3 {
        flex-wrap: nowrap;
        gap: 10px;
    }

    .gw-workflow-sig-row--cols3 .gw-sig-block {
        flex: 1 1 0;
        min-width: 0;
    }

    .gw-workflow-sig-row--cols3 .gw-sig-block .gw-sig-canvas,
    .gw-workflow-sig-row--cols3 .gw-sig-block .gw-sig-preview-box {
        max-width: 100%;
    }

    .gw-workflow-sig-row--cols3 .gw-sig-name-field,
    .gw-workflow-sig-row--cols3 .gw-sig-name-input {
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .gw-stage-detail-shell {
        --gw-detail-gutter: 4px;
    }

    .gw-stage-detail-header {
        gap: 6px;
        padding-block: 6px;
    }

    .gw-stage-detail-title {
        font-size: 18px;
    }

    .gw-workflow-tab-panels {
        padding-block: 6px;
    }

    .gw-workflow-tab {
        flex: 1 1 100%;
        font-size: 14px;
        padding: 10px 8px;
    }

    .gw-workflow-form-table tr {
        display: block;
    }

    .gw-workflow-form-table td {
        display: block;
        width: 100% !important;
        white-space: normal;
    }

    .gw-workflow-form-table td:first-child {
        padding-bottom: 4px;
        border-bottom: none;
    }

    .gw-workflow-sig-row .gw-sig-block,
    .gw-workflow-sig-row--cols3 .gw-sig-block {
        flex: 1 1 100%;
        min-width: 0;
    }
}

/* Gợi ý tìm nhân viên — dropdown floating (vị trí do JS: flip + max-height theo viewport) */
.gw-producer-name-wrap {
    position: relative;
}

.gw-producer-worker-suggest {
    display: none;
    box-sizing: border-box;
}

.gw-producer-worker-suggest.gw-producer-worker-suggest--open {
    display: block;
    position: fixed;
    z-index: 10050;
    margin: 0;
    width: auto;
    max-width: none;
    -webkit-overflow-scrolling: touch;
}

.gw-producer-worker-searchresults {
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
    gap: 6px;
    align-content: flex-start;
    padding: 6px;
    border: 1px solid #bdbdbd;
    border-radius: 8px;
    background: #fafafa;
    box-sizing: border-box;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.gw-producer-worker-searchresults .gw-worker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

.gw-producer-worker-searchresults .gw-worker-item .avatar-wrapper img {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.gw-producer-worker-searchresults .gw-worker-item__text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
    flex: 1;
}

.gw-producer-worker-searchresults .gw-worker-item__name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gw-producer-worker-searchresults .gw-worker-item__dept {
    font-size: 11px;
    color: #757575;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Thống kê nhân viên — chi tiết công đoạn hàng mộc (bảng KPI) */
.gw-producer-stats {
    margin: 0 0 16px 0;
    border: 1px solid #cfd8dc;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.gw-producer-stats__header {
    padding: 12px 14px 10px;
    background: linear-gradient(180deg, #f5f7fa 0%, #eef1f5 100%);
    border-bottom: 1px solid #dce3e8;
}

.gw-producer-stats__title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #37474f;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.3;
}

.gw-producer-stats__title .fas {
    color: #546e7a;
    font-size: 14px;
}

.gw-producer-stats__subtitle {
    margin: 4px 0 0;
    line-height: 1.4;
}

.gw-producer-stats__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.gw-producer-stats--panels-2 .gw-producer-stats__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gw-producer-stats-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-bottom: 1px solid #dce3e8;
}

.gw-producer-stats--panels-2 .gw-producer-stats-panel:first-child {
    border-right: 1px solid #dce3e8;
}

.gw-producer-stats--panels-2 .gw-producer-stats-panel {
    border-bottom: none;
}

.gw-producer-stats-panel.gw-producer-stats-panel--in-tab {
    border: 1px solid #dce3e8;
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin: 0 0 14px;
}

.gw-producer-stats-panel.gw-producer-stats-panel--in-tab:last-child {
    margin-bottom: 0;
}

.gw-producer-stats-panel__head {
    padding: 10px 12px 8px;
    border-bottom: 1px solid #e8edf0;
}

.gw-producer-stats-panel__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.gw-producer-stats-panel__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 12px;
    flex-shrink: 0;
}

.gw-producer-stats-panel--daily .gw-producer-stats-panel__title {
    color: #1565c0;
}

.gw-producer-stats-panel--daily .gw-producer-stats-panel__icon {
    background: rgba(21, 101, 192, 0.12);
    color: #1565c0;
}

.gw-producer-stats-panel--piecework .gw-producer-stats-panel__title {
    color: #6a1b9a;
}

.gw-producer-stats-panel--piecework .gw-producer-stats-panel__icon {
    background: rgba(106, 27, 154, 0.12);
    color: #6a1b9a;
}

.gw-producer-stats-panel--all .gw-producer-stats-panel__title {
    color: #37474f;
}

.gw-producer-stats-panel--all .gw-producer-stats-panel__icon {
    background: rgba(55, 71, 79, 0.1);
    color: #546e7a;
}

/* kpi-block — dải KPI tóm tắt; specs: .cursor/rules/kpi-block-layout.mdc */
.gw-producer-stats-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    background: #e0e0e0;
    border-bottom: 1px solid #e8edf0;
    align-items: stretch;
}

.gw-producer-stats-kpi {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    padding: 10px 6px 8px;
    background: #fafbfc;
    text-align: center;
    min-height: 58px;
    box-sizing: border-box;
}

.gw-producer-stats-kpi__label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #78909c;
    line-height: 1.2;
    flex: 0 0 auto;
    min-height: 13px;
}

.gw-producer-stats-kpi__value {
    font-size: 17px;
    font-weight: 700;
    color: #263238;
    line-height: 1.15;
    flex: 0 0 auto;
    min-height: 19px;
}

.gw-producer-stats-kpi__unit {
    font-size: 11px;
    font-weight: 600;
    color: #90a4ae;
    line-height: 1.2;
    flex: 0 0 auto;
    min-height: 13px;
}

.gw-producer-stats-kpi__unit--placeholder {
    visibility: hidden;
    user-select: none;
    pointer-events: none;
}

.gw-producer-stats-kpi--primary .gw-producer-stats-kpi__value {
    color: #1565c0;
}

.gw-producer-stats-kpi--danger .gw-producer-stats-kpi__value {
    color: #c62828;
}

.gw-producer-stats-kpi--success .gw-producer-stats-kpi__value {
    color: #2e7d32;
}

.gw-producer-stats-kpi--purple .gw-producer-stats-kpi__value {
    color: #7b1fa2;
}

/* Hiệu suất định mức HĐ khoán — tím (vượt) / xanh (đạt) / đỏ (dưới) */
.pw-norm-eff-bar--above {
    background: linear-gradient(90deg, #ba68c8, #7b1fa2) !important;
}

.pw-norm-eff-bar--on {
    background: linear-gradient(90deg, #66bb6a, #2e7d32) !important;
}

.pw-norm-eff-bar--below {
    background: linear-gradient(90deg, #ef5350, #c62828) !important;
}

.pw-norm-eff-text--above {
    color: #7b1fa2;
}

.pw-norm-eff-text--on {
    color: #2e7d32;
}

.pw-norm-eff-text--below {
    color: #c62828;
}

.gw-producer-stats-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px 16px;
    color: #90a4ae;
    font-size: 13px;
    text-align: center;
    line-height: 1.45;
}

.gw-producer-stats-empty .fas {
    font-size: 22px;
    opacity: 0.55;
}

.gw-producer-stats-table-wrap {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
}

.gw-producer-stats-table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    font-size: 13px;
    line-height: 1.35;
    table-layout: fixed;
}

.gw-producer-stats-table thead th,
.gw-producer-stats-table tbody td,
.gw-producer-stats-table tfoot td {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

.gw-producer-stats-table thead th {
    padding: 8px 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #607d8b;
    background: #f0f4f7;
    border-bottom: 1px solid #dce3e8;
}

.gw-producer-stats-table tbody td,
.gw-producer-stats-table tfoot td {
    padding: 9px 10px;
    border-bottom: 1px solid #eceff1;
    vertical-align: middle;
}

.gw-producer-stats-table tbody tr:last-child td {
    border-bottom: none;
}

.gw-producer-stats-table tbody tr:hover {
    background: rgba(21, 101, 192, 0.04);
}

.gw-producer-stats-panel--piecework .gw-producer-stats-table tbody tr:hover {
    background: rgba(106, 27, 154, 0.05);
}

.gw-producer-stats-table tfoot td {
    background: #f5f7fa;
    border-top: 2px solid #cfd8dc;
    border-bottom: none;
    font-weight: 700;
}

.gw-producer-stats-table__rank {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    text-align: center;
    color: #90a4ae;
    font-weight: 600;
}

.gw-producer-stats-table__name {
    width: auto;
    min-width: 120px;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

.gw-producer-stats-table__num {
    width: 68px;
    min-width: 68px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.gw-producer-stats-table__num--prod {
    font-weight: 700;
    color: #1565c0;
}

.gw-producer-stats-panel--piecework .gw-producer-stats-table__num--prod {
    color: #6a1b9a;
}

.gw-producer-stats-table__num--def {
    font-weight: 700;
    color: #c62828;
}

.gw-producer-stats-table__share {
    width: 64px;
    min-width: 64px;
    max-width: 64px;
}

.gw-producer-stats-table__foot-label {
    text-align: right;
    color: #546e7a;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.gw-producer-stats-table__foot-pct {
    font-variant-numeric: tabular-nums;
    color: #546e7a;
}

.gw-producer-stats-worker {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.gw-producer-stats-worker__avatar {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    margin: 0;
    border: 1px solid #e0e0e0;
    box-shadow: none;
}

.gw-producer-stats-worker__avatar--empty {
    background: #eceff1;
}

.gw-producer-stats-worker__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 32px;
    color: #90a4ae;
    font-size: 14px;
}

.gw-producer-stats-worker__name {
    font-weight: 600;
    color: #263238;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    flex-shrink: 0;
}

.gw-producer-stats-share {
    display: flex;
    align-items: center;
    gap: 3px;
    min-width: 0;
    width: 100%;
}

.gw-producer-stats-share__track {
    flex: 1 1 auto;
    height: 5px;
    border-radius: 3px;
    background: #eceff1;
    overflow: hidden;
    min-width: 22px;
}

.gw-producer-stats-share__fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #42a5f5, #1565c0);
    min-width: 2px;
    transition: width 0.2s ease;
}

.gw-producer-stats-panel--piecework .gw-producer-stats-share__fill {
    background: linear-gradient(90deg, #ba68c8, #6a1b9a);
}

.gw-producer-stats-share__pct {
    flex: 0 0 auto;
    font-size: 10px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #546e7a;
    min-width: 26px;
    text-align: right;
}

/* product-table — danh sách SP (piecework detail); specs: .cursor/rules/product-table-layout.mdc */
.piecework-detail-products-panel {
    margin-top: 14px;
    border: 1px solid #dce3e8;
    border-radius: 10px;
    background: #fff;
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.piecework-detail-products-panel__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 0 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid #e8edf0;
}

.piecework-detail-products-panel__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #1565c0;
}

.piecework-detail-products-panel__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 12px;
    flex-shrink: 0;
    background: rgba(21, 101, 192, 0.12);
    color: #1565c0;
}

.piecework-detail-products-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

.piecework-detail-products-table-wrap .piecework-detail-products-table,
table.piecework-detail-products-table {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    border-collapse: separate !important;
    border-spacing: 0;
    font-size: 13px;
    line-height: 1.35;
}

.piecework-detail-products-table th,
.piecework-detail-products-table td {
    overflow: hidden;
    box-sizing: border-box;
}

.piecework-detail-products-table th.pw-products-table__photo,
.piecework-detail-products-table td.pw-products-table__photo {
    overflow: visible;
}

.piecework-detail-products-table.gw-order-greenware-products-table {
    min-width: 920px;
}

.piecework-detail-products-table.op-prod-products-table {
    min-width: 980px;
}

.piecework-detail-products-table .pw-products-table__add {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    text-align: center;
    padding-left: 4px;
    padding-right: 4px;
}

.piecework-detail-products-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.35;
    color: #607d8b;
    background: #f0f4f7;
    border-bottom: 1px solid #dce3e8;
    vertical-align: middle;
}

.piecework-detail-products-table thead th.pw-products-table__desc {
    white-space: normal;
    word-break: break-word;
}

.piecework-detail-products-table thead th.gw-producer-stats-table__rank,
.piecework-detail-products-table thead th.pw-products-table__add,
.piecework-detail-products-table thead th.pw-products-table__code,
.piecework-detail-products-table thead th.pw-products-table__photo,
.piecework-detail-products-table thead th.pw-products-table__size,
.piecework-detail-products-table thead th.gw-producer-stats-table__num,
.piecework-detail-products-table thead th.pw-products-table__gw,
.piecework-detail-products-table thead th[class*="op-prod-products-table__"],
.piecework-detail-products-table thead th.gw-order-greenware-products-table__qty-stack,
.piecework-detail-products-table thead th.gw-order-product-col,
.piecework-detail-products-table thead th.gw-order-stages-col {
    white-space: nowrap;
    word-break: normal;
}

.piecework-detail-products-table tbody td {
    font-size: 14px;
    padding: 9px 10px;
    border-bottom: 1px solid #eceff1;
    vertical-align: middle;
}

.piecework-detail-products-table tbody .gw-producer-stats-table__rank,
.piecework-detail-products-table tbody .pw-products-table__code,
.piecework-detail-products-table tbody .gw-producer-stats-table__num {
    font-size: 14px;
}

.piecework-detail-products-table thead th.gw-producer-stats-table__rank,
.piecework-detail-products-table thead th.pw-products-table__code,
.piecework-detail-products-table thead th.pw-products-table__photo,
.piecework-detail-products-table thead th.pw-products-table__desc,
.piecework-detail-products-table thead th.gw-producer-stats-table__num,
.piecework-detail-products-table thead th[class*="op-prod-products-table__"] {
    font-size: 12px;
    font-weight: 700;
}

.piecework-detail-products-table .pw-products-table__code {
    width: 108px;
    min-width: 108px;
    max-width: 108px;
    white-space: normal;
    word-break: break-word;
    text-align: left;
}

.piecework-detail-products-table .pw-products-table__photo {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
    box-sizing: border-box;
    padding-left: 10px;
    padding-right: 10px;
}

.piecework-detail-products-table th.pw-products-table__photo,
.piecework-detail-products-table td.pw-products-table__photo {
    position: sticky;
    left: 0;
    z-index: 2;
    box-shadow: none;
    overflow: visible;
}

/* Cột ảnh dính trái khi cuộn — chỉ viền + bóng bên phải */
.piecework-detail-products-table-wrap.is-sticky-photo-scrolled .piecework-detail-products-table th.pw-products-table__photo,
.piecework-detail-products-table-wrap.is-sticky-photo-scrolled .piecework-detail-products-table td.pw-products-table__photo,
.scroll-table-wrapper.is-sticky-photo-scrolled .piecework-detail-products-table th.pw-products-table__photo,
.scroll-table-wrapper.is-sticky-photo-scrolled .piecework-detail-products-table td.pw-products-table__photo {
    box-shadow: inset -1px 0 0 #ddd;
    border-left: none !important;
    border-right: none !important;
}

.piecework-detail-products-table-wrap.is-sticky-photo-scrolled .piecework-detail-products-table th.pw-products-table__photo::after,
.piecework-detail-products-table-wrap.is-sticky-photo-scrolled .piecework-detail-products-table td.pw-products-table__photo::after,
.scroll-table-wrapper.is-sticky-photo-scrolled .piecework-detail-products-table th.pw-products-table__photo::after,
.scroll-table-wrapper.is-sticky-photo-scrolled .piecework-detail-products-table td.pw-products-table__photo::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 8px;
    transform: translateX(100%);
    pointer-events: none;
    z-index: 4;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.07), rgba(0, 0, 0, 0.02) 60%, transparent);
}

.piecework-detail-products-table thead th.pw-products-table__photo {
    top: 0;
    z-index: 5;
    background: #f0f4f7 !important;
}

.piecework-detail-products-table tbody td.pw-products-table__photo {
    top: auto;
    background-color: #fff !important;
}

.piecework-detail-products-table .pw-products-table__photo img {
    display: block;
    width: 80px;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

.piecework-detail-products-table tbody tr:hover {
    background: rgba(21, 101, 192, 0.04);
}

.piecework-detail-products-table tbody tr:hover td.pw-products-table__photo {
    background: #f5f9fd !important;
}

.piecework-detail-products-table .pw-products-table__desc {
    width: 150px;
    min-width: 140px;
    max-width: 180px;
    white-space: normal !important;
    text-align: left;
    word-break: break-word;
    overflow-wrap: break-word;
    font-size: 13px;
    line-height: 1.35;
}

.piecework-detail-products-table .pw-products-table__size {
    width: 118px;
    min-width: 110px;
    max-width: 130px;
    white-space: normal !important;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Số lượng — vừa đủ cho input + ghi chú tối thiểu */
.piecework-detail-products-table td.gw-producer-stats-table__num.text-center:not(.pw-products-table__gw),
.piecework-detail-products-table thead th.gw-producer-stats-table__num.text-center:not(.pw-products-table__gw) {
    width: 84px;
    min-width: 76px;
    max-width: 96px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Đơn giá */
.piecework-detail-products-table td.gw-producer-stats-table__num.text-right:not(.bold700),
.piecework-detail-products-table thead th.gw-producer-stats-table__num.text-right:nth-last-child(2) {
    width: 108px;
    min-width: 100px;
    max-width: none;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Thành tiền — rộng nhất trong nhóm số */
.piecework-detail-products-table td.gw-producer-stats-table__num.text-right.bold700,
.piecework-detail-products-table thead th.gw-producer-stats-table__num.text-right:last-child {
    width: 122px;
    min-width: 112px;
    max-width: none;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.piecework-detail-products-table .gw-producer-stats-table__num {
    white-space: nowrap;
    text-overflow: ellipsis;
}

.piecework-detail-products-table .gw-producer-stats-table__rank {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    padding-inline: 4px;
    text-align: center;
}

.gw-order-greenware-products-table.piecework-detail-products-table .gw-order-greenware-products-table__qty-stack {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
    white-space: normal !important;
    vertical-align: middle;
}

.gw-order-qty-stack {
    display: flex;
    flex-direction: column;
    gap: 0;
    text-align: left;
    font-size: 13px;
    line-height: 1.25;
}

.gw-order-qty-stack__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid #eceff1;
}

.gw-order-qty-stack__row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.gw-order-qty-stack__row:first-child {
    padding-top: 0;
}

.gw-order-qty-stack__label {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #78909c;
    white-space: nowrap;
}

.gw-order-qty-stack__val {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.gw-order-qty-stack__val--order {
    color: #1565c0;
}

.gw-order-greenware-products-table.piecework-detail-products-table .pw-products-table__desc,
.gw-order-greenware-products-table.piecework-detail-products-table th.gw-order-product-col,
.gw-order-greenware-products-table.piecework-detail-products-table td.gw-order-product-col {
    width: 200px;
    min-width: 200px;
    max-width: 200px;
}

.gw-order-greenware-products-table.piecework-detail-products-table .gw-order-stages-col {
    width: 460px;
    min-width: 460px;
    max-width: 460px;
    padding: 8px 10px !important;
    vertical-align: top;
}

.gw-order-greenware-products-table.piecework-detail-products-table .gw-order-stages-panel,
.gw-order-greenware-products-table.piecework-detail-products-table .gw-order-greenware-stages {
    min-width: 440px;
}

.piecework-detail-products-table .pw-products-table__gw {
    width: 100px;
    min-width: 92px;
    max-width: 112px;
    white-space: normal !important;
    word-break: break-word;
}

.piecework-detail-products-panel .piecework-detail-products-table .gw-producer-stats-table__num--prod {
    color: #1565c0;
}

.piecework-detail-products-table-wrap.is-sticky-photo-flush .piecework-detail-products-table th.pw-products-table__photo,
.piecework-detail-products-table-wrap.is-sticky-photo-flush .piecework-detail-products-table td.pw-products-table__photo,
.scroll-table-wrapper.is-sticky-photo-flush .piecework-detail-products-table th.pw-products-table__photo,
.scroll-table-wrapper.is-sticky-photo-flush .piecework-detail-products-table td.pw-products-table__photo {
    border-left: none !important;
    box-shadow: inset 1px 0 0 #ddd, 2px 0 5px rgba(0, 0, 0, 0.1);
}

.piecework-detail-products-table-wrap.is-sticky-photo-flush.is-sticky-photo-scrolled .piecework-detail-products-table th.pw-products-table__photo,
.piecework-detail-products-table-wrap.is-sticky-photo-flush.is-sticky-photo-scrolled .piecework-detail-products-table td.pw-products-table__photo,
.scroll-table-wrapper.is-sticky-photo-flush.is-sticky-photo-scrolled .piecework-detail-products-table th.pw-products-table__photo,
.scroll-table-wrapper.is-sticky-photo-flush.is-sticky-photo-scrolled .piecework-detail-products-table td.pw-products-table__photo {
    box-shadow: inset -1px 0 0 #ddd;
    border-left: none !important;
    border-right: none !important;
}

@media (min-width: 1200px) {
    .piecework-detail-products-table-wrap {
        overflow-x: visible;
        overflow-y: visible;
    }
}

@media (max-width: 1199px) {
    .piecework-detail-products-table-wrap .piecework-detail-products-table,
    table.piecework-detail-products-table {
        width: auto !important;
        min-width: 1080px !important;
        max-width: none !important;
        table-layout: auto !important;
    }

    .piecework-detail-products-table.gw-order-greenware-products-table {
        min-width: 920px;
    }

    .piecework-detail-products-table.op-prod-products-table {
        min-width: 980px;
    }
}

@media (max-width: 767px) {
    .gw-producer-stats-table:not(.piecework-detail-products-table) {
        min-width: 540px;
        table-layout: fixed;
    }

    .gw-producer-stats-panel--in-tab .gw-producer-stats-table:not(.piecework-detail-products-table) {
        min-width: 540px;
        width: max-content;
        max-width: none;
        table-layout: auto;
    }

    .piecework-detail-products-table-wrap .piecework-detail-products-table,
    table.piecework-detail-products-table {
        width: auto !important;
        min-width: 1080px !important;
        max-width: none !important;
        table-layout: auto !important;
    }

    .piecework-detail-products-table.gw-order-greenware-products-table {
        min-width: 920px;
    }

    .piecework-detail-products-table.op-prod-products-table {
        min-width: 980px;
    }

    .piecework-detail-products-table .gw-producer-stats-table__rank {
        width: 36px;
        min-width: 36px;
        max-width: 36px;
        padding-inline: 4px;
    }

    .piecework-detail-products-table .pw-products-table__code {
        width: 108px;
        min-width: 108px;
        max-width: 108px;
    }

    .piecework-detail-products-table .pw-products-table__photo {
        width: 100px;
        min-width: 100px;
        max-width: 100px;
    }

    .piecework-detail-products-table .pw-products-table__desc {
        width: 150px;
        min-width: 140px;
        max-width: 180px;
    }

    .piecework-detail-products-table .pw-products-table__size {
        width: 118px;
        min-width: 110px;
        max-width: 130px;
    }

    .piecework-detail-products-table td.gw-producer-stats-table__num.text-center:not(.pw-products-table__gw),
    .piecework-detail-products-table thead th.gw-producer-stats-table__num.text-center:not(.pw-products-table__gw) {
        width: 84px;
        min-width: 76px;
        max-width: 96px;
        padding-inline: 6px;
        white-space: normal;
    }

    .piecework-detail-products-table td.gw-producer-stats-table__num.text-right:not(.bold700),
    .piecework-detail-products-table .op-prod-products-table__surplus,
    .piecework-detail-products-table .op-prod-products-table__ralo,
    .piecework-detail-products-table .op-prod-products-table__pass,
    .piecework-detail-products-table .op-prod-products-table__refire,
    .piecework-detail-products-table .op-prod-products-table__reject {
        width: 108px;
        min-width: 100px;
        max-width: none;
        padding-inline: 6px;
        white-space: nowrap;
    }

    .piecework-detail-products-table td.gw-producer-stats-table__num.text-right.bold700 {
        width: 122px;
        min-width: 112px;
        max-width: none;
        padding-inline: 6px;
        white-space: nowrap;
    }

    .piecework-detail-products-table .pw-products-table__gw {
        width: 100px;
        min-width: 92px;
        max-width: 112px;
        padding-inline: 6px;
        white-space: normal;
    }

    .gw-order-greenware-products-table.piecework-detail-products-table .pw-products-table__desc,
    .gw-order-greenware-products-table.piecework-detail-products-table .gw-order-product-col {
        width: 200px;
        min-width: 200px;
        max-width: 200px;
    }

    .gw-order-greenware-products-table.piecework-detail-products-table .gw-order-greenware-products-table__qty-stack {
        width: 120px;
        min-width: 120px;
        max-width: 120px;
    }

    .gw-order-greenware-products-table.piecework-detail-products-table .gw-order-stages-col {
        width: 460px;
        min-width: 460px;
        max-width: 460px;
    }

    .gw-producer-stats-panel--in-tab .gw-producer-stats-table__name {
        width: auto;
        min-width: 120px;
        max-width: none;
        overflow: visible;
        text-overflow: clip;
        white-space: nowrap;
    }

    .gw-producer-stats-panel--in-tab .gw-producer-stats-table:not(.piecework-detail-products-table) .gw-producer-stats-table__rank {
        width: 28px;
        min-width: 28px;
        max-width: 28px;
        padding-inline: 4px;
    }

    .gw-producer-stats-panel--in-tab .gw-producer-stats-table:not(.piecework-detail-products-table) .gw-producer-stats-table__num {
        width: auto;
        min-width: 44px;
        max-width: none;
        padding-inline: 6px;
        white-space: nowrap;
    }

    .gw-producer-stats-panel--in-tab .gw-producer-stats-table:not(.piecework-detail-products-table) .gw-producer-stats-table__share {
        width: auto;
        min-width: 92px;
        max-width: none;
    }

    .gw-producer-stats-panel--in-tab .gw-producer-stats-worker {
        align-items: flex-start;
    }

    .gw-producer-stats-panel--in-tab .gw-producer-stats-worker__avatar {
        width: 28px;
        height: 28px;
        margin-top: 1px;
    }

    .gw-producer-stats-panel--in-tab .gw-producer-stats-worker__name {
        white-space: nowrap;
        overflow: visible;
        text-overflow: clip;
        flex-shrink: 0;
    }

    .gw-producer-stats-panel--in-tab .gw-producer-stats-table:not(.piecework-detail-products-table) thead th.gw-producer-stats-table__name,
    .gw-producer-stats-panel--in-tab .gw-producer-stats-table:not(.piecework-detail-products-table) tbody td.gw-producer-stats-table__name,
    .gw-producer-stats-panel--in-tab .gw-producer-stats-table:not(.piecework-detail-products-table) tfoot td.gw-producer-stats-table__foot-label {
        white-space: nowrap;
        overflow: visible;
        text-overflow: clip;
    }
}

@media (max-width: 960px) {
    .gw-producer-stats--panels-2 .gw-producer-stats__grid {
        grid-template-columns: 1fr;
    }

    .gw-producer-stats--panels-2 .gw-producer-stats-panel:first-child {
        border-right: none;
        border-bottom: 1px solid #dce3e8;
    }
}

@media (max-width: 640px) {
    .gw-producer-stats-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Legacy wrap — piecework_detail vẫn dùng pill layout */
.gw-producer-totals-wrap {
    margin: 0 0 14px 0;
}

.gw-producer-totals-heading {
    margin-bottom: 10px;
    font-weight: 700;
    font-size: 14px;
}

.gw-producer-totals-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: stretch;
}

.gw-producer-pill {
    display: inline-block;
    vertical-align: top;
    box-sizing: border-box;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.35;
    border: 1px solid transparent;
    max-width: 100%;
}

.gw-producer-pill-layout {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.gw-producer-pill-avatar.avatar-wrapper {
    flex-shrink: 0;
    width: 52px;
    margin: 0;
    border: 1px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.gw-producer-pill-avatar--noprofile img {
    object-fit: contain;
    padding: 3px;
    opacity: 0.88;
}

.gw-producer-pill-avatar .gw-producer-pill-no-cover {
    font-size: 22px;
    color: rgba(0, 0, 0, 0.35);
    width: 100%;
    height: 100%;
    min-height: 48px;
}

.gw-producer-pill-body {
    flex: 1;
    min-width: 0;
}

.gw-producer-pill-name {
    display: block;
    font-weight: 700;
    word-break: break-word;
}

.gw-producer-pill-qty {
    display: block;
    margin-top: 2px;
    font-weight: 600;
    opacity: 0.92;
}

.gw-producer-pill-stats {
    display: block;
    margin-top: 4px;
    font-weight: 600;
    opacity: 0.92;
}

.gw-producer-pill-stat-line {
    display: block;
    line-height: 1.4;
}

.gw-producer-pill-stat-line+.gw-producer-pill-stat-line {
    margin-top: 2px;
}

.gw-producer-pill-money {
    display: block;
    margin-top: 4px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.01em;
}

/* Chi tiết HĐ khoán — block thống kê theo nhân viên (trên bảng SP) */
.piecework-detail-worker-gw-stats {
    margin-bottom: 14px;
}

.piecework-detail-worker-gw-stats .gw-producer-stats-panel--in-tab {
    margin-bottom: 0;
    border-radius: 5px;
    overflow: hidden;
}

.piecework-detail-worker-gw-stats .gw-producer-stats-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Mobile: 2 KPI / hàng */
@media (max-width: 639px) {
    .piecework-detail-worker-gw-stats .gw-producer-stats-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Tablet rộng + desktop: 6 KPI một hàng */
@media (min-width: 992px) {
    .piecework-detail-worker-gw-stats .gw-producer-stats-kpis {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .piecework-detail-worker-gw-stats .gw-producer-stats-panel--in-tab .gw-producer-stats-kpi {
        padding: 10px 4px 8px;
    }

    .piecework-detail-worker-gw-stats .gw-producer-stats-panel--in-tab .gw-producer-stats-kpi__label {
        font-size: 11px;
        letter-spacing: 0.02em;
    }

    .piecework-detail-worker-gw-stats .gw-producer-stats-panel--in-tab .gw-producer-stats-kpi__unit {
        font-size: 11px;
    }
}

/* Cột bảng thống kê NV — width theo nội dung, không chia % đều */
.piecework-detail-worker-gw-stats .gw-producer-stats-panel--in-tab .piecework-detail-worker-stats-table .gw-producer-stats-table__rank {
    width: 28px;
    min-width: 28px;
    max-width: 28px;
    padding-inline: 4px;
    text-align: center;
}

.piecework-detail-worker-gw-stats .gw-producer-stats-panel--in-tab .piecework-detail-worker-stats-table .gw-producer-stats-table__name {
    width: auto;
    min-width: 140px;
    max-width: none;
}

.piecework-detail-worker-gw-stats .gw-producer-stats-panel--in-tab .piecework-detail-worker-stats-table .gw-producer-stats-table__num:not(.piecework-detail-worker-stats-table__money) {
    width: 76px;
    min-width: 72px;
    max-width: 88px;
}

.piecework-detail-worker-gw-stats .gw-producer-stats-panel--in-tab .piecework-detail-worker-stats-table .piecework-detail-worker-stats-table__money {
    width: 108px;
    min-width: 100px;
    max-width: 120px;
}

.piecework-detail-worker-gw-stats .gw-producer-stats-panel--in-tab .piecework-detail-worker-stats-table .gw-producer-stats-table__share:not(.piecework-detail-worker-stats-table__eff) {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
}

.piecework-detail-worker-gw-stats .gw-producer-stats-panel--in-tab .piecework-detail-worker-stats-table .piecework-detail-worker-stats-table__eff {
    width: 150px;
    min-width: 150px;
    max-width: 150px;
}

.piecework-detail-worker-gw-stats .gw-producer-stats-panel--in-tab .piecework-detail-worker-stats-table .gw-producer-stats-table__share:not(.piecework-detail-worker-stats-table__eff) .gw-producer-stats-progress.progress-container {
    min-width: 52px;
}

.piecework-detail-worker-gw-stats .gw-producer-stats-panel--in-tab .piecework-detail-worker-stats-table .piecework-detail-worker-stats-table__eff .gw-producer-stats-progress.progress-container {
    min-width: 44px;
}

.piecework-detail-worker-gw-stats .gw-producer-stats-worker {
    min-width: max-content;
}

.piecework-detail-worker-gw-stats .gw-producer-stats-worker__name {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
    flex-shrink: 0;
}

.piecework-detail-worker-gw-stats .piecework-detail-worker-stats-table__eff .gw-producer-stats-share__pct {
    min-width: 44px;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .piecework-detail-worker-gw-stats .gw-producer-stats-worker {
        min-width: 0;
        max-width: 100%;
    }

    .piecework-detail-worker-gw-stats .gw-producer-stats-worker__name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1 1 auto;
        min-width: 0;
        flex-shrink: 1;
    }
}

/* Giải trình hiệu suất — nút info + modal */
.piecework-norm-eff-cell {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    min-width: 0;
}

.piecework-norm-eff-cell .gw-producer-stats-share {
    flex: 1 1 auto;
    min-width: 0;
}

.piecework-norm-eff-cell--foot {
    justify-content: center;
}

.piecework-norm-eff-detail-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(15, 76, 129, 0.08);
    color: #0f4c81;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease;
}

.piecework-norm-eff-detail-btn:hover,
.piecework-norm-eff-detail-btn:focus-visible {
    background: rgba(15, 76, 129, 0.16);
    color: #08385f;
    outline: none;
}

.piecework-norm-eff-detail-btn--kpi {
    width: 18px;
    height: 18px;
    font-size: 12px;
    vertical-align: middle;
}

.gw-producer-stats-kpi__label--with-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

#pwNormEffExplainModal {
    align-items: flex-start;
    padding: 12px;
    box-sizing: border-box;
}

#pwNormEffExplainModal .popup-box {
    position: relative;
    width: min(640px, calc(100vw - 24px));
    max-width: min(640px, calc(100vw - 24px));
    max-height: min(92vh, 720px);
    overflow-y: auto;
    margin-top: 4vh;
    padding: 16px 44px 18px 18px;
    text-align: left;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__head {
    margin-bottom: 12px;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__title {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.35;
    padding-right: 4px;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.06);
    color: inherit;
    cursor: pointer;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__close:hover,
#pwNormEffExplainModal .piecework-norm-eff-modal__close:focus-visible {
    background: rgba(0, 0, 0, 0.1);
    outline: none;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__params {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef4fa;
    border: 1px solid rgba(15, 76, 129, 0.12);
    font-size: 12px;
    line-height: 1.35;
    color: #234;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__formula {
    margin: 0 0 12px;
    font-size: 12px;
    line-height: 1.45;
    color: #5a6572;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__table-label {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #607d8b;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__table-panel {
    margin-bottom: 12px;
    border: 1px solid #e5e9ef;
    border-radius: 8px;
    overflow: hidden;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__table-scroll {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    max-height: min(128px, 18vh);
    border-top: 1px solid #e8ecf1;
    border-bottom: 1px solid #e8ecf1;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__table-panel .piecework-norm-eff-modal__table {
    width: 100%;
    min-width: 420px;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 13px;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__table th,
#pwNormEffExplainModal .piecework-norm-eff-modal__table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e8ecf1;
    vertical-align: middle;
    color: #1e293b;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__table-head .piecework-norm-eff-modal__table thead th {
    background: #f4f7fb;
    font-weight: 700;
    white-space: nowrap;
    color: #0f172a;
    border-bottom: 0;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__table-scroll .piecework-norm-eff-modal__table tbody tr:last-child td {
    border-bottom: 0;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__table-foot .piecework-norm-eff-modal__table tfoot td {
    background: #fafbfd;
    border-bottom: 0;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__code {
    font-weight: 600;
    word-break: break-word;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__pay-compare {
    margin-bottom: 12px;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__pay-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__pay-col {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #e5e9ef;
    background: #fafbfc;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__pay-title {
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
    color: #546e7a;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__pay-value {
    display: block;
    font-size: 15px;
    line-height: 1.35;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__pay-value--theo {
    color: #c62828;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__pay-value--piece {
    color: #1565c0;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__pay-sub {
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.4;
    color: #78909c;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__summary {
    padding: 12px 14px;
    border-radius: 8px;
    background: linear-gradient(135deg, #eef6ff 0%, #f8fbff 100%);
    border: 1px solid rgba(15, 76, 129, 0.14);
    margin-bottom: 10px;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__summary-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    line-height: 1.5;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__summary-row+.piecework-norm-eff-modal__summary-row {
    margin-top: 6px;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__summary-row--result {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed rgba(15, 76, 129, 0.22);
    font-size: 14px;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__note {
    margin: 0 0 14px;
    font-size: 11px;
    line-height: 1.45;
    color: #6b7280;
}

#pwNormEffExplainModal .piecework-norm-eff-modal__note code {
    font-size: 10px;
}

@media (max-width: 640px) {
    #pwNormEffExplainModal {
        align-items: flex-end;
        padding: 0;
    }

    #pwNormEffExplainModal .popup-box {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin-top: 0;
        padding-right: 44px;
        border-radius: 14px 14px 0 0;
        max-height: 92vh;
    }

    #pwNormEffExplainModal .piecework-norm-eff-modal__table-scroll {
        max-height: min(112px, 16vh);
    }

    #pwNormEffExplainModal .piecework-norm-eff-modal__pay-grid {
        grid-template-columns: 1fr;
    }

    #pwNormEffExplainModal .piecework-norm-eff-modal__chip {
        font-size: 11px;
    }

    #pwNormEffExplainModal .piecework-norm-eff-modal__summary-row {
        flex-direction: column;
        gap: 2px;
    }
}

@media (max-width: 640px) {
    .piecework-detail-worker-gw-stats .piecework-detail-worker-stats-table .piecework-detail-worker-stats-table__money {
        width: auto;
        min-width: 88px;
        max-width: none;
    }

    .piecework-detail-worker-gw-stats .piecework-detail-worker-stats-table .piecework-detail-worker-stats-table__eff,
    .piecework-detail-worker-gw-stats .piecework-detail-worker-stats-table .gw-producer-stats-table__share:not(.piecework-detail-worker-stats-table__eff) {
        width: auto;
        min-width: 96px;
        max-width: none;
    }
}

/* Legacy pill layout — giữ cho trang khác nếu còn dùng */
.gw-producer-pill--h0 {
    background: hsl(200 62% 90%);
    color: hsl(205 55% 22%);
    border-color: hsl(200 45% 72%);
}

.gw-producer-pill--h1 {
    background: hsl(145 50% 88%);
    color: hsl(150 50% 20%);
    border-color: hsl(145 40% 68%);
}

.gw-producer-pill--h2 {
    background: hsl(275 48% 92%);
    color: hsl(275 45% 26%);
    border-color: hsl(275 38% 76%);
}

.gw-producer-pill--h3 {
    background: hsl(32 75% 90%);
    color: hsl(28 70% 22%);
    border-color: hsl(32 55% 72%);
}

.gw-producer-pill--h4 {
    background: hsl(330 55% 92%);
    color: hsl(330 50% 26%);
    border-color: hsl(330 42% 76%);
}

.gw-producer-pill--h5 {
    background: hsl(95 50% 88%);
    color: hsl(95 45% 20%);
    border-color: hsl(95 40% 68%);
}

.gw-producer-pill--h6 {
    background: hsl(245 52% 91%);
    color: hsl(245 48% 24%);
    border-color: hsl(245 40% 74%);
}

.gw-producer-pill--h7 {
    background: hsl(15 70% 91%);
    color: hsl(12 65% 24%);
    border-color: hsl(15 55% 74%);
}

@media (max-width: 768px) {
    .gw-producer-totals-bar {
        flex-direction: column;
    }

    .gw-producer-pill {
        display: block;
        width: 100%;
    }
}

body.dark .gw-producer-totals-heading,
html.dark .gw-producer-totals-heading {
    color: #bdc1c6 !important;
}

/* Greenware — thống kê nhân viên (bảng KPI) dark mode */
body.dark .gw-producer-stats,
html.dark .gw-producer-stats {
    background: #2d2e30;
    border-color: #3c4043;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

body.dark .gw-producer-stats__header,
html.dark .gw-producer-stats__header {
    background: linear-gradient(180deg, #35363a 0%, #2d2e30 100%);
    border-bottom-color: #3c4043;
}

body.dark .gw-producer-stats__title,
html.dark .gw-producer-stats__title {
    color: #e8eaed;
}

body.dark .gw-producer-stats__title .fas,
html.dark .gw-producer-stats__title .fas {
    color: #9aa0a6;
}

body.dark .gw-producer-stats__subtitle,
html.dark .gw-producer-stats__subtitle {
    color: #9aa0a6 !important;
}

body.dark .gw-producer-stats-panel,
html.dark .gw-producer-stats-panel {
    border-bottom-color: #3c4043;
}

body.dark .gw-producer-stats-panel--in-tab,
html.dark .gw-producer-stats-panel--in-tab {
    background: #2d2e30;
    border-color: #3c4043;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

body.dark .gw-producer-stats-panel--in-tab .gw-producer-stats-panel__head,
html.dark .gw-producer-stats-panel--in-tab .gw-producer-stats-panel__head {
    border-bottom-color: #3c4043;
}

body.dark .gw-producer-stats--panels-2 .gw-producer-stats-panel:first-child,
html.dark .gw-producer-stats--panels-2 .gw-producer-stats-panel:first-child {
    border-right-color: #3c4043;
}

body.dark .gw-producer-stats-panel__head,
html.dark .gw-producer-stats-panel__head {
    border-bottom-color: #3c4043;
}

body.dark .gw-producer-stats-panel--daily .gw-producer-stats-panel__title,
html.dark .gw-producer-stats-panel--daily .gw-producer-stats-panel__title {
    color: #8ab4f8;
}

body.dark .gw-producer-stats-panel--daily .gw-producer-stats-panel__icon,
html.dark .gw-producer-stats-panel--daily .gw-producer-stats-panel__icon {
    background: rgba(138, 180, 248, 0.15);
    color: #8ab4f8;
}

body.dark .gw-producer-stats-panel--piecework .gw-producer-stats-panel__title,
html.dark .gw-producer-stats-panel--piecework .gw-producer-stats-panel__title {
    color: #ce93d8;
}

body.dark .gw-producer-stats-panel--piecework .gw-producer-stats-panel__icon,
html.dark .gw-producer-stats-panel--piecework .gw-producer-stats-panel__icon {
    background: rgba(206, 147, 216, 0.15);
    color: #ce93d8;
}

body.dark .piecework-detail-products-panel__title,
html.dark .piecework-detail-products-panel__title {
    color: #8ab4f8;
}

body.dark .piecework-detail-products-panel__icon,
html.dark .piecework-detail-products-panel__icon {
    background: rgba(138, 180, 248, 0.15);
    color: #8ab4f8;
}

body.dark .gw-producer-stats-panel--all .gw-producer-stats-panel__title,
html.dark .gw-producer-stats-panel--all .gw-producer-stats-panel__title {
    color: #e8eaed;
}

body.dark .gw-producer-stats-kpis,
html.dark .gw-producer-stats-kpis {
    background: #3c4043;
    border-bottom-color: #3c4043;
}

body.dark .gw-producer-stats-kpi,
html.dark .gw-producer-stats-kpi {
    background: #35363a;
}

body.dark .gw-producer-stats-kpi__label,
html.dark .gw-producer-stats-kpi__label {
    color: #9aa0a6;
}

body.dark .gw-producer-stats-kpi__value,
html.dark .gw-producer-stats-kpi__value {
    color: #e8eaed;
}

body.dark .gw-producer-stats-kpi__unit,
html.dark .gw-producer-stats-kpi__unit {
    color: #80868b;
}

body.dark .gw-producer-stats-kpi--primary .gw-producer-stats-kpi__value,
html.dark .gw-producer-stats-kpi--primary .gw-producer-stats-kpi__value {
    color: #8ab4f8;
}

body.dark .gw-producer-stats-kpi--danger .gw-producer-stats-kpi__value,
html.dark .gw-producer-stats-kpi--danger .gw-producer-stats-kpi__value {
    color: #f28b82;
}

body.dark .gw-producer-stats-empty,
html.dark .gw-producer-stats-empty {
    color: #80868b;
}

body.dark .gw-producer-stats-table thead th,
html.dark .gw-producer-stats-table thead th {
    background: #35363a;
    color: #9aa0a6;
    border-bottom-color: #3c4043;
}

body.dark .gw-producer-stats-table tbody td,
html.dark .gw-producer-stats-table tbody td,
body.dark .gw-producer-stats-table tfoot td,
html.dark .gw-producer-stats-table tfoot td {
    border-bottom-color: #3c4043;
}

body.dark .gw-producer-stats-table tbody tr:hover,
html.dark .gw-producer-stats-table tbody tr:hover {
    background: rgba(138, 180, 248, 0.08);
}

body.dark .gw-producer-stats-panel--piecework .gw-producer-stats-table tbody tr:hover,
html.dark .gw-producer-stats-panel--piecework .gw-producer-stats-table tbody tr:hover {
    background: rgba(206, 147, 216, 0.1);
}

body.dark .piecework-detail-products-panel .piecework-detail-products-table tbody tr:hover,
html.dark .piecework-detail-products-panel .piecework-detail-products-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.06);
}

body.dark .piecework-detail-products-panel .piecework-detail-products-table tbody tr:hover td.pw-products-table__photo,
html.dark .piecework-detail-products-panel .piecework-detail-products-table tbody tr:hover td.pw-products-table__photo {
    background-color: rgba(255, 255, 255, 0.06) !important;
}

body.dark .piecework-detail-products-panel .piecework-detail-products-table .gw-producer-stats-table__num--prod,
html.dark .piecework-detail-products-panel .piecework-detail-products-table .gw-producer-stats-table__num--prod {
    color: #8ab4f8;
}

body.dark .op-prod-products-table .gw-producer-stats-table__num--prod,
html.dark .op-prod-products-table .gw-producer-stats-table__num--prod {
    color: #8ab4f8;
}

body.dark .gw-order-qty-stack__row,
html.dark .gw-order-qty-stack__row {
    border-bottom-color: #3c4043;
}

body.dark .gw-order-qty-stack__label,
html.dark .gw-order-qty-stack__label {
    color: #9aa0a6;
}

body.dark .gw-order-qty-stack__val--order,
html.dark .gw-order-qty-stack__val--order {
    color: #8ab4f8;
}

body.dark .gw-order-greenware-products-table .gw-producer-stats-table__num--prod,
html.dark .gw-order-greenware-products-table .gw-producer-stats-table__num--prod {
    color: #8ab4f8;
}

body.dark .scroll-table-wrapper.is-row-focus-mode #gwProductTable .gw-product-row--focus-target td.sticky-photo,
html.dark .scroll-table-wrapper.is-row-focus-mode #gwProductTable .gw-product-row--focus-target td.sticky-photo {
    background: #2d2e30 !important;
}

body.dark .scroll-table-wrapper.is-row-focus-mode #gwProductTable .gw-product-row--focus-target,
html.dark .scroll-table-wrapper.is-row-focus-mode #gwProductTable .gw-product-row--focus-target {
    background-color: #2d2e30;
}

body.dark .op-prod-page .scroll-table-wrapper.is-row-focus-mode .op-prod-product-row.op-prod-row--focus-target,
html.dark .op-prod-page .scroll-table-wrapper.is-row-focus-mode .op-prod-product-row.op-prod-row--focus-target {
    background-color: #2d2e30;
}

body.dark .op-prod-page .scroll-table-wrapper.is-row-focus-mode .op-prod-product-row.op-prod-row--focus-target td.sticky-photo,
html.dark .op-prod-page .scroll-table-wrapper.is-row-focus-mode .op-prod-product-row.op-prod-row--focus-target td.sticky-photo {
    background: #2d2e30 !important;
}

body.dark .gw-producer-stats-table tfoot td,
html.dark .gw-producer-stats-table tfoot td {
    background: #35363a;
    border-top-color: #5f6368;
}

body.dark .gw-producer-stats-table__rank,
html.dark .gw-producer-stats-table__rank {
    color: #80868b;
}

body.dark .gw-producer-stats-table__num--prod,
html.dark .gw-producer-stats-table__num--prod {
    color: #8ab4f8;
}

body.dark .gw-producer-stats-panel--piecework .gw-producer-stats-table__num--prod,
html.dark .gw-producer-stats-panel--piecework .gw-producer-stats-table__num--prod {
    color: #ce93d8;
}

body.dark .gw-producer-stats-table__num--def,
html.dark .gw-producer-stats-table__num--def {
    color: #f28b82;
}

body.dark .gw-producer-stats-table__foot-label,
html.dark .gw-producer-stats-table__foot-label,
body.dark .gw-producer-stats-table__foot-pct,
html.dark .gw-producer-stats-table__foot-pct,
body.dark .gw-producer-stats-share__pct,
html.dark .gw-producer-stats-share__pct {
    color: #9aa0a6;
}

body.dark .gw-producer-stats-worker__avatar,
html.dark .gw-producer-stats-worker__avatar {
    border-color: #5f6368;
}

body.dark .gw-producer-stats-worker__avatar--empty,
html.dark .gw-producer-stats-worker__avatar--empty {
    background: #3c4043;
}

body.dark .gw-producer-stats-worker__placeholder,
html.dark .gw-producer-stats-worker__placeholder {
    color: #80868b;
}

body.dark .gw-producer-stats-worker__name,
html.dark .gw-producer-stats-worker__name {
    color: #e8eaed;
}

body.dark .gw-producer-stats-share__track,
html.dark .gw-producer-stats-share__track {
    background: #3c4043;
}

body.dark .gw-producer-stats-panel--piecework .gw-producer-stats-share__fill,
html.dark .gw-producer-stats-panel--piecework .gw-producer-stats-share__fill {
    background: linear-gradient(90deg, #ce93d8, #8e24aa);
}

body.dark .gw-producer-stats-share__fill,
html.dark .gw-producer-stats-share__fill {
    background: linear-gradient(90deg, #64b5f6, #1976d2);
}

@media (max-width: 960px) {

    body.dark .gw-producer-stats--panels-2 .gw-producer-stats-panel:first-child,
    html.dark .gw-producer-stats--panels-2 .gw-producer-stats-panel:first-child {
        border-bottom-color: #3c4043;
    }
}

body.dark .gw-producer-totals-section,
html.dark .gw-producer-totals-section {
    background: #2a2a2a;
    border-color: #444;
}

body.dark .gw-producer-totals-section--daily .gw-producer-totals-section__title,
html.dark .gw-producer-totals-section--daily .gw-producer-totals-section__title {
    color: #64b5f6;
}

body.dark .gw-producer-totals-section--piecework .gw-producer-totals-section__title,
html.dark .gw-producer-totals-section--piecework .gw-producer-totals-section__title {
    color: #ce93d8;
}

body.dark .gw-producer-pill--h0,
html.dark .gw-producer-pill--h0 {
    background: hsl(200 32% 26%);
    color: hsl(200 25% 94%);
    border-color: hsl(200 28% 42%);
}

body.dark .gw-producer-pill--h1,
html.dark .gw-producer-pill--h1 {
    background: hsl(145 28% 24%);
    color: hsl(145 22% 93%);
    border-color: hsl(145 25% 40%);
}

body.dark .gw-producer-pill--h2,
html.dark .gw-producer-pill--h2 {
    background: hsl(275 28% 28%);
    color: hsl(275 22% 94%);
    border-color: hsl(275 25% 44%);
}

body.dark .gw-producer-pill--h3,
html.dark .gw-producer-pill--h3 {
    background: hsl(32 38% 26%);
    color: hsl(32 30% 94%);
    border-color: hsl(32 32% 42%);
}

body.dark .gw-producer-pill--h4,
html.dark .gw-producer-pill--h4 {
    background: hsl(330 30% 28%);
    color: hsl(330 22% 94%);
    border-color: hsl(330 26% 44%);
}

body.dark .gw-producer-pill--h5,
html.dark .gw-producer-pill--h5 {
    background: hsl(95 28% 24%);
    color: hsl(95 22% 93%);
    border-color: hsl(95 25% 40%);
}

body.dark .gw-producer-pill--h6,
html.dark .gw-producer-pill--h6 {
    background: hsl(245 30% 28%);
    color: hsl(245 22% 94%);
    border-color: hsl(245 26% 44%);
}

body.dark .gw-producer-pill--h7,
html.dark .gw-producer-pill--h7 {
    background: hsl(15 35% 27%);
    color: hsl(15 28% 94%);
    border-color: hsl(15 30% 43%);
}

/* ===================================
   SETTINGS TABLE - Form table 2 cột, mobile display block
   =================================== */

/* ✅ Settings Table - chỉ dùng cho form table 2 cột */
.settings-table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    border-collapse: collapse;
    table-layout: auto !important;
    box-sizing: border-box !important;
}

/* Fixed layout cho các bảng cần respect width attribute */
.settings-table.table-fixed-width {
    table-layout: fixed !important;
}

/* Đảm bảo settings-form-table không bị ảnh hưởng bởi rule data table */
.settings-table.settings-form-table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

.settings-table,
.settings-table * {
    box-sizing: border-box;
}

.settings-table td {
    border-bottom: 1px solid #eee;
    padding: 10px 6px;
    vertical-align: middle;
    font-size: 14px;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.settings-table input,
.settings-table select,
.settings-table textarea {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box !important;
}

/* Checkbox/radio trong form 2 cột: không dùng width:100% (gây label xuống từng từ) */
.settings-table input[type="checkbox"],
.settings-table input[type="radio"] {
    width: auto !important;
    max-width: none !important;
    min-width: 0;
    padding: 0;
    border: none;
    background: none;
    border-radius: 0;
    box-shadow: none;
    flex-shrink: 0;
    margin: 0 4px 0 0;
    align-self: center;
    vertical-align: middle;
}

/* Nhóm dạng sản xuất công đoạn mộc: label một dòng, không word-break từng chữ */
.gw-stage-prod-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 20px;
    max-width: 100%;
}

/* Nhiều phân loại tạo hình: cuộn trong khung Giống bộ phận liên kết */
.settings-table .gw-stage-prod-filters.gw-stage-prod-filters--scroll {
    align-items: flex-start;
    align-content: flex-start;
    max-height: min(40vh, 320px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fafafa;
    box-sizing: border-box;
}

body.dark .settings-table .gw-stage-prod-filters.gw-stage-prod-filters--scroll {
    border-color: #444;
    background: #252525;
}

.settings-table .gw-stage-prod-filters--custom .custom-checkbox label,
.settings-table .gw-stage-prod-filters--custom .custom-checkbox label * {
    word-break: normal !important;
    overflow-wrap: normal;
}

.settings-table .gw-stage-prod-filters--custom .custom-checkbox {
    display: inline-flex !important;
    width: max-content;
    max-width: 100%;
    flex: 0 0 auto;
}

.settings-table .gw-stage-prod-filters--custom .custom-checkbox label {
    white-space: nowrap;
    width: max-content;
    max-width: 100%;
    min-width: 0;
}

@media (min-width: 601px) {
    .settings-table .gw-stage-prod-filters--custom .custom-checkbox--medium {
        min-width: min-content;
    }
}

/* Bộ phận liên kết (công đoạn): mỗi dòng full width; tick = nền xanh như .bgxlightblue */
.settings-table .gw-dept-pick-box {
    max-width: 400px;
    width: 100%;
    height: 150px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 6px 8px;
    background: #fcfcfc;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-sizing: border-box;
}

.settings-table .gw-dept-pick-item {
    display: flex;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    word-wrap: break-word;
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

.settings-table .gw-dept-pick-item:hover {
    background-color: #f5f9fc;
}

.settings-table .gw-dept-pick-item:has(input[type="checkbox"]:checked) {
    background-color: #f0f7ff !important;
    /* cùng .bgxlightblue */
    border-color: #90caf9;
}

/* Ngày lễ công ty — chọn bộ phận (settings attendance) */
.settings-table .setting-holiday-dept-pick {
    max-width: min(100%, 480px);
}

.settings-table .setting-holiday-dept-pick .gw-dept-pick-item {
    border-color: #cbd5e1;
}

.settings-table tr.setting-holiday-dept-row[hidden],
.settings-table tr.setting-holiday-dept-row.is-collapsed {
    display: none !important;
}

/* Override rule chung input[type="text"] max-width: 100% */
.settings-table input[type="text"],
.settings-table input[type="password"],
.settings-table input[type="email"],
.settings-table input[type="number"],
.settings-table input[type="tel"],
.settings-table input[type="url"],
.settings-table input[type="search"],
.settings-table input[type="date"],
.settings-table input[type="datetime-local"],
.settings-table input[type="month"],
.settings-table input[type="time"] {
    max-width: 100% !important;
    width: 100% !important;
}


/* ✅ Table header - white-space */
.settings-table th {
    white-space: nowrap;
    word-wrap: normal;
}

.settings-table th.text-center {
    text-align: center;
}

/* ✅ Scroll hint */
.settings-scroll-hint {
    text-align: center;
    padding: 5px;
    font-size: 9pt;
    color: #666;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-bottom: none;
    display: none;
    margin-bottom: 0;
}

/* ✅ Desktop/Tablet lớn: Full width, không scroll */
@media (min-width: 1200px) {
    .settings-table-wrapper {
        overflow-x: visible;
    }
}

/* ✅ Responsive: Mobile, mobile landscape, tablet — scroll ngang (chỉ data table) */
@media (max-width: 1199px) {
    .settings-table-wrapper {
        overflow-x: auto;
    }

    /* Đảm bảo settings-form-table không bị ảnh hưởng bởi rule data table */
    .settings-table.settings-form-table {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }
}

/* ============================================
   ORDER PACKING LIST MODULE
============================================ */
.packinglist-primary-action {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    line-height: 1;
    box-sizing: border-box;
}

.packing-items-table tbody tr td {
    border-bottom: 1px solid #ddd !important;
}

.packinglist-view-controls {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    min-height: 34px;
}

/* Checkbox chỉ là hiển thị; click được xử lý trên nút .packing-select-all-btn để không double-toggle */
.packinglist-view-controls .packing-select-all-btn .packing-select-all-visible-cb {
    width: 18px;
    height: 18px;
    margin: 0;
    flex-shrink: 0;
    pointer-events: none;
}

/*
 * Thanh packing: các thẻ <button class="button"> thường còn kế thừa height: 100% từ selector
 * html,body,...,button { height:100% }, nên 2 nút trực tiếp trong flex có thể bị cao bất thường
 * trong khi «Lọc theo ngày» bọc trong .pdf-export-dropdown không bị. Đồng bộ chiều cao nội dung + inline-flex.
 */
.packinglist-view-controls>button.button.small.gray,
.packinglist-view-controls .packing-box-date-trigger.button.small.gray {
    height: auto;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1.2;
    white-space: nowrap;
    vertical-align: middle;
}

.packinglist-view-controls .pdf-export-dropdown.packing-box-date-dropdown {
    align-self: center;
    flex-shrink: 0;
}

.packinglist-view-controls .view-mode-toggle {
    margin-left: auto;
    flex: 0 0 auto;
    padding: 2px;
    gap: 2px;
}

.packinglist-view-controls .packing-box-code-search-wrap {
    display: inline-flex;
    align-items: center;
    flex: 0 1 auto;
    min-width: 0;
}

.packinglist-view-controls .packing-box-code-search {
    width: clamp(110px, 18vw, 200px);
    font-size: 13px;
    padding: 0 10px;
    height: 34px;
    min-height: 34px;
    line-height: 1.2;
    box-sizing: border-box;
}

.packinglist-view-controls .view-mode-btn {
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
}

/* Lọc ngày packing: dùng chung .pdf-export-dropdown; nâng z-index so với bar phía trên */
.packinglist-view-controls .packing-box-date-dropdown {
    z-index: 2106;
}

.packinglist-view-controls .packing-box-date-dropdown-menu {
    left: 0;
    right: auto;
    min-width: min(288px, calc(100vw - 48px));
    max-height: min(320px, 55vh);
    overflow-x: hidden;
    overflow-y: auto;
}

.packing-box-date-dropdown-actions {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eaeaea;
}

.pdf-export-dropdown {
    position: relative;
    display: inline-flex;
    padding-bottom: 6px;
    margin-bottom: -6px;
    /* Cao hơn .packing-box-date-dropdown (2106) để menu PDF không bị đè khi hai dropdown gần nhau */
    z-index: 2120;
    isolation: isolate;
}

.pdf-export-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
    min-width: 250px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 10px;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
    z-index: 2110;
}

.pdf-export-dropdown:hover .pdf-export-dropdown-menu,
.pdf-export-dropdown:focus-within .pdf-export-dropdown-menu {
    display: block;
}


.pdf-export-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: #333;
}

.pdf-export-title {
    font-weight: 600;
    font-size: 13px;
    color: #555;
    margin-bottom: 4px;
}

.pdf-export-option input[type="checkbox"] {
    margin: 0;
}

.packing-list-view-table-wrapper .packing-list-view-table {
    min-width: 980px;
    width: 100%;
}

.packing-list-view-table th.packing-list-col-select,
.packing-list-view-table td.packing-list-col-select {
    width: 36px;
    min-width: 36px;
    max-width: 40px;
    box-sizing: border-box;
    padding: 8px 4px;
    vertical-align: middle;
}

.packing-list-view-table td.packing-list-col-select input[type="checkbox"] {
    margin: 0;
}

.packing-list-view-table th.packing-list-col-stt,
.packing-list-view-table td.packing-list-col-stt {
    width: 44px;
}

.packing-list-box-code {
    margin-bottom: 4px;
}

.packing-list-box-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    font-size: 12px;
    color: #666;
    line-height: 1.35;
}

.packing-list-products {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.packing-list-product-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}

.packing-list-product-main {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.packing-list-product-desc {
    font-size: 12px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.packing-list-note {
    display: inline-block;
    max-width: 320px;
    white-space: normal;
    overflow-wrap: anywhere;
    vertical-align: bottom;
}

@media (min-width: 1200px) {
    .packing-items-table-wrapper .packing-items-table {
        width: 100% !important;
        min-width: 100% !important;
    }
}

@media (max-width: 1199px) {
    .packing-items-table-wrapper .packing-items-table {
        width: max-content !important;
        min-width: 960px !important;
    }

    .packinglist-view-controls {
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .packinglist-view-controls .view-mode-toggle {
        width: auto;
        justify-content: flex-start;
    }

    .packinglist-view-controls .view-mode-btn {
        flex: 0 0 auto;
        padding: 5px 11px;
        font-size: 12px;
    }

    .packinglist-view-controls .packing-box-code-search {
        width: min(160px, 42vw);
        height: 34px;
        min-height: 34px;
    }

    #packingListView .view-mode-btn {
        padding: 5px 11px;
        font-size: 12px;
    }
}


/* ============================================
   GREENWARE TAB (vieworder opt=greenware)
============================================ */

/* Badge HĐ làm khoán trên tab Hàng mộc (vieworder) */
.gw-pw-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6a1b9a;
    font-size: 14px;
    line-height: 1;
    text-decoration: none;
    flex-shrink: 0;
}

a.gw-pw-badge:hover,
a.gw-pw-badge:focus {
    color: #4a148c;
}


/* Tab Hàng mộc đơn: lọc sản phẩm có HĐ làm khoán (toolbar trên bảng) */
.gw-piecework-filter-link {
    display: inline-block;
    margin: 0;
    padding: 5px 12px;
    border: 1px solid #6a1b9a;
    border-radius: 6px;
    background: #fff;
    color: #6a1b9a;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.gw-piecework-filter-link:hover,
.gw-piecework-filter-link:focus {
    color: #4a148c;
    border-color: #4a148c;
    background: #f3e5f5;
}

.gw-piecework-filter-link.is-active {
    color: #fff;
    background: #6a1b9a;
    border-color: #6a1b9a;
}

.gw-piecework-filter-link.is-active i {
    color: #e1bee7;
}

/* ============================================================
   BOM Management & Product BOM
   ============================================================ */

/* BOM manage list (inside gw-settings-page) */
.bom-manage-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bom-manage-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f0f7ff;
    border: 1px solid #dbeafe;
}

.bom-manage-list-item-main {
    flex: 1 1 auto;
    min-width: 0;
}

.bom-cat-sort-arrows {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
    min-width: 36px;
}

.bom-manage-list-item.is-inactive {
    opacity: 0.65;
}

.bom-manage-list-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.bom-manage-page {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.bom-manage-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.bom-manage-filter,
.bom-add-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.bom-items-list-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.bom-items-list-head-row .gw-workflow-tab-heading {
    flex: 1 1 auto;
    min-width: 0;
}

/* Chi tiết loại định lượng (bom_manage view=type) */
.bom-type-detail-page {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    width: auto;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

.bom-type-detail-page.gw-settings-page {
    padding: 0;
}

.bom-type-detail-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-bottom: 12px;
}

.bom-type-detail-head>div:first-child {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
}

.bom-type-detail-head .settings-page-title {
    word-break: break-word;
    overflow-wrap: anywhere;
}

.bom-type-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
    max-width: 100%;
}

.bom-type-block-header-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.bom-type-block-header-row::after {
    content: '';
    display: table;
    clear: both;
}

.bom-type-block-header-title {
    flex: 1 1 auto;
    min-width: 0;
}

.bom-type-block-header-actions {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    max-width: 100%;
}

.bom-type-detail-page .js-bom-type-delete-blocked {
    cursor: pointer;
}

.bom-type-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.bom-type-detail-grid>.data-block {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.bom-type-detail-grid .data-block-body {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

/* Bảng thông tin 2 cột: không áp rule mobile block-by-td của form settings */
.bom-type-detail-grid #bomTypeInfoView .settings-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
}

.bom-type-detail-grid #bomTypeInfoView .settings-table td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.bom-type-price-form {
    padding: 12px;
    background: var(--bg-light-blue, #f0f7ff);
    border-radius: 8px;
    box-sizing: border-box;
    max-width: 100%;
}

.bom-type-price-form .field input,
.bom-type-price-form input[type="datetime-local"] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.bom-type-price-chart-wrap {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 220px;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.bom-type-price-chart-wrap canvas {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
}

.scroll-table-wrapper.bom-type-price-history-scroll {
    max-height: min(360px, 50vh);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.bom-type-price-table.scroll-table {
    min-width: 520px;
}

.bom-type-price-table .bom-type-price-th-note,
.bom-type-price-table .bom-type-price-td-note {
    white-space: normal;
    word-break: break-word;
    min-width: 100px;
    max-width: 180px;
}

@media (max-width: 768px) {
    .bom-manage-page.gw-settings-page {
        padding: 0;
        overflow-x: hidden;
    }

    .bom-manage-page .gw-workflow-tab-panels {
        padding: 10px;
    }

    .bom-manage-page .gw-workflow-tab-bar {
        flex-direction: column;
    }

    .bom-manage-page .gw-workflow-tab,
    .bom-manage-page a.gw-workflow-tab {
        flex: 1 1 auto;
        width: 100%;
        justify-content: flex-start;
        text-align: left;
        padding: 10px 12px;
        font-size: 14px;
    }

    .bom-manage-toolbar {
        justify-content: stretch;
        margin-bottom: 12px;
    }

    .bom-manage-toolbar .button {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }

    .bom-manage-page .gw-workflow-form-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .bom-manage-page .gw-workflow-form-actions .button {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }

    .bom-manage-list-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }

    .bom-manage-list-item-main {
        width: 100%;
        min-width: 0;
    }

    .bom-manage-list-item-main .bold600 {
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    .bom-cat-sort-arrows {
        flex-direction: row;
        align-self: flex-start;
        gap: 6px;
    }

    .bom-manage-list-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .bom-manage-list-actions .button {
        width: 100%;
        margin: 0;
        text-align: center;
        box-sizing: border-box;
        white-space: normal;
        line-height: 1.35;
    }

    .bom-items-list-head-row {
        flex-direction: column;
        align-items: stretch;
    }

    .bom-items-list-head-row .button {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }

    .bom-manage-filter {
        gap: 8px;
    }

    .bom-cat-pill {
        max-width: 100%;
        box-sizing: border-box;
        word-break: break-word;
        text-align: center;
    }

    .bom-type-detail-page {
        margin: 0;
        padding: 8px 6px;
    }

    .bom-type-detail-actions,
    .bom-type-block-header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .bom-type-detail-actions .button,
    .bom-type-block-header-actions .button {
        flex: 0 1 auto;
        min-width: 0;
        max-width: 100%;
    }

    .bom-type-block-header-row {
        flex-direction: column;
        align-items: stretch;
    }

    .bom-type-block-header-actions {
        justify-content: stretch;
    }

    .bom-type-block-header-actions .button {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }

    .bom-type-detail-grid #bomTypeInfoView .settings-table tr {
        display: table-row !important;
    }

    .bom-type-detail-grid #bomTypeInfoView .settings-table td {
        display: table-cell !important;
        width: auto !important;
    }

    .bom-type-detail-grid #bomTypeInfoView .settings-table td:first-child {
        width: 38% !important;
        padding-bottom: 10px;
    }

    .bom-type-price-table.scroll-table {
        min-width: 560px !important;
    }

    .bom-type-price-scroll-hint {
        display: block;
    }

    .gw-workflow-form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .bom-type-detail-page .gw-workflow-form-actions .button {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
}

.bom-cat-pill {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #475569;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.bom-cat-pill:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.bom-cat-pill.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

body.dark .bom-manage-list-item {
    background: #1e293b;
    border-color: #334155;
}

body.dark .bom-cat-pill {
    background: #1e293b;
    border-color: #475569;
    color: #cbd5e1;
}

body.dark .bom-cat-pill:hover {
    background: #273548;
}

body.dark .bom-cat-pill.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

/* Tab định lượng sản phẩm — tránh tràn ngang trên mobile */
.product-bom-stack.data-block-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: clip;
}

.product-bom-stack>* {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.product-bom-stack #productBomView,
.product-bom-stack #productBomEdit,
.product-bom-stack #productBomForm {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.product-bom-stack .data-block,
.product-bom-stack .wrapper-payroll,
.product-bom-stack .data-block-body,
.product-bom-stack .product-bom-scroll-zone,
.product-bom-stack .product-bom-add-search {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.product-bom-stack .product-bom-block-head {
    margin-bottom: 10px;
}

.product-bom-stack .product-bom-block-head::after {
    content: '';
    display: table;
    clear: both;
}

.product-bom-stack .product-bom-block-head-actions {
    float: right;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 100%;
}

.product-bom-stack .filters .input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.product-bom-stack .scroll-table-wrapper {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

.product-bom-stack .scroll-table .input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.product-bom-stack .bom-add-categories {
    max-width: 100%;
    min-width: 0;
}

.product-bom-view-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.product-bom-view-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.product-bom-add-search {
    position: relative;
    margin: 12px 0 14px;
    max-width: 100%;
    min-width: 0;
}

.product-bom-add-search .input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.product-bom-searchresults.searchUsers {
    display: none;
    left: 0;
    top: 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    max-height: min(280px, 45vh);
    z-index: 10050;
}

.product-bom-search-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    cursor: pointer;
}

.product-bom-empty-row td {
    background: #f8fafc;
}

body.dark .product-bom-empty-row td {
    background: #1e293b;
}

@media (max-width: 768px) {

    .product-bom-stack .scroll-table.product-bom-view-table,
    .product-bom-stack .scroll-table.product-bom-edit-table {
        width: max-content !important;
        min-width: 780px !important;
        table-layout: auto;
    }
}

/* =============================================================================
   KILNLOAD — Xếp lò / vận hành lò (page=kilnload)
   ============================================================================= */
.kilnload-page {
    padding: 0;
    box-sizing: border-box;
}

.kilnload-page .kl-page-tabs-wrap {
    padding-top: 0;
}

.kilnload-page .kl-page-body {
    margin-top: 0;
}

.kilnload-page .kl-sheet {
    padding: 0;
    border-radius: 0;
    overflow: visible;
    box-sizing: border-box;
}

.kilnload-page .kl-sheet > .kl-pane,
.kilnload-page .kl-sheet > .kl-toolbar,
.kilnload-page .kl-sheet > .kl-load-grid,
.kilnload-page .kl-sheet > .kl-plan,
.kilnload-page .kl-sheet > .kl-view,
.kilnload-page .kl-sheet > .kl-slips,
.kilnload-page .kl-sheet > .kl-profile,
.kilnload-page .kl-sheet > .kl-form-pane,
.kilnload-page .kl-sheet > .kl-an,
.kilnload-page .kl-sheet > .kl-op {
    padding: 10px;
    box-sizing: border-box;
}

.kilnload-page .kl-sheet > .kl-pane + .kl-pane,
.kilnload-page .kl-sheet > .kl-toolbar + .kl-load-grid,
.kilnload-page .kl-sheet > .kl-toolbar + .kl-plan,
.kilnload-page .kl-sheet > .kl-toolbar + .kl-slips {
    padding-top: 0;
}

/* —— Toolbar / filters —— */
.kilnload-page .kl-toolbar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    border-radius: 5px;
    background: #f5f7f9;
    border: 1px solid #eceff1;
    box-sizing: border-box;
}

.kilnload-page .kl-toolbar__form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin: 0;
}

.kilnload-page .kl-toolbar__form select,
.kilnload-page .kl-toolbar__form .input {
    min-height: 36px;
    padding: 6px 10px;
    border-radius: 5px;
    border: 1px solid #cfd8dc;
    background: #fff;
    font-size: 14px;
    font-weight: 600;
    box-sizing: border-box;
}

.kilnload-page .kl-toolbar__search-wrap {
    display: flex;
    flex: 0 1 auto;
    align-items: stretch;
    gap: 6px;
    min-width: 0;
    max-width: 280px;
    width: 100%;
}

.kilnload-page .kl-toolbar__search {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 200px;
    width: 100%;
}

.kilnload-page .kl-toolbar__search-btn {
    flex-shrink: 0;
    min-height: 36px;
    margin: 0;
    padding: 5px 14px;
    border-radius: 5px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.kilnload-page .kl-toolbar__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.kilnload-page .kl-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid #cfd8dc;
    background: #fff;
    color: #455a64;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    cursor: pointer;
    user-select: none;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.kilnload-page .kl-chip:hover {
    background: #eef4ff;
    border-color: #90caf9;
    color: #1565c0;
}

.kilnload-page .kl-chip.active {
    border-color: #1565c0;
    background: #1565c0;
    color: #fff;
    box-shadow: 0 1px 4px rgba(21, 101, 192, 0.25);
}

.kilnload-page .kl-chip--kiln {
    font-weight: 600;
}

/* —— Greenware plan —— */
.kilnload-page .kl-pane.kl-plan {
    padding: 10px;
    box-sizing: border-box;
}

/* Kế hoạch vào lò — KPI panel (cùng pattern Tổng hợp / greenwareproduction) */
.kilnload-page .kl-plan-kpi-panel {
    margin-bottom: 10px;
}

.kilnload-page .kl-plan-kpi-panel .gw-producer-stats-panel.gw-producer-stats-panel--in-tab {
    border-radius: 5px;
    margin-bottom: 10px;
}

.kilnload-page .kl-plan-kpi-panel .gw-producer-stats-panel--in-tab:last-child {
    margin-bottom: 0;
}

.kilnload-page .kl-plan-kpi-panel .gw-producer-stats-panel__head--actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.kilnload-page .kl-plan-panel__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.kilnload-page .kl-plan-panel__actions .button {
    height: auto;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1.2;
    margin: 0;
}

.kilnload-page .kl-plan-export-form {
    margin: 0;
    display: inline-flex;
}

.kilnload-page .kl-plan-stats-panel--pick .gw-producer-stats-panel__title {
    color: #e65100;
}

.kilnload-page .kl-plan-stats-panel--pick .gw-producer-stats-panel__icon {
    background: rgba(230, 81, 0, 0.12);
    color: #e65100;
}

.kilnload-page .kl-plan-kpis--pick {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kilnload-page .kl-plan-stats-panel--pick .gw-producer-stats-kpi__value {
    color: #e65100;
}

.kilnload-page .kl-plan-order-list {
    margin-top: 0;
}

.kilnload-page .kl-plan-order.gw-entry-month {
    margin: 0;
}

.kilnload-page .kl-plan-order .gw-entry-month-summary {
    flex-wrap: wrap;
    align-items: center;
}

.kilnload-page .kl-plan-order__title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

.kilnload-page .kl-plan-order__title-sep {
    color: #90a4ae;
    font-weight: 700;
    line-height: 1;
    user-select: none;
}

.kilnload-page .kl-plan-order__title a {
    color: inherit;
    text-decoration: none;
}

.kilnload-page .kl-plan-order__title a:hover {
    text-decoration: underline;
}

.kilnload-page .kl-plan-order__customer {
    font-weight: 600;
    color: #546e7a;
}

.kilnload-page .kl-plan-order__summary-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-left: auto;
    font-size: 12px;
    font-weight: 500;
}

.kilnload-page .kl-plan-order__totals {
    font-size: 13px;
    font-weight: 600;
    color: #1565c0;
    white-space: nowrap;
}

.kilnload-page .kl-plan-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
}

.kilnload-page .kl-plan-badge--muted {
    background: #eceff1;
    color: #78909c;
}

.kilnload-page .kl-plan-badge--ok {
    background: #e8f5e9;
    color: #2e7d32;
}

.kilnload-page .kl-plan-badge--warn {
    background: #fff3e0;
    color: #e65100;
}

.kilnload-page .kl-plan-badge--danger {
    background: #ffebee;
    color: #c62828;
}

/* Hợp đồng: header + bảng trong một khối gw-entry-month (sát viền, không padding body) */
.kilnload-page .kl-plan-order .gw-entry-month-body {
    padding: 0;
    margin: 0;
}

.kilnload-page .kl-plan-order .gw-entry-month-body > .scroll-hint {
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    border-bottom: 1px solid #d0dbe4;
}

.kilnload-page .kl-plan-order .gw-entry-month-body > .scroll-hint + .gw-entry-table-wrap,
.kilnload-page .kl-plan-order .gw-entry-month-body > .scroll-hint + .scroll-table-wrapper {
    margin-top: 0;
}

.kilnload-page .kl-plan-order .gw-entry-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.kilnload-page .kl-plan-order .kl-plan-products-table {
    width: 100%;
    margin: 0;
    border-radius: 0;
    color: #37474f;
}

.kilnload-page .kl-plan-order .kl-plan-products-table th,
.kilnload-page .kl-plan-order .kl-plan-products-table td {
    border-color: #e0e4e8;
}

.kilnload-page .kl-plan-order .kl-plan-products-table thead th {
    border-top: none;
    background: #f8fafb;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #607d8b;
    border-bottom: 1px solid #e0e4e8;
}

.kilnload-page .kl-plan-order .kl-plan-products-table tbody td {
    border-bottom: 1px solid #eef1f3;
}

.kilnload-page .kl-plan-order .kl-plan-products-table tbody tr:last-child > td {
    border-bottom: none !important;
}

.kilnload-page .kl-plan-check-all {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0;
    cursor: pointer;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

.kilnload-page .kl-plan-product__code {
    font-weight: 700;
    line-height: 1.35;
    text-align: left;
}

.kilnload-page .kl-plan-products-table .kl-plan-col-product {
    text-align: left !important;
    white-space: normal;
    vertical-align: middle;
}

.kilnload-page .kl-plan-product__code a {
    color: #1565c0;
    text-decoration: none;
}

.kilnload-page .kl-plan-product__desc {
    margin-top: 2px;
    font-size: 14px;
    font-weight: 600;
    color: #37474f;
    line-height: 1.35;
}

.kilnload-page .kl-plan-product__finish {
    margin-top: 2px;
    font-size: 14px;
    font-style: italic;
    color: #78909c;
    line-height: 1.35;
}

.kilnload-page td.kl-plan-product__size {
    font-size: 14px;
    color: #546e7a;
    white-space: nowrap;
}

.kilnload-page .kl-plan-table__ready {
    font-weight: 700;
    color: #1565c0;
}

.kilnload-page .kl-plan-qty {
    width: 88px;
    min-height: 36px;
    margin: 0 auto;
    padding: 6px 8px;
    text-align: center;
    font-weight: 700;
    box-sizing: border-box;
}

.kilnload-page .kl-plan-table__vol {
    font-weight: 600;
    color: #546e7a;
    white-space: nowrap;
}

.kilnload-page .kl-pane.kl-plan > .kl-empty {
    margin: 0;
}

@media (max-width: 900px) {
    .kilnload-page .kl-plan-panel__actions {
        width: 100%;
        justify-content: flex-start;
    }

    .kilnload-page .kl-plan-order__summary-meta {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .kilnload-page .kl-plan-kpi-panel .gw-producer-stats-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kilnload-page .kl-plan-kpis--pick {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .kilnload-page .kl-plan-panel__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .kilnload-page .kl-plan-panel__actions .button,
    .kilnload-page .kl-plan-export-form {
        width: 100%;
    }

    .kilnload-page .kl-plan-export-form .button {
        width: 100%;
    }
}

/* —— Load cards grid —— */
.kilnload-page .kl-load-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    padding: 0;
    box-sizing: border-box;
}

.kilnload-page .kl-pane .kl-toolbar + .kl-load-grid,
.kilnload-page .kl-pane .kl-toolbar + .kl-load-search-summary {
    margin-top: 10px;
}

.kilnload-page .kl-load-search-summary {
    margin: 0 0 10px;
    padding: 8px 10px;
    border-radius: 5px;
    background: #e3f2fd;
    border: 1px solid #90caf9;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    color: #1565c0;
    box-sizing: border-box;
}

.kilnload-page .kl-load-search-summary strong {
    font-weight: 700;
}

.kilnload-page .kl-load-warn {
    margin: 10px 0;
    padding: 10px 12px;
    border-radius: 5px;
    background: #fff8e1;
    border: 1px solid #ffcc80;
    box-sizing: border-box;
}

.kilnload-page .kl-load-warn__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 700;
    color: #e65100;
}

.kilnload-page .kl-load-warn__head i {
    font-size: 15px;
}

.kilnload-page .kl-load-warn__text {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.55;
    color: #5d4037;
}

.kilnload-page .kl-load-warn__text strong {
    font-weight: 700;
    color: #bf360c;
}

.kilnload-page .kl-load-warn__badges {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.kilnload-page .kl-load-warn__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 30px;
    margin: 0;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #ffb74d;
    background: #fff;
    color: #e65100;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    box-sizing: border-box;
}

.kilnload-page .kl-load-warn__badge:hover {
    background: #ffe0b2;
    border-color: #fb8c00;
    color: #bf360c;
}

.kilnload-page .kl-load-card {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 100%;
    padding: 0;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
    box-sizing: border-box;
}

.kilnload-page .kl-load-card:hover {
    border-color: #90caf9;
    box-shadow: 0 4px 14px rgba(21, 101, 192, 0.12);
    transform: translateY(-1px);
}

.kilnload-page .kl-load-card--past {
    background: #fffde7;
    border-color: #ffe082;
}

.kilnload-page .kl-load-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 10px 8px;
    border-bottom: 1px solid #eceff1;
    background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
}

.kilnload-page .kl-load-card__title {
    font-size: 19px;
    font-weight: 700;
    color: #263238;
    line-height: 1.35;
    min-width: 0;
}

.kilnload-page .kl-load-card__badges {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.kilnload-page .kl-load-card__kiln-badge,
.kilnload-page .kl-load-card__type {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    box-sizing: border-box;
    white-space: nowrap;
    text-transform: uppercase;
}

.kilnload-page .kl-load-card__kiln-badge {
    border: none;
}

.kilnload-page .kl-load-card__kiln-badge[data-kiln="1"] {
    background: rgba(31, 119, 180, 0.14);
    color: #1565c0;
}

.kilnload-page .kl-load-card__kiln-badge[data-kiln="2"] {
    background: rgba(255, 127, 14, 0.14);
    color: #e65100;
}

.kilnload-page .kl-load-card__kiln-badge[data-kiln="3"] {
    background: rgba(44, 160, 44, 0.14);
    color: #2e7d32;
}

.kilnload-page .kl-load-card__kiln-badge[data-kiln="4"] {
    background: rgba(214, 39, 40, 0.14);
    color: #c62828;
}

.kilnload-page .kl-load-card__kiln-badge[data-kiln="5"] {
    background: rgba(148, 103, 189, 0.14);
    color: #7b1fa2;
}

.kilnload-page .kl-load-card__kiln-badge[data-kiln="6"] {
    background: rgba(140, 86, 75, 0.14);
    color: #6d4c41;
}

.kilnload-page .kl-load-card__kiln-badge[data-kiln="7"] {
    background: rgba(227, 119, 194, 0.14);
    color: #ad1457;
}

.kilnload-page .kl-load-card__kiln-badge[data-kiln="8"] {
    background: rgba(127, 127, 127, 0.14);
    color: #546e7a;
}

.kilnload-page .kl-load-card__kiln-badge[data-kiln="9"] {
    background: rgba(188, 189, 34, 0.16);
    color: #827717;
}

.kilnload-page .kl-load-card__kiln-badge[data-kiln="10"] {
    background: rgba(23, 190, 207, 0.14);
    color: #00838f;
}

.kilnload-page .kl-load-card__type {
    background: #eceff1;
    color: #546e7a;
}

.kilnload-page .kl-load-card--type-so_nung .kl-load-card__type {
    background: #fff3e0;
    color: #e65100;
}

.kilnload-page .kl-load-card--type-nung_chin .kl-load-card__type {
    background: #ffebee;
    color: #c62828;
}

.kilnload-page .kl-load-card__body {
    padding: 8px 10px;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kilnload-page .kl-load-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    font-size: 14px;
    color: #546e7a;
}

.kilnload-page .kl-load-card__status {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}

.kilnload-page .kl-load-card__qty {
    text-align: center;
    padding: 8px 0;
    border-top: 1px dashed #e0e0e0;
    border-bottom: 1px dashed #e0e0e0;
}

.kilnload-page .kl-load-card__qty-num {
    font-size: 26px;
    font-weight: 700;
    color: #1565c0;
    line-height: 1.1;
}

.kilnload-page .kl-load-card__qty-label {
    font-size: 13px;
    color: #78909c;
}

.kilnload-page .kl-load-card__op {
    font-size: 14px;
    font-weight: 600;
    color: #546e7a;
    line-height: 1.45;
}

.kilnload-page .kl-load-card__op-name {
    font-weight: 700;
}

.kilnload-page .kl-load-card__op-detail {
    font-weight: 600;
}

.kilnload-page .kl-load-card__avatars {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.kilnload-page .kl-load-card__foot {
    padding: 8px 10px 10px;
    margin-top: auto;
}

.kilnload-page .kl-load-card__foot .button {
    width: 100%;
    justify-content: center;
}

/* —— Slips (phiếu ra lò) —— */
.kilnload-page .kl-slips-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 10px;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #eceff1;
    background: #f5f7f9;
    box-sizing: border-box;
}

.kilnload-page .kl-slips-filters {
    flex: 0 0 auto;
    margin: 0;
}

.kilnload-page .kl-slips-stats {
    display: flex;
    flex: 1 1 auto;
    align-items: stretch;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.kilnload-page .kl-slips-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 6px 10px;
    border-radius: 5px;
    border: 1px solid #e3edf7;
    background: #fff;
    text-align: center;
    box-sizing: border-box;
}

.kilnload-page .kl-slips-stat--ok {
    border-color: #c8e6c9;
    background: #f1f8f2;
}

.kilnload-page .kl-slips-stat--warn {
    border-color: #ffe0b2;
    background: #fffaf3;
}

.kilnload-page .kl-slips-stat__value {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    color: #263238;
}

.kilnload-page .kl-slips-stat--ok .kl-slips-stat__value {
    color: #2e7d32;
}

.kilnload-page .kl-slips-stat--warn .kl-slips-stat__value {
    color: #e65100;
}

.kilnload-page .kl-slips-stat__label {
    margin-top: 2px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #78909c;
    line-height: 1.2;
    white-space: nowrap;
}

.kilnload-page .kl-slip-board {
    margin-top: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    background: #fff;
    overflow: hidden;
    box-sizing: border-box;
}

.kilnload-page .kl-slip-row {
    display: grid;
    grid-template-columns: minmax(88px, 0.95fr) minmax(100px, 1.35fr) minmax(100px, 1.2fr) minmax(76px, 0.75fr) 24px;
    gap: 6px 10px;
    align-items: center;
    padding: 6px 10px;
    min-height: 36px;
    border-bottom: 1px solid #eceff1;
    box-sizing: border-box;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s ease;
}

.kilnload-page .kl-slip-row:last-child {
    border-bottom: none;
}

.kilnload-page .kl-slip-row--head {
    min-height: 32px;
    padding: 4px 10px;
    background: #f5f7f9;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #78909c;
}

.kilnload-page a.kl-slip-row:hover {
    background: #f0f7ff;
}

.kilnload-page .kl-slip-row--pending {
    border-left: 3px solid #ff9800;
    padding-left: 7px;
}

.kilnload-page .kl-slip-row--completed {
    border-left: 3px solid #43a047;
    padding-left: 7px;
}

.kilnload-page .kl-slip-row__col {
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: #37474f;
}

.kilnload-page .kl-slip-row__col--date .kl-slip-row__date {
    font-weight: 700;
    color: #1565c0;
}

.kilnload-page .kl-slip-row__col--loads {
    text-align: center;
}

.kilnload-page .kl-slip-row__kilns {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
}

.kilnload-page .kl-slip-row__col--status {
    text-align: center;
}

.kilnload-page .kl-slip-row__col--go {
    text-align: right;
    color: #90a4ae;
    font-size: 13px;
}

.kilnload-page .kl-slip-row__badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
}

.kilnload-page .kl-slip-row__badge--ok {
    background: #e8f5e9;
    color: #2e7d32;
}

.kilnload-page .kl-slip-row__badge--pending {
    background: #fff3e0;
    color: #e65100;
}

@media (max-width: 720px) {
    .kilnload-page .kl-slips-topbar {
        flex-direction: column;
    }

    .kilnload-page .kl-slips-stats {
        justify-content: stretch;
    }

    .kilnload-page .kl-slips-stat {
        flex: 1 1 0;
        min-width: 0;
    }

    .kilnload-page .kl-slip-row--head {
        display: none;
    }

    .kilnload-page .kl-slip-row {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "date status"
            "in go"
            "loads loads";
        gap: 2px 8px;
        padding: 8px 10px;
        min-height: 0;
    }

    .kilnload-page .kl-slip-row__col--date {
        grid-area: date;
    }

    .kilnload-page .kl-slip-row__col--in {
        grid-area: in;
        font-size: 13px;
        color: #546e7a;
    }

    .kilnload-page .kl-slip-row__col--in::before {
        content: "Vào lò: ";
        font-weight: 700;
        color: #78909c;
    }

    .kilnload-page .kl-slip-row__col--loads {
        grid-area: loads;
        text-align: left;
        font-size: 13px;
        color: #546e7a;
    }

    .kilnload-page .kl-slip-row__col--loads::before {
        content: "Lò: ";
        font-weight: 700;
        color: #78909c;
    }

    .kilnload-page .kl-slip-row__kilns {
        justify-content: flex-start;
    }

    .kilnload-page .kl-slip-row__col--status {
        grid-area: status;
        text-align: right;
    }

    .kilnload-page .kl-slip-row__col--go {
        grid-area: go;
        align-self: center;
    }
}

/* —— View detail: hero + meta + actions (một hàng ngang trên desktop) —— */
.kilnload-page .kl-view-hero {
    margin: 0 0 8px;
    padding: 8px 10px;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    box-sizing: border-box;
}

.kilnload-page .kl-view-hero__top {
    display: flex;
    align-items: stretch;
    gap: 8px;
    min-width: 0;
}

.kilnload-page .kl-view-hero__identity {
    flex: 0 0 280px;
    width: min(100%, 280px);
    min-width: 0;
    padding-right: 10px;
    border-right: 1px solid #eceff1;
    box-sizing: border-box;
}

.kilnload-page .kl-view-hero__identity-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 4px;
}

.kilnload-page .kl-view-hero__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    min-width: 0;
}

.kilnload-page .kl-view-hero__badges {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.kilnload-page .kl-view-hero__title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
    color: #263238;
}

.kilnload-page .kl-view-hero__sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    margin-bottom: 4px;
}

.kilnload-page .kl-view-hero__date {
    font-size: 12px;
    font-weight: 600;
    color: #546e7a;
}

.kilnload-page .kl-view-hero__date i {
    margin-right: 3px;
    color: #78909c;
    font-size: 11px;
}

.kilnload-page .kl-view-type-badge,
.kilnload-page .kl-view-kiln-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    box-sizing: border-box;
}

.kilnload-page .kl-view-type-badge {
    text-transform: uppercase;
    letter-spacing: 0.02em;
    background: #eceff1;
    color: #546e7a;
}

.kilnload-page .kl-view-hero--type-so_nung .kl-view-type-badge {
    background: #fff3e0;
    color: #e65100;
}

.kilnload-page .kl-view-hero--type-nung_chin .kl-view-type-badge {
    background: #ffebee;
    color: #c62828;
}

.kilnload-page .kl-view-kiln-badge[data-kiln="1"] {
    background: rgba(31, 119, 180, 0.14);
    color: #1565c0;
}

.kilnload-page .kl-view-kiln-badge[data-kiln="2"] {
    background: rgba(255, 127, 14, 0.14);
    color: #e65100;
}

.kilnload-page .kl-view-kiln-badge[data-kiln="3"] {
    background: rgba(44, 160, 44, 0.14);
    color: #2e7d32;
}

.kilnload-page .kl-view-kiln-badge[data-kiln="4"] {
    background: rgba(214, 39, 40, 0.14);
    color: #c62828;
}

.kilnload-page .kl-view-kiln-badge[data-kiln="5"] {
    background: rgba(148, 103, 189, 0.14);
    color: #7b1fa2;
}

.kilnload-page .kl-view-kiln-badge[data-kiln="6"] {
    background: rgba(140, 86, 75, 0.14);
    color: #6d4c41;
}

.kilnload-page .kl-view-kiln-badge[data-kiln="7"] {
    background: rgba(227, 119, 194, 0.14);
    color: #ad1457;
}

.kilnload-page .kl-view-kiln-badge[data-kiln="8"] {
    background: rgba(127, 127, 127, 0.14);
    color: #546e7a;
}

.kilnload-page .kl-view-kiln-badge[data-kiln="9"] {
    background: rgba(188, 189, 34, 0.16);
    color: #827717;
}

.kilnload-page .kl-view-kiln-badge[data-kiln="10"] {
    background: rgba(23, 190, 207, 0.14);
    color: #00838f;
}

.kilnload-page .kl-view-hero__status {
    font-size: 12px;
    line-height: 1.35;
}

.kilnload-page .kl-view-hero__edit {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.kilnload-page .kl-view-meta {
    flex: 1 1 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    min-width: 0;
    width: 100%;
    align-self: stretch;
}

.kilnload-page .kl-view-meta__item {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    min-height: 100%;
    width: 100%;
    padding: 6px 8px;
    border-radius: 5px;
    background: #f5f7f9;
    border: 1px solid #eceff1;
    box-sizing: border-box;
    min-width: 0;
    min-height: 0;
}

.kilnload-page .kl-view-meta__label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #78909c;
    margin-bottom: 2px;
    line-height: 1.2;
}

.kilnload-page .kl-view-meta__value {
    font-size: 13px;
    font-weight: 600;
    color: #37474f;
    line-height: 1.35;
    word-break: break-word;
}

.kilnload-page .kl-view-meta__value--compact {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    align-content: flex-start;
    gap: 2px 4px;
}

.kilnload-page .kl-view-meta__sep {
    color: #90a4ae;
    font-weight: 400;
}

.kilnload-page .kl-view-meta__hint {
    font-size: 12px;
    font-weight: 700;
    color: #1565c0;
    white-space: nowrap;
}

.kilnload-page .kl-view-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eceff1;
}

.kilnload-page .kl-view-actions .button {
    padding: 6px 10px;
    font-size: 13px;
}

.kilnload-page .kl-view-products-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 8px;
    padding: 8px 10px;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
    background: #fff;
    box-sizing: border-box;
}

.kilnload-page .kl-view-products-bar__summary {
    font-size: 15px;
    font-weight: 700;
    color: #263238;
    white-space: nowrap;
}

.kilnload-page .kl-view-products-bar__sep {
    color: #90a4ae;
    margin: 0 2px;
}

.kilnload-page .kl-view-products-bar__qty {
    color: #1565c0;
}

.kilnload-page .kl-view-products-bar__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    flex: 1 1 auto;
}

.kilnload-page .kl-view-products-bar__filters .kl-chip.active {
    border-color: #1565c0;
    background: #1565c0;
    color: #fff;
}

.kilnload-page .kl-view-panel {
    margin: 0 0 10px;
    padding: 12px 14px;
    border-radius: 5px;
    box-sizing: border-box;
}

.kilnload-page .kl-view-panel__title {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 700;
    color: #263238;
}

.kilnload-page .kl-view-panel__search {
    position: relative;
    max-width: 520px;
}

.kilnload-page .kl-view-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 10px;
    min-width: 0;
}

.kilnload-page .kl-view-panel__header .kl-view-panel__title {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
}

.kilnload-page .kl-view-panel__tools {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex-shrink: 0;
}

.kilnload-page .kl-view-panel__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    background: #f5f7f9;
    color: #78909c;
    cursor: pointer;
    box-sizing: border-box;
}

.kilnload-page .kl-view-panel__toggle:hover {
    background: #eceff1;
    color: #546e7a;
}

.kilnload-page .kl-view-footer-cta {
    margin: 10px 0 0;
    padding: 10px 0 0;
    border-top: 1px solid #eceff1;
    text-align: center;
}

.kilnload-page .kl-view .wrapper-payroll {
    margin: 0 0 10px;
    border-radius: 5px;
}

@media (max-width: 1199px) {
    .kilnload-page .kl-view-hero__top {
        flex-direction: column;
        gap: 8px;
    }

    .kilnload-page .kl-view-hero__identity {
        flex: 0 0 auto;
        width: 100%;
        padding-right: 0;
        padding-bottom: 8px;
        border-right: none;
        border-bottom: 1px solid #eceff1;
    }

    .kilnload-page .kl-view-meta {
        flex: 0 0 auto;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .kilnload-page .kl-view-meta__item--time {
        grid-column: span 1;
    }

    .kilnload-page .kl-view-products-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .kilnload-page .kl-view-products-bar__filters {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .kilnload-page .kl-view-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 400px) {
    .kilnload-page .kl-view-meta {
        grid-template-columns: 1fr;
    }

    .kilnload-page .kl-view-actions .button {
        flex: 1 1 calc(50% - 3px);
        justify-content: center;
    }
}

.kilnload-page .kl-view {
    --kl-product-card-border: #e0e0e0;
    --kl-product-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.kilnload-page .kl-view #productList {
    margin: 10px 0 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Grid sản phẩm phải nằm trên .product-grid.large (full width), không grid #productList */
.kilnload-page .kl-view #productList .product-grid.large {
    display: grid !important;
    width: 100%;
    max-width: 100%;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)) !important;
    gap: 10px;
}

.kilnload-page .kl-view #productList .product-grid.large > .product-card {
    width: 100%;
    max-width: none;
    min-width: 0;
    border-radius: 5px;
    border: 1px solid var(--kl-product-card-border);
    box-shadow: var(--kl-product-card-shadow);
}

@media (min-width: 1200px) {
    .kilnload-page .kl-view #productList .product-grid.large {
        grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 640px) {
    .kilnload-page .kl-view #productList .product-grid.large {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px;
    }
}

@media (max-width: 339px) {
    .kilnload-page .kl-view #productList .product-grid.large {
        grid-template-columns: 1fr !important;
    }
}

.kilnload-page .kl-view .product-grid.xlarge {
    display: grid !important;
    width: 100%;
    max-width: 100%;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)) !important;
    gap: 10px;
}

@media (min-width: 1200px) {
    .kilnload-page .kl-view .product-grid.xlarge {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    }
}

/* —— Form / profile panes —— */
.kilnload-page .kl-form-pane .wrapper-payroll,
.kilnload-page .kl-profile .wrapper-payroll {
    border: none;
    box-shadow: none;
    padding: 0;
}

.kilnload-page .kl-form-pane__title {
    margin: 0 0 12px;
    font-size: 17px;
    font-weight: 700;
    color: #263238;
}

.kilnload-page .kl-form-pane__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 12px;
}

.kilnload-page .kl-form-pane__head .kl-form-pane__title {
    margin: 0;
}

.kilnload-page .kl-form-pane__head .kl-form-pane__title i {
    margin-right: 6px;
    color: #1565c0;
}

.kilnload-page .kl-form-pane__head .button {
    margin: 0;
}

.kilnload-page .kl-form-pane > .alert {
    margin-bottom: 12px;
}

.kilnload-page .kl-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 640px;
}

.kilnload-page .kl-form-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    background: #fff;
    box-sizing: border-box;
}

.kilnload-page .kl-form-row {
    display: grid;
    gap: 12px;
}

.kilnload-page .kl-form-row--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.kilnload-page .kl-form-field label,
.kilnload-page .kl-form-field__label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
    color: #37474f;
}

.kilnload-page .kl-form-field .input,
.kilnload-page .kl-form-field select.input {
    width: 100%;
    min-height: 40px;
    box-sizing: border-box;
}

.kilnload-page .kl-form-hint {
    margin: 5px 0 8px;
    font-size: 13px;
    line-height: 1.4;
    color: #78909c;
}

.kilnload-page .kl-form-divider {
    margin: 0;
    border: none;
    border-top: 1px solid #eceff1;
}

.kilnload-page .kl-form-type {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.kilnload-page .kl-form-type__opt {
    margin: 0;
    cursor: pointer;
}

.kilnload-page .kl-form-type__opt input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.kilnload-page .kl-form-type__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 10px;
    border-radius: 5px;
    border: 1px solid #cfd8dc;
    background: #fafbfc;
    font-size: 14px;
    font-weight: 700;
    color: #37474f;
    box-sizing: border-box;
    transition: border-color 0.12s ease, background 0.12s ease;
}

.kilnload-page .kl-form-type__opt input:checked + .kl-form-type__btn--nung-chin {
    border-color: #1565c0;
    background: #e3f2fd;
    color: #1565c0;
}

.kilnload-page .kl-form-type__opt input:checked + .kl-form-type__btn--so-nung {
    border-color: #e65100;
    background: #fff3e0;
    color: #e65100;
}

.kilnload-page .kl-form-workers {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kilnload-page .kl-form-workers .searchUserToTag {
    width: 100% !important;
    max-width: none;
}

.kilnload-page .kl-form-workers__chips {
    min-height: 44px;
    padding: 8px 10px;
    border-radius: 5px;
    border: 1px dashed #cfd8dc;
    background: #f5f7f9;
}

.kilnload-page .kl-form-workers__chips:empty::before {
    content: "Chưa chọn nhân viên";
    font-size: 13px;
    font-weight: 600;
    color: #90a4ae;
}

.kilnload-page .kl-form__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin: 4px 0 0;
    padding: 12px 16px;
    box-sizing: border-box;
}

@media (max-width: 640px) {
    .kilnload-page .kl-form {
        max-width: none;
    }

    .kilnload-page .kl-form-row--2,
    .kilnload-page .kl-form-type {
        grid-template-columns: 1fr;
    }
}

/* —— Tạo chuyến lò (kl-an) —— */
.kilnload-page--addnew .kl-page-body {
    flex: 0 0 auto;
    align-self: stretch;
}

.kilnload-page--addnew .kl-sheet {
    flex: 0 0 auto;
    min-height: 0;
    height: auto;
    padding: 0;
}

.kilnload-page .kl-an {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 12px 14px 14px;
    box-sizing: border-box;
}

.kilnload-page .kl-an__card {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}

.kilnload-page .kl-an__layout {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
}

@media (min-width: 901px) {
    .kilnload-page .kl-an__layout {
        grid-template-columns: 4fr 6fr;
    }
}

.kilnload-page .kl-an__aside {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #eceff1;
}

.kilnload-page .kl-an__section {
    padding: 14px 16px;
    border-bottom: 1px solid #eceff1;
}

.kilnload-page .kl-an__section:last-child {
    border-bottom: none;
}

.kilnload-page .kl-an__main {
    padding: 14px 16px 16px;
    min-width: 0;
}

.kilnload-page .kl-an__section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-bottom: 10px;
}

.kilnload-page .kl-an__section-head--workers {
    margin-bottom: 6px;
}

.kilnload-page .kl-an__section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #37474f;
}

.kilnload-page .kl-an__section-title i {
    font-size: 14px;
}

.kilnload-page .kl-an__counter {
    margin-left: auto;
    padding: 3px 10px;
    border-radius: 999px;
    background: #e3f2fd;
    color: #1565c0;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
}

.kilnload-page .kl-an__counter[data-count="0"] {
    background: #eceff1;
    color: #78909c;
}

.kilnload-page .kl-an__hint {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.45;
    color: #78909c;
}

.kilnload-page .kl-an__fields {
    display: grid;
    gap: 10px;
}

.kilnload-page .kl-an__fields--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.kilnload-page .kl-an__field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 0;
    min-width: 0;
}

.kilnload-page .kl-an__label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #78909c;
}

.kilnload-page .kl-an__input.input,
.kilnload-page .kl-an__field .input {
    width: 100%;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    padding: 0 12px !important;
    font-size: 16px !important;
    font-weight: 600;
    line-height: normal;
    border-radius: 6px;
    box-sizing: border-box;
}

.kilnload-page .kl-an__field input[type="date"].input,
.kilnload-page .kl-an__field input[type="time"].input {
    appearance: none;
    -webkit-appearance: none;
    display: block;
}

.kilnload-page .kl-an__field input[type="date"].input::-webkit-date-and-time-value,
.kilnload-page .kl-an__field input[type="time"].input::-webkit-date-and-time-value {
    height: 44px;
    line-height: 44px;
    margin: 0;
    padding: 0;
}

.kilnload-page .kl-an__field input[type="date"].input::-webkit-calendar-picker-indicator,
.kilnload-page .kl-an__field input[type="time"].input::-webkit-calendar-picker-indicator {
    margin: 0;
    padding: 0;
}

/* Flatpickr thay type=date bằng altInput text — ô gốc ẩn, cần style ô hiển thị */
.kilnload-page .kl-an__field .flatpickr-wrapper {
    display: block;
    width: 100%;
}

.kilnload-page .kl-an__field input.flatpickr-input.flatpickr-alt-display.lch-flatpickr-input {
    display: block;
    width: 100% !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    padding: 0 12px !important;
    font-size: 16px !important;
    font-weight: 600;
    line-height: 44px;
    border-radius: 6px;
    box-sizing: border-box;
}

.kilnload-page .kl-an__picks {
    display: grid;
    gap: 8px;
}

.kilnload-page .kl-an__picks--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.kilnload-page .kl-an__picks--kiln {
    grid-template-columns: repeat(var(--kl-kiln-count, 5), minmax(0, 1fr));
}

.kilnload-page .kl-an__pick,
.kilnload-page .kl-an__worker {
    position: relative;
    display: block;
    margin: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.kilnload-page .kl-an__pick-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.kilnload-page .kl-an__chip {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #cfd8dc;
    background: #fafbfc;
    font-size: 13px;
    font-weight: 700;
    color: #37474f;
    text-align: center;
    line-height: 1.25;
    box-sizing: border-box;
    transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
    user-select: none;
}

.kilnload-page .kl-an__chip--chin,
.kilnload-page .kl-an__chip--so,
.kilnload-page .kl-an__chip--kiln {
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 14px;
}

.kilnload-page .kl-an__chip--kiln {
    white-space: nowrap;
    padding-inline: 6px;
    font-size: 14px;
}

.kilnload-page .kl-an__pick-input:checked + .kl-an__chip--chin {
    border-color: #1565c0;
    background: #e3f2fd;
    color: #1565c0;
    box-shadow: 0 0 0 1px rgba(21, 101, 192, 0.12);
}

.kilnload-page .kl-an__pick-input:checked + .kl-an__chip--so {
    border-color: #e65100;
    background: #fff3e0;
    color: #e65100;
    box-shadow: 0 0 0 1px rgba(230, 81, 0, 0.12);
}

.kilnload-page .kl-an__pick-input:checked + .kl-an__chip--kiln {
    border-color: #1565c0;
    background: #e3f2fd;
    color: #1565c0;
    box-shadow: 0 0 0 1px rgba(21, 101, 192, 0.12);
}

.kilnload-page .kl-an__pick-input:focus-visible + .kl-an__chip,
.kilnload-page .kl-an__pick-input:focus-visible + .kl-an__worker-card {
    outline: 2px solid #1565c0;
    outline-offset: 2px;
}

.kilnload-page .kl-an__workers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}

.kilnload-page .kl-an__worker-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-height: 118px;
    padding: 10px 8px;
    border-radius: 8px;
    border: 1px solid #cfd8dc;
    background: #fafbfc;
    box-sizing: border-box;
    transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.kilnload-page .kl-an__pick-input:checked + .kl-an__worker-card {
    border-color: #1565c0;
    background: #e3f2fd;
    box-shadow: 0 0 0 1px rgba(21, 101, 192, 0.12);
}

.kilnload-page .kl-an__worker-photo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #eceff1;
    flex-shrink: 0;
    background: #fff;
    box-sizing: border-box;
}

.kilnload-page .kl-an__worker-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.kilnload-page .kl-an__pick-input:checked + .kl-an__worker-card .kl-an__worker-photo {
    border-color: #1565c0;
}

.kilnload-page .kl-an__worker-check {
    display: none;
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #1565c0;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    border: 2px solid #fff;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 1;
}

.kilnload-page .kl-an__pick-input:checked + .kl-an__worker-card .kl-an__worker-check {
    display: block;
}

.kilnload-page .kl-an__worker-name {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    color: #37474f;
    word-break: break-word;
}

.kilnload-page .kl-an__pick-input:checked + .kl-an__worker-card .kl-an__worker-name {
    color: #1565c0;
}

.kilnload-page .kl-an__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 160px;
    padding: 24px 16px;
    text-align: center;
    border: 1px dashed #cfd8dc;
    border-radius: 8px;
    background: #f8fafb;
    color: #78909c;
    font-size: 14px;
    line-height: 1.45;
}

.kilnload-page .kl-an__empty i {
    font-size: 24px;
    opacity: 0.65;
}

.kilnload-page .kl-an__empty p {
    margin: 0;
}

.kilnload-page .kl-an__footer {
    display: flex;
    justify-content: center;
    padding: 0 2px;
}

.kilnload-page .kl-an__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 420px;
    min-height: 48px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 8px;
    box-sizing: border-box;
}

@media (max-width: 900px) {
    .kilnload-page .kl-an__layout {
        grid-template-columns: 1fr;
    }

    .kilnload-page .kl-an__aside {
        border-right: none;
        border-bottom: 1px solid #eceff1;
    }

    .kilnload-page .kl-an__section:last-child {
        border-bottom: 1px solid #eceff1;
    }
}

@media (max-width: 640px) {
    .kilnload-page .kl-an {
        padding: 10px;
    }

    .kilnload-page .kl-an__fields--2 {
        grid-template-columns: 1fr;
    }

    .kilnload-page .kl-an__picks--kiln {
        grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    }

    .kilnload-page .kl-an__workers {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .kilnload-page .kl-an__section,
    .kilnload-page .kl-an__main {
        padding: 12px;
    }
}

@media (max-width: 380px) {
    .kilnload-page .kl-an__picks--kiln {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kilnload-page .kl-an__workers {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* —— Operation (vận hành đốt lò) —— */
.kilnload-page .kl-op-topbar {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 10px;
}

.kilnload-page .kl-op-finish-form {
    margin: 0;
}

.kilnload-page .kl-op-finish-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto;
    min-height: 36px;
    padding-left: 14px;
    padding-right: 14px;
    white-space: nowrap;
    box-sizing: border-box;
}

.kilnload-page .kl-op-form-panel {
    overflow: hidden;
}

.kilnload-page .kl-op-form-panel__chevron {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.kilnload-page .kl-op-form-panel--collapsed .kl-op-form-panel__chevron {
    transform: rotate(180deg);
}

.kilnload-page .kl-op-form-panel__body {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.22s ease;
}

.kilnload-page .kl-op-form-panel--collapsed .kl-op-form-panel__body {
    grid-template-rows: 0fr;
}

.kilnload-page .kl-op-form-panel--collapsed .kl-view-panel__header {
    margin-bottom: 0;
}

.kilnload-page .kl-op-form-panel__content {
    overflow: hidden;
    min-height: 0;
}

.kilnload-page .kl-op-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 0;
    box-sizing: border-box;
}

.kilnload-page .kl-op-form__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    min-width: 0;
}

.kilnload-page .kl-op-form__label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #78909c;
    line-height: 1.2;
}

.kilnload-page .kl-op-form__input.input {
    width: 100%;
    min-height: 40px;
    padding: 6px 10px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 5px;
    box-sizing: border-box;
}

.kilnload-page .kl-op-form .kl-op-warn {
    margin-top: 2px;
    padding: 4px 6px;
    font-size: 11px;
}

.kilnload-page .kl-op-form .kl-op-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.kilnload-page .kl-op-form .flatpickr-input,
.kilnload-page .kl-op-form .flatpickr-alt-display,
.kilnload-page .kl-op-form .lch-flatpickr-input {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

.kilnload-page .kl-op-form .flatpickr-wrapper {
    display: block;
    width: 100%;
}

.kilnload-page .kl-op-form__actions {
    margin-top: 2px;
}

.kilnload-page .kl-op-form__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    min-height: 42px;
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    border-radius: 6px;
    box-sizing: border-box;
}

@media (min-width: 901px) {
    .kilnload-page .kl-op-form {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px 12px;
        align-items: start;
    }

    .kilnload-page .kl-op-form__field--action {
        grid-column: 1;
        grid-row: 1;
    }

    .kilnload-page .kl-op-form__field--time {
        grid-column: 2;
        grid-row: 1;
    }

    .kilnload-page .kl-op-form__field--temp {
        grid-column: 3;
        grid-row: 1;
    }

    .kilnload-page .kl-op-form__field--gas {
        grid-column: 4;
        grid-row: 1;
    }

    .kilnload-page .kl-op-form__field--door {
        grid-column: 1;
        grid-row: 2;
    }

    .kilnload-page .kl-op-form__field--pipe {
        grid-column: 2;
        grid-row: 2;
    }

    .kilnload-page .kl-op-form__field--piece {
        grid-column: 3;
        grid-row: 2;
    }

    .kilnload-page .kl-op-form__field--note {
        grid-column: 4;
        grid-row: 2;
    }

    .kilnload-page .kl-op-form__actions {
        grid-column: 1 / -1;
        grid-row: 3;
        display: flex;
        justify-content: flex-end;
        margin-top: 2px;
        padding-top: 0;
    }

    .kilnload-page .kl-op-form__submit {
        width: auto;
        min-width: 140px;
        min-height: 40px;
        padding-left: 16px;
        padding-right: 16px;
    }

    .kilnload-page .kl-op-form__input.input,
    .kilnload-page .kl-op-form select.input,
    .kilnload-page .kl-op-form .flatpickr-input,
    .kilnload-page .kl-op-form .flatpickr-alt-display,
    .kilnload-page .kl-op-form .lch-flatpickr-input {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 40px;
        font-size: 14px;
    }
}

.kilnload-page .kl-op-empty {
    padding: 32px 16px;
    text-align: center;
    color: #78909c;
}

.kilnload-page .kl-op-empty__icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.kilnload-page .kl-op-empty p {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.kilnload-page .kl-op-log {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin: 0 -14px -12px;
    padding: 10px 14px 12px;
    background: #e8edf1;
    border-radius: 0 0 5px 5px;
}

.kilnload-page .kl-op-entry {
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    border-radius: 6px;
    border: 1px solid #cfd8dc;
    border-top: 3px solid #1565c0;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.kilnload-page .kl-op-entry--alt {
    border-top-color: #00838f;
}

.kilnload-page .kl-op-entry__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-bottom: 1px solid #dce3e8;
    background: #e3f2fd;
}

.kilnload-page .kl-op-entry--alt .kl-op-entry__head {
    background: #e0f7fa;
}

.kilnload-page .kl-op-entry__num {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #1565c0;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.kilnload-page .kl-op-entry--alt .kl-op-entry__num {
    background: #00838f;
}

.kilnload-page .kl-op-entry__title-wrap {
    flex: 1 1 auto;
    min-width: 0;
}

.kilnload-page .kl-op-entry__action {
    margin: 0 0 1px;
    font-size: 14px;
    font-weight: 700;
    color: #1a237e;
    line-height: 1.25;
    word-break: break-word;
}

.kilnload-page .kl-op-entry--alt .kl-op-entry__action {
    color: #006064;
}

.kilnload-page .kl-op-entry__time {
    font-size: 13px;
    font-weight: 600;
    color: #546e7a;
}

.kilnload-page .kl-op-entry__delete {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid #ef9a9a;
    background: #ffebee;
    color: #c62828;
    font-size: 11px;
    text-decoration: none;
}

.kilnload-page .kl-op-entry__delete[hidden] {
    display: none;
}

.kilnload-page .kl-op-entry__actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: auto;
}

.kilnload-page .kl-op-entry__edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid #90caf9;
    background: #e3f2fd;
    color: #1565c0;
    font-size: 11px;
    cursor: pointer;
}

.kilnload-page .kl-op-entry__edit:hover {
    background: #bbdefb;
}

.kilnload-page .kl-op-facts {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 0;
    padding: 6px 8px 8px;
    flex: 1 1 auto;
}

.kilnload-page .kl-op-fact {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    margin: 0;
    padding: 2px 0;
    border: none;
    background: transparent;
}

.kilnload-page .kl-op-fact dt {
    flex-shrink: 0;
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #90a4ae;
}

.kilnload-page .kl-op-fact dd {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: #37474f;
    line-height: 1.25;
    text-align: right;
    word-break: break-word;
}

.kilnload-page .kl-op-fact--temp dd {
    color: #c62828;
}

.kilnload-page .kl-op-fact--gas dd,
.kilnload-page .kl-op-fact--worker dd {
    color: #1565c0;
}

.kilnload-page .kl-op-entry__note {
    padding: 5px 8px 6px;
    border-top: 1px dashed #cfd8dc;
    background: #fffde7;
    font-size: 13px;
    line-height: 1.35;
    color: #5d4037;
}

.kilnload-page .kl-op-edit-modal {
    width: min(520px, calc(100vw - 32px));
    max-width: min(520px, calc(100vw - 32px));
    padding: 16px 18px 18px;
}

.kilnload-page .kl-op-edit-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.kilnload-page .kl-op-edit-modal__head h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #1565c0;
}

.kilnload-page .kl-op-edit-modal__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #cfd8dc;
    border-radius: 999px;
    background: #fff;
    color: #546e7a;
    cursor: pointer;
}

.kilnload-page .kl-op-edit-modal__subtitle {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 600;
    color: #78909c;
}

.kilnload-page .kl-op-edit-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kilnload-page .kl-op-edit-form__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    align-items: start;
}

.kilnload-page .kl-op-edit-form__item,
.kilnload-page .kl-op-edit-form__item-inner {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    min-width: 0;
    width: 100%;
}

.kilnload-page .kl-op-edit-form__item--full {
    grid-column: 1 / -1;
}

.kilnload-page .kl-op-edit-form .kl-op-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.kilnload-page .kl-op-edit-form .kl-op-form__input.input,
.kilnload-page .kl-op-edit-form select.input,
.kilnload-page .kl-op-edit-form textarea.input,
.kilnload-page .kl-op-edit-form .flatpickr-input,
.kilnload-page .kl-op-edit-form .flatpickr-alt-display,
.kilnload-page .kl-op-edit-form .lch-flatpickr-input {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 40px;
    padding: 6px 10px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 5px;
    box-sizing: border-box;
}

.kilnload-page .kl-op-edit-form textarea.input {
    min-height: 64px;
    resize: vertical;
}

.kilnload-page .kl-op-edit-form .kl-op-warn {
    margin-top: 0;
    padding: 4px 6px;
    font-size: 11px;
}

.kilnload-page .kl-op-edit-form .flatpickr-wrapper {
    display: block;
    width: 100%;
}

.kilnload-page .kl-op-edit-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

@media (max-width: 900px) {
    .kilnload-page .kl-op-log {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .kilnload-page .kl-op-topbar {
        justify-content: stretch;
    }

    .kilnload-page .kl-op-finish-form {
        width: 100%;
    }

    .kilnload-page .kl-op-finish-btn {
        width: 100%;
        min-height: 44px;
    }

    .kilnload-page .kl-op-form__input.input {
        min-height: 44px;
        font-size: 16px;
    }

    .kilnload-page .kl-op-edit-form__grid {
        grid-template-columns: 1fr;
    }

    .kilnload-page .kl-op-edit-form .kl-op-form__input.input,
    .kilnload-page .kl-op-edit-form select.input,
    .kilnload-page .kl-op-edit-form textarea.input,
    .kilnload-page .kl-op-edit-form .flatpickr-input,
    .kilnload-page .kl-op-edit-form .flatpickr-alt-display,
    .kilnload-page .kl-op-edit-form .lch-flatpickr-input {
        min-height: 44px;
        font-size: 16px;
    }
}

/* —— Profile (biểu đồ lò) —— */
.kilnload-page .kl-profile-section {
    margin-top: 12px;
}

.kilnload-page .kl-profile-section__title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 700;
    color: #263238;
}

.kilnload-page .kl-profile-section__title i {
    color: #1565c0;
}

.kilnload-page .kl-profile-bao-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
}

@media (min-width: 601px) {
    .kilnload-page .kl-profile-bao-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.kilnload-page .kl-profile-bao-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    min-width: 0;
    padding: 12px;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
    background: #fff;
    box-sizing: border-box;
}

.kilnload-page .kl-profile-bao-card__head {
    grid-column: 1 / -1;
    margin-bottom: 8px;
}

.kilnload-page .kl-profile-bao-card__kiln {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 5px;
    background: #e3f2fd;
    color: #1565c0;
    font-size: 13px;
    font-weight: 700;
}

.kilnload-page .kl-profile-bao-card__main {
    grid-column: 1;
    margin-bottom: 0;
    padding-right: 12px;
    align-self: center;
}

.kilnload-page .kl-profile-bao-card__main-label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #78909c;
}

.kilnload-page .kl-profile-bao-card__main-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
    color: #263238;
}

.kilnload-page .kl-profile-bao-card__unit {
    font-size: 14px;
    font-weight: 600;
    color: #78909c;
}

.kilnload-page .kl-profile-bao-card__meta {
    grid-column: 2;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    border-top: none;
    border-left: 1px solid #eceff1;
    align-self: stretch;
}

.kilnload-page .kl-profile-bao-card__stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 8px 6px;
    text-align: center;
    box-sizing: border-box;
}

.kilnload-page .kl-profile-bao-card__stat + .kl-profile-bao-card__stat {
    border-left: 1px solid #eceff1;
}

.kilnload-page .kl-profile-bao-card__stat-label {
    display: block;
    margin-bottom: 2px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #90a4ae;
}

.kilnload-page .kl-profile-bao-card__stat-value {
    font-size: 13px;
    font-weight: 700;
    color: #37474f;
}

.kilnload-page .kl-profile-chart {
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #eceff1;
    background: #fafbfc;
    box-sizing: border-box;
}

.kilnload-page .kl-profile-chart__title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 700;
    color: #263238;
    text-align: center;
}

.kilnload-page .kl-profile-chart__title i {
    color: #1565c0;
}

.kilnload-page .kl-profile-chart__legend {
    margin-bottom: 8px;
}

.kilnload-page .kl-profile-chart__canvas-wrap {
    position: relative;
    height: 280px;
    max-height: 400px;
}

.kilnload-page .kl-profile-chart__canvas-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

.kilnload-page .kl-settings .data-block {
    border-radius: 5px;
}

/* —— Settings —— */
.kilnload-page .kl-pane.kl-settings {
    padding: 0;
}

.kilnload-page .kl-settings-alerts .kl-settings-alert {
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
}

.kilnload-page .kl-settings-alerts .kl-settings-alert + .kl-settings-alert {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.kilnload-page .kl-settings-body {
    padding: 10px;
    box-sizing: border-box;
}

.kilnload-page .kl-settings-body > .mould-detail-pane:first-child {
    border-top: none;
}

.kilnload-page .kl-settings .mould-detail-bom-intro,
.kilnload-page .kl-settings .kl-form-hint {
    font-size: 14px;
}

.kilnload-page .kl-settings .kl-form-hint {
    margin: 5px 0 0;
}

.kilnload-page .kl-settings-form .kl-form-field__label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
    color: #37474f;
}

.kilnload-page .kl-settings-dept-picker {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
    padding: 10px 12px;
    border: 1px solid #dce3e8;
    border-radius: 5px;
    background: #fafbfc;
    box-sizing: border-box;
}

.kilnload-page .kl-settings-dept-opt {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    color: #37474f;
}

.kilnload-page .kl-settings-dept-opt input {
    margin-top: 3px;
    flex-shrink: 0;
}

.kilnload-page .kl-settings-form {
    max-width: 720px;
    margin-bottom: 14px;
}

.kilnload-page .kl-settings-form .kl-form-field--narrow {
    max-width: 160px;
}

.kilnload-page .kl-settings-form__submit {
    align-self: flex-start;
    width: auto;
    margin-top: 4px;
}

.kilnload-page .kl-settings-catalog .kl-form-field label,
.kilnload-page .kl-settings-catalog .kl-settings-item__title {
    font-size: 14px;
}

.kilnload-page .kl-settings-catalog .kl-settings-item__desc {
    font-size: 14px;
}

.kilnload-page .kl-settings-catalog .kl-settings-item__type,
.kilnload-page .kl-settings-catalog .kl-settings-item__badge {
    font-size: 11px;
}

.kilnload-page .kl-settings-add-toolbar {
    margin-bottom: 10px;
}

.kilnload-page .kl-settings-add-toggle.is-active {
    box-shadow: inset 0 0 0 1px rgba(21, 101, 192, 0.25);
}

.kilnload-page .kl-settings-add-panel {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 5px;
    border: 1px solid #dce3e8;
    background: #f0f4f8;
    box-sizing: border-box;
}

.kilnload-page .kl-settings-add-panel[hidden] {
    display: none !important;
}

.kilnload-page .kl-settings-add-panel .kl-settings-form--add {
    margin-bottom: 0;
}

.kilnload-page .kl-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 4px;
}

.kilnload-page .kl-settings-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
    min-height: 118px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    background: #fff;
    box-sizing: border-box;
}

.kilnload-page .kl-settings-item--edit {
    grid-column: 1 / -1;
    min-height: 0;
}

.kilnload-page .kl-settings-item--inactive {
    opacity: 0.78;
    background: #fafbfc;
}

.kilnload-page .kl-settings-item__main {
    flex: 1 1 auto;
    min-width: 0;
}

.kilnload-page .kl-settings-item__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.kilnload-page .kl-settings-item__type {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.3;
}

.kilnload-page .kl-settings-item__type--action {
    background: #e8eaf6;
    color: #3949ab;
}

.kilnload-page .kl-settings-item__type--door {
    background: #e3f2fd;
    color: #1565c0;
}

.kilnload-page .kl-settings-item__type--pipe {
    background: #fff3e0;
    color: #e65100;
}

.kilnload-page .kl-settings-item__type--piece {
    background: #e8f5e9;
    color: #2e7d32;
}

.kilnload-page .kl-settings-item__badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.kilnload-page .kl-settings-item__badge--off {
    background: #eceff1;
    color: #78909c;
}

.kilnload-page .kl-settings-item__title {
    font-size: 14px;
    font-weight: 700;
    color: #263238;
    line-height: 1.35;
    word-break: break-word;
}

.kilnload-page .kl-settings-item__desc {
    margin-top: 4px;
    font-size: 12px;
    color: #607d8b;
    line-height: 1.4;
    word-break: break-word;
}

.kilnload-page .kl-settings-item__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid #eceff1;
}

.kilnload-page .kl-settings-item__actions form {
    margin: 0;
}

.kilnload-page .kl-settings-item__edit {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (min-width: 900px) {
    .kilnload-page .kl-settings-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .kilnload-page .kl-settings-grid {
        grid-template-columns: 1fr;
    }
}

.kilnload-page .kl-op-field--warn .input {
    border-color: #e65100;
    background: #fff8f3;
}

.kilnload-page .kl-op-warn {
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 5px;
    border: 1px solid #ffcc80;
    background: #fff3e0;
    color: #e65100;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
}

.kilnload-page .kl-op-warn[hidden] {
    display: none;
}

/* —— Empty state —— */
.kilnload-page .kl-empty {
    padding: 32px 16px;
    text-align: center;
    color: #78909c;
}

.kilnload-page .kl-empty__icon {
    font-size: 40px;
    margin-bottom: 8px;
    opacity: 0.85;
}

.kilnload-page .kl-empty p {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
}

@media (max-width: 1199px) {
    .kilnload-page .kl-load-grid {
        grid-template-columns: 1fr;
    }

    .kilnload-page .kl-toolbar__search-wrap {
        max-width: 320px;
    }

    .kilnload-page .kl-toolbar__search {
        max-width: none;
    }
}

@media (min-width: 600px) and (max-width: 1199px) {
    .kilnload-page .kl-load-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .kilnload-page .kl-load-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .kilnload-page .kl-load-card__head {
        padding: 8px;
    }

    .kilnload-page .kl-load-card__body {
        padding: 6px 8px;
        gap: 6px;
    }

    .kilnload-page .kl-load-card__title {
        font-size: 18px;
    }

    .kilnload-page .kl-load-card__qty-num {
        font-size: 22px;
    }

    .kilnload-page .kl-load-card__foot {
        padding: 6px 8px 8px;
    }

    .kilnload-page .kl-load-card__foot .button {
        font-size: 13px;
        padding: 6px 8px;
    }
}

/* =============================================================================
   VIEW KILNSLIP — Phiếu ra lò chi tiết (page=viewkilnslip)
   ============================================================================= */
.vks-page {
    padding: 0;
    box-sizing: border-box;
}

.vks-page .vks-sheet {
    padding: 10px;
    border-radius: 0;
    overflow: visible;
    box-sizing: border-box;
}

.vks-page .vks-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 10px;
    padding: 10px;
    border: 1px solid #eceff1;
    border-radius: 5px;
    background: #f5f7f9;
    box-sizing: border-box;
}

.vks-page .vks-topbar__main {
    display: flex;
    flex: 1 1 520px;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    max-width: 100%;
}

.vks-page .vks-topbar__identity {
    flex: 1 1 240px;
    min-width: 0;
}

.vks-page .vks-topbar__title {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
    color: #263238;
}

.vks-page .vks-topbar__title i {
    margin-right: 6px;
    color: #1565c0;
}

.vks-page .vks-topbar__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin-bottom: 6px;
}

.vks-page .vks-topbar__date,
.vks-page .vks-topbar__time {
    font-size: 13px;
    font-weight: 600;
    color: #546e7a;
}

.vks-page .vks-topbar__date i,
.vks-page .vks-topbar__time i {
    margin-right: 4px;
    color: #78909c;
}

.vks-page .vks-topbar__badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
}

.vks-page .vks-topbar__badge--type {
    background: #e3f2fd;
    color: #1565c0;
}

.vks-page .vks-topbar__sub {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    font-size: 13px;
    line-height: 1.35;
}

.vks-page .vks-topbar__label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #78909c;
}

.vks-page .vks-topbar__value {
    font-weight: 600;
    color: #37474f;
}

.vks-page .vks-topbar__link {
    color: #1565c0;
    text-decoration: none;
    font-weight: 600;
}

.vks-page .vks-topbar__link:hover {
    text-decoration: underline;
}

.vks-page .vks-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
    flex: 0 1 auto;
}

.vks-page .vks-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 6px 10px;
    border-radius: 5px;
    border: 1px solid #e3edf7;
    background: #fff;
    text-align: center;
    box-sizing: border-box;
}

.vks-page .vks-stat--blue {
    border-color: #bbdefb;
    background: #e3f2fd;
}

.vks-page .vks-stat--blue .vks-stat__value {
    color: #1565c0;
}

.vks-page .vks-stat--ok {
    border-color: #c8e6c9;
    background: #f1f8f2;
}

.vks-page .vks-stat--ok .vks-stat__value {
    color: #2e7d32;
}

.vks-page .vks-stat__value {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    color: #263238;
}

.vks-page .vks-stat__label {
    margin-top: 2px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #78909c;
    line-height: 1.2;
    white-space: nowrap;
}

.vks-page .vks-topbar__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.vks-page .vks-topbar__actions .button {
    height: auto;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1.2;
}

.vks-page .vks-pending {
    margin: 0 0 10px;
}

.vks-page .vks-pending__header {
    color: #e65100;
}

.vks-page .vks-pending__body {
    padding-top: 10px;
    padding-bottom: 12px;
}

.vks-page .vks-pending__hint {
    margin: 0 0 8px;
    font-size: 13px;
    color: #546e7a;
    line-height: 1.4;
}

.vks-page .vks-pending__list {
    margin: 0 0 10px;
    padding-left: 18px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
}

.vks-page .vks-order.mould-detail-pane {
    border-top: none;
}

.vks-page .vks-order__header {
    flex-wrap: wrap;
    margin: 0 -10px;
    width: calc(100% + 20px);
    max-width: none;
    box-sizing: border-box;
    padding: 10px;
    border-top: 1px solid #e0e0e0;
    border-bottom: none;
}

.vks-page .vks-order__header .vks-order__title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

.vks-page .vks-order__header .vks-order__title a {
    color: inherit;
    text-decoration: none;
}

.vks-page .vks-order__header .vks-order__title a:hover {
    text-decoration: underline;
}

.vks-page .vks-order__summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-left: auto;
    font-size: 14px;
    font-weight: 600;
}

.vks-page .vks-order__load {
    color: #1565c0;
    text-decoration: none;
    white-space: nowrap;
}

.vks-page .vks-order__load:hover {
    text-decoration: underline;
}

.vks-page .vks-order__load--missing {
    color: #c62828;
}

.vks-page .vks-order__totals {
    color: #546e7a;
    white-space: nowrap;
    font-size: 15px;
}

.vks-page .vks-order__body {
    padding: 0 0 12px;
    margin: 0 -10px;
    width: calc(100% + 20px);
    max-width: none;
    box-sizing: border-box;
}

.vks-page .vks-order__body .viewkilnslip-table-wrapper,
.vks-page .vks-order__body .scroll-table-wrapper {
    width: 100%;
    max-width: 100%;
}

.vks-page .vks-order__body .scroll-table-wrapper .scroll-hint {
    margin: 0;
    padding: 4px 10px;
    box-sizing: border-box;
}

.vks-page .viewkilnslip-table.viewkilnslip-products-table {
    width: 100% !important;
    min-width: 100%;
    table-layout: auto !important;
}

.vks-page .viewkilnslip-table.viewkilnslip-products-table th:nth-child(3),
.vks-page .viewkilnslip-table.viewkilnslip-products-table td:nth-child(3) {
    width: auto;
    min-width: 220px;
}

.vks-page .vks-col-product {
    min-width: 220px;
    text-align: left !important;
    white-space: normal;
    vertical-align: middle;
}

.vks-page .description .word-wrap {
    font-size: 14px;
    font-weight: 600;
    color: #37474f;
    line-height: 1.35;
}

.vks-page .vks-th-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.vks-page .vks-th-info__label {
    font-weight: inherit;
}

.vks-page .vks-toggle-finish {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 0;
    padding: 4px 10px;
    border: 1px solid #cfd8dc;
    border-radius: 999px;
    background: #eceff1;
    color: #546e7a;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    box-sizing: border-box;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.vks-page .vks-toggle-finish:hover {
    background: #dfe6ea;
    border-color: #b0bec5;
}

.vks-page .vks-toggle-finish.is-active,
.vks-page .vks-toggle-finish[aria-pressed="true"] {
    background: #e3f2fd;
    border-color: #90caf9;
    color: #1565c0;
}

.vks-page .vks-toggle-finish.is-active:hover,
.vks-page .vks-toggle-finish[aria-pressed="true"]:hover {
    background: #bbdefb;
    border-color: #64b5f6;
}

.vks-page .vks-toggle-finish__icon {
    font-size: 10px;
}

.vks-page .vks-product__finish {
    margin-top: 2px;
    font-size: 14px;
    font-style: italic;
    color: #78909c;
    line-height: 1.35;
}

.vks-page .vks-product__size {
    margin-top: 2px;
    font-size: 14px;
    color: #546e7a;
}

.vks-page .vks-product__note {
    margin-top: 6px;
    padding: 6px 8px;
    border-radius: 5px;
    background: #ffebee;
    color: #c62828;
    font-size: 12px;
    line-height: 1.35;
}

@media (max-width: 900px) {
    .vks-page .vks-topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .vks-page .vks-topbar__main {
        flex: 0 0 auto;
        width: 100%;
    }

    .vks-page .vks-stats {
        width: 100%;
    }

    .vks-page .vks-topbar__actions {
        margin-left: 0;
        width: 100%;
    }

    .vks-page .vks-order__summary {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .vks-page .vks-stats {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .vks-page .vks-stat {
        min-width: 0;
        width: auto;
    }
}

@media print {
    @page {
        size: A4 landscape;
        margin: 10mm;
    }

    body * {
        visibility: hidden;
    }

    .vks-page.printsection,
    .vks-page.printsection * {
        visibility: visible;
    }

    .vks-page.printsection {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }

    .vks-page .vks-topbar__actions,
    .vks-page .vks-pending,
    .vks-page .vks-toggle-finish {
        display: none !important;
    }

    .vks-page .scroll-hint {
        display: none !important;
    }

    body {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .vks-page .viewkilnslip-table-wrapper {
        overflow: visible !important;
    }

    .vks-page .vks-order.mould-detail-pane,
    .vks-page .vks-sheet {
        page-break-inside: avoid;
        box-shadow: none !important;
    }

    .vks-page table {
        page-break-inside: auto;
    }

    .vks-page tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
}