/*
 * Path: public/assets/css/admin-layout-v7.css
 * Version: 7.2.0
 * Status: Update (Full Build)
 * Comment cho dev: Chứa khung giao diện RISE CRM. Đã vá lỗi xung đột Flexbox ở Toolbar (.filter-bar) 
 * và lỗi margin làm lệch nút Action. Kèm theo CSS Mobile-First (48px touch target).
 */

:root {
    /* === LAYOUT === */
    --sidebar-width: 260px;
    --header-height: 65px;
    --sidebar-collapsed-width: 70px;

    /* === PRIMARY === */
    --primary: #3B82F6;
    --primary-hover: #2563EB;
    --primary-rgb: 59, 130, 246;
    /* Chuyển đổi từ #16a34a */
    --primary-light: #f0f9ff;

    /* === ÉP BOOTSTRAP TUÂN THỦ (OVERRIDE BS VARIABLES) === */
    --bs-primary: var(--primary) !important;
    --bs-primary-rgb: var(--primary-rgb) !important;

    --bs-link-color: var(--primary) !important;
    --bs-link-hover-color: var(--primary-hover) !important;

    --bs-nav-link-hover-color: var(--primary-hover) !important;
    --bs-navbar-active-color: var(--primary) !important;

    /* Vòng sáng khi click vào Input/Button (Focus Ring) */
    --bs-focus-ring-color: rgba(var(--primary-rgb), 0.25) !important;

    /* === NEUTRAL: Text === */
    --text-dark: #0f172a;
    --text-main: #334155;
    --text-muted: #5A687D;
    --text-light: #94a3b8;

    /* === NEUTRAL: Background === */
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-muted: #f8fafc;

    /* === NEUTRAL: Border === */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    /* === SEMANTIC: Success === */
    --success: #10b981;
    --success-light: #ecfdf5;
    --success-border: #a7f3d0;

    /* === SEMANTIC: Warning === */
    --warning: #dc8e09;
    --warning-light: #fef3c7;
    --warning-border: #fde68a;

    /* === SEMANTIC: Danger === */
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --danger-border: #fecaca;

    /* === SEMANTIC: Info === */
    --info: #16a34a;
    --info-light: #eff6ff;
    --info-border: #bfdbfe;

    /* === SEMANTIC: Purple (Special for Customer Module) === */
    --purple: #8b5cf6;
    --purple-light: #f5f3ff;

    /* === SIDEBAR: Cloud Gray 3D === */
    --sidebar-bg: #ffffff;
    --sidebar-text: #334155;
    --sidebar-hover: rgba(var(--primary-rgb), 0.1);
    --sidebar-hover-text: #0f172a;
    --sidebar-border: #e2e8f0;
    --sidebar-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05),
        inset 0 2px 3px rgba(255, 255, 255, 0.8),
        inset 2px 0 3px rgba(255, 255, 255, 0.5);
    --active-bg: rgba(var(--primary-rgb), 0.1);
    --active-text: #16a34a;
    --active-shadow: 0 4px 8px rgba(0, 0, 0, 0.05), inset 0 2px 1px #ffffff;

    /* === TYPOGRAPHY === */
    --font-sans: "Instrument Sans", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    --font-weight-semibold: 600;

    /* === SHADOWS === */
    --shadow-card: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    --shadow-input-focus: 0 0 0 4px rgba(var(--primary-rgb), 0.15);
    --shadow-btn-primary: 0 4px 6px -1px rgba(var(--primary-rgb), 0.3), 0 2px 4px -1px rgba(var(--primary-rgb), 0.2);

    /* === [PHASE 1] TABLE HEADERS & TYPOGRAPHY (Chân lý tập trung) === */
    --th-font-size: 14px;
    --th-font-weight: 700;
    --th-letter-spacing: 0.5px;
    --td-font-size-main: 14px;
    --td-font-size-sub: 13px;
    --td-font-weight-normal: 400;
    --td-font-weight-medium: 500;
}

/* === DARK MODE OVERRIDE === */
[data-theme="dark"] {
    /* --- Neutral: Text (đảo ngược) --- */
    --text-dark: #f1f5f9;
    --text-main: #cbd5e1;
    --text-muted: #94a3b8;
    --text-light: #5A687D;

    /* --- Neutral: Background (hệ Tailwind Slate) --- */
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-muted: #334155;

    /* --- Neutral: Border --- */
    --border-color: #334155;
    --border-light: #1e293b;

    /* --- Primary (tăng sáng nhẹ cho Dark) --- */
    --primary: #38bdf8;
    --primary-hover: #8E09DC;
    --primary-rgb: 56, 189, 248;
    --primary-light: rgba(56, 189, 248, 0.1);

    /* --- Semantic (giảm saturation nền, giữ nguyên text) --- */
    --success-light: rgba(16, 185, 129, 0.1);
    --success-border: rgba(16, 185, 129, 0.2);
    --warning-light: rgba(245, 158, 11, 0.1);
    --warning-border: rgba(245, 158, 11, 0.2);
    --danger-light: rgba(239, 68, 68, 0.1);
    --danger-border: rgba(239, 68, 68, 0.2);
    --info-light: rgba(59, 130, 246, 0.1);
    --info-border: rgba(59, 130, 246, 0.2);

    /* --- Purple (Dark) --- */
    --purple: #a78bfa;
    --purple-light: rgba(167, 139, 250, 0.1);

    /* --- Sidebar (Dark Variant) --- */
    --sidebar-bg: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-hover: rgba(255, 255, 255, 0.05);
    --sidebar-hover-text: #f1f5f9;
    --sidebar-border: #334155;
    --sidebar-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3),
        inset 0 2px 3px rgba(255, 255, 255, 0.03),
        inset 2px 0 3px rgba(255, 255, 255, 0.02);
    --active-bg: linear-gradient(135deg, #334155, #475569);
    --active-text: #f1f5f9;
    --active-shadow: 0 4px 8px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.05);

    /* --- Shadows (tăng depth cho nền tối) --- */
    --shadow-card: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
}

/* === Theme Toggle Button === */
.btn-theme-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-theme-toggle:hover {
    background: var(--bg-muted);
    color: var(--primary);
}

/* Icon swap: Light mode = show sun, Dark mode = show moon */
.btn-theme-toggle .icon-sun {
    display: block;
}

.btn-theme-toggle .icon-moon {
    display: none;
}

[data-theme="dark"] .btn-theme-toggle .icon-sun {
    display: none;
}

[data-theme="dark"] .btn-theme-toggle .icon-moon {
    display: block;
}

/* Smooth color transition for theme switch */
body,
.sidebar,
.top-header,
.admin-content,
.admin-footer,
.modal-content,
.card,
.widget-card,
.btn-theme-toggle {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    background-color: var(--bg-body);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-main);
    overflow-x: hidden;
    margin: 0;
}

/* =======================================
   CRM BADGES - GHOST OUTLINE (NHÓM 4)
   ======================================= */
.crm-badge {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px; padding: 4px 12px; border-radius: 99px;
    font-size: 11.5px; font-weight: 700 !important; /* Ép đậm chữ */
    line-height: 1.5; background: transparent !important;
    border: 1.5px solid var(--b-border) !important; /* Ép viền */
    color: var(--b-color) !important; /* ÉP CHỮ TRÙNG MÀU VIỀN */
    white-space: nowrap; transition: all 0.2s ease;
}

.crm-badge i,
.crm-badge svg {
    width: 12px;
    height: 12px;
    stroke-width: 2.5px;
}

/* Mapping Semantic Colors (Tương thích Light/Dark Mode) */
.badge-ghost-primary {
    --b-color: var(--primary);
    --b-border: var(--primary);
}

.badge-ghost-success {
    --b-color: var(--success);
    --b-border: var(--success);
}

.badge-ghost-warning {
    --b-color: var(--warning);
    --b-border: var(--warning);
}

.badge-ghost-danger {
    --b-color: var(--danger);
    --b-border: var(--danger);
}

.badge-ghost-info {
    --b-color: var(--info);
    --b-border: var(--info);
}

.badge-ghost-muted {
    --b-color: var(--text-muted);
    --b-border: var(--text-muted);
    border-style: dashed;
}

/* =======================================
   1. KHUNG XƯƠNG (LAYOUT WRAPPER)
   ======================================= */
.admin-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.admin-main-panel {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

/* Sidebar Collapsed State for Panel */
.sidebar-collapsed .admin-main-panel {
    margin-left: var(--sidebar-collapsed-width);
}


/* =======================================
   2. SIDEBAR
   ======================================= */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1040;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--sidebar-border);
    box-shadow: var(--sidebar-shadow);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Sidebar Collapsed State for Aside */
.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

.sidebar-brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--text-dark);
    border-bottom: 1px solid var(--sidebar-border);
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-collapsed .sidebar-brand {
    padding: 0;
    justify-content: center;
}

.sidebar-brand i {
    margin-right: 10px;
    stroke-width: 2.5px;
    flex-shrink: 0;
}

.sidebar-collapsed .sidebar-brand i {
    margin: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 15px 0;
    margin: 0;
}

.sidebar-collapsed .menu-title,
.sidebar-collapsed .sidebar-group-title,
.sidebar-collapsed .sidebar-brand span {
    display: none !important;
}


.sidebar-collapsed .menu-link {
    padding: 10px 0 !important;
    justify-content: center;
}

.sidebar-collapsed .menu-icon {
    margin: 0 !important;
}

.menu-item {
    margin-bottom: 4px;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 6px 15px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 14.5px;
    border-radius: 10px;
    transition: all 0.2s;
}

.menu-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-hover-text);
}

.menu-item.active .menu-link {
    background: var(--active-bg);
    color: var(--active-text);
    font-weight: 600;
    box-shadow: var(--active-shadow);
}

.menu-icon {
    margin-right: 12px;
    display: flex;
    align-items: center;
}

.menu-icon i,
.menu-icon svg {
    width: 20px !important;
    height: 20px !important;
}

/* =======================================
   3. HEADER
   ======================================= */
.top-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.header-left {
    display: flex;
    align-items: center;
}

.btn-mobile-toggle {
    display: block;
    /* Hiện trên cả máy tính và mobile */
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    margin-right: 15px;
    border-radius: 6px;
    transition: background 0.2s;
}

.btn-mobile-toggle:hover {
    background: var(--bg-body);
    color: var(--primary);
}


.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info-text {
    text-align: right;
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}

.user-role {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: capitalize;
}

.btn-logout {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--danger);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: var(--danger-light);
    border-color: var(--danger-border);
}

/* =======================================
   4. CONTENT & FOOTER
   ======================================= */
.admin-content {
    padding: 24px;
    flex: 1;
}

.admin-footer {
    padding: 15px 24px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}

/* Lớp phủ màn hình Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 1035;
    opacity: 0;
    transition: opacity 0.3s;
}

/* =======================================
   5. MOBILE RESPONSIVE (< 992px)
   ======================================= */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .admin-main-panel {
        margin-left: 0;
        width: 100%;
    }

    .btn-mobile-toggle {
        display: block;
    }

    /* Đã xóa Avatar nên hiện lại chữ trên điện thoại */
    .user-info-text {
        display: flex;
    }

    /* Giấu chữ, chỉ để Avatar trên điện thoại */
    .admin-content {
        padding: 15px;
    }
}

/* =======================================
   6. VÁ LỖI GIAO DIỆN (THEO KẾT QUẢ X-QUANG)
   ======================================= */

/* Sửa lỗi dính chùm ở thanh Toolbar (.filter-bar) */
.filter-bar .d-flex {
    flex-wrap: wrap !important;
    /* Ép cho phép rớt dòng nếu thiếu chỗ */
    gap: 12px !important;
    /* Tăng khoảng cách an toàn giữa các khối */
}

/* Đảm bảo ô Search không bị bóp méo quá đà trên màn hình nhỏ */
#customSearch {
    flex: 1 1 auto;
    min-width: 150px !important;
}

/* Sửa lỗi lệch nút Sửa/Xóa ở cột Action cuối bảng */
#usersTable tbody tr td:last-child,
#customersTable tbody tr td:last-child {
    white-space: nowrap !important;
    /* Cấm rớt dòng trong ô này */
    vertical-align: middle !important;
    text-align: right !important;
}

/* Biến thẻ <a> thành một khối vững chắc (inline-flex) để căn giữa Icon */
#usersTable .btn-edit-user,
#usersTable .btn-delete-user,
#customersTable .btn-edit-customer,
#customersTable .btn-delete-customer {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 32px !important;
    height: 32px !important;
    border-radius: 6px !important;
    margin: 0 4px !important;
    /* Margin đều hai bên, triệt tiêu margin lệch cũ */
    transition: all 0.2s ease;
}

/* Tạo hiệu ứng Hover (Nổi bật) chuẩn RISE CRM cho các nút Action */
#usersTable .btn-edit-user:hover,
#customersTable .btn-edit-customer:hover {
    background-color: var(--primary-light) !important;
    color: var(--primary) !important;
}

#usersTable .btn-delete-user:hover,
#customersTable .btn-delete-customer:hover {
    background-color: var(--danger-light) !important;
    color: var(--danger) !important;
}

/* =======================================
   7. DATATABLES BUTTONS (CSS RỜI TỪ VIEW)
   ======================================= */
div.dt-buttons {
    display: inline-block;
    margin-right: 8px;
}

.btn-colvis-custom {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    padding: 6px 12px !important;
    border-radius: 6px !important;
}

.btn-colvis-custom:hover {
    background: var(--bg-muted) !important;
}

.dropdown-menu.dt-button-collection {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.dropdown-menu.dt-button-collection .dt-button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 8px 15px;
    font-size: 13px;
    color: var(--text-main);
    border-radius: 4px;
    transition: background 0.2s;
}

.dropdown-menu.dt-button-collection .dt-button:hover {
    background-color: var(--bg-body);
}

.dropdown-menu.dt-button-collection .dt-button.active {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.dropdown-menu.dt-button-collection .dt-button.active::after {
    content: '✓';
    float: right;
}

/* =======================================
   7.1. XERMIUS STANDARDIZED DATAGRID
   ======================================= */
.dataTable {
    font-family: var(--font-sans) !important;
}

table.dataTable tbody td,
.table tbody td {
    font-size: var(--td-font-size-main) !important;
    font-weight: var(--td-font-weight-normal) !important;
    color: var(--text-main);
    vertical-align: middle !important;
    padding-top: 0.6rem !important;
    padding-bottom: 0.6rem !important;
    border-bottom: 1px solid var(--border-color) !important;
    text-decoration: none !important;
}

/* KHÔNG GẠCH CHÂN CHO LIÊN KẾT TRONG BẢNG VÀ GIỮ MÀU */
table.dataTable tbody td a,
.table tbody td a {
    text-decoration: none !important;
    color: inherit;
}

table.dataTable tbody td a:hover,
.table tbody td a:hover {
    text-decoration: none !important;
    color: inherit !important;
}

/* Style cho Text phụ (Email, Ngày tháng...) */
table.dataTable tbody td .text-muted,
table.dataTable tbody td .sub-text,
.table tbody td .text-muted {
    font-size: var(--td-font-size-sub) !important;
    color: var(--text-muted) !important;
}

/* Style cho Text chính/Định danh (Tên, Mã) */
table.dataTable tbody td .fw-medium {
    font-size: var(--td-font-size-main) !important;
    font-weight: var(--td-font-weight-medium) !important;
    color: var(--text-main) !important;
}

/* [PHASE 1] ÉP CHUẨN TOÀN BỘ TIÊU ĐỀ BẢNG */
table.dataTable thead th,
table.dataTable thead td,
.table thead th {
    font-size: var(--th-font-size) !important;
    font-weight: var(--th-font-weight) !important;
    color: var(--text-main) !important;
    text-transform: capitalize !important;
    letter-spacing: var(--th-letter-spacing) !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 12px 10px !important;
    vertical-align: middle !important;
    background-color: transparent !important;
    text-decoration: none !important;
    /* Nền trong suốt theo yêu cầu */
}

table.dataTable thead th:hover,
.table thead th:hover {
    text-decoration: none !important;
    color: var(--text-main) !important;
}

/* Điểm nhấn dùng Semibold thay vì Bold thô */
.dataTable .highlight-text,
.dataTable tbody td a.fw-bold,
.dataTable tbody td .fw-bold {
    font-weight: var(--font-weight-semibold) !important;
}

.dataTable tbody tr:last-child td {
    border-bottom: none !important;
}

/* Resize Icon toàn cục cho bảng */
.dataTable tbody td svg.lucide {
    width: 14px !important;
    height: 14px !important;
    stroke-width: 2.5 !important;
}

/* HIỆU ỨNG ROW HOVER (TĨNH & SANG TRỌNG) */
table.dataTable tbody tr:hover,
.table tbody tr:hover,
#customersTable tbody tr:hover,
#invoiceMainTable tbody tr:hover,
#frag_inv_table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02) !important;
    transition: background-color 0.15s ease;
}




/* =======================================
   8. COMPONENTS (USER MODULE SESSION)
   ======================================= */
.session-item {
    border-left: 3px solid var(--border-color);
    transition: all 0.2s;
}

.session-item.current {
    border-left-color: var(--info);
    background-color: var(--info-light);
}



/* =======================================
   9. GIAO DIỆN MOBILE-FIRST (FORM NHẬP LIỆU)
   ======================================= */
/* Kích thước ngón tay chuẩn Mobile-First (48px) */
.h-48-mobile {
    min-height: 48px;
    display: flex;
    align-items: center;
}

/* Biến Modal thành Full màn hình trên Điện thoại để dễ nhập liệu */
@media (max-width: 767.98px) {
    .modal-fullscreen-md-down {
        width: 100%;
        max-width: none;
        height: 100%;
        margin: 0;
    }

    .modal-fullscreen-md-down .modal-content {
        height: 100%;
        border: 0;
        border-radius: 0;
    }

    .modal-fullscreen-md-down .modal-body {
        overflow-y: auto;
    }

    /* Chỉnh nút Save xuống đáy dễ bấm bằng ngón cái */
    .modal-footer {
        flex-direction: column-reverse;
    }

    .modal-footer .btn {
        margin: 0 0 10px 0 !important;
        justify-content: center;
    }
}

/* =======================================
   10. VÁ LỖI TOOLBAR & ACTION (TỪ SANDBOX)
   ======================================= */

/* Toolbar Flexbox & Mobile Responsive */
.filter-bar-v7 {
    padding: 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
}

.filter-bar-v7 .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: var(--bs-btn-hover-color);
    transition: all 0.2s;
}

.filter-bar-v7 .btn:hover {
    background-color: var(--bg-muted);
    color: var(--text-dark);
}

/* Bộ lọc Soft Tabs */
.custom-filter-group {
    background: var(--bg-body);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: inline-flex;
    flex-wrap: wrap;
}

.custom-filter-group .btn-outline-secondary {
    border: none !important;
    color: var(--text-muted);
    border-radius: 6px !important;
    padding: 4px 14px;
}

.custom-filter-group .btn-check:checked+.btn-outline-secondary {
    background-color: var(--bg-card);
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

/* Ô tìm kiếm tự bung trên Mobile */
.search-box {
    min-width: 250px;
}

@media (max-width: 768px) {
    .search-box {
        width: 100%;
        min-width: 100%;
    }

    .search-box input {
        width: 100% !important;
    }
}

/* Action Cell (Sửa/Xóa cuối bảng) */
#usersTable tbody tr td:last-child {
    text-align: right !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
}

#usersTable .btn-edit-user,
#usersTable .btn-delete-user {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    margin: 0 4px !important;
    /* Thay thế me-2 */
    background-color: var(--bg-muted);
    color: var(--text-muted) !important;
    transition: all 0.2s ease;
}

#usersTable .btn-edit-user:hover {
    background-color: var(--primary-light);
    color: var(--primary) !important;
}

#usersTable .btn-delete-user:hover {
    background-color: var(--danger-light);
    color: var(--danger) !important;
}

/* 3. TEST CASE: WIDGET CARDS (TAB TỔNG QUAN) */
.widget-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    /* Nét viền trái màu Xanh chủ đạo */
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    /* Tránh dính nhau trên Mobile */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
}

/* Hiệu ứng nổi bọt khi trỏ chuột */
.widget-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.06);
}

/* Đổi màu viền trái theo Trạng thái */
.widget-card.warning {
    border-left-color: var(--warning);
}

/* Màu vàng cam */
.widget-card.danger {
    border-left-color: var(--danger);
}

/* Màu đỏ */

.widget-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.widget-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
    color: var(--text-dark);
}

/* Module Doamin style */


.dom-clickable,
.dom-clickable-customer {
    transition: all 0.2s;
    cursor: pointer;
}

.dom-clickable:hover,
.dom-clickable-customer:hover {
    text-decoration: underline;
    color: var(--primary-hover) !important;
}

.section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    text-transform: uppercase;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.invoice-history-table th {
    font-size: 11px;
    text-transform: uppercase;
    background: var(--bg-muted);
}

.invoice-history-table td {
    font-size: 12px;
    vertical-align: middle;
}

.tech-debt-box {
    background: var(--bg-muted);
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    padding: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.tech-debt-box i {
    width: 14px;
    height: 14px;
    margin-right: 4px;
    vertical-align: middle;
}

/* Chi tiết khách hàng */
/* Customer Dashboard Styles */
.cd-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    border-radius: 12px;
    padding: 28px 32px;
    color: var(--bg-card);
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.cd-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.cd-header .cd-avatar {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: var(--bg-card);
    flex-shrink: 0;
}

.cd-header .cd-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.cd-header .cd-meta {
    font-size: 13px;
    opacity: 0.85;
}

.cd-header .cd-meta i {
    width: 14px;
    height: 14px;
}



.cd-header .cd-actions .btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: var(--bg-card);
    font-size: 13px;
    padding: 6px 16px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    transition: all 0.2s;
}

.cd-header .cd-actions .btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Stat Cards */
.cd-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.cd-stat-card {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 20px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform 0.2s;
}

.cd-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.cd-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cd-stat-icon i {
    width: 20px;
    height: 20px;
}

.cd-stat-icon.revenue {
    background: var(--success-light);
    color: var(--success);
}

.cd-stat-icon.credit {
    background: var(--info-light);
    color: var(--info);
}

.cd-stat-icon.services {
    background: var(--warning-light);
    color: var(--warning);
}

.cd-stat-icon.tenure {
    background-color: var(--purple-light);
    color: var(--purple);
}

.cd-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.cd-stat-label {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    font-weight: 600;
}

/* Tab Navigation */
.cd-tabs .nav-tabs {
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-card);
    padding: 0 20px;
    border-radius: 10px 10px 0 0;
    gap: 0;
}

.cd-tabs .nav-tabs .nav-link {
    border: none;
    color: var(--text-muted);
    padding: 14px 20px;
    font-weight: 500;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.cd-tabs .nav-tabs .nav-link:hover {
    color: var(--info);
    background: var(--bg-muted);
}

.cd-tabs .nav-tabs .nav-link.active {
    color: var(--info);
    border-bottom-color: var(--info);
    background: transparent;
    font-weight: 600;
}

.cd-tabs .nav-tabs .nav-link i {
    width: 16px;
    height: 16px;
}

.cd-tabs .nav-tabs .nav-link .tab-badge {
    background: var(--danger);
    color: var(--bg-card);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    line-height: 1;
}

.cd-tabs .tab-content {
    background: var(--bg-card);
    border-radius: 0 0 10px 10px;
    border: 1px solid var(--border-color);
    border-top: 0;
    padding: 24px;
    min-height: 300px;
}

/* Tab Loading Spinner */
.tab-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-light);
    gap: 10px;
}

.tab-loading .spinner-border {
    width: 24px;
    height: 24px;
}

/* Profile Form inside tab */
.cd-profile-section {
    border-bottom: 1px solid var(--bg-body);
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.cd-profile-section:last-child {
    border-bottom: 0;
    margin-bottom: 0;
    padding-bottom: 0;
}

.cd-profile-section h6 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 16px;
    letter-spacing: 0.5px;
}

/* Breadcrumb */
.cd-breadcrumb {
    margin-bottom: 16px;
    font-size: 13px;
}

.cd-breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
}

.cd-breadcrumb a:hover {
    color: var(--info);
}

.cd-breadcrumb .separator {
    color: var(--border-color);
    margin: 0 8px;
}

.cd-breadcrumb .current {
    color: var(--text-dark);
    font-weight: 600;
}

/* =======================================
   11. GLOBAL XERMIUS MODAL STYLE
   ======================================= */
.modal-content {
    border: none !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
    overflow: hidden;
}

.modal-backdrop.show {
    backdrop-filter: blur(3px);
    background-color: rgba(15, 23, 42, 0.5) !important;
    opacity: 1 !important;
}

.modal-header,
.modal-footer {
    padding: 1.25rem 1.5rem !important;
    border-color: var(--bg-body) !important;
    background-color: var(--bg-card);
    align-items: center;
}

.modal-title {
    font-family: var(--font-sans) !important;
    font-weight: var(--font-weight-semibold) !important;
    color: var(--text-dark) !important;
    font-size: 1.1rem !important;
}

.btn-close {
    background-size: 10px;
    transition: all 0.2s;
}

.btn-close:focus {
    box-shadow: none !important;
}

/* Chuẩn hóa nút bấm trong Modal */
.modal-footer .btn {
    border-radius: 50rem !important;
    padding: 0.5rem 1.5rem !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.modal-footer .btn-light,
.modal-footer .btn-secondary {
    background-color: var(--bg-muted) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-muted) !important;
}

.modal-footer .btn-primary {
    box-shadow: var(--shadow-btn-primary) !important;
}

.modal-footer .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Chuẩn hóa Form trong Modal */
.modal-body .form-control,
.modal-body .form-select {
    border-radius: 10px !important;
    border-color: var(--border-color) !important;
    font-size: 0.9rem !important;
    padding: 0.6rem 0.875rem !important;
    box-shadow: none !important;
    font-weight: 400 !important;
    /* Xóa độ đậm gõ vào */
    color: var(--text-dark) !important;
}

.modal-body .form-control:focus,
.modal-body .form-select:focus {
    border-color: var(--primary) !important;
    background-color: var(--bg-card) !important;
}

.modal-body label {
    font-weight: 600 !important;
    font-size: 13px !important;
    color: var(--text-main) !important;
    margin-bottom: 6px !important;
    display: block;
}

/* =======================================
   12. FINAL POLISH (RE-AUDIT UI KIT)
   ======================================= */
/* 1. Tinh chỉnh Table Header */
.dataTable th {
    font-weight: 600 !important;
    white-space: nowrap;
}

/* 2. Thu nhỏ Datatable Toolbar */


/* 3. Class Giá tiền (Currency) */
.text-currency {
    color: var(--danger) !important;
    font-weight: 500 !important;
}

/* 4. Làm gọn (Compact) Modal Forms */
.modal-body .form-label {
    font-size: 11px !important;
    margin-bottom: 4px;
}

.modal-body .form-control,
.modal-body .form-select {
    font-size: 13px !important;
    padding: 0.4rem 0.75rem !important;
}

/* 5. Chuẩn hóa Badge Trạng thái */
.dataTable .badge {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.3px;
    border: none;
    text-transform: capitalize;
}

/* =======================================
   13. COMPACT UI UPDATE
   ======================================= */
/* 1. XÓA SỔ KHỐI DOM RỖNG ĐẨY BẢNG CỦA DATATABLES */


/* 2. ĐÓNG KÍN KHE HỞ GIỮA TABLE VÀ THEAD (BORDER-SPACING) */
table.dataTable {
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* 3. ÉP CHỮ TRONG THEAD NẰM GIỮA, ÔM SÁT TEXT */
table.dataTable>thead>tr>th {
    padding: 10px 10px !important;
    vertical-align: middle !important;
    height: auto !important;
    line-height: 1.2 !important;
    position: relative !important;
}

/* 4. TREO MŨI TÊN SORTING LƠ LỬNG KHÔNG CHIẾM DIỆN TÍCH */
/* 5. TRIỆT TIÊU MARGIN-BOTTOM CỦA TOOLBAR/BUTTONS (ÉP BẢNG SÁT LÊN) */
.dataTables_wrapper .dt-buttons,
.dataTables_wrapper .dt-layout-row:first-child,
.dataTables_wrapper>.row:first-child,
.dataTables_wrapper .custom-filter-group {
    margin-bottom: 8px !important;
    /* Chỉ giữ lại 8px cho thoáng, không để mb-3 (16px) hay mb-4 (24px) */
    padding-bottom: 0 !important;
}

table.dataTable thead th.sorting::before,
table.dataTable thead th.sorting::after,
table.dataTable thead th.sorting_asc::before,
table.dataTable thead th.sorting_asc::after,
table.dataTable thead th.sorting_desc::before,
table.dataTable thead th.sorting_desc::after {
    position: absolute !important;
    bottom: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    right: 8px !important;
}

table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc {
    padding-right: 24px !important;
}

/* 2. Thu nhỏ Phân trang (Pagination) */


/* =======================================
   14. LUẬT 11 & ICON ALIGNMENT (FINAL)
   ======================================= */
/* 1. Căn chỉnh Micro-icons (12px, 14px, 16px) */
svg.lucide,
.icon-12,
.icon-14,
.icon-16,
.icon-20 {
    vertical-align: middle !important;
    margin-top: -2px;
    /* Tinh chỉnh trọng tâm so với dòng chữ */
}

/* 2. LUẬT 11: Trạng thái Trống (Empty State) */
.empty-state-v7 {
    padding: 40px 20px;
    text-align: center;
    background: var(--bg-card);
    border-radius: 12px;
}

.empty-state-v7 i,
.empty-state-v7 svg {
    display: block;
    margin: 0 auto 12px auto;
    width: 48px !important;
    height: 48px !important;
    opacity: 0.15;
    color: var(--text-muted);
}

.empty-state-v7 .empty-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

/* 3. Dọn dẹp Typography Header Table */
table.dataTable thead th:not(.text-uppercase) {
    text-transform: none !important;
}

table.dataTable thead th.fw-bold {
    color: var(--text-main) !important;
}

/* =======================================
   15.5 DATA HIERARCHY: "DÌM HÀNG" DEAD ROWS (V7 Standard)
   Dòng có status "chết" sẽ bị xám mờ, chìm xuống đáy.
   Sử dụng thông số chuẩn Xermius (opacity 0.65) cực nét.
   ======================================= */
.dataTable tr.row-dead>*,
.table tr.row-dead>* {
    background-color: var(--bs-table-hover-bg) !important;
    /* Dùng màu hover hệ thống như sếp chỉ thị */
    transition: opacity 0.2s ease;
}

.dataTable tr.row-dead {
    opacity: 0.95 !important;
}

.dataTable tr.row-dead td {
    color: #6c757d !important;
}

.dataTable tr.row-dead:hover {
    opacity: 0.9 !important;
}

.dataTable tr.row-dead:hover>*,
.table tr.row-dead:hover>* {
    background-color: var(--bs-table-hover-bg) !important;
}

/* =======================================
   15. LEGACY MIGRATION (from admin.css V6.5)
   Classes still in active use across 16+ modules.
   ======================================= */

/* 1. Workspace Container (16+ modules) */
.workspace-wrapper {
    background-color: var(--bg-body);
    padding: 10px;
    border-radius: 8px;
    font-family: var(--font-sans);
}

.workspace-wrapper .card {
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    border-radius: 6px;
    background: var(--bg-card);
}

/* 2. Workspace Tabs (Nav-tabs) */
.workspace-wrapper .nav-tabs {
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    padding: 10px 20px 0;
    border-radius: 6px 6px 0 0;
}

.workspace-wrapper .nav-tabs .nav-link {
    border: none;
    color: var(--text-muted);
    padding: 10px 15px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
}

.workspace-wrapper .nav-tabs .nav-link.active {
    color: var(--info);
    border-bottom: 2px solid var(--info);
    background: transparent;
}

/* 3. Filter Bar V6 (Project, Product modules) */
.filter-bar {
    padding: 15px 20px;
    background: var(--bg-muted);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 6px 6px 0 0;
}

/* 4. Button Default (13+ modules) */
.workspace-wrapper .btn-default {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 500;
}

/* ============================================
   16. VIBE TAB UNIFIED — Single Source of Truth
   Ghost/Outline Pill Tabs with color-mix (Dark Mode Safe)
   ============================================ */

/* Container: Pill Track */
.vibe-tabs-pills {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background-color: var(--bg-muted);
    border-radius: 99px;
    border: 1px solid var(--border-color);
    flex-wrap: nowrap;
    overflow-x: auto;
}

/* Scrollbar ẩn cho container */
.vibe-tabs-pills.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.vibe-tabs-pills.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Full-width variant: tabs fill container */
.vibe-tabs-pills.w-100 .vibe-tab {
    flex: 1;
    text-align: center;
}

/* Tab Item */
.vibe-tab {
    padding: 6px 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    background: var(--active-bg);
    border: 1.5px solid transparent;
    border-radius: 99px;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

/* Hover: CSS Variable, Dark Mode safe */
.vibe-tab:hover {
    color: var(--text-main);
    background: var(--bg-muted);
}

/* Active: Ghost/Outline Primary — color-mix cho Pastel bg */
.vibe-tab.active {
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    color: var(--primary);
    border-color: var(--primary);
    font-weight: 700;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 15%, transparent);
}

/* Ghost Badge bên trong Tab */
.vibe-tab .badge-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 4px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    border-radius: 6px;
    margin-left: 4px;
    transition: all 0.2s;
}

.vibe-tab.active .badge-ghost {
    background: color-mix(in srgb, var(--primary) 15%, transparent);
    color: var(--primary);
}

/* =======================================
   17. MODULE: SETTINGS (MIGRATED)
   Migrated from admin-settings.css
   ======================================= */
.tab-title {
    font-weight: 700;
    color: var(--text-dark);
    border-bottom: 2px solid var(--bg-body);
    padding-bottom: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-group {
    background: var(--bg-muted);
    padding: 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.group-label {
    display: block;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.list-header {
    display: flex;
    gap: 10px;
    padding: 0 10px;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.dynamic-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
    background: var(--bg-card);
    padding: 6px 10px;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    transition: 0.2s;
}

.dynamic-row:hover {
    border-color: var(--text-light);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.row-col-actions {
    flex: 0 0 70px;
    display: flex;
    justify-content: flex-end;
    gap: 5px;
}

.btn-action-icon {
    color: var(--text-muted);
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-action-icon:hover {
    background: var(--bg-body);
    color: var(--text-dark);
}

.btn-action-icon.delete:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.btn-action-icon.link:hover {
    background: var(--info-light);
    color: var(--primary-hover);
}

.sys-btn {
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.readonly-field {
    background-color: var(--bg-body);
    border: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-main);
}


.workspace-wrapper .btn-default:hover,
.workspace-wrapper .btn-check:checked+.btn-default {
    background: var(--bg-muted);
    color: var(--text-dark);
}

/* 5. Icon-16 (50+ places — also handled by Section 14 alignment) */
.icon-16 {
    width: 16px;
    height: 16px;
    stroke-width: 2px;
}

/* --- Vibe Standard Typography Utilities --- */
.size-14px {
    font-size: 14px !important;
}

.size-13px {
    font-size: 13px !important;
}

.size-12px {
    font-size: 12px !important;
}

.size-11px {
    font-size: 11px !important;
}

.size-10px {
    font-size: 10px !important;
}

/* [DELETED] .nav-pills duplicate blocks — Merged into .vibe-tab unified (Section 16) */

/* --- Hide Scrollbar Utility --- */
.hide-scrollbar {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.hide-scrollbar::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

/* =======================================
   GOLDEN GREEN: .btn-primary Override
   Dùng CSS Variables của Bootstrap 5 thay vì ghi mã cứng
   ======================================= */
.btn-primary {
    --bs-btn-bg: var(--primary) !important;
    --bs-btn-border-color: var(--primary) !important;
    --bs-btn-hover-bg: var(--primary-hover) !important;
    --bs-btn-hover-border-color: var(--primary-hover) !important;
    --bs-btn-active-bg: var(--primary-hover) !important;
    --bs-btn-active-border-color: var(--primary-hover) !important;
    --bs-btn-disabled-bg: var(--primary) !important;
    --bs-btn-disabled-border-color: var(--primary) !important;
}

/* =======================================
   SELECT2 V8 MAX UI FIX (Bootstrap 5 Theme)
   Kỷ luật DNA 04: Premium Gradient & Layout Fixes
   ======================================= */
.select2-container--bootstrap-5 .select2-selection {
    border: 1px solid var(--bs-border-color);
    background-color: var(--bs-body-bg);
    min-height: 38px;
    padding: 0.375rem 2.25rem 0.375rem 0.75rem;
    border-radius: 0.5rem;
    /* rounded-4 equivalent */
    width: 100%;

    /* Native form-select Bootstrap 5 Arrow */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(22, 163, 74, 0.25);
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    color: var(--bs-body-color);
    font-size: 0.875rem;
    /* Text nhỏ gọn theo DNA */
    line-height: 1.5;
    padding: 0;

    /* Chống dồn ép lưới - Chống vỡ label Domain dài */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

/* Tinh chỉnh dấu X (Clear Button) tránh chèn chữ */
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__clear {
    position: absolute;
    right: 2.25rem;
    /* Cách mũi tên thả xuống một khoảng an toàn */
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    background-color: transparent;
    color: #adb5bd;
    font-size: 1.25rem;
    z-index: 10;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__clear:hover {
    color: var(--bs-danger);
}

/* =======================================
   BỘ MÀU ĐỘC LẬP CHO TRẠNG THÁI (STATUS PALETTE)
   ======================================= */
:root {
    --st-pending: #8E09DC;     /* Tím - Chờ xử lý */
    --st-inprogress: #3B82F6;  /* Xanh dương - Đang làm */
    --st-completed: #10B981;   /* Xanh lá - Hoàn thành */
    --st-onhold: #DC8E09;      /* Cam đất - Tạm dừng */
    --st-danger: #EF4444;      /* Đỏ - Quá hạn/Lỗi */
    --st-cancelled: #5A687D;   /* Xám - Đã hủy */
}

/* Hệ màu Status Palette chuẩn */
.badge-st-pending    { --b-color: #8E09DC; --b-border: #8E09DC; }
.badge-st-inprogress { --b-color: #3B82F6; --b-border: #3B82F6; }
.badge-st-completed  { --b-color: #10B981; --b-border: #10B981; }
.badge-st-onhold     { --b-color: #DC8E09; --b-border: #DC8E09; }
.badge-st-danger     { --b-color: #EF4444; --b-border: #EF4444; }
.badge-st-cancelled  { --b-color: #5A687D; --b-border: #5A687D; border-style: dashed !important; }