/* Giao diện Dashboard Cloudhub trên Tabler 1.6.1 + Bootstrap 5.3 (nạp sau tabler.min.css).
   1. font  2. biến màu  3. khung (sidebar, thanh trên, tiêu đề trang)  4. thành phần (card, bảng, form, nút, modal)
   5. lớp cũ của style.css còn dùng  6. trang đăng nhập */

/* ---------- 1. Font: Inter (chữ thường) + Lexend (tiêu đề), nạp local, đủ tiếng Việt ---------- */
@font-face {
    font-family: 'Inter Variable';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url(../vendor/fonts/inter/inter-vietnamese-wght-normal.woff2) format('woff2-variations');
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
    font-family: 'Inter Variable';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url(../vendor/fonts/inter/inter-latin-ext-wght-normal.woff2) format('woff2-variations');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Inter Variable';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url(../vendor/fonts/inter/inter-latin-wght-normal.woff2) format('woff2-variations');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Lexend Variable';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url(../vendor/fonts/lexend/lexend-vietnamese-wght-normal.woff2) format('woff2-variations');
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
    font-family: 'Lexend Variable';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url(../vendor/fonts/lexend/lexend-latin-ext-wght-normal.woff2) format('woff2-variations');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Lexend Variable';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url(../vendor/fonts/lexend/lexend-latin-wght-normal.woff2) format('woff2-variations');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- 2. Biến màu ---------- */
:root, [data-bs-theme="light"] {
    --ch-primary: #e92276;
    --ch-primary-rgb: 233, 34, 118;
    --ch-primary-dark: #cb1561;
    --ch-primary-soft: #fdf2f7;
    --ch-bg: #f8fafc;
    --ch-surface: #ffffff;
    --ch-border: #e5eaf2;
    --ch-text: #0f172a;
    --ch-muted: #64748b;
    --ch-faint: #94a3b8;
    --ch-radius: 1rem;
    --ch-radius-sm: .7rem;
    --ch-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 28px rgba(15, 23, 42, .06);
    --ch-shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 2px 8px rgba(15, 23, 42, .04);
    --ch-font-display: 'Lexend Variable', 'Inter Variable', system-ui, -apple-system, 'Segoe UI', sans-serif;

    --tblr-primary: var(--ch-primary);
    --tblr-primary-rgb: var(--ch-primary-rgb);
    --tblr-primary-lt: var(--ch-primary-soft);
    --tblr-link-color: var(--ch-primary);
    --tblr-link-color-rgb: var(--ch-primary-rgb);
    --tblr-link-hover-color: var(--ch-primary-dark);
    --tblr-link-hover-color-rgb: 203, 21, 97;
    --tblr-body-bg: var(--ch-bg);
    --tblr-body-color: var(--ch-text);
    --tblr-secondary: var(--ch-muted);
    --tblr-secondary-color: var(--ch-muted);
    --tblr-border-color: var(--ch-border);
    --tblr-border-color-translucent: rgba(15, 23, 42, .09);
    --tblr-border-radius: .65rem;
    --tblr-border-radius-sm: .5rem;
    --tblr-border-radius-lg: var(--ch-radius);
    --tblr-font-sans-serif: 'Inter Variable', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --tblr-body-font-size: .875rem;
}

body {
    background: var(--ch-bg);
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .h1, .h2, .h3, .h4, .ch-page-title, .ch-brand-name, .modal-title {
    font-family: var(--ch-font-display);
    letter-spacing: -.01em;
}

a {
    text-decoration: none;
}

/* ---------- 3. Khung ---------- */
.ch-shell {
    display: flex;
    min-height: 100vh;
}

.ch-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ch-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--ch-surface);
}

@media (min-width: 992px) {
    .ch-sidebar {
        position: sticky;
        top: 0;
        flex: 0 0 16.25rem;
        width: 16.25rem;
        height: 100vh;
        padding: .75rem 0 .75rem .75rem;
        transition: margin-left .2s ease;
    }

    .ch-sidebar-inner {
        border: 1px solid var(--ch-border);
        border-radius: 1.25rem;
        box-shadow: var(--ch-shadow);
        overflow: hidden;
    }

    /* nút ẩn/hiện menu trên màn hình rộng (trạng thái nhớ trong localStorage) */
    .ch-sidebar-collapsed .ch-sidebar {
        margin-left: -16.25rem;
    }
}

@media (max-width: 991.98px) {
    .ch-sidebar {
        --tblr-offcanvas-width: 17rem;
    }
}

.ch-brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: 1.1rem 1.1rem .5rem;
    color: var(--ch-text);
}

.ch-brand:hover {
    color: var(--ch-text);
    text-decoration: none;
}

.ch-brand-logo {
    height: 38px;
    width: auto;
    max-width: 105px;
    object-fit: contain;
    flex-shrink: 0;
    transition: transform .2s ease;
}

.ch-brand:hover .ch-brand-logo {
    transform: scale(1.03);
}

.ch-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ch-brand-mark {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: .85rem;
    background: linear-gradient(135deg, #f43f8e, var(--ch-primary));
    color: #fff;
    font-size: 1.05rem;
    box-shadow: 0 6px 16px rgba(var(--ch-primary-rgb), .35);
}

.ch-brand-name {
    font-weight: 600;
    font-size: 1.02rem;
    line-height: 1.15;
}

.ch-brand-sub {
    font-size: .72rem;
    color: var(--ch-faint);
}

.ch-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: .25rem .7rem 1rem;
}

.ch-nav-title {
    padding: 1rem .6rem .35rem;
    font-size: .72rem;
    font-weight: 600;
    color: var(--ch-faint);
}

.ch-nav-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .45rem .6rem;
    margin-bottom: .1rem;
    border-radius: .8rem;
    color: #334155;
    font-weight: 500;
}

.ch-nav-icon {
    display: grid;
    place-items: center;
    flex: 0 0 1.9rem;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: .6rem;
    background: #f1f5f9;
    color: var(--ch-muted);
    font-size: .8rem;
    transition: background-color .15s, color .15s;
}

.ch-nav-link:hover {
    background: #f6f9ff;
    color: var(--ch-primary);
    text-decoration: none;
}

.ch-nav-link.active {
    background: var(--ch-primary-soft);
    color: var(--ch-primary);
    font-weight: 600;
}

.ch-nav-link.active .ch-nav-icon {
    background: var(--ch-primary);
    color: #fff;
    box-shadow: 0 4px 10px rgba(var(--ch-primary-rgb), .3);
}

.ch-sidebar-foot {
    margin: 0 .7rem .7rem;
    padding: .8rem .9rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, #eef4ff, #e3ecff);
    position: relative;
    overflow: hidden;
}

.ch-sidebar-foot::after {
    content: "";
    position: absolute;
    right: -1.6rem;
    top: -1.6rem;
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    background: rgba(var(--ch-primary-rgb), .12);
}

.ch-sidebar-foot small {
    color: var(--ch-muted);
}

.ch-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .6rem;
    padding: .75rem 1.25rem;
    background: rgba(243, 246, 251, .86);
    backdrop-filter: blur(8px);
}

.ch-pill {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    height: 2.4rem;
    padding: 0 .95rem;
    border: 1px solid var(--ch-border);
    border-radius: 999px;
    background: var(--ch-surface);
    color: #334155;
    font-weight: 500;
    box-shadow: var(--ch-shadow-sm);
    white-space: nowrap;
}

a.ch-pill:hover, button.ch-pill:hover {
    color: var(--ch-primary);
    border-color: #c9d8fb;
    text-decoration: none;
}

.ch-pill-icon {
    width: 2.4rem;
    padding: 0;
    justify-content: center;
}

.ch-pill-primary, a.ch-pill-primary:hover {
    background: var(--ch-primary);
    border-color: var(--ch-primary);
    color: #fff;
    box-shadow: 0 6px 14px rgba(var(--ch-primary-rgb), .28);
}

.ch-search {
    position: relative;
    flex: 1 1 14rem;
    max-width: 24rem;
    margin: 0;
}

.ch-search .ch-search-icon,
.ch-search > .fa-magnifying-glass {
    position: absolute;
    left: .95rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ch-faint);
    pointer-events: none;
}

.ch-search .form-control {
    height: 2.4rem;
    padding-left: 2.4rem;
    padding-right: 2.4rem;
    border-radius: 999px;
    box-shadow: var(--ch-shadow-sm);
}

/* Ẩn nút xóa mặc định của WebKit/Blink trên input[type="search"] để không trùng 2 dấu X */
.ch-search input[type="search"]::-webkit-search-cancel-button,
.ch-search input[type="search"]::-webkit-search-decoration,
.ch-search input[type="search"]::-webkit-search-results-button,
.ch-search input[type="search"]::-webkit-search-results-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

.ch-search-clear {
    position: absolute;
    right: .45rem;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ch-faint);
    cursor: pointer;
    font-size: .8125rem;
    line-height: 1;
    z-index: 2;
    transition: color .15s ease, background-color .15s ease;
}

.ch-search-clear[hidden] {
    display: none !important;
}

.ch-search-clear:hover {
    color: var(--ch-text);
    background-color: var(--ch-border);
}

.ch-search-clear:focus-visible {
    outline: 2px solid var(--ch-primary);
    outline-offset: 1px;
    color: var(--ch-text);
}

.ch-user {
    padding-left: .3rem;
}

.ch-avatar {
    display: grid;
    place-items: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    background: var(--ch-primary);
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.ch-content {
    flex: 1 1 auto;
    padding: .5rem 1.25rem 2.5rem;
}

.ch-page-head {
    margin: .35rem 0 1rem;
}

.ch-crumb {
    font-size: .78rem;
    color: var(--ch-faint);
    margin-bottom: .2rem;
}

.ch-crumb i {
    font-size: .6rem;
    margin: 0 .3rem;
}

.ch-page-title {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 600;
    line-height: 1.25;
}

.ch-page-sub {
    margin: .2rem 0 0;
    color: var(--ch-muted);
}

/* thanh công cụ của trang danh sách (block count_chosen + hàng nút đầu block content) */
.ch-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    margin-bottom: .9rem;
    padding: .7rem .9rem;
    background: var(--ch-surface);
    border: 1px solid var(--ch-border);
    border-radius: var(--ch-radius);
    box-shadow: var(--ch-shadow-sm);
}

/* 2 thanh liền nhau (bộ lọc + hàng nút) ghép thành một khối */
.ch-toolbar:has(+ .ch-toolbar) {
    margin-bottom: 0;
    border-bottom: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: none;
}

.ch-toolbar + .ch-toolbar {
    border-top-color: #eef2f7;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.ch-toolbar > form {
    flex: 1 1 auto;
}

.ch-toolbar label:empty {
    display: none;
}

.ch-toolbar form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    margin: 0;
}

.ch-toolbar hr {
    display: none;
}

.ch-toolbar label {
    margin: 0;
    color: var(--ch-muted);
    font-weight: 500;
}

.ch-toolbar .form-control, .ch-toolbar .form-select {
    width: auto;
    min-width: 11rem;
}

.ch-toolbar textarea.form-control {
    min-width: 16rem;
    height: 2.35rem;
    min-height: 2.35rem;
    resize: vertical;
}

.ch-toolbar .select2-container {
    width: 17rem !important;
}

.ch-toolbar .btn-icon {
    width: 2.35rem;
    height: 2.35rem;
}

/* dropdown chọn hành động hàng loạt */
.ch-action-dropdown {
    position: relative;
}

.ch-action-dropdown .ch-action-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    height: 2.35rem;
    min-width: 12.5rem;
    padding: 0 .85rem;
    background-color: var(--ch-surface);
    border: 1px solid var(--ch-border);
    border-radius: var(--tblr-border-radius);
    color: var(--ch-text);
    font-weight: 500;
    box-shadow: var(--ch-shadow-sm);
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.ch-action-dropdown .ch-action-toggle:hover,
.ch-action-dropdown .ch-action-toggle:focus,
.ch-action-dropdown .ch-action-toggle[aria-expanded="true"] {
    border-color: #cbd5e1;
    background-color: #fff;
    color: var(--ch-primary-dark);
}

.ch-action-dropdown .ch-action-toggle:disabled,
.ch-action-dropdown .ch-action-toggle.disabled {
    background-color: #f8fafc;
    border-color: var(--ch-border);
    color: var(--ch-faint);
    opacity: .65;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
}

.ch-action-dropdown .dropdown-menu {
    min-width: 13rem;
    padding: .35rem;
    border: 1px solid var(--ch-border);
    border-radius: var(--tblr-border-radius);
    box-shadow: var(--ch-shadow);
}

.ch-action-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: .5rem .75rem;
    border: 0;
    border-radius: calc(var(--tblr-border-radius) - 2px);
    background: transparent;
    color: var(--ch-text);
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background-color .12s ease, color .12s ease;
}

.ch-action-dropdown .dropdown-item:hover,
.ch-action-dropdown .dropdown-item:focus {
    background-color: var(--ch-primary-soft);
    color: var(--ch-primary-dark);
}

.ch-action-dropdown .dropdown-item.text-danger:hover,
.ch-action-dropdown .dropdown-item.text-danger:focus {
    background-color: #fef2f2;
    color: #dc2626 !important;
}

.ch-action-dropdown .dropdown-item i {
    font-size: .95rem;
}

.ch-action-dropdown .dropdown-divider {
    margin: .35rem 0;
    border-top: 1px solid var(--ch-border);
    opacity: 1;
}

.ch-toolbar-sep {
    flex: 1 1 auto;
}

.ch-count {
    color: var(--ch-muted);
    white-space: nowrap;
}

.ch-count strong {
    color: var(--ch-text);
}

/* ---------- 4. Thành phần ---------- */
.card {
    border: 1px solid var(--ch-border);
    border-radius: var(--ch-radius);
    box-shadow: var(--ch-shadow-sm);
}

.card-header {
    border-bottom-color: var(--ch-border);
}

.ch-card-narrow {
    max-width: 54rem;
}

.btn {
    --tblr-btn-border-radius: .7rem;
    font-weight: 500;
}

.btn-sm, .btn-group-sm > .btn {
    --tblr-btn-border-radius: .55rem;
}

/* nút chỉ có icon trong ô bảng: vuông, đều nhau */
.table .btn-sm {
    min-width: 2rem;
    height: 2rem;
    padding: 0 .45rem;
}

.table .btn-group {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: .25rem;
    vertical-align: middle;
}

.table .btn-group > .btn, .table .btn-group > a > .btn {
    flex: 0 0 auto;
    width: 2rem;
    border-radius: .55rem !important;
    margin-left: 0 !important;
}

.table .btn-group > a {
    display: inline-flex;
}

/* bảng django-tables2 trong card */
.ch-table-card {
    overflow: hidden;
    margin-bottom: 1rem;
}

.ch-table-card .table-responsive {
    margin: 0;
}

.ch-table-card .table {
    margin: 0;
    border: 0;
    --tblr-table-striped-bg: transparent;
    --tblr-table-hover-bg: #f6f9ff;
}

.ch-table-card .table > :not(caption) > * {
    border-width: 0;
}

.ch-table-card .table > :not(caption) > * > * {
    padding: .6rem .75rem;
    border-width: 0 0 1px;
    border-color: #eef2f7;
    vertical-align: middle;
    box-shadow: none;
    background-color: var(--ch-surface);
    white-space: nowrap;
}

/* cột chữ dài được xuống dòng */
.ch-table-card .table td[data-col="customer"], .ch-table-card .table td[data-col="note"],
.ch-table-card .table td[data-col="list_ds_local"], .ch-table-card .table td[data-col="action"] {
    white-space: normal;
    min-width: 10rem;
    max-width: 20rem;
}

/* cột cuối (nút chức năng) luôn nhìn thấy khi bảng phải cuộn ngang */
.ch-table-card .table > * > tr > :last-child {
    position: sticky;
    right: 0;
}

.ch-table-card .table-responsive.ch-scrolled-x .table > * > tr > :last-child {
    box-shadow: -10px 0 12px -10px rgba(15, 23, 42, .18);
}

.ch-table-card .table > thead > tr > th {
    background: #f8fafc;
    color: var(--ch-muted);
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    white-space: nowrap;
    border-bottom-color: var(--ch-border);
}

.ch-table-card .table > thead > tr > th a {
    color: inherit;
}

.ch-table-card .table > thead > tr > th.asc a::after {
    content: " \2191";
}

.ch-table-card .table > thead > tr > th.desc a::after {
    content: " \2193";
}

.ch-table-card .table > tbody > tr:hover > * {
    background-color: #f6f9ff;
}

.ch-table-card .table > tbody > tr:last-child > * {
    border-bottom-width: 0;
}

.ch-table-card .table > tbody > tr.checked-vps > *, .ch-table-card .table > tbody > tr.checked-vps:hover > * {
    background-color: var(--ch-primary-soft);
}

.ch-table-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .6rem .9rem;
    border-top: 1px solid var(--ch-border);
    color: var(--ch-muted);
}

.ch-table-foot .form-select {
    display: inline-block;
    width: auto;
}

.pagination {
    --tblr-pagination-border-radius: .6rem;
    margin: 0;
    gap: .15rem;
}

.page-link {
    border-radius: .6rem !important;
}

.table > :not(caption) > * > * {
    vertical-align: middle;
}

/* nhãn trạng thái */
.ch-state {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .12rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

.ch-state::before {
    content: "";
    width: .4rem;
    height: .4rem;
    border-radius: 50%;
    background: currentColor;
}

.ch-state-on {
    background: #e7f8ef;
    color: #0f9d58;
}

.ch-state-off {
    background: #f1f5f9;
    color: var(--ch-muted);
}

.badge {
    border-radius: 999px;
    font-weight: 600;
}

/* form */
.form-label, form label {
    font-weight: 500;
}

.form-control, .form-select {
    border-radius: .65rem;
}

.form-control:focus, .form-select:focus {
    border-color: #9db8f8;
    box-shadow: 0 0 0 .22rem rgba(var(--ch-primary-rgb), .14);
}

.form-check-input:checked {
    background-color: var(--ch-primary);
    border-color: var(--ch-primary);
}

.form-switch .form-check-input {
    cursor: pointer;
}

/* select2 (django-autocomplete-light) theo theme bootstrap-5 */
.select2-container {
    min-width: 0 !important;
    max-width: 100%;
}

.select2-container--bootstrap-5 .select2-selection {
    border-radius: .65rem;
    border-color: var(--ch-border);
    min-height: 2.35rem;
    font-size: .875rem;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: #9db8f8;
    box-shadow: 0 0 0 .22rem rgba(var(--ch-primary-rgb), .14);
}

.select2-container--bootstrap-5 .select2-dropdown {
    border-color: var(--ch-border);
    border-radius: .65rem;
    box-shadow: var(--ch-shadow);
    overflow: hidden;
    font-size: .875rem;
}

.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--highlighted {
    background-color: var(--ch-primary-soft);
    color: var(--ch-primary);
}

.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--selected,
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option[aria-selected="true"]:not(.select2-results__option--highlighted) {
    background-color: var(--ch-primary);
    color: #fff;
}

/* modal trên nền mờ: mở modal từ ô select2 vẫn gõ được */
.modal-content {
    border: 0;
    border-radius: 1.1rem;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
}

.modal-header {
    border-bottom: 1px solid var(--ch-border);
}

.modal-footer {
    border-top: 1px solid var(--ch-border);
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 600;
}

#progress-id {
    padding: 0 1.25rem;
}

#progress-id:empty {
    display: none;
}

/* bootstrap-datepicker (BS4) trên BS5: menu thả phải tự định vị */
.datepicker.dropdown-menu {
    position: absolute;
    padding: .5rem;
    border-radius: .8rem;
    box-shadow: var(--ch-shadow);
    font-size: .85rem;
}

.datepicker table tr td.active, .datepicker table tr td.active:hover,
.datepicker table tr td span.active, .datepicker table tr td span.active:hover {
    background: var(--ch-primary) !important;
    color: #fff !important;
    text-shadow: none;
}

/* danh sách thông tin dạng nhãn : giá trị */
.ch-facts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: .9rem 1.5rem;
    margin: 0;
}

.ch-facts dt {
    font-size: .72rem;
    font-weight: 600;
    color: var(--ch-faint);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.ch-facts dd {
    margin: .1rem 0 0;
    font-weight: 500;
    overflow-wrap: anywhere;
}

/* ---------- 5. Lớp cũ của style.css còn dùng trong template / JS ---------- */
.btn-circle {
    border-radius: 50% !important;
}

@keyframes ch-progressing {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: .35;
    }
}

.sync-progressing {
    animation: ch-progressing 1s infinite;
}

.progress-wrapper {
    min-width: 9rem;
    background: #eef2f7;
    border-radius: 999px;
    overflow: hidden;
}

.progress-wrapper .progress-bar {
    min-height: 1.1rem;
    border-radius: 999px;
    color: #fff;
    font-size: .7rem;
    white-space: nowrap;
}

/* ---------- 6. Trang đăng nhập / đã đăng xuất ---------- */
.ch-auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: radial-gradient(60rem 30rem at 15% 0%, #dbe7ff 0%, transparent 60%),
    radial-gradient(50rem 28rem at 100% 100%, #e3f0ff 0%, transparent 55%),
    var(--ch-bg);
}

.ch-auth-card {
    width: 100%;
    max-width: 25rem;
    padding: 2rem 1.9rem;
    background: var(--ch-surface);
    border: 1px solid var(--ch-border);
    border-radius: 1.4rem;
    box-shadow: var(--ch-shadow);
}

.ch-auth-card .ch-brand {
    padding: 0 0 1.2rem;
}

.ch-auth-card h1 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: .25rem;
}

@media (max-width: 575.98px) {
    .ch-topbar, .ch-content {
        padding-left: .75rem;
        padding-right: .75rem;
    }

    .ch-page-title {
        font-size: 1.2rem;
    }
}

/* ---------- 7. Tinh chỉnh ---------- */
/* icon Font Awesome trong nút: Tabler chỉ chừa khoảng cách cho .icon (svg) */
.btn {
    gap: .45rem;
}

.btn > i[class*="fa-"] {
    line-height: 1;
}

/* vạch ngăn cột nút chức năng ghim bên phải */
.ch-table-card .table > * > tr > :last-child {
    box-shadow: inset 1px 0 0 #eef2f7;
}

.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option,
.select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field {
    font-size: .875rem;
}

.select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field {
    border-radius: .55rem;
}

.datepicker.dropdown-menu table tr td, .datepicker.dropdown-menu table tr th {
    width: 2.1rem;
    height: 2rem;
    border-radius: .5rem;
    text-align: center;
}

.datepicker.dropdown-menu table tr th.dow {
    color: var(--ch-faint);
    font-size: .72rem;
    font-weight: 600;
}

.ch-table-card .table-responsive.ch-scrolled-x .table > * > tr > :last-child {
    box-shadow: -14px 0 14px -10px rgba(15, 23, 42, .22);
}

/* nút xóa lựa chọn (×) của select2 4.0 nằm trong dòng chữ, đẩy chữ lệch sang phải */
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered .select2-selection__clear {
    position: absolute;
    top: 50%;
    right: 2.2rem;
    float: none;
    margin: 0;
    transform: translateY(-50%);
}

@media (max-width: 991.98px) {
    /* màn hình hẹp: cột ghim che hết bảng -> bỏ ghim, bảng cuộn ngang bình thường */
    .ch-table-card .table > * > tr > :last-child {
        position: static;
        box-shadow: none !important;
    }

    .ch-toolbar .form-control, .ch-toolbar .form-select, .ch-toolbar textarea.form-control,
    .ch-action-dropdown {
        min-width: 0;
        flex: 1 1 100%;
    }

    .ch-action-dropdown .ch-action-toggle {
        width: 100%;
    }

    .ch-toolbar .select2-container {
        width: 100% !important;
    }

    .ch-search {
        flex: 1 1 6rem;
    }
}

/* form trong thanh công cụ không được rộng hơn thanh (textarea cols=42 tự giãn) */
.ch-toolbar > form {
    min-width: 0;
    max-width: 100%;
}

@media (max-width: 991.98px) {
    .ch-toolbar textarea.form-control {
        width: 100%;
    }
}

/* màn hình ngang dưới 1700px: thu gọn bảng để cột ngày hết hạn / còn lại không bị cột nút ghim che */
@media (min-width: 992px) and (max-width: 1699.98px) {
    .ch-table-card .table > :not(caption) > * > * {
        padding: .5rem .3rem;
        font-size: .8125rem;
    }

    .ch-table-card .table > :not(caption) > * > :first-child {
        padding-left: .75rem;
    }

    .table .btn-group > .btn, .table .btn-group > a > .btn {
        width: 1.75rem;
    }

    .table .btn-sm {
        min-width: 1.75rem;
        height: 1.75rem;
        padding: 0 .3rem;
    }

    .table .btn-group {
        gap: .15rem;
    }

    .ch-table-card .table td[data-col="customer"] {
        min-width: 6rem;
        max-width: 13rem;
    }
}

@media (min-width: 992px) and (max-width: 1699.98px) {
    .ch-sidebar {
        flex-basis: 14.5rem;
        width: 14.5rem;
    }

    .ch-sidebar-collapsed .ch-sidebar {
        margin-left: -14.5rem;
    }

    .ch-topbar, .ch-content {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
