html {
    scrollbar-gutter: stable;
}

html,
body {
    font-family: 'Inter', system-ui, -apple-system, blinkmacsystemfont, 'Segoe UI', roboto, 'Helvetica Neue', arial, sans-serif;
    height: 100vh;
    min-height: 100vh;
    margin: 0;
    --midnight-blue: #1d273b;
    --qcs-primary: var(--nexus-primary, #01757A);
    background-color: var(--mud-palette-background, #F8FAFC) !important;
}

/* Dark bg applied immediately when html.dark-mode is set by the inline
   index.html script (runs before Blazor boots), preventing the white flash
   during MainLayout's first render when _isDarkMode is briefly false. */
html.dark-mode,
html.dark-mode body {
    background-color: #0F172A !important;
    color-scheme: dark;
}

.main-wrapper {
    background-color: var(--mud-palette-background, #F8FAFC) !important;
    padding: 1rem 1.25rem !important;
}

.nexus-sidebar-menu .mud-nav-link {
    padding-left: 1.25rem !important;
    font-size: 0.8125rem !important;
    color: #475569 !important;
    /* Standard Slate 600 */
    font-weight: 500 !important;
    opacity: 1 !important;
    transition: all 0.2s ease;
}

.sidebar-group .mud-nav-link {
    padding-left: 2.75rem !important;
}

/* ── Sidebar subgroup: indent + left-border to show hierarchy ── */
.sidebar-subgroup {
    margin-left: 0.875rem;
    border-left: 2px solid rgba(107, 114, 128, 0.18);
    padding-left: 0.25rem;
}

/* Subgroup header row: compact, muted, label-style */
.sidebar-subgroup>.mud-nav-group>.mud-nav-link {
    padding-left: 0.75rem !important;
    min-height: 30px !important;
    height: 30px !important;
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.55px;
    color: #9ca3af !important;
    background: transparent !important;
    opacity: 1;
}

/* Hide icon on subgroup header — icon already on parent */
.sidebar-subgroup>.mud-nav-group>.mud-nav-link .mud-nav-link-icon {
    display: none !important;
}

/* Subgroup expand chevron: smaller */
.sidebar-subgroup>.mud-nav-group>.mud-nav-link .mud-nav-group-expand-icon {
    font-size: 0.85rem !important;
    opacity: 0.5;
}

/* Links inside subgroup */
.sidebar-subgroup .mud-nav-link {
    padding-left: 1.25rem !important;
    font-size: 0.85rem !important;
}

.nexus-sidebar-menu .mud-nav-link:hover {
    color: var(--nexus-primary, #01757A) !important;
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 7%, transparent) !important;
}

.nexus-sidebar-menu .mud-nav-link.active,
.nexus-sidebar-menu .nx-nav-active .mud-nav-link,
.nexus-sidebar-menu .mud-nav-link.nx-nav-active {
    color: var(--nexus-primary, #01757A) !important;
    font-weight: 600 !important;
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 8%, transparent) !important;
    border-right: 3px solid var(--nexus-primary, #01757A);
}

.nexus-sidebar-menu .mud-nav-group-title .mud-nav-link-icon-default {
    color: #64748B !important;
    /* Steel Gray */
}

.nexus-sidebar-menu .mud-nav-group>.mud-nav-link {
    color: #1e293b !important;
    font-weight: 600 !important;
}

/* Dark mode overrides — sidebar uses hardcoded light colors that don't flip via MudBlazor CSS vars */
html.dark-mode .nexus-sidebar-menu .mud-nav-link {
    color: #94A3B8 !important;
}

html.dark-mode .nexus-sidebar-menu .mud-nav-link:hover {
    color: var(--nexus-primary, #2BA5AB) !important;
    background-color: color-mix(in srgb, var(--nexus-primary, #2BA5AB) 10%, transparent) !important;
}

html.dark-mode .nexus-sidebar-menu .mud-nav-link.active,
html.dark-mode .nexus-sidebar-menu .nx-nav-active .mud-nav-link,
html.dark-mode .nexus-sidebar-menu .mud-nav-link.nx-nav-active {
    color: var(--nexus-primary, #2BA5AB) !important;
    background-color: color-mix(in srgb, var(--nexus-primary, #2BA5AB) 10%, transparent) !important;
    border-right-color: var(--nexus-primary, #2BA5AB);
}

html.dark-mode .nexus-sidebar-menu .mud-nav-group-title .mud-nav-link-icon-default {
    color: #64748B !important;
}

html.dark-mode .nexus-sidebar-menu .mud-nav-group>.mud-nav-link {
    color: #CBD5E1 !important;
}

html.dark-mode .sidebar-subgroup>.mud-nav-group>.mud-nav-link {
    color: #475569 !important;
}

html.dark-mode .sidebar-subgroup {
    border-left-color: rgba(203, 213, 225, 0.15);
}

h1:focus {
    outline: none;
}

a,
.btn-link {
    color: var(--nexus-primary, #01757A);
}

.btn-primary {
    color: #fff;
    background-color: var(--nexus-primary, #01757A);
    border-color: var(--nexus-primary, #01757A);
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: none !important;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* Required field asterisk */
.form-label.required::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

/* Invalid field border highlight */
.form-control.invalid,
.form-control.modified.invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.125rem rgba(220, 53, 69, 0.25);
}

#blazor-error-ui {
    color-scheme: light only;
    background: #fff9e6;
    color: #92400e;
    top: 1rem;
    right: 1rem;
    bottom: auto;
    left: auto;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    box-sizing: border-box;
    display: none;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: auto;
    min-width: 300px;
    max-width: 480px;
    z-index: 9999;
    border-radius: 8px;
    border: 1px solid #ffecb5;
    border-left: 4px solid #f59e0b;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    margin-left: 1rem;
    font-weight: bold;
}

#blazor-error-ui .reload {
    color: #b45309;
    font-weight: 600;
    text-decoration: underline;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTgyIDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3LjgyOSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5LjE4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDgyLjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

code {
    color: #c02d76;
}

/* Custom layout fixes for Tabler/MudBlazor */
.sidebar-drawer {
    border-right: 1px solid var(--mud-palette-divider) !important;
}

/* ==========================================================
   NexusDataTable Component Styles
   ========================================================== */
.nexus-table thead th {
    background-color: rgba(0, 0, 0, 0.02) !important;
    /* Subtle bg-light effect */
    color: #334155 !important; /* BR-SYS-A11Y-AA: 10.4:1 trên #F8FAFC (cũ var(--bs-secondary) #6c757d = 4.28:1) */
    font-size: 0.7rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.05em;
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
    border-top: 1px solid rgba(101, 109, 119, 0.12) !important;
    border-bottom: 1px solid rgba(101, 109, 119, 0.12) !important;
    vertical-align: middle !important;
}

/* Toolbar spacing */
.nexus-datatable .card-header {
    padding: 0.5rem 1rem !important;
    min-height: 40px !important;
    background-color: transparent !important;
    border-bottom: 1px solid #e6e7e9 !important;
}

.nexus-table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    border: 0 !important;
}

.nexus-table tbody td {
    padding-top: 1.25rem !important;
    padding-bottom: 1.25rem !important;
    vertical-align: middle !important;
    border-bottom: 1px solid rgba(101, 109, 119, 0.06) !important;
    transition: background-color 0.15s ease !important;
}

.nexus-table tr:last-child td {
    border-bottom: 0 !important;
}

/* â”€â”€ Zebra Stripes (QCS-inspired) â”€â”€ */
.nexus-table tbody tr:nth-child(even) {
    background-color: #f8f9fc !important;
}

.nexus-table tbody tr:hover {
    background-color: #F1F5F9 !important;
}

.nexus-table.is-loading {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
}

.nexus-table .status-dot {
    width: 6px;
    height: 6px;
    margin-right: 0.5rem;
}

/* Checkbox columns */
.nexus-th-checkbox,
.nexus-td-checkbox {
    width: 40px !important;
    padding-left: 12px !important;
    padding-right: 4px !important;
}

/* Pagination active page */
.nexus-datatable .pagination .page-item.active .page-link {
    background-color: var(--nexus-primary, #01757A);
    border-color: var(--nexus-primary, #01757A);
    color: #fff;
}

/* ==========================================================
   Status Dot & Badges
   ========================================================== */

.status-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    margin-right: 0.375rem;
}

.status-dot-success {
    background-color: #059669;
}

.status-dot-warning {
    background-color: #f59e0b;
}

.text-status-success {
    color: #059669;
    font-weight: 500;
    font-size: 0.8125rem;
}

.badge-outline {
    background: transparent;
    border: 1px solid rgba(101, 109, 119, 0.16);
    color: #616876;
    font-weight: 500;
    font-size: 0.7rem;
    padding: 0.125rem 0.5rem;
    border-radius: 100px;
}

/* Sidebar Dark Mode Bridge */
.sidebar-dark {
    background-color: #FFFFFF !important;
    border-right: 1px solid #E2E8F0 !important;
}

.sidebar-dark .mud-nav-link {
    color: #64748B !important;
}

.sidebar-dark .mud-nav-link.active {
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 8%, transparent) !important;
    color: var(--nexus-primary, #01757A) !important;
}

.sidebar-dark .mud-nav-link:hover {
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 5%, transparent) !important;
}

.sidebar-dark .mud-nav-group-title {
    color: #94A3B8 !important;
}

/* ==========================================================
   Executive Luxury Login Page
   ========================================================== */

/* Fade-in Animation */
@keyframes nexusFadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-fade-in {
    animation: nexusFadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-fill-mode: both;
}

/* Left Hero Panel */
.login-hero-luxury {
    background-color: var(--nexus-primary, #01757A);
    background-image: url('../images/login-hero-bg.png');
    background-blend-mode: luminosity;
    background-size: cover;
    background-position: center;
    position: relative;
    min-height: 100vh;
}

.login-hero-overlay-luxury {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, color-mix(in srgb, var(--nexus-primary, #01757A) 68%, rgba(9, 13, 22, 0.35)), color-mix(in srgb, var(--nexus-primary-hover, var(--nexus-primary, #01757A)) 55%, rgba(9, 13, 22, 0.45)));
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 4rem;
}

.login-hero-content {
    max-width: 520px;
}

.login-hero-title-luxury {
    font-size: 3.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 0.75rem;
    letter-spacing: 3px;
}

.login-hero-tagline {
    font-family: 'Inter', 'Roboto', sans-serif;
    font-size: 18px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
    margin-bottom: 0;
}

.login-hero-features {
    margin-top: 1.5rem;
}

/* Right Panel — Form Container */
.login-container-card {
    width: 100%;
    max-width: 380px;
    padding: 0 1.5rem;
}

/* Nexus Gradient Logo */
.nexus-login-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--nexus-primary, #01757A), var(--nexus-primary-hover, #006b70));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px color-mix(in srgb, var(--nexus-primary, #01757A) 30%, transparent);
}

.nexus-login-logo-text {
    font-size: 28px;
    font-weight: 800;
    color: white;
    letter-spacing: -1px;
}

/* Form Fields */
.nexus-login-field .mud-input-outlined-border {
    border-color: #E2E8F0 !important;
    border-radius: 10px !important;
}

.nexus-login-field .mud-input-outlined-border:hover {
    border-color: #CBD5E1 !important;
}

.nexus-login-field.mud-input-has-focus .mud-input-outlined-border {
    border-color: var(--nexus-primary, #01757A) !important;
    border-width: 2px !important;
}

/* Adornment icons (person/lock) match the idle border tone instead of the
   MudBlazor default dark gray, so they blend with the outlined field. */
.nexus-login-field .mud-input-adornment .mud-icon-root {
    color: #94A3B8 !important;
}

.nexus-login-field.mud-input-has-focus .mud-input-adornment .mud-icon-root {
    color: var(--nexus-primary, #01757A) !important;
}

/* Browser autofill (e.g. saved "admin" credentials) repaints the input
   background pale blue/yellow via -webkit-autofill, clashing with the
   outlined field's white background and gray icon. Force it back to white
   using the box-shadow inset trick (background-color is ignored on autofill). */
.nexus-login-field input:-webkit-autofill,
.nexus-login-field input:-webkit-autofill:hover,
.nexus-login-field input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #FFFFFF inset !important;
    box-shadow: 0 0 0 1000px #FFFFFF inset !important;
    -webkit-text-fill-color: #1E293B !important;
    caret-color: #1E293B !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Sign In Button */
.nexus-login-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.nexus-login-btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 8px 25px color-mix(in srgb, var(--nexus-primary, #01757A) 40%, transparent) !important;
    filter: brightness(1.06);
}

.nexus-login-btn:active {
    transform: translateY(0) !important;
}

/* Mobile Responsive */
@media (max-width: 991.98px) {
    .login-container-card {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(12px);
        margin: 1.5rem;
        padding: 2.5rem !important;
        border-radius: 20px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
    }
}

/* ==========================================================
   Soft Pill Badges (Executive Luxury)
   ========================================================== */
.nexus-soft-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 9999px;
    white-space: nowrap;
}

.nexus-soft-badge-success {
    background-color: #D1FAE5;
    color: #047857; /* AA ≥ 4.5:1 */
}

.nexus-soft-badge-info {
    background-color: #DBEAFE;
    color: #1D4ED8;
}

.nexus-soft-badge-dark {
    background-color: #F1F5F9;
    color: #475569;
}

.nexus-soft-badge-warning {
    background-color: #FEF3C7;
    color: #92400E;
}

.nexus-soft-badge-error {
    background-color: #FEE2E2;
    color: #B91C1C;
}

/* ==========================================================
   Search Box – Global Standard (Executive Luxury)
   Applies to ALL MudTextField inside Toolbar / card-header
   ========================================================== */
.mud-toolbar .mud-input-outlined .mud-input-outlined-border,
.card-header .mud-input-outlined .mud-input-outlined-border,
.nexus-search-box .mud-input-outlined-border {
    border-color: #CBD5E1 !important;
    border-width: 1px !important;
    border-radius: 8px !important;
}

.mud-toolbar .mud-input-outlined:hover .mud-input-outlined-border,
.card-header .mud-input-outlined:hover .mud-input-outlined-border,
.nexus-search-box:hover .mud-input-outlined-border {
    border-color: #94A3B8 !important;
}

.mud-toolbar .mud-input-outlined.mud-input-focused .mud-input-outlined-border,
.card-header .mud-input-outlined.mud-input-focused .mud-input-outlined-border,
.nexus-search-box.mud-input-focused .mud-input-outlined-border {
    border-color: var(--nexus-primary, #01757A) !important;
    border-width: 1.5px !important;
}

/* Remove MudBlazor default margin-bottom on search fields in toolbars */
.mud-toolbar .mud-input-control,
.card-header .mud-input-control {
    margin-bottom: 0 !important;
}

/* Custom Filter Bar for Compact Left-Aligned Filters */
.nexus-filter-bar,
.nexus-filter-bar.d-flex.align-items-center,
.d-flex.align-items-center.bg-light:has(.mud-input-control) {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: start !important;
    gap: 0.75rem !important;
    width: 100% !important;
}

/* BR-UI-SEARCHPANEL-02: Cụm nút Tìm kiếm / Xóa bộ lọc nằm ngay liền sau ô điều kiện lọc cuối cùng */
.nexus-filter-bar > .nexus-search-actions {
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    min-height: 36px;
}

/* BR-SAL-SQ-UI-05: Chống che khuất ký tự cuối của ngày dd/MM/yyyy (vd: "01/11/2026" bị cắt thành "01/11/202")
   trên mọi MudDatePicker khi ô lọc hoặc cột hẹp. Thu gọn khoảng đệm phải và nút lịch. */
.mud-picker input.mud-input-slot {
    padding-left: 10px !important;
    padding-right: 2px !important;
    font-variant-numeric: tabular-nums;
}

.mud-picker .mud-input-adornment-end {
    margin-left: 0 !important;
}

.mud-picker .mud-input-adornment-end .mud-icon-button {
    padding: 4px !important;
    margin-right: -4px !important;
}

.nexus-filter-bar .mud-input-control,
.bg-light:has(.mud-input-control) .mud-input-control {
    flex: 0 0 auto !important;
    margin-bottom: 0 !important;
}

/* BR-UI-SEARCHPANEL-04 (17/11/2026) — ô chọn / ô ngày phải giãn KÍN phần của mình trong thanh lọc.
   Luật trên ép mọi .mud-input-control co theo chữ (flex 0 0 auto) — kể cả control nằm BÊN TRONG
   .mud-select / .mud-picker (MudBlazor cho 2 lớp này display:flex) ⇒ Kết quả / Thiết bị / Mạng co còn
   "K…", "T…", chừa khoảng trống lớn (màn Lịch sử đăng nhập, Henry 17/11 "chỉnh lại cho cân đối"). */
.nexus-filter-bar :is(.mud-select, .mud-picker) > .mud-input-control,
.bg-light:has(.mud-input-control) :is(.mud-select, .mud-picker) > .mud-input-control {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
}

/* ==========================================================
   BR-UI-FILTERBAR-01 — thanh lọc trên màn nhỏ
   ----------------------------------------------------------
   Các màn bọc ô lọc bằng <div style="width: 350px"> theo đúng rule
   "ô lọc đặt width cụ thể". Trên desktop thì đúng, nhưng màn nhỏ thì
   3 ô × 350px = 1050px > khung 1154px kể cả sidebar → tràn ngang.

   Inline style thắng mọi class, nên chỗ duy nhất giành lại được là
   media query có !important. Đặt ở component để 156 màn cùng hưởng,
   KHÔNG đi sửa inline style ở từng màn.
   ========================================================== */

/* Desktop hẹp: cho ô lọc co lại thay vì đẩy nhau tràn ra ngoài. */
@media (max-width: 1440px) {
    .nexus-filter-bar-responsive {
        gap: 0.75rem !important;
    }

    .nexus-filter-bar-responsive > * {
        max-width: 100% !important;
    }
}

/* Tablet / desktop nhỏ: hai ô một hàng. */
@media (max-width: 991.98px) {
    .nexus-filter-bar-responsive > * {
        flex: 1 1 calc(50% - 0.75rem) !important;
        width: auto !important;
        min-width: 0 !important;
    }
}

/* Điện thoại: mỗi ô một hàng, chật hơn nữa thì không đọc được nhãn. */
@media (max-width: 575.98px) {
    .nexus-filter-bar-responsive > * {
        flex: 1 1 100% !important;
    }
}

/* Số điều kiện đang lọc, hiện khi thanh lọc đã gấp. */
.nexus-filter-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--nexus-primary, #01757A);
    background: color-mix(in srgb, var(--nexus-primary, #01757A) 8%, transparent);
    border-radius: 4px;
    padding: 0.1rem 0.45rem;
    white-space: nowrap;
}

/* ==========================================================
   Grid Row Height – 52px for airy Executive Luxury spacing
   ========================================================== */
.nexus-table tbody tr {
    height: 52px;
}

.nexus-table tbody td {
    padding-top: 12px !important;
    padding-bottom: 12px !important;
    vertical-align: middle;
}

.nexus-table thead th {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    font-weight: 600;
    color: #475569;
    font-size: 13px;
    text-transform: capitalize;
    border-bottom: 2px solid #E2E8F0 !important;
}

/* ==========================================================
   Action Icons – Slate default, Indigo on hover
   ========================================================== */
.nexus-table .mud-icon-button {
    color: #64748B !important;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.nexus-table .mud-icon-button:hover {
    color: var(--nexus-primary, #01757A) !important;
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 8%, transparent) !important;
}

/* Expansion Fixes */
.container-xl,
.container-lg {
    max-width: 100% !important;
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
}

.page-header {
    margin-bottom: 0.75rem !important;
    /* Reduced for tighter layout */
}

/* ==========================================================
   Scrollable Tab Headers - prevents wrapping
   ========================================================== */
.card-header-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

.card-header-tabs::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.card-header-tabs .nav-link {
    white-space: nowrap !important;
    cursor: pointer;
}

/* Allow tabs to scroll horizontally when content is long (e.g. Vietnamese) */
.card-header-tabs.nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
}

.card-header-tabs.nav-tabs::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

/* Prevent card-header from clipping tab content */
.card-header {
    overflow: visible !important;
}

/* Ensure tab content is not clipped */
.tab-content {
    overflow: visible;
}

/* Responsive page header - prevent title/button overlap */
@media (max-width: 1199.98px) {
    .page-header .row {
        flex-direction: column !important;
    }

    .page-header .col-auto {
        margin-top: 0.75rem;
    }
}

/* ==========================================================
   NEXUS DESIGN SYSTEM - SAP S/4HANA Vibe
   ========================================================== */

/* ==========================================================
   NEXUS DESIGN SYSTEM - Buttons
   ========================================================== */
.nexus-btn-primary {
    background-color: var(--mud-palette-primary) !important;
    color: var(--mud-palette-primary-text) !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    text-transform: none !important;
    padding: 6px 16px !important;
    box-shadow: 0 1px 2px color-mix(in srgb, var(--nexus-primary, #01757A) 12%, transparent) !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.nexus-btn-primary:hover:not(:disabled) {
    background-color: var(--mud-palette-primary-darken) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--nexus-primary, #01757A) 22%, transparent) !important;
}

.nexus-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.nexus-btn-outline {
    border-radius: 8px !important;
    font-weight: 600 !important;
    text-transform: none !important;
    border: 1px solid #CBD5E1 !important;
    color: #475569 !important;
    background-color: #FFFFFF !important;
    transition: all 0.2s ease !important;
}

.nexus-btn-outline:hover:not(:disabled) {
    background-color: #F8FAFC !important;
    border-color: #94A3B8 !important;
    color: #1E293B !important;
}

/* --- Older Button Variants --- */

/* ==========================================================
   NEXUS DESIGN SYSTEM v3 — World-Class Design Tokens
   Benchmarked: SAP Fiori 3.0, Oracle Redwood, Linear, Stripe
   ========================================================== */
:root {
    /* --- Color Tokens --- */
    --nx-bg: #F8FAFC;
    --nx-text: #334155;
    --nx-text-muted: #64748B;
    --nx-primary: var(--nexus-primary, #01757A);
    --nx-primary-hover: color-mix(in srgb, var(--nexus-primary, #01757A) 85%, #000000);
    --nx-accent: var(--nexus-primary, #01757A);
    --nx-radius: 6px;
    --nx-radius-sm: 4px;
    --nx-radius-lg: 8px;

    /* --- Shadow Tiers (3-level) --- */
    --nx-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --nx-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --nx-shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --nx-shadow-xl: 0 20px 50px -12px rgba(0, 0, 0, 0.12);

    /* --- Spacing Scale (4px grid) --- */
    --nx-space-1: 4px;
    --nx-space-2: 8px;
    --nx-space-3: 12px;
    --nx-space-4: 16px;
    --nx-space-5: 20px;
    --nx-space-6: 24px;
    --nx-space-8: 32px;
    --nx-space-10: 40px;
    --nx-space-12: 48px;

    /* --- Motion / Easing --- */
    --nx-ease-default: cubic-bezier(0.4, 0, 0.2, 1);
    --nx-ease-in: cubic-bezier(0.4, 0, 1, 1);
    --nx-ease-out: cubic-bezier(0, 0, 0.2, 1);
    --nx-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --nx-duration-fast: 0.15s;
    --nx-duration-normal: 0.2s;
    --nx-duration-slow: 0.35s;

    /* --- Backward Compat --- */
    --nexus-primary: #01757A;
    --nexus-primary-hover: color-mix(in srgb, var(--nexus-primary, #01757A) 85%, #000000);
    --nexus-accent: #01757A;
    --nexus-accent-glow: 0 0 12px color-mix(in srgb, var(--nexus-primary, #01757A) 35%, transparent);
    --nexus-bg: #F8FAFC;
    --nexus-card-bg: #ffffff;
    --nexus-card-radius: 6px;
    --nexus-card-shadow: var(--nx-shadow-md);
    --nexus-card-shadow-hover: var(--nx-shadow-lg);
    --nexus-transition: var(--nx-duration-normal) var(--nx-ease-default);
    --nexus-font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;

    /* --- Focus Ring (Accessibility WCAG 2.1 AA) --- */
    --nx-focus-ring: 0 0 0 3px color-mix(in srgb, var(--nexus-primary, #01757A) 35%, transparent);
    --nx-focus-ring-error: 0 0 0 3px rgba(239, 68, 68, 0.3);

    /* --- Dashboard Theme Variables --- */
    --bg-card: #FFFFFF;
    --border-color: #E2E8F0;
    --text-heading: #1E293B;
    --text-secondary: #64748B;
    --bg-surface-alt: #F8FAFC;
}

/* --- Dark Mode Token Overrides --- */
.dark-mode {
    --nx-bg: #0F172A;
    --nx-text: #F8FAFC;
    --nx-text-muted: #94A3B8;
    --nx-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --nx-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.15);
    --nx-shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    --nx-shadow-xl: 0 20px 50px -12px rgba(0, 0, 0, 0.5);
    --nx-focus-ring: 0 0 0 3px color-mix(in srgb, var(--nexus-primary, #2BA5AB) 40%, transparent);
    --nexus-card-bg: #1E293B;
    --nexus-bg: #0F172A;

    /* --- Dashboard Theme Variables --- */
    --bg-card: #1E293B;
    --border-color: #334155;
    --text-heading: #F8FAFC;
    --text-secondary: #94A3B8;
    --bg-surface-alt: #0F172A;
}

/* --- Global Focus: strip all outline + box-shadow from every element --- */
*:focus,
*:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

/* Restore focus ring ONLY on native interactive elements (keyboard accessibility).
   Using * caused MudBlazor wrapper divs to show a large box-shadow overlay when child inputs were focused. */
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
[role="menuitem"]:focus-visible,
[role="option"]:focus-visible,
[role="tab"]:focus-visible,
[role="checkbox"]:focus-visible,
[role="switch"]:focus-visible,
a[href]:focus-visible {
    box-shadow: var(--nx-focus-ring) !important;
}

/* BR-UI-FOCUS-SINGLE-01 (16/11/2026) — MỘT ô chỉ MỘT vòng focus, do KHUNG ô vẽ.
   Luật trên vẽ vòng lên mọi input — kể cả thẻ input BÊN TRONG ô MudBlazor, trong khi khung ô
   (fieldset Outlined, gạch chân Text/Filled, hộp ô lưới .erp-datagrid) cũng vẽ dấu focus
   ⇒ 2 vòng chồng nhau ("viền đôi"); ô có icon / nút X / mũi tên thì vòng trong ngắn hơn, lộ rõ.
   Input gốc đứng một mình vẫn giữ vòng ở trên (WCAG 2.4.7). Hàng rào: InputFocusRingGuardTests. */
.mud-input-outlined .mud-input-slot:focus-visible,
.mud-input-underline .mud-input-slot:focus-visible,
.erp-datagrid .mud-input-control-input-container :is(input, textarea):focus-visible,
.nx-cell-ring .mud-input-slot:focus-visible,
.nx-field-shell :is(input, textarea):focus-visible {
    box-shadow: none !important;
    outline: none !important;
}

/* BR-UI-FOCUS-SINGLE-04 — khung tự vẽ quanh MỘT input gốc (ô quét PDA…): gắn class="nx-field-shell".
   Khung giữ viền riêng của màn; khi focus khung đổi màu + vòng, input bên trong không vẽ gì. */
.nx-field-shell:focus-within {
    border-color: var(--nexus-primary, #01757A) !important;
    box-shadow: var(--nx-focus-ring) !important;
}

/* BR-UI-FOCUS-SINGLE-04 — ô kiểu Text trong bảng gọn (MudTable): khi gõ, MỘT khung bao ô thay cho gạch chân.
   Dùng: <MudTable Class="... nx-cell-ring">. Trước đây màn tự viết (lưới cước FWD) + vòng input = 2 vòng. */
.nx-cell-ring td .mud-input-control:focus-within .mud-input {
    outline: 2px solid var(--mud-palette-primary, #01757A) !important;
    outline-offset: -1px !important;
    border-radius: 4px !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--nexus-primary, #01757A) 18%, transparent) !important;
    background-color: var(--mud-palette-surface, #FFFFFF) !important;
}
.nx-cell-ring td .mud-input-control:focus-within .mud-input-underline::before,
.nx-cell-ring td .mud-input-control:focus-within .mud-input-underline::after {
    display: none !important;
}

/* --- Tabular Nums for Data --- */
.erp-datagrid td,
.nexus-stat-value,
.hero-number,
.stat-number,
.qty-column input,
[class*="numeric"],
[class*="amount"],
[class*="price"],
[class*="rate"] {
    font-variant-numeric: tabular-nums !important;
    font-feature-settings: "tnum" 1 !important;
}

/* --- Smooth font rendering (all browsers) --- */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* --- Global Layouts --- */
.master-page {
    background-color: var(--nx-bg);
    color: var(--nx-text);
    /* BR-SYS-46: was `height:100%; min-height:0; overflow:hidden`, which locked this box to the
       viewport and then CLIPPED anything taller. On a page without its own inner scroller — the
       FWD dashboard, measured 1319px of content in a 972px box — the bottom 347px was simply
       unreachable: the wrapper outside is the real scroll container, and clipping here meant it
       never saw there was more to scroll to.
       Growing with the content instead lets that wrapper do its job.
       overflow must be `visible` on BOTH axes, not `overflow-x:hidden` + `overflow-y:visible`:
       when one axis is hidden CSS computes the other to `auto`, which turns this element into a
       scroll container of its own and takes the job away from the wrapper again (measured). */
    height: auto;
    min-height: 100% !important;
    flex: 1 1 auto !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
    padding-bottom: 0 !important;
}

.master-page > .card {
    /* flex-grow: 0 (not 1) — the card sizes to its content instead of always stretching to
       fill .master-page's full forced height. A short result list (e.g. a 7-row master-data
       table) no longer leaves a stretched blank gap below its pagination footer. flex-shrink: 1
       is untouched, so long lists still get clamped to the available height and scroll
       internally instead of pushing the pagination bar off-screen (the original reason this
       chain forces flex + min-height:0 + overflow:hidden down through card-body/.nexus-datatable). */
    flex: 0 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    margin-bottom: 0 !important;
}

/* Thẻ nào CÒN thẻ khác phía sau thì không phải thẻ cuối, nên không được kẹp chiều cao và
   không được cắt nội dung. Nhánh thứ hai `~ form .card` là cần thiết vì màn Đơn bán bọc
   toàn bộ nội dung trong <form>: thanh nút Lưu nằm NGOÀI form, còn các thẻ nội dung nằm
   TRONG, nên nó không có thẻ anh em nào ở cùng cấp. Thiếu nhánh này, thanh nút giữ
   overflow:hidden và sập còn 2px — nút Lưu vẫn vẽ ra nhưng bị thẻ kế tiếp che, bấm không
   ăn. Đo được: cùng markup, PO/Báo giá/Đề nghị mua cao 74–86px, Đơn bán cao 2px. */
.master-page > .card:has(~ .card),
.master-page > .card:has(~ form .card),
/* BR-UI-CARD-SHRINK-01 (Bug_R3 #17, 12/11): thẻ bộ lọc đứng trước lưới bọc MudPaper (Đối chiếu sai lệch…) cũng KHÔNG
   phải thẻ cuối. Thiếu nhánh này thẻ bị kẹp (flex-shrink + overflow:hidden) trên màn thấp ⇒ ô lọc bị bảng phía dưới che. */
.master-page > .card:has(~ .mud-paper) {
    flex: 0 0 auto !important;
    overflow: visible !important;
}

.master-page .card-body,
.master-page .mud-hidden {
    /* See .master-page > .card above — same flex-grow:0 rationale, one level down the chain. */
    flex: 0 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.master-page .card.h-100 > .card-body,
.master-page .card-body.flex-grow-1 {
    flex: 1 1 auto !important;
}

/* BR-UI-CARD-ROW-01 — `d-flex` của Bootstrap nghĩa là HÀNG NGANG. Rule chung ở trên ép mọi
   card-body thành cột (cần cho chuỗi flex giữ lưới cuộn trong khung), nên thanh tiêu đề + nút
   khai `d-flex justify-content-between` bị xếp chồng và `align-items-center` đẩy cả hai vào
   giữa (màn Tạo Đơn Mua và ~26 màn khác, 2026-10-13). Màn nào muốn cột thì tự khai `flex-column`. */
.master-page .card-body.d-flex:not(.flex-column) {
    flex-direction: row !important;
}

.master-page .card-body.border-bottom,
.master-page .card-body.flex-none,
.master-page .filter-toolbar {
    flex: 0 0 auto !important;
}

.master-page .card > .p-0,
.master-page .card > .nexus-datatable {
    /* See .master-page > .card above — same flex-grow:0 rationale, one level down the chain. */
    flex: 0 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

/* List pages that wrap NexusDataGrid directly in a MudPaper instead of .card/.card-body
   (PortList, ChargeTypeList, JobList, and most other master/forwarding list pages) skip the
   .master-page > .card flex chain above entirely — MudPaper isn't a flex container and never
   gets bounded, so .erp-datagrid's own flex:1/overflow:hidden/min-height:0 (which needs a
   height-bounded flex parent to do anything) has no effect. Rows then render at full natural
   height instead of scrolling internally, pushing PagerContent past .master-page's
   overflow:hidden boundary — the pagination bar exists in the DOM but is clipped off-screen.
   Give any MudPaper that directly wraps .erp-datagrid the same containment .card gets. */
.master-page > .mud-paper:has(.erp-datagrid) {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    margin-bottom: 0 !important;
}

.code-link {
    color: var(--nexus-primary, #01757A);
    cursor: pointer;
    text-decoration: none !important;
    border-bottom: none !important;
    transition: color 0.15s ease;
}

.code-link:hover {
    text-decoration: underline !important;
    border-bottom: none !important;
    color: var(--nexus-primary-hover, #006b70) !important;
}

.rounded-sm {
    border-radius: 4px !important;
}

/* Command Ribbon / Toolbar - flat surface, tonal layering (no glassmorphism/blur) */
.glass-header {
    position: sticky !important;
    top: 48px !important;
    z-index: 1000 !important;
    background: var(--mud-palette-surface) !important;
    border-bottom: 1px solid var(--mud-palette-lines-default) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.dark-mode .glass-header {
    background: var(--bg-card, var(--mud-palette-surface)) !important;
    border-bottom: 1px solid var(--border-color, var(--mud-palette-lines-default)) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

.odoo-sheet {
    background: var(--mud-palette-surface);
    padding: 1.5rem;
    border-radius: var(--nx-radius);
    border: 1px solid var(--mud-palette-lines-default);
    box-shadow: var(--nexus-card-shadow);
    max-width: 100%;
    margin: 1rem 0;
}

/* CSS-based Fullscreen mode */
@media (min-width: 768px) {
    .transaction-fullscreen {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 1350 !important;
        overflow-y: auto !important;
        background-color: var(--nx-bg) !important;
        padding: 0 !important;
    }

    .transaction-fullscreen .odoo-sheet {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0.75rem 0.75rem !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }

    .transaction-fullscreen .glass-header {
        border-radius: 0 !important;
        margin: 0 0 16px 0 !important;
        top: 0 !important;
    }
}

/* Smart Buttons Box */
.oe_button_box {
    display: flex;
    gap: 0.5rem;
}

.oe_button_box .btn-outline-secondary {
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    transition: all 0.2s;
}

.oe_button_box .btn-outline-secondary:hover {
    background: var(--mud-palette-background-grey);
    border-color: var(--nx-primary);
    transform: translateY(-1px);
}

/* Status Bar / Workflow Stepper */
.odoo-statusbar {
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--mud-palette-lines-default);
}

.odoo-statusbar .btn {
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    font-weight: 700;
    padding: 6px 20px;
    border-radius: 0 !important;
    border-right: 1px solid var(--mud-palette-lines-default);
}

.odoo-statusbar .btn.btn-light {
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    border-color: var(--mud-palette-lines-default);
}

.odoo-statusbar .btn:last-child {
    border-right: none;
}

.odoo-statusbar .btn-primary {
    background-color: var(--nexus-primary, #01757A);
    background-image: none;
    color: white;
}

/* ==========================================================
   NEXUS DATA GRID — Premium Design System
   Inspired by: Linear, SAP Fiori, Stripe Dashboard
   Supports: Light Mode + Dark Mode via .dark-mode class
   ========================================================== */

/* --- Design Tokens (Light) --- */
.erp-datagrid {
    --grid-bg: #FFFFFF;
    --grid-border: #E2E8F0;
    --grid-radius: 4px;
    --grid-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);

    /* Header */
    --grid-th-bg: #F8FAFC;
    --grid-th-color: #64748B;
    --grid-th-border: #E2E8F0;
    --grid-th-font: 0.75rem;

    /* Body */
    --grid-td-color: #334155;
    --grid-td-border: #F1F5F9;
    --grid-td-font: 0.875rem;

    /* Zebra */
    --grid-row-odd: #FFFFFF;
    --grid-row-even: #F8FAFC;

    /* Hover / Active (Teal tint — DESIGN.md §368) */
    --grid-hover: color-mix(in srgb, var(--nexus-primary, #01757A) 6%, transparent);
    --grid-active: color-mix(in srgb, var(--nexus-primary, #01757A) 12%, transparent);

    /* Filter inputs */
    --grid-input-bg: #FFFFFF;
    --grid-input-border: #E2E8F0;
    --grid-input-focus: var(--nx-primary, #01757A);
    --grid-input-ring: color-mix(in srgb, var(--nexus-primary, #01757A) 12%, transparent);

    /* Pagination */
    --grid-pager-bg: #FAFBFC;
    --grid-pager-color: #64748B;
    --grid-pager-border: #E2E8F0;

    /* Accent */
    --grid-accent: var(--nexus-primary, #01757A);
    --grid-accent-soft: color-mix(in srgb, var(--nexus-primary, #01757A) 8%, transparent);
    --grid-accent-glow: color-mix(in srgb, var(--nexus-primary, #01757A) 12%, transparent);

    /* Scrollbar */
    --grid-scroll-thumb: #CBD5E1;
    --grid-scroll-track: transparent;
}

/* --- Design Tokens (Dark) --- */
.dark-mode .erp-datagrid {
    --grid-bg: #1E293B;
    --grid-border: #334155;
    --grid-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.15);

    --grid-th-bg: #0F172A;
    --grid-th-color: #94A3B8;
    --grid-th-border: #334155;

    --grid-td-color: #E2E8F0;
    --grid-td-border: #334155;

    --grid-row-odd: #1E293B;
    --grid-row-even: #172133;

    --grid-hover: color-mix(in srgb, var(--nexus-primary, #2BA5AB) 10%, transparent);
    --grid-active: color-mix(in srgb, var(--nexus-primary, #2BA5AB) 18%, transparent);

    --grid-input-bg: #0F172A;
    --grid-input-border: #475569;
    --grid-input-ring: color-mix(in srgb, var(--nexus-primary, #2BA5AB) 25%, transparent);

    --grid-pager-bg: #0F172A;
    --grid-pager-color: #94A3B8;
    --grid-pager-border: #334155;

    --grid-accent: var(--nexus-primary, #2BA5AB);
    --grid-accent-soft: color-mix(in srgb, var(--nexus-primary, #2BA5AB) 10%, transparent);
    --grid-accent-glow: color-mix(in srgb, var(--nexus-primary, #2BA5AB) 15%, transparent);

    --grid-scroll-thumb: #475569;
    --grid-scroll-track: transparent;
}

/* --- Container --- */
.erp-datagrid {
    background: var(--grid-bg) !important;
    border-radius: var(--grid-radius) !important;
    border: 1px solid var(--grid-border) !important;
    box-shadow: var(--grid-shadow) !important;
    overflow: hidden;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
}

.erp-datagrid .mud-table-container {
    border-radius: var(--grid-radius);
    overflow-x: auto !important;
    overflow-y: auto !important;
    width: 100% !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: 100% !important;
}

.erp-datagrid .mud-table-pagination,
.erp-datagrid .mud-table-pager {
    flex: 0 0 auto !important;
}

.erp-datagrid .mud-table-container > table,
.erp-datagrid .mud-table-root {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    width: 100% !important;
    min-width: 100% !important;
    table-layout: auto !important;
}

/* --- Header --- */
.erp-datagrid thead {
    position: sticky;
    top: 0;
    z-index: 3;
}

/* Accent top-line on header */
.erp-datagrid thead::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--grid-accent), var(--grid-accent) 40%, transparent 100%);
    z-index: 1;
    border-radius: var(--grid-radius) var(--grid-radius) 0 0;
}

.erp-datagrid th {
    background-color: var(--grid-th-bg) !important;
    color: var(--grid-th-color) !important;
    font-weight: 600 !important;
    font-size: var(--grid-th-font) !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--grid-th-border) !important;
    border-top: none !important;
    padding: 14px 16px !important;
    padding-inline-start: 16px !important;
    padding-inline-end: 16px !important;
    white-space: nowrap;
    position: sticky !important;
    top: 0;
    z-index: 3;
}

/* Align header content to match the text-alignment of the column */
.erp-datagrid th.text-end,
.erp-datagrid th.mud-text-align-right,
.erp-datagrid th[style*="text-align: right"],
.erp-datagrid th[style*="text-align:right"] {
    text-align: right !important;
}

.erp-datagrid th.text-end .column-header,
.erp-datagrid th.mud-text-align-right .column-header,
.erp-datagrid th[style*="text-align: right"] .column-header,
.erp-datagrid th[style*="text-align:right"] .column-header,
.erp-datagrid th.text-end .mud-data-grid-header-cell-container,
.erp-datagrid th[style*="text-align: right"] .mud-data-grid-header-cell-container,
.erp-datagrid th[style*="text-align:right"] .mud-data-grid-header-cell-container {
    display: flex !important;
    justify-content: flex-end !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

.erp-datagrid th.text-end .sortable-column-header,
.erp-datagrid th.mud-text-align-right .sortable-column-header,
.erp-datagrid th[style*="text-align: right"] .sortable-column-header,
.erp-datagrid th[style*="text-align:right"] .sortable-column-header,
.erp-datagrid th.text-end .mud-header-cell-wrapper,
.erp-datagrid th.text-end .mud-button-root,
.erp-datagrid th.text-end .mud-data-grid-header-cell-sort-label,
.erp-datagrid th.text-end span,
.erp-datagrid th[style*="text-align: right"] .mud-header-cell-wrapper,
.erp-datagrid th[style*="text-align: right"] .mud-button-root,
.erp-datagrid th[style*="text-align: right"] .mud-data-grid-header-cell-sort-label,
.erp-datagrid th[style*="text-align: right"] span,
.erp-datagrid th[style*="text-align:right"] .mud-header-cell-wrapper,
.erp-datagrid th[style*="text-align:right"] .mud-button-root,
.erp-datagrid th[style*="text-align:right"] .mud-data-grid-header-cell-sort-label,
.erp-datagrid th[style*="text-align:right"] span {
    width: auto !important;
    margin-left: auto !important;
    margin-right: 0 !important;
    padding-right: 0 !important;
    text-align: right !important;
    justify-content: flex-end !important;
}

.erp-datagrid th.text-end .column-options,
.erp-datagrid th.mud-text-align-right .column-options,
.erp-datagrid th[style*="text-align: right"] .column-options,
.erp-datagrid th[style*="text-align:right"] .column-options {
    order: -1;
    width: auto !important;
    margin-left: 0 !important;
    margin-right: 4px !important;
}

.erp-datagrid th.text-end .column-options:empty,
.erp-datagrid th.mud-text-align-right .column-options:empty,
.erp-datagrid th[style*="text-align: right"] .column-options:empty,
.erp-datagrid th[style*="text-align:right"] .column-options:empty {
    display: none !important;
}

.erp-datagrid th[style*="text-align: center"] .mud-table-cell-header-wrapper,
.erp-datagrid th[style*="text-align:center"] .mud-table-cell-header-wrapper,
.erp-datagrid th.mud-text-align-center .mud-table-cell-header-wrapper,
.erp-datagrid th[style*="text-align: center"] .mud-button-root,
.erp-datagrid th[style*="text-align:center"] .mud-button-root,
.erp-datagrid th.mud-text-align-center .mud-button-root,
.erp-datagrid th.text-center .mud-table-cell-header-wrapper,
.erp-datagrid th.text-center .mud-button-root,
.erp-datagrid th.text-center .mud-data-grid-header-cell-container,
.erp-datagrid th.text-center .mud-data-grid-header-cell-sort-label,
.erp-datagrid th.text-center .header-cell-wrapper,
.erp-datagrid th[style*="text-align: center"] .mud-data-grid-header-cell-container,
.erp-datagrid th[style*="text-align: center"] .mud-data-grid-header-cell-sort-label,
.erp-datagrid th[style*="text-align: center"] .header-cell-wrapper,
.erp-datagrid th[style*="text-align:center"] .mud-data-grid-header-cell-container,
.erp-datagrid th[style*="text-align:center"] .mud-data-grid-header-cell-sort-label,
.erp-datagrid th[style*="text-align:center"] .header-cell-wrapper {
    justify-content: center !important;
    text-align: center !important;
    width: 100% !important;
}

/* First header cell — subtle accent tint */
.erp-datagrid th:first-child {
    padding-left: 20px !important;
}

/* Sort button inherits header color */
.erp-datagrid th .mud-button-root {
    color: var(--grid-th-color) !important;
    font-weight: 600 !important;
    font-size: var(--grid-th-font) !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.erp-datagrid th .mud-button-root:hover {
    color: var(--grid-accent) !important;
}

/* --- Body Rows --- */
.erp-datagrid td {
    border-bottom: 1px solid var(--grid-td-border) !important;
    padding: 11px 16px !important;
    padding-inline-start: 16px !important;
    padding-inline-end: 16px !important;
    font-size: var(--grid-td-font) !important;
    color: var(--grid-td-color) !important;
    vertical-align: middle;
    transition: background-color 0.12s ease;
}

/* BR-UI-GRID-STICKY-05 — ô ghim là ô duy nhất trong dòng tự tô nền (để che nội dung cuộn ngang bên dưới),
   nên transition ở trên chỉ làm riêng các ô này đổi màu trễ khi chuyển sáng <-> tối: cả dòng đổi xong mà ô
   Job No / Import-Export còn màu cũ một nhịp (Danh sách Job, user báo 2026-10-14). Ô ghim đổi màu ngay. */
.erp-datagrid td.sticky-left,
.erp-datagrid td.nexus-sticky-col2,
.erp-datagrid td.mud-table-cell-checkbox {
    transition: none !important;
}

/* Remove bottom border on last row to prevent double line with pagination footer */
.erp-datagrid .mud-table-body .mud-table-row:last-child td {
    border-bottom: none !important;
}

/* Zebra Striping */
.erp-datagrid .mud-table-body .mud-table-row:nth-child(odd) {
    background-color: var(--grid-row-odd) !important;
}

.erp-datagrid .mud-table-body .mud-table-row:nth-child(even) {
    background-color: var(--grid-row-even) !important;
}

/* Hover — overrides zebra */
.erp-datagrid .mud-table-body .mud-table-row:hover {
    background-color: var(--grid-hover) !important;
}

.erp-datagrid .mud-table-body .mud-table-row:hover td {
    color: var(--grid-td-color) !important;
}

/* Last row: no bottom border (cleaner card edge) */
.erp-datagrid .mud-table-body .mud-table-row:last-child td {
    border-bottom: none !important;
}

/* --- Sticky Column 2 ---
   MudBlazor's own Column.StickyLeft hardcodes left:0, which only works for ONE pinned column — see
   NexusDataGrid.razor's ApplyStickyColumns for why a second pinned column can't reuse it. This class
   is applied by that same code to whichever column is currently second-from-left; its `left` offset
   is kept in sync with column 1's actual rendered width by a ResizeObserver in nexus-datagrid.js
   (--nexus-sticky2-left), not hardcoded, since that width varies per grid/content and changes live
   on column resize. Row-parity backgrounds are redeclared explicitly (not "inherit") so the pinned
   cell shows the correct opaque color instead of letting horizontally-scrolled content show through. */
/* BR-UI-GRID-STICKY-04 — chỉ ghim cột 2 khi nexus-datagrid.js ĐÃ đo được bề rộng cột 1 và gắn
   class .nexus-sticky2-ready. Trước đây rule này áp vô điều kiện với fallback left:0px, nên khi JS
   chưa chạy (hoặc chạy lúc DOM chưa có ô) cột 2 ghim ngay tại 0 — trùng chỗ cột 1, z-index lại cao
   hơn nên đè lên và che mất tiêu đề cột 1 ("DOCUMENT NUMBER" bị cắt còn "DOC" khi cuộn ngang,
   user báo 2026-08-14). Không có class ⇒ cột 2 hiển thị bình thường, không ghim. */
.erp-datagrid.nexus-sticky2-ready .nexus-sticky-col2 {
    position: sticky !important;
    left: var(--nexus-sticky2-left, 0px);
    z-index: 1;
}
.erp-datagrid.nexus-sticky2-ready thead .nexus-sticky-col2 {
    z-index: 3;
}
.erp-datagrid .mud-table-body .mud-table-row:nth-child(odd) .nexus-sticky-col2 {
    background-color: var(--grid-row-odd) !important;
}
.erp-datagrid .mud-table-body .mud-table-row:nth-child(even) .nexus-sticky-col2 {
    background-color: var(--grid-row-even) !important;
}
.erp-datagrid .mud-table-body .mud-table-row:hover .nexus-sticky-col2 {
    background-color: var(--grid-hover) !important;
}

/* --- Sticky Column 1 (+ the MultiSelection checkbox that rides along) ---
   Column 1 is pinned through MudBlazor's own Column.StickyLeft, whose CSS paints a single flat
   surface colour. That colour does NOT follow row striping or hover, so every pinned cell stayed
   white while the row behind it went grey — a visible white/grey seam down the pinned edge (user
   report 2026-08-14, screenshot on Stock Transactions). The col-2 rules above already solved this;
   column 1 was simply never given the same treatment.
   Backgrounds are redeclared explicitly rather than `inherit` for the same reason as col 2: the cell
   must be opaque, otherwise horizontally-scrolled content shows through underneath it. */
.erp-datagrid .mud-table-body .mud-table-row:nth-child(odd) .mud-table-cell.sticky-left,
.erp-datagrid .mud-table-body .mud-table-row:nth-child(odd) td.mud-table-cell-checkbox {
    background-color: var(--grid-row-odd) !important;
}
.erp-datagrid .mud-table-body .mud-table-row:nth-child(even) .mud-table-cell.sticky-left,
.erp-datagrid .mud-table-body .mud-table-row:nth-child(even) td.mud-table-cell-checkbox {
    background-color: var(--grid-row-even) !important;
}
.erp-datagrid .mud-table-body .mud-table-row:hover .mud-table-cell.sticky-left,
.erp-datagrid .mud-table-body .mud-table-row:hover td.mud-table-cell-checkbox {
    background-color: var(--grid-hover) !important;
}

/* --- Checkbox Column --- */
.erp-datagrid th.mud-table-cell-checkbox,
.erp-datagrid td.mud-table-cell-checkbox {
    padding-left: 20px !important;
    padding-right: 8px !important;
    width: 48px !important;
    text-align: center !important;
}

/* --- Column Filter Inputs --- */
.erp-datagrid th .mud-input-control {
    margin-top: 6px;
}

.erp-datagrid .mud-input-control {
    width: 100% !important;
    margin: 0 !important;
}

.erp-datagrid .mud-input-control-input-container {
    background-color: var(--grid-input-bg) !important;
    border: 1px solid var(--grid-input-border) !important;
    border-radius: 4px !important;
    /* Locked to 4px rounded.sm */
    padding: 0 6px !important;
    height: 28px !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
}

/* BR-SAL-PL-PERF-01: Lightweight static cell trigger for Active-Row Edit in virtualized grids.
   Matches .mud-input-control-input-container height (28px) and 4px radius so switching a row to
   edit mode causes zero layout shift while keeping 0 Popover / 0 JSInterop on inactive rows. */
.erp-datagrid .erp-grid-cell-trigger {
    appearance: none;
    background-color: var(--grid-input-bg);
    border: 1px solid var(--grid-input-border);
    border-radius: 4px;
    padding: 0 8px;
    height: 28px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    color: var(--mud-palette-text-primary);
    font-size: inherit;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
    text-align: left;
    overflow: hidden;
    white-space: nowrap;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.erp-datagrid .erp-grid-cell-trigger:hover,
.erp-datagrid .erp-grid-cell-trigger:focus-visible {
    border-color: #01757A;
    outline: none;
}

.erp-datagrid .erp-grid-cell-trigger.erp-grid-cell-end {
    justify-content: flex-end;
    text-align: right;
}

.erp-datagrid .erp-grid-cell-trigger .erp-grid-cell-caret {
    color: var(--mud-palette-text-secondary);
    font-size: 10px;
    flex: 0 0 auto;
}

.erp-datagrid .mud-input {
    margin-top: 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    align-items: center !important;
    width: 100% !important;
}

/* Remove default MudBlazor text variant underlines AND Outlined fieldset border inside grid cells
   (BR-SAL-PL-UI-02: .erp-datagrid .mud-input-control-input-container already renders the 1px 4px cell input box;
   keeping .mud-input-outlined-border causes a bizarre double-border box-in-box effect!) */
.erp-datagrid .mud-input::before,
.erp-datagrid .mud-input::after,
.erp-datagrid .mud-table-body .mud-input-outlined-border,
.erp-datagrid tbody .mud-input-outlined-border,
.erp-datagrid thead .mud-input-outlined-border /* BR-UI-FOCUS-SINGLE-03: ô lọc cột cũng nằm trong hộp có viền */ {
    display: none !important;
}

.erp-datagrid .mud-table-body .mud-input-outlined,
.erp-datagrid tbody .mud-input-outlined {
    background-color: transparent !important;
}

.erp-datagrid input.mud-input-slot {
    margin-top: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    height: 100% !important;
    align-self: center !important;
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    text-overflow: clip !important;
}

.erp-datagrid .mud-input-adornment,
.erp-datagrid .mud-input-adornment-end,
.erp-datagrid .mud-numeric-spin-buttons {
    margin-top: 0 !important;
    align-self: center !important;
}

.erp-datagrid .mud-input-adornment .mud-icon-button,
.erp-datagrid .mud-icon-button.mud-input-clear-button,
.erp-datagrid .mud-input-adornment-end .mud-icon-button {
    padding: 2px !important;
    margin: 0 !important;
    width: 24px !important;
    height: 24px !important;
}



.erp-datagrid .mud-input-control-input-container:hover {
    border-color: var(--grid-input-focus) !important;
}

.erp-datagrid .mud-input-control-input-container:focus-within {
    border-color: var(--grid-input-focus) !important;
    box-shadow: 0 0 0 3px var(--grid-input-ring) !important;
}

/* --- Pagination Footer --- */
.erp-datagrid .mud-table-pagination {
    border-top: 1px solid var(--grid-pager-border) !important;
    background: var(--grid-bg) !important;
    color: var(--grid-pager-color) !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 0.8rem;
    position: relative;
}

.erp-datagrid .mud-table-pagination::after {
    display: none !important;
}

.erp-datagrid .mud-table-pagination .mud-button-root {
    color: var(--grid-pager-color) !important;
    border-radius: 6px !important;
    transition: all 0.15s ease;
}

.erp-datagrid .mud-table-pagination .mud-button-root.mud-button-filled,
.mud-pagination .mud-button-root.mud-button-filled {
    color: var(--mud-palette-primary-contrast-text) !important;
}

.erp-datagrid .mud-table-pagination .mud-button-root:hover {
    background-color: var(--grid-accent-soft) !important;
    color: var(--grid-accent) !important;
}

/* Page size selector */
.erp-datagrid .mud-table-pagination .mud-select {
    font-size: 0.8rem;
}

/* Fix: Remove double border on MudSelect in pagination area.
   The .mud-input-control-input-container rule (line ~1182) adds an extra border
   meant for column filter inputs, but it also hits the page-size MudSelect
   which already has its own Outlined fieldset border → 2 overlapping rectangles. */
.erp-datagrid .mud-table-pagination .mud-input-control-input-container,
.erp-datagrid .card-footer .mud-input-control-input-container {
    border: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    height: auto !important;
}

/* Keep the Outlined fieldset border clean in pagination */
.erp-datagrid .mud-table-pagination .mud-input-outlined-border,
.erp-datagrid .card-footer .mud-input-outlined-border {
    border-color: var(--grid-pager-border, #E2E8F0) !important;
    border-width: 1px !important;
    border-radius: 4px !important;
}

/* Fix: Reset nested card-footer inside mud-table-pagination to prevent double borders/backgrounds and wrapping layout bugs */
.erp-datagrid .mud-table-pagination .card-footer {
    border: none !important;
    background-color: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
    width: 100% !important;
}


/* Collapse empty DataGrid toolbar and position the column chooser gear button inline with the header */
.erp-datagrid .mud-table-toolbar,
.erp-datagrid .mud-grid-toolbar {
    height: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    position: relative;
    border: none !important;
    background: transparent !important;
    overflow: visible !important;
}

.erp-datagrid .mud-table-toolbar .mud-menu,
.erp-datagrid .mud-grid-toolbar .mud-menu {
    position: absolute !important;
    right: 8px !important;
    top: 8px !important;
    z-index: 100 !important;
}

/* Adjust gear icon padding and color to fit header theme */
.erp-datagrid .mud-table-toolbar .mud-menu .mud-icon-button,
.erp-datagrid .mud-grid-toolbar .mud-menu .mud-icon-button {
    padding: 6px !important;
    color: var(--text-secondary, #64748B) !important;
}
.erp-datagrid .mud-table-toolbar .mud-menu .mud-icon-button:hover,
.erp-datagrid .mud-grid-toolbar .mud-menu .mud-icon-button:hover {
    background-color: var(--mud-palette-action-default-hover) !important;
}

/* Push the last column header text slightly to the left to avoid overlapping the gear icon (only when gear menu exists) */
.erp-datagrid:has(.mud-table-toolbar .mud-menu) .mud-table-head .mud-table-row .mud-table-cell:last-child,
.erp-datagrid:has(.mud-grid-toolbar .mud-menu) .mud-table-head .mud-table-row .mud-table-cell:last-child {
    padding-right: 42px !important;
    padding-inline-end: 42px !important;
}

/* BR-FWD-DOC-55: MudDataGrid inserts its native loading indicator as an extra in-flow
   <tr><th class="mud-table-loading"> inside <thead> while Loading="true", then removes it
   when the request resolves — every data row is pushed down by that row's height and snaps
   back up a moment later (measured 33px on JobList). Same class of bug already fixed for
   NexusDataTable (system.md #39): overlay the bar instead of letting it occupy flow space. */
/* Scoped to `.mud-table`, not `.erp-datagrid`: MudBlazor puts that class on the wrapper of
   BOTH MudTable and MudDataGrid, so this covers the 139 NexusDataGrid screens plus the ~36
   that still instantiate MudDataGrid/MudTable directly. NexusDataTable is unaffected — it
   renders its own `.nexus-grid-loading-bar` (system.md #39), a different element. */
.mud-table .mud-table-container {
    position: relative;
}
/* `th.` (not just the class) is required: `.erp-datagrid th:first-child` above also sets
   padding with !important, and the loading cell is the only child of its row — a bare
   class selector loses the specificity tie and the bar ends up indented 20px. */
.mud-table th.mud-table-loading {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    /* The <th> ships with 14px vertical padding and an opaque surface background, so
       overlaying it as-is put a 33px solid block over the header row and hid the column
       titles. Strip both: what is left is the 4px progress bar itself, sitting flush on
       the header's top edge. */
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    height: auto !important;
    line-height: 0 !important;
    z-index: 20 !important;
}


/* --- Scrollbar (thin, Mac-style) --- */
.erp-datagrid .mud-table-container::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}

.erp-datagrid .mud-table-container::-webkit-scrollbar-track {
    background: var(--grid-scroll-track);
}

.erp-datagrid .mud-table-container::-webkit-scrollbar-thumb {
    background: var(--grid-scroll-thumb);
    border-radius: 3px;
}

.erp-datagrid .mud-table-container::-webkit-scrollbar-thumb:hover {
    background: var(--grid-th-color);
}

/* --- Action Icons in Grid --- */
.erp-datagrid .mud-icon-button {
    opacity: 0.6;
    transition: opacity 0.15s ease, background-color 0.15s ease;
}

.erp-datagrid .mud-table-row:hover .mud-icon-button {
    opacity: 1;
}

.erp-datagrid .mud-icon-button:hover {
    opacity: 1;
    background-color: var(--grid-row-even) !important;
    border-radius: 8px;
}

/* --- Empty State --- */
.erp-datagrid .mud-table-empty-row td {
    text-align: center !important;
    padding: 3rem 1rem !important;
    color: var(--grid-th-color) !important;
    font-style: italic;
    border-bottom: none !important;
}

/* --- Standardized Badges (Soft Pill) --- */
.nx-badge {
    padding: 4px 12px;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.72rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.nx-badge-receipt {
    background: #DCFCE7;
    color: #166534;
}

.nx-badge-issue {
    background: #FEE2E2;
    color: #991B1B;
}

.nx-badge-transfer {
    background: #DBEAFE;
    color: #1E40AF;
}

.nx-badge-default {
    background: #F1F5F9;
    color: #475569;
}

/* Status Soft Badges */
.nexus-soft-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.nexus-soft-badge-success {
    background: #DCFCE7 !important;
    color: #15803D !important;
}

.nexus-soft-badge-warning {
    background: #FEF9C3 !important;
    color: #A16207 !important;
}

.nexus-soft-badge-danger {
    background: #FEE2E2 !important;
    color: #B91C1C !important;
}

/* Màu chủ đạo Teal — dùng cho SOStatus Giao một phần và Tiến độ "Đang soạn / Đã soạn · chờ giao" (BR-DSP-18e).
   Trước đây lớp này chưa định nghĩa nên các nhãn đó hiện chữ trơn. */
.nexus-soft-badge-primary,
.nexus-soft-badge.primary {
    background: var(--nexus-primary-tint, #E0F2F1) !important;
    color: var(--nexus-primary-ink, #014D51) !important;
}

.nexus-soft-badge-info {
    background: #DBEAFE !important;
    color: #1D4ED8 !important;
}

.nexus-soft-badge-dark {
    background: #F1F5F9 !important;
    color: #334155 !important;
}

/* Numeric Columns */
.qty-column input {
    text-align: right !important;
    font-weight: 600 !important;
    font-variant-numeric: tabular-nums;
}

/* Hover Icons */
.hover-action-icon {
    opacity: 0.4;
    transition: all 0.2s;
}

.hover-action-icon:hover {
    opacity: 1;
    background-color: #F1F5F9;
}

.hover-action-icon.danger:hover {
    color: #DC2626 !important;
    background-color: #FEE2E2 !important;
}

/* --- Dashboard Cards --- */
.hero-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #E2E8F0;
}

.hero-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1) !important;
}

.hero-label {
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    color: var(--mud-palette-text-secondary);
}

.hero-number {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary);
    margin-top: 2px;
}

.hero-icon {
    padding: 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-value {
    border-left: 4px solid var(--nexus-primary, #01757A) !important;
}

.hero-icon-value {
    background: color-mix(in srgb, var(--nexus-primary, #01757A) 8%, transparent);
    color: var(--nexus-primary, #01757A);
}

.hero-danger {
    border-left: 5px solid #ef4444 !important;
    background: linear-gradient(135deg, #fff 0%, #fef2f2 100%);
}

.hero-icon-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.hero-warning {
    border-left: 5px solid #f59e0b !important;
    background: linear-gradient(135deg, #fff 0%, #fffbeb 100%);
}

.hero-icon-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.hero-safe {
    border-left: 5px solid #22c55e !important;
}

.hero-icon-safe {
    background: rgba(34, 197, 94, 0.08);
    color: #22c55e;
}

.stat-card {
    border-radius: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #E2E8F0;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

.stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--mud-palette-text-secondary);
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.stat-number {
    font-size: 1.4rem;
    font-weight: 800;
}

/* Dashboard Pill Badges */
.pill-badge {
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid;
}

.pill-success {
    background: rgba(34, 197, 94, 0.08);
    color: #16a34a;
    border-color: rgba(34, 197, 94, 0.2);
}

.pill-danger {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.2);
}

.pill-warning {
    background: rgba(245, 158, 11, 0.08);
    color: #d97706;
    border-color: rgba(245, 158, 11, 0.2);
}

.pill-info {
    background: color-mix(in srgb, var(--nexus-primary, #01757A) 8%, transparent);
    color: #0284c7;
    border-color: color-mix(in srgb, var(--nexus-primary, #01757A) 20%, transparent);
}

.pill-secondary {
    background: rgba(100, 116, 139, 0.08);
    color: #475569;
    border-color: rgba(100, 116, 139, 0.2);
}

.pill-posted {
    background: rgba(34, 197, 94, 0.08);
    color: #16a34a;
    border-color: rgba(34, 197, 94, 0.2);
}

.pill-draft {
    background: rgba(245, 158, 11, 0.08);
    color: #d97706;
    border-color: rgba(245, 158, 11, 0.2);
}

/* --- AI Insight Alert --- */
.insight-alert {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 10px;
    color: #92400e;
    font-size: 0.85rem;
}

/* Skeleton Shimmer */
.skeleton-line {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* KPI Blink */
@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.kpi-blink {
    animation: blink 2s ease-in-out infinite;
}

/* â”€â”€â”€ Enhanced Typography â”€â”€â”€ */
body {
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================
   Executive Luxury Page Header Components
   ========================================================== */
.nexus-page-header {
    display: flex;
    align-items: center;
    /* Vertically center breadcrumbs and buttons */
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.125rem 0 0.5rem 0;
    /* Halved top padding */
    margin-bottom: 0;
}

.nexus-page-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    /* Tight gap between tiny breadcrumbs and large title */
}

/* 12px Light Gray Breadcrumbs */
.nexus-premium-breadcrumbs .mud-breadcrumb-item {
    font-size: 12px !important;
    font-weight: 500;
}

.nexus-premium-breadcrumbs .mud-breadcrumb-item a {
    color: #64748B !important;
    text-decoration: none;
    transition: color 0.2s ease;
}

.nexus-premium-breadcrumbs .mud-breadcrumb-item a:hover {
    color: var(--nexus-primary) !important;
}

.nexus-premium-breadcrumbs .mud-breadcrumb-separator {
    color: #CBD5E1 !important;
    /* Extremely subtle separator */
    font-size: 14px;
}

/* 24px Semi-Bold Teal Page Title */
.nexus-page-title {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #111827 !important;
    margin: 0;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.nexus-page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    /* BR-UI-PAGEHEADER-RESPONSIVE-01 — phải xuống hàng được.
       Trước đây flex-shrink:0 mà không cho wrap: đo trên /inventory/dashboard khung 900px,
       cụm nút rộng 964px trong khung 778px -> đẩy cả trang cuộn ngang. */
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 0;
}

.nexus-btn-action {
    text-transform: none !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    border-radius: 6px !important;
    transition: all var(--nexus-transition) !important;
}

.nexus-btn-action:hover {
    transform: translateY(-1px);
}

/* Reset margins for MudBlazor inputs inside the header so they don't push vertical alignment */
.nexus-page-header .mud-input-control,
.nexus-page-header .mud-switch {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* Mốc 1199.98px cho khớp với chế độ thẻ của lưới và luật thu ngăn menu.
   BR-UI-PAGEHEADER-RESPONSIVE-02 (Henry 17/11, ảnh Báo cáo bán hàng: "xuất excel đưa lên"): giữ MỘT hàng —
   breadcrumb bên trái, cụm nút bên phải; chỉ xuống hàng khi thật sự thiếu chỗ (flex-wrap), cụm nút vẫn dính phải
   nhờ margin-left:auto. Bản cũ (RESPONSIVE-01) ép flex-direction:column ⇒ ở MỌI màn < 1200px nút luôn rơi xuống
   hàng riêng, để trống góc phải. Chống tràn ngang giữ nguyên: wrap + min-width:0. */
@media (max-width: 1199.98px) {
    .nexus-page-header {
        flex-direction: row;
        flex-wrap: wrap;
        /* !important vì các màn gắn utility .align-items-* của Bootstrap ngay trên thẻ (utility có !important). */
        align-items: center !important;
    }

    .nexus-page-header > .mud-breadcrumbs {
        flex: 1 1 auto;
        min-width: 0;
    }

    .nexus-page-header-actions {
        flex: 0 1 auto;
        margin-left: auto;
        justify-content: flex-end;
    }

    /* Cụm nút không được ép cả trang cuộn ngang. */
    .nexus-page-header-actions > * {
        min-width: 0;
    }
}

/* ==========================================================
   BR-UI-ROWGUTTER-01 — hết cuộn ngang do lề âm của Bootstrap row
   ----------------------------------------------------------
   .container-fluid trong hệ thống đang bị đè padding về 0, trong khi .row của
   Bootstrap mang margin âm (-8px mỗi bên) và TRÔNG CHỜ cha có padding bù lại.
   Không bù thì mỗi hàng thò ra 16px -> đo trên /inventory/dashboard khung 900px:
   row rộng 794px trong khung 778px, đủ để đẻ ra thanh cuộn ngang ở MỌI màn dùng
   khuôn container-fluid > row.
   KHÔNG trả padding lại cho .container-fluid: dòng 3809 cố ý đặt padding 0 !important để
   tránh padding hai lớp. Nên khử LỀ ÂM của .row thay vì cãi lại quyết định đó.
   Cũng không dùng overflow:hidden — cái đó cắt mất nội dung chứ không sửa được gì.
   ========================================================== */
.main-wrapper .container-fluid > .row,
.mud-main-content .container-fluid > .row {
    margin-left: 0;
    margin-right: 0;
}

/* ==========================================================
   NexusStatCards Component - QCS-Inspired Gradient
   ========================================================== */
.nexus-stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.nexus-stat-card {
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid #E2E8F0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
}

/* Subtle sheen overlay */
.nexus-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background: none;
    pointer-events: none;
}

/* Ledger Desk Stat Cards (BR-HRM-UI-07, DESIGN.md §338-340) */
.nexus-stat-card {
    background: var(--mud-palette-surface, #FFFFFF) !important;
    border-radius: 4px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    border: 1px solid var(--mud-palette-lines-default, #E2E8F0);
    border-left: 3px solid var(--nx-primary, #01757A);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.nexus-stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08) !important;
}

/* Compact Variation */
.nexus-stat-card-compact {
    padding: 0.45rem 0.75rem !important;
}
.nexus-stat-card-compact .nexus-stat-icon {
    width: 32px;
    height: 32px;
}
.nexus-stat-card-compact .nexus-stat-icon .mud-icon-root {
    font-size: 1.05rem;
}
.nexus-stat-card-compact .nexus-stat-value {
    font-size: 1.05rem;
    line-height: 1.15;
}
.nexus-stat-card-compact .nexus-stat-label {
    font-size: 12px !important;
    line-height: 1.25;
    color: #475569 !important;
    font-weight: 600;
}
/* BR-UI-KPI-COMPACT-01 (2026-10-15): dải gọn xếp được 5–6 thẻ một hàng ở màn ~1366px (Danh sách đơn bán 6 thẻ từng
   rớt 2 hàng, đẩy lưới xuống). Thẻ hẹp (phần nội dung < 150px) tự ẩn biểu tượng + thu chữ số — thà thu nhỏ còn hơn số vỡ dòng. */
.nexus-stat-row-compact {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}
.nexus-stat-card-compact {
    container-type: inline-size;
}
@container (max-width: 150px) {
    .nexus-stat-card-compact .nexus-stat-icon {
        display: none;
    }
    .nexus-stat-card-compact .nexus-stat-value {
        font-size: 1.05rem;
        white-space: nowrap;
    }
    .nexus-stat-card-compact .nexus-stat-label {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

.nexus-stat-card-inner {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.nexus-stat-chart-inline {
    opacity: 0.8;
    /* Nudge it down minimally to align with text baseline perfectly */
    transform: translateY(4px);
}

.nexus-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--nexus-primary, #01757A);
    background: color-mix(in srgb, var(--nexus-primary, #01757A) 10%, transparent);
    box-shadow: none;
    flex-shrink: 0;
}

.nexus-stat-icon .mud-icon-root {
    color: inherit !important;
}

/* Tinted Icon Box Variants (Light & Dark WCAG AA — BR-HRM-UI-07) */
.nexus-stat-icon.icon-teal,
.nexus-stat-icon.icon-purple {
    background: color-mix(in srgb, var(--nexus-primary, #01757A) 10%, transparent);
    color: var(--nexus-primary, #01757A);
}

.nexus-stat-icon.icon-blue {
    background: rgba(2, 132, 199, 0.10);
    color: #0369A1;
}

.nexus-stat-icon.icon-green {
    background: rgba(16, 185, 129, 0.10);
    color: #047857;
}

.nexus-stat-icon.icon-amber {
    background: rgba(245, 158, 11, 0.12);
    color: #B45309;
}

.nexus-stat-icon.icon-red {
    background: rgba(239, 68, 68, 0.10);
    color: #B91C1C;
}

.dark-mode .nexus-stat-icon.icon-teal,
.dark-mode .nexus-stat-icon.icon-purple {
    background: color-mix(in srgb, var(--nexus-primary, #2BA5AB) 16%, transparent);
    color: var(--nexus-primary, #2BA5AB);
}

.dark-mode .nexus-stat-icon.icon-blue {
    background: rgba(56, 189, 248, 0.16);
    color: #38BDF8;
}

.dark-mode .nexus-stat-icon.icon-green {
    background: rgba(16, 185, 129, 0.16);
    color: #34D399;
}

.dark-mode .nexus-stat-icon.icon-amber {
    background: rgba(245, 158, 11, 0.16);
    color: #FBBF24;
}

.dark-mode .nexus-stat-icon.icon-red {
    background: rgba(239, 68, 68, 0.16);
    color: #F87171;
}

/* Legacy gradient icon variants (retain white icon text) */
.nexus-stat-primary,
.nexus-stat-success,
.nexus-stat-warning,
.nexus-stat-error,
.nexus-stat-danger {
    color: #FFFFFF;
}

.nexus-stat-primary .mud-icon-root,
.nexus-stat-success .mud-icon-root,
.nexus-stat-warning .mud-icon-root,
.nexus-stat-error .mud-icon-root,
.nexus-stat-danger .mud-icon-root {
    color: #FFFFFF !important;
}

.nexus-stat-primary {
    background: linear-gradient(135deg, var(--nexus-primary, #01757A), var(--nexus-primary-hover, #006b70));
    box-shadow: 0 2px 6px color-mix(in srgb, var(--nexus-primary, #01757A) 20%, transparent);
}

.nexus-stat-success {
    background: linear-gradient(135deg, #059669, #10B981);
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.2);
}

.nexus-stat-warning {
    background: linear-gradient(135deg, #D97706, #F59E0B);
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.2);
}

.nexus-stat-error {
    background: linear-gradient(135deg, #DC2626, #EF4444);
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.2);
}

.nexus-stat-info {
    box-shadow: 0 2px 6px color-mix(in srgb, var(--nexus-primary, #01757A) 20%, transparent);
}

.nexus-stat-danger {
    background: linear-gradient(135deg, #DC2626, #EF4444);
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
}

.nexus-stat-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.nexus-stat-value {
    font-size: 1.625rem;
    font-weight: 700;
    color: #1E293B;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.nexus-stat-label {
    font-size: 0.7rem;
    color: #64748B;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* BR-UI-KPI-COMPACT-01 — dòng phụ dưới nhãn ("358 tổng", "= [26] + [27]").
   Mờ hơn nhãn để không tranh chỗ với con số chính; cắt bằng ellipsis thay vì
   gãy dòng, vì gãy dòng làm các thẻ trong cùng dải cao thấp so le. */
.nexus-stat-subtext {
    font-size: 0.7rem;
    color: #475569; /* BR-FIN-APINV-UI-05: #94A3B8 trên nền #F1F5F9 chỉ đạt 2.34:1 — #475569 đạt ≥ 6:1 */
    font-weight: 400;
    line-height: 1.3;
    margin-top: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark-mode .nexus-stat-subtext {
    color: #94A3B8;
}

/* Màn nhỏ: dòng phụ là thứ hy sinh đầu tiên để giữ con số đọc được. */
@media (max-width: 991.98px) {
    .nexus-stat-card-compact .nexus-stat-subtext {
        display: none;
    }
}

/* Trend indicator */
.nexus-stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.nexus-stat-trend-up {
    color: #059669;
}

.nexus-stat-trend-down {
    color: #DC2626;
}

/* ==========================================================
   Badge-Dot Status System (Tabler-inspired)
   ========================================================== */
.nexus-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.625rem 0.2rem 0.5rem;
    border-radius: 100px;
    letter-spacing: 0.02em;
    line-height: 1.4;
}

.nexus-badge::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.nexus-badge-success {
    background: rgba(5, 150, 105, 0.08);
    color: #059669;
}

.nexus-badge-success::before {
    background: #059669;
    box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.2);
}

.nexus-badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #c27803;
}

.nexus-badge-warning::before {
    background: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.nexus-badge-secondary {
    background: rgba(98, 105, 118, 0.1);
    color: #626976;
}

.nexus-badge-secondary::before {
    background: #626976;
    box-shadow: 0 0 0 2px rgba(98, 105, 118, 0.2);
}

.nexus-badge-danger {
    background: rgba(214, 57, 57, 0.1);
    color: #d63939;
}

.nexus-badge-danger::before {
    background: #d63939;
    box-shadow: 0 0 0 2px rgba(214, 57, 57, 0.2);
}

.nexus-badge-info {
    background: color-mix(in srgb, var(--nexus-primary, #01757A) 8%, transparent);
    color: var(--nexus-primary, #01757A);
}

.nexus-badge-info::before {
    background: var(--nexus-primary, #01757A);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--nexus-primary, #01757A) 20%, transparent);
}

/* ==========================================================
   Sticky Table Header
   ========================================================== */
.nexus-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.nexus-table thead th {
    background-color: var(--mud-palette-background, #F8FAFC) !important;
    backdrop-filter: blur(8px);
}

/* ==========================================================
   Micro-Animations & Transitions
   ========================================================== */
.nexus-fade-in {
    animation: nexusFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes nexusFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nexus-slide-up {
    animation: nexusSlideUp 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes nexusSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered child animations */
.nexus-stagger>*:nth-child(1) {
    animation-delay: 0ms;
}

.nexus-stagger>*:nth-child(2) {
    animation-delay: 50ms;
}

.nexus-stagger>*:nth-child(3) {
    animation-delay: 100ms;
}

.nexus-stagger>*:nth-child(4) {
    animation-delay: 150ms;
}

.nexus-stagger>*:nth-child(5) {
    animation-delay: 200ms;
}

/* Card hover micro-animation */
.card {
    transition: box-shadow var(--nexus-transition), transform var(--nexus-transition) !important;
}

/* Neon Green accent button glow */
.btn-accent,
.nexus-btn-accent {
    background-color: var(--nexus-accent) !important;
    border-color: var(--nexus-accent) !important;
    color: white !important;
    font-weight: 600;
    transition: all var(--nexus-transition);
}

.btn-accent:hover,
.nexus-btn-accent:hover {
    box-shadow: var(--nexus-accent-glow);
    transform: translateY(-1px);
}

/* ==========================================================
   Code Link - Interactive Hover
   ========================================================== */
.code-link {
    cursor: pointer;
    color: var(--nexus-primary);
    font-weight: 600;
    text-decoration: none !important;
    border-bottom: none !important;
    transition: all 0.2s ease;
}

.code-link:hover {
    color: var(--nexus-primary-hover);
    text-decoration: underline !important;
    border-bottom: none !important;
}

/* ==========================================================
   Glassmorphism - Dialogs & Modals
   ========================================================== */
.mud-dialog-container .mud-dialog {
    backdrop-filter: blur(16px) saturate(1.2) !important;
    -webkit-backdrop-filter: blur(16px) saturate(1.2) !important;
    background: rgba(255, 255, 255, 0.92) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06) !important;
}

.mud-dialog .mud-dialog-title {
    font-weight: 700 !important;
    font-size: 1.125rem !important;
    color: var(--midnight-blue) !important;
    letter-spacing: -0.2px;
}

.approval-wf-dialog .mud-dialog-title {
    position: relative;
}

.approval-wf-dialog .approval-wf-title-row {
    padding-right: 40px;
}

.approval-wf-dialog .mud-dialog-title .mud-button-close {
    top: 50% !important;
    right: 12px !important;
    transform: translateY(-50%);
}

.mud-dialog .mud-dialog-actions {
    padding: 1rem 1.5rem !important;
    border-top: 1px solid rgba(0, 0, 0, 0.06) !important;
}

/* Custom Modal (NexusEditModal / NexusConfirmModal) */
.modal-content {
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border-radius: 16px !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15) !important;
}

.modal-backdrop.show {
    opacity: 0.4 !important;
    backdrop-filter: blur(4px) !important;
}

/* ==========================================================
   NexusPageHeader - Subtitle
   ========================================================== */
.nexus-page-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary, #626976);
    font-weight: 400;
    margin-top: 0.125rem;
    line-height: 1.4;
}

/* ==========================================================
   Dark Mode: Design System Overrides
   ========================================================== */
.dark-mode .nexus-page-title {
    color: var(--text-heading) !important;
}

.dark-mode .nexus-page-subtitle {
    color: var(--text-secondary) !important;
}

/* Stat cards in dark mode — Slate Panel (#1E293B) with Lagoon Teal accent */
.dark-mode .nexus-stat-card {
    background: #1E293B !important;
    border-color: #334155 !important;
    border-left-color: var(--nexus-primary, #2BA5AB) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25) !important;
}

.dark-mode .nexus-stat-value {
    color: #F8FAFC;
}

.dark-mode .nexus-stat-label {
    color: #94A3B8;
}

.dark-mode .nexus-stat-trend-up {
    color: #34D399;
}

.dark-mode .nexus-stat-trend-down {
    color: #F87171;
}

.dark-mode .nexus-badge-success {
    background: rgba(16, 185, 129, 0.16);
}

.dark-mode .nexus-badge-warning {
    background: rgba(245, 158, 11, 0.16);
}

.dark-mode .nexus-badge-secondary {
    background: rgba(148, 163, 184, 0.16);
    color: #CBD5E1;
}

.dark-mode .nexus-badge-secondary::before {
    background: #94A3B8;
}

.dark-mode .nexus-badge-danger {
    background: rgba(239, 68, 68, 0.16);
    color: #F87171;
}

.dark-mode .nexus-badge-danger::before {
    background: #F87171;
}

.dark-mode .nexus-badge-info {
    background: color-mix(in srgb, var(--nexus-primary, #2BA5AB) 16%, transparent);
    color: var(--nexus-primary, #2BA5AB);
}

.dark-mode .nexus-badge-info::before {
    background: var(--nexus-primary, #2BA5AB);
}

.dark-mode .nexus-table thead th {
    background-color: var(--bg-elevated) !important;
}

/* Zebra stripes in dark mode */
.dark-mode .nexus-table tbody tr:nth-child(even) {
    background-color: var(--table-stripe) !important;
}

.dark-mode .nexus-table tbody tr:hover {
    background-color: var(--table-hover) !important;
}

.dark-mode .nexus-page-header-left .breadcrumb a {
    color: var(--nexus-primary, #2BA5AB);
}

/* Dialogs - Dark mode */
.dark-mode .mud-dialog-container .mud-dialog {
    background: #1E293B !important;
    border-color: #334155 !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
}

.dark-mode .mud-dialog .mud-dialog-title {
    color: var(--text-heading) !important;
}

.dark-mode .modal-content {
    background: #1E293B !important;
    border-color: #334155 !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5) !important;
}

/* Code link - dark mode */
.dark-mode .code-link {
    color: var(--nexus-primary, #2BA5AB);
}

.dark-mode .code-link:hover {
    color: #4CBFC5;
    border-bottom-color: var(--nexus-primary, #2BA5AB);
}

/* ==========================================================
   World-Class SaaS Sidebar - High-DPI Optimized Typography
   Target: All screens (Standard, Retina, M4 Pro, 4K)
   ========================================================== */

/* â”€â”€ Base Container â”€â”€ */
.nexus-sidebar-menu,
.nexus-sidebar-menu * {
    font-family: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: optimizeLegibility !important;
}

/* â”€â”€ All NavLinks (Child-level default) â”€â”€ */
.nexus-sidebar-menu .mud-nav-link {
    padding: 12px 16px !important;
    transition: all 0.2s ease !important;
    position: relative;
    border-left: 3px solid transparent !important;
    color: #4B5563 !important;
    /* Gray 600 */
    font-size: 14px !important;
    font-weight: 500 !important;
    letter-spacing: 0.02em !important;
}

.nexus-sidebar-menu .mud-nav-link-text {
    font-size: 14px !important;
    font-weight: 500 !important;
    letter-spacing: 0.02em !important;
    margin-left: 16px !important;
    transition: all 0.2s ease !important;
    color: inherit !important;
}

/* -- Icons (Inactive) — tinted with the active module's identity color (--module-accent,
   set by NavMenu.razor) instead of flat gray, so sub-menu icons match the rail -- */
.nexus-sidebar-menu .mud-nav-link-icon-default,
.nexus-sidebar-menu .mud-icon-root {
    color: #64748B !important;
    opacity: 0.75;
    transition: color 0.2s ease, transform 0.2s ease, opacity 0.2s ease !important;
    font-size: 20px !important;
    margin-right: 8px !important;
}

/* -- Hover State (teal brand, duplicate-rule conflict fixed 2026-06-16: this block
   used to ship a "dark sidebar" white-on-white hover that silently won the cascade
   in light mode, making sidebar hover nearly invisible) -- */
.nexus-sidebar-menu .mud-nav-link:hover {
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 7%, transparent) !important;
    color: var(--nexus-primary, #01757A) !important;
}

.nexus-sidebar-menu .mud-nav-link:hover .mud-nav-link-icon-default,
.nexus-sidebar-menu .mud-nav-link:hover .mud-icon-root {
    color: var(--nexus-primary, #01757A) !important;
    opacity: 1 !important;
    transform: translateX(2px);
}

/* ── Active Item (Teal Brand) ── */
.nexus-sidebar-menu .mud-nav-link.active,
.nexus-sidebar-menu .mud-nav-link.active:hover {
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 8%, transparent) !important;
    border-left-color: var(--nexus-primary, #01757A) !important;
    color: var(--nexus-primary, #01757A) !important;
}

.nexus-sidebar-menu .mud-nav-link.active .mud-nav-link-text {
    font-weight: 600 !important;
    color: var(--nexus-primary, #01757A) !important;
}

.nexus-sidebar-menu .mud-nav-link.active .mud-nav-link-icon-default,
.nexus-sidebar-menu .mud-nav-link.active .mud-icon-root {
    color: var(--nexus-primary, #01757A) !important;
    opacity: 1 !important;
    filter: none !important;
}

/* â”€â”€ Parent Group (15px / 600 weight) â”€â”€ */
.nexus-sidebar-menu .mud-nav-group>.mud-nav-group-button>.mud-nav-link {
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #4B5563 !important;
    /* Gray 600 */
    padding: 12px 16px !important;
}

.nexus-sidebar-menu .mud-nav-group>.mud-nav-group-button>.mud-nav-link>.mud-nav-link-text {
    font-size: 15px !important;
    font-weight: 600 !important;
}

/* Expanded parent â†’ brighter text */
.nexus-sidebar-menu .mud-nav-group.mud-nav-group-expanded>.mud-nav-group-button>.mud-nav-link {
    color: #1E293B !important;
    /* Dark Slate */
}

/* â”€â”€ Child Items (14px / 400 weight + deeper indent) â”€â”€ */
.nexus-sidebar-menu .mud-nav-group .mud-nav-item .mud-nav-link,
.nexus-sidebar-menu .sidebar-group .mud-nav-item .mud-nav-link {
    padding-left: 42px !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    color: #64748B !important;
    /* Steel Gray */
}

.nexus-sidebar-menu .mud-nav-group .mud-nav-item .mud-nav-link .mud-nav-link-text,
.nexus-sidebar-menu .sidebar-group .mud-nav-item .mud-nav-link .mud-nav-link-text {
    font-size: 14px !important;
    font-weight: 400 !important;
}

/* Active child */
.nexus-sidebar-menu .mud-nav-group .mud-nav-item .mud-nav-link.active,
.nexus-sidebar-menu .sidebar-group .mud-nav-item .mud-nav-link.active {
    color: var(--nexus-primary, #01757A) !important;
}

.nexus-sidebar-menu .mud-nav-group .mud-nav-item .mud-nav-link.active .mud-nav-link-text,
.nexus-sidebar-menu .sidebar-group .mud-nav-item .mud-nav-link.active .mud-nav-link-text {
    font-weight: 600 !important;
    color: var(--nexus-primary, #01757A) !important;
}

/* BR-UI-SIDEBAR-WRAP-01 (2026-10-15) — tên menu dài KHÔNG được bị cắt.
   Ngăn menu rộng 250px; mục con thụt 42px + icon 28px + lề chữ 16px chỉ còn ~120px cho chữ
   ⇒ "Thanh Toán Phải Trả", "Cấu hình định khoản" bị che. Giảm thụt lề và cho xuống 2 dòng. */
.nexus-sidebar-menu .mud-nav-group .mud-nav-item .mud-nav-link,
.nexus-sidebar-menu .sidebar-group .mud-nav-item .mud-nav-link {
    padding-left: 30px !important;
    padding-right: 10px !important;
    white-space: normal !important;
    height: auto !important;
    min-height: 40px;
    align-items: center;
}

.nexus-sidebar-menu .mud-nav-link .mud-nav-link-text {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    overflow-wrap: anywhere;
    line-height: 1.3 !important;
    min-width: 0;
}

.nexus-sidebar-menu .mud-nav-group .mud-nav-item .mud-nav-link .mud-nav-link-text,
.nexus-sidebar-menu .sidebar-group .mud-nav-item .mud-nav-link .mud-nav-link-text {
    margin-left: 10px !important;
}

/* â”€â”€ Expand / Collapse Arrow â”€â”€ */
.nexus-sidebar-menu .mud-nav-group-expand-icon {
    transition: all 0.2s ease !important;
    color: #94A3B8 !important;
    /* Muted Steel */
}

.nexus-sidebar-menu .mud-nav-group.mud-nav-group-expanded>.mud-nav-group-button>.mud-nav-link .mud-nav-group-expand-icon {
    color: var(--nexus-primary, #01757A) !important;
}

/* -- Section Headers — Executive Luxury Standard -- */
.sidebar-section-title {
    font-family: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: optimizeLegibility !important;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #64748B;
    /* Slate-500 — crisp & readable */
    padding: 20px 16px 8px 16px;
    user-select: none;
    margin-top: 0;
    position: relative;
}

/* Thin separator above every sidebar-section-title except the first */
.sidebar-section-title~.sidebar-section-title::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 16px;
    right: 16px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #CBD5E1, transparent);
    opacity: 0.5;
}

.nav-section-header {
    font-family: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: optimizeLegibility !important;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #64748B;
    /* Slate-500 */
    padding: 14px 10px 6px 26px;
    user-select: none;
    position: relative;
    margin-top: 0;
}

/* Thin separator line above each nav-section-header (except first within its parent) */
.nav-section-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 42px;
    right: 16px;
    height: 1px;
    background: linear-gradient(90deg, #E2E8F0, transparent);
    opacity: 0.5;
}

.nav-section-header:first-of-type::before {
    display: none;
}

/* -- Nav Pending Badge -- */
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background-color: var(--qcs-error, #DC2626);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

/* Active state — teal brand */
.nexus-sidebar-menu .mud-nav-link.active {
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 8%, transparent) !important;
    border-left: 3px solid var(--nexus-primary, #01757A) !important;
}

/* Dark mode nav badge */
.dark-mode .nav-badge {
    background-color: #f85149;
}

/* â”€â”€ Responsive: ensure crispness at every DPI â”€â”€ */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .nexus-sidebar-menu .mud-nav-link-text {
        text-rendering: geometricPrecision !important;
    }
}

/* Sparkline Chart Container */
.nexus-stat-chart-container {
    margin: -0.5rem -1.25rem -1.125rem -1.25rem;
    position: relative;
    z-index: 0;
    opacity: 0.85;
}

.nexus-stat-chart-container .mud-chart-line {
    stroke-width: 3px !important;
    filter: drop-shadow(0 4px 6px color-mix(in srgb, var(--nexus-primary, #01757A) 30%, transparent));
}







/* Executive Luxury Dialog Overlays */
.glass-overlay {
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    background-color: rgba(15, 23, 42, 0.4) !important;
}

.executive-dialog {
    border-radius: 16px !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
}

.executive-dialog .mud-dialog-title {
    padding: 1.5rem 1.5rem 0.5rem 1.5rem !important;
}

.executive-dialog .mud-dialog-content {
    padding: 0 1.5rem 1.5rem 1.5rem !important;
}

.executive-dialog .mud-dialog-actions {
    padding: 0 !important;
}

/* Global Glassmorphism for Dialogs */
.mud-overlay-dialog .mud-overlay-scrim {
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    background-color: rgba(15, 23, 42, 0.4) !important;
}

/* Executive Luxury View Modal */
.nexus-view-modal-header {
    background-color: var(--mud-palette-background, #F8FAFC) !important;
    border-bottom: 1px solid #E2E8F0;
    padding: 16px 24px;
}

.nexus-view-modal-header .mud-typography {
    color: #1E293B !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em;
}

.nexus-soft-pill-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nexus-soft-pill-success {
    background-color: #DCFCE7;
    color: #166534;
}

.nexus-soft-pill-error {
    background-color: #FEE2E2;
    color: #991B1B;
}

/* ==========================================================
   MudTabs - Executive ERP Tab Styling
   Override MudBlazor default UPPERCASE text-transform
   ========================================================== */
.mud-tabs .mud-tab {
    text-transform: none !important;
    font-size: 0.8125rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em !important;
    color: #64748B !important;
    min-width: auto !important;
    padding: 10px 16px !important;
    transition: color 0.2s ease, background-color 0.2s ease !important;
}

.mud-tabs .mud-tab:hover {
    color: var(--nexus-primary, #01757A) !important;
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 5%, transparent) !important;
}

.mud-tabs .mud-tab.mud-tab-active {
    color: var(--nexus-primary, #01757A) !important;
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 8%, transparent) !important;
    font-weight: 700 !important;
}

.mud-tabs .mud-tab-slider {
    background-color: var(--nexus-primary, #01757A) !important;
    height: 2.5px !important;
    border-radius: 2px !important;
}

.mud-tabs .mud-tab .mud-tab-icon-text {
    gap: 6px !important;
}

.mud-tabs .mud-tabs-header,
.mud-tabs .mud-tabs-tabbar,
.mud-tabs .mud-tabs-tabbar-primary {
    background-color: var(--mud-palette-surface, #FFFFFF) !important;
    color: var(--mud-palette-text-primary, #1E293B) !important;
    border-bottom: 1px solid #E2E8F0 !important;
}

.mud-tabs .mud-tabs-header .mud-tabs-scroll-button {
    color: #94A3B8 !important;
}

/* ==========================================================
   Bootstrap Table Dark Mode Variables (Nexus Fix)
   ========================================================== */
.dark-mode .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--mud-palette-text-primary) !important;
    --bs-table-border-color: var(--mud-palette-lines-default) !important;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.05);
    --bs-table-striped-color: var(--mud-palette-text-primary) !important;
    --bs-table-active-bg: rgba(255, 255, 255, 0.1);
    --bs-table-active-color: var(--mud-palette-text-primary) !important;
    --bs-table-hover-bg: var(--mud-palette-action-default-hover, rgba(255, 255, 255, 0.075)) !important;
    --bs-table-hover-color: var(--mud-palette-text-primary) !important;
    color: var(--bs-table-color);
    border-color: var(--bs-table-border-color);
}

.dark-mode .table> :not(caption)>*>* {
    color: var(--bs-table-color);
    background-color: var(--bs-table-bg);
    border-bottom-color: var(--bs-table-border-color);
}

.dark-mode .table-hover>tbody>tr:hover>* {
    --bs-table-bg-state: var(--bs-table-hover-bg);
    color: var(--bs-table-hover-color);
}

/* ==========================================================
   Global Filter Panel — Flexible Widths
   Uses min/max constraints with flex-grow so fields adapt
   to their content while staying within sane bounds.

   MudAutocomplete/MudSelect wrap their sized element (the one
   that receives our Class/Style) inside an extra outer
   `.mud-select` div — and that OUTER div, not the one carrying
   our class, is the actual flex item in the filter toolbar row.
   Without :has(), our max-width/flex constraints land on an
   inner box that has no effect on the outer flex item's size,
   so it grows unconstrained (flex:1 1 auto; max-width:none) and
   leaves a large empty gap after each visually-narrow input.
   MudTextField and MudDatePicker don't have that extra wrapper
   (their sized element IS the flex item), so they size correctly
   without :has().
   ========================================================== */
.filter-input,
.mud-select:has(> .filter-input) {
    min-width: 220px;
    max-width: 300px;
    flex: 1 1 240px;
}

.filter-input-small,
.mud-select:has(> .filter-input-small) {
    min-width: 120px;
    max-width: 150px;
    flex: 0 0 130px;
}

.filter-input-date {
    min-width: 165px;
    max-width: 220px;
    flex: 0 0 155px;
}

/* BR-SAL-PRICE-TYPE-05 — dòng "Sàn …" dưới ô Đơn giá trên đơn bán; thấp hơn sàn ⇒ đỏ */
.so-floor-hint {
    font-size: 11px;
    line-height: 1.3;
    margin-top: 2px;
    text-align: right;
    white-space: nowrap;
    color: var(--mud-palette-text-secondary);
}

.so-floor-hint.so-floor-below {
    color: var(--mud-palette-error);
    font-weight: 600;
}

/* BR-INV-NXT-MONTH-01 — ô chọn tháng in báo cáo tồn (MM/yyyy) cạnh nút In trên thanh trên */
.nxt-month-input {
    width: 130px;
    flex: 0 0 130px;
}

/* ==========================================================
   UNIVERSAL DARK MODE FIXES
   Covers: Stat Cards, Data Tables, Modals/Dialogs,
   Input Fields, Tabs, Status Cards, Section Labels,
   Badges, and all hardcoded light-mode colors.
   ========================================================== */

/* --- Stat Cards --- */
.dark-mode .nexus-stat-card {
    background: #1E293B !important;
    border-color: #334155 !important;
    border-left-color: var(--nexus-primary, #2BA5AB) !important;
}

/* --- Card / Card Header / Card Body --- */
.dark-mode .card,
.dark-mode .card-header,
.dark-mode .card-body {
    background-color: #1E293B !important;
    border-color: #334155 !important;
    color: #F8FAFC !important;
}

/* --- Bootstrap buttons left untheme'd by MudBlazor palette --- */
.dark-mode .btn-light {
    background-color: #1E293B !important;
    border-color: #334155 !important;
    color: #F8FAFC !important;
}

.dark-mode .btn-light:hover {
    background-color: #334155 !important;
}

.dark-mode .btn-outline-secondary {
    border-color: #334155 !important;
    color: #94A3B8 !important;
    background-color: transparent !important;
}

.dark-mode .btn-outline-secondary:hover {
    background-color: #1E293B !important;
    color: #F8FAFC !important;
}

/* --- Data Table --- */
.dark-mode .table thead {
    background-color: #0F172A !important;
    border-bottom: 1px solid #334155 !important;
}

.dark-mode .table thead th {
    color: #94A3B8 !important;
    background-color: #0F172A !important;
}

.dark-mode .table> :not(caption)>*>* {
    background-color: transparent !important;
    border-bottom-color: #334155 !important;
    color: #E2E8F0 !important;
}

.dark-mode .table-hover>tbody>tr:hover>* {
    background-color: color-mix(in srgb, var(--nexus-primary, #2BA5AB) 10%, transparent) !important;
}

/* --- MudDialog / Modal (AGGRESSIVE — overrides MudBlazor inline styles) --- */
.dark-mode .mud-dialog,
.dark-mode .mud-dialog.mud-paper,
.dark-mode .mud-dialog-container .mud-dialog,
.dark-mode .mud-paper.mud-dialog {
    background: #1E293B !important;
    background-color: #1E293B !important;
    border-color: #334155 !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6) !important;
    color: #F8FAFC !important;
}

.dark-mode .mud-dialog .mud-dialog-title,
.dark-mode .mud-dialog-title {
    color: #F8FAFC !important;
    border-bottom-color: #334155 !important;
    background-color: #1E293B !important;
}

.dark-mode .mud-dialog .mud-dialog-actions,
.dark-mode .mud-dialog-actions {
    background-color: #0F172A !important;
    border-top: 1px solid #334155 !important;
}

.dark-mode .mud-dialog .mud-dialog-content,
.dark-mode .mud-dialog-content {
    background-color: #1E293B !important;
    color: #F8FAFC !important;
}

/* MudTabs panels inside dialog */
.dark-mode .mud-tabs-panels,
.dark-mode .mud-tab-panel {
    background-color: #1E293B !important;
    color: #F8FAFC !important;
}


/* --- Dialog Header Icon Box (gradient) --- */
.dark-mode .mud-dialog [style*="background: linear-gradient(135deg, #eff6ff"] {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
    border-color: #334155 !important;
}

.dark-mode .mud-dialog [style*="color: #2563eb"] {
    color: var(--nexus-primary, #2BA5AB) !important;
}

/* --- Dialog Scroll Area & Inline Light Background Overrides --- */
.dark-mode .dialog-scroll-area,
.dark-mode [style*="background-color: #f8fafc"],
.dark-mode [style*="background-color: #F8FAFC"],
.dark-mode [style*="background-color:#f8fafc"],
.dark-mode [style*="background-color:#F8FAFC"],
.dark-mode [style*="background: #f8fafc"],
.dark-mode [style*="background: #F8FAFC"],
.dark-mode [style*="background:#F8FAFC"],
.dark-mode [style*="background:#F8FAFB"],
.dark-mode [style*="background-color: #fafafa"],
.dark-mode [style*="background-color: #FAFAFA"],
.dark-mode [style*="background-color: #f1f5f9"],
.dark-mode [style*="background-color: #F1F5F9"],
.dark-mode [style*="background: #F1F5F9"] {
    background-color: #0F172A !important;
    background: #0F172A !important;
}

.dark-mode [style*="background-color: white"],
.dark-mode [style*="background-color:white"],
.dark-mode [style*="background: white"],
.dark-mode [style*="background:white"],
.dark-mode [style*="background-color: #ffffff"],
.dark-mode [style*="background-color: #FFFFFF"],
.dark-mode [style*="background-color: #fff"],
.dark-mode [style*="background:#fff"],
.dark-mode [style*="background: #fff"],
.dark-mode [style*="background:#F8FFFE"] {
    background-color: #1E293B !important;
    background: #1E293B !important;
}

/* --- Dialog Title / Subtitle Hardcoded Colors --- */
.dark-mode [style*="color: #0f172a"],
.dark-mode [style*="color: #0F172A"] {
    color: #F8FAFC !important;
}

.dark-mode [style*="color: #64748b"],
.dark-mode [style*="color: #64748B"] {
    color: #94A3B8 !important;
}

/* --- MudTabs inside Dialogs & Dark Mode --- */
.dark-mode .mud-tabs .mud-tabs-header,
.dark-mode .mud-tabs .mud-tabs-tabbar,
.dark-mode .mud-tabs .mud-tabs-tabbar-primary,
.dark-mode .mud-dialog .mud-tabs-header {
    background-color: #1E293B !important;
    border-bottom-color: #334155 !important;
}

.dark-mode .mud-tabs .mud-tab {
    color: #94A3B8 !important;
}

.dark-mode .mud-tabs .mud-tab.mud-tab-active {
    color: var(--nexus-primary, #2BA5AB) !important;
}

.dark-mode .mud-tabs .mud-tab-slider {
    background-color: var(--nexus-primary, #2BA5AB) !important;
}

/* --- MudTextField / MudAutocomplete (Outlined) --- */
.dark-mode .mud-input-outlined .mud-input-outlined-border {
    border-color: #334155 !important;
}

.dark-mode .mud-input-outlined:hover .mud-input-outlined-border {
    border-color: #475569 !important;
}

.dark-mode .mud-input-outlined.mud-input-focused .mud-input-outlined-border {
    border-color: var(--nexus-primary, #2BA5AB) !important;
}

.dark-mode .mud-input {
    color: #F8FAFC !important;
}

.dark-mode .mud-input-label {
    color: #94A3B8 !important;
}

.dark-mode .mud-input-label-inputcontrol {
    color: #94A3B8 !important;
}

.dark-mode .mud-input-slot {
    color: #F8FAFC !important;
}


/* --- Section Headers (THÔNG TIN CƠ BẢN, etc.) --- */
.dark-mode .text-primary.fw-bold.text-uppercase {
    color: var(--nexus-primary, #2BA5AB) !important;
}

/* --- Status Card (Active/Inactive toggle area) --- */
.dark-mode .rounded-3.border[style*="background-color: #f8fafc"] {
    background-color: #0F172A !important;
    border-color: #334155 !important;
}

.dark-mode .text-dark {
    color: #F8FAFC !important;
}

.dark-mode .text-muted {
    color: #94A3B8 !important;
}

.dark-mode .bg-light {
    background-color: #0F172A !important;
}

/* --- Divider --- */
.dark-mode .mud-divider {
    border-color: #334155 !important;
}

/* --- MudSwitch --- */
.dark-mode .mud-switch .mud-switch-track {
    background-color: #334155 !important;
}

/* --- Layout Containers Dark Mode --- */
.dark-mode .main-wrapper,
.dark-mode .mud-main-content,
.dark-mode .page-body,
.dark-mode .page-wrapper {
    background-color: var(--bg-surface, #0F172A) !important;
}

/* --- Bootstrap bg-white override --- */
.dark-mode .bg-white {
    background-color: transparent !important;
}

/* Specific styling for inputs/selects in dark mode that have bg-white class */
.dark-mode .bg-white.mud-input-control,
.dark-mode .bg-white.mud-input-control .mud-input-outlined,
.dark-mode .bg-white.mud-input-control input,
.dark-mode .bg-white.mud-input-control .mud-select-input {
    background-color: var(--bg-card, #1E293B) !important;
}



/* --- Border color overrides --- */
.dark-mode [style*="border-color: #e2e8f0"],
.dark-mode [style*="border-color: #E2E8F0"] {
    border-color: #334155 !important;
}

.dark-mode [style*="border-color: #F1F5F9"],
.dark-mode [style*="border-color: #f1f5f9"] {
    border-color: #334155 !important;
}

.dark-mode [style*="border-color: #CBD5E1"],
.dark-mode [style*="border-color: #cbd5e1"],
.dark-mode [style*="border-color: #bfdbfe"] {
    border-color: #334155 !important;
}

.dark-mode [style*="border-bottom: 1px solid #e2e8f0"] {
    border-bottom-color: #334155 !important;
}

/* --- MudSelect / MudMenu Popover --- */
.dark-mode .mud-popover {
    background-color: #1E293B !important;
    border-color: #334155 !important;
}

.dark-mode .mud-list-item:hover {
    background-color: color-mix(in srgb, var(--nexus-primary, #2BA5AB) 10%, transparent) !important;
}

/* --- Modal Content (Bootstrap modal) --- */
.dark-mode .modal-content {
    background: #1E293B !important;
    border-color: #334155 !important;
    color: #F8FAFC !important;
}

.dark-mode .modal-header {
    border-bottom-color: #334155 !important;
}

.dark-mode .modal-footer {
    border-top-color: #334155 !important;
}

/* --- Code Link --- */
.dark-mode .code-link {
    color: var(--nexus-primary, #2BA5AB) !important;
}

.dark-mode .code-link:hover {
    color: #4CBFC5 !important;
}

/* --- MudNumericField / Other inputs --- */
.nexus-numeric-field input {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}

.dark-mode .mud-input-control {
    color: #F8FAFC !important;
}

/* --- Filter bar / Search bg-white --- */
.dark-mode .card-header .mud-input-outlined .mud-input-outlined-border {
    border-color: #334155 !important;
    background-color: transparent !important;
}

/* --- Nexus Soft Badges (Dark — WCAG AA Status Inks per DESIGN.md §214-219) --- */
.dark-mode .nexus-soft-badge-success,
.dark-mode .nexus-soft-badge.success {
    background: rgba(16, 185, 129, 0.16) !important;
    color: #34D399 !important;
}

.dark-mode .nexus-soft-badge-warning,
.dark-mode .nexus-soft-badge.warning {
    background: rgba(245, 158, 11, 0.16) !important;
    color: #FBBF24 !important;
}

.dark-mode .nexus-soft-badge-info,
.dark-mode .nexus-soft-badge.info {
    background: color-mix(in srgb, var(--nexus-primary, #2BA5AB) 16%, transparent) !important;
    color: var(--nexus-primary, #2BA5AB) !important;
}

.dark-mode .nexus-soft-badge-dark,
.dark-mode .nexus-soft-badge.dark,
.dark-mode .nexus-soft-badge-secondary,
.dark-mode .nexus-soft-badge.secondary {
    background: rgba(148, 163, 184, 0.18) !important;
    color: #CBD5E1 !important;
}

.dark-mode .nexus-soft-badge-danger,
.dark-mode .nexus-soft-badge.danger,
.dark-mode .nexus-soft-badge-error,
.dark-mode .nexus-soft-badge.error {
    background: rgba(239, 68, 68, 0.16) !important;
    color: #F87171 !important;
}


/* Hide section titles completely or adapt when mini drawer is collapsed */
.mud-drawer--mini .sidebar-section-title {
    padding: 16px 0 8px 0 !important;
}

.mud-drawer--mini .sidebar-section-title::before {
    display: none !important;
}

.mud-drawer--mini .sidebar-section-title .mud-icon-root {
    margin: 0 !important;
}


/* ============================================================
   NEXUSERP — RESPONSIVE LINE-ITEM GRID (Mobile / Tablet)
   Strategy: Table → Stacked Card layout
   Breakpoint: < 1200px (covers phone, portrait tablet)
   Design: SAP Fiori / Odoo Mobile inspired
   ============================================================ */
@media (max-width: 1199.98px) {

    /* ── Remove horizontal scroll — card layout takes over ── */
    .table-responsive:has(.nexus-data-grid) {
        overflow-x: unset !important;
    }

    /* ── Hide thead (labels come from data-label) ── */
    .nexus-data-grid thead {
        display: none !important;
    }

    /* ── tbody / tfoot become block flow ── */
    .nexus-data-grid tbody {
        display: block !important;
    }

    .nexus-data-grid tfoot {
        display: none !important;
    }

    /* ── tfoot "Tổng cộng" row ── */
    .nexus-data-grid tfoot tr {
        display: flex !important;
        flex-wrap: wrap;
        gap: 0.25rem 1rem;
        padding: 0.75rem 1rem;
        background: var(--mud-palette-background-grey);
        border: 1px solid var(--grid-border);
        border-radius: 10px;
        margin-bottom: 0.5rem;
    }

    .nexus-data-grid tfoot td {
        display: block !important;
        border: none !important;
        padding: 0.1rem 0 !important;
        width: auto !important;
        font-size: 0.82rem;
    }

    /* ════════════════════════════════════════════════════════
       CARD — each <tr> becomes a rounded card
       ════════════════════════════════════════════════════════ */
    .nexus-data-grid tbody tr {
        display: block !important;
        margin-bottom: 1rem;
        border: 1px solid var(--grid-border);
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        background: var(--mud-palette-surface);
        overflow: hidden;
    }

    /* ── Row number — pill header inside card ── */
    .nexus-data-grid tbody tr td[data-label="#"] {
        display: flex !important;
        justify-content: flex-end !important;
        align-items: center;
        background: var(--mud-palette-background-grey);
        border-bottom: 1px solid var(--grid-border) !important;
        padding: 0.45rem 0.9rem !important;
        font-size: 0.72rem;
        font-weight: 700;
        color: var(--nexus-primary, #01757A);
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    .nexus-data-grid tbody tr td[data-label="#"]::before {
        content: "STT";
        margin-right: auto;
        font-size: 0.7rem;
        font-weight: 700;
        color: var(--mud-palette-text-secondary);
        letter-spacing: 0.12em;
    }

    /* ════════════════════════════════════════════════════════
       FIELD ROW — label | value layout via flex
       ════════════════════════════════════════════════════════ */
    .nexus-data-grid tbody tr td:not([data-label="#"]):not(.grid-action-cell) {
        display: flex !important;
        flex-direction: row;
        align-items: flex-start;
        min-height: 46px;
        padding: 0.6rem 0.9rem !important;
        border-bottom: 1px solid var(--grid-border) !important;
        gap: 0.75rem;
    }

    /* ── Left: label from data-label ── */
    .nexus-data-grid tbody tr td:not([data-label="#"]):not(.grid-action-cell)::before {
        content: attr(data-label);
        flex: 0 0 38%;
        font-size: 0.77rem;
        font-weight: 600;
        color: var(--mud-palette-text-secondary);
        text-align: left;
        word-break: break-word;
        line-height: 1.4;
        padding-top: 6px;
        /* align with input baseline */
    }

    /* ── Right: value / input fills remaining space ── */
    .nexus-data-grid tbody tr td:not([data-label="#"]):not(.grid-action-cell)>*,
    .nexus-data-grid tbody tr td:not([data-label="#"]):not(.grid-action-cell) .mud-input-control,
    .nexus-data-grid tbody tr td:not([data-label="#"]):not(.grid-action-cell) .mud-select,
    .nexus-data-grid tbody tr td:not([data-label="#"]):not(.grid-action-cell) .mud-picker {
        flex: 1 1 0;
        min-width: 0;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* ── Restore normal height for inputs on mobile (undo erp-datagrid 30px) ── */
    .nexus-data-grid tbody tr td .mud-input-control-input-container {
        height: auto !important;
        min-height: 38px !important;
    }

    /* ── Static text cells: right-align the value text ── */
    .nexus-data-grid tbody tr td.text-end:not([data-label="#"]) {
        text-align: right;
    }

    .nexus-data-grid tbody tr td.text-end:not([data-label="#"]):not(.grid-action-cell)::after {
        /* push text right — value sits at end of the flex row */
        margin-left: auto;
    }

    /* Simple text value in a flex td — must right-align */
    .nexus-data-grid tbody tr td.text-end:not([data-label="#"]):not(.grid-action-cell) {
        justify-content: space-between;
    }

    /* ── Wrapper div for complex cells (ItemCode + ItemName) ── */
    .nexus-data-grid .nx-cell-val {
        display: flex !important;
        flex-direction: column;
        flex: 1 1 0;
        min-width: 0;
        gap: 2px;
        align-items: flex-start;
    }

    .nexus-data-grid .nx-cell-val>* {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0;
    }

    .nexus-data-grid .nx-cell-val .text-muted.small {
        font-size: 0.72rem;
        color: var(--mud-palette-text-secondary);
        white-space: normal;
        word-break: break-word;
        line-height: 1.3;
        margin-top: 4px;
    }

    /* ── Highlight important money cells ── */
    .nexus-data-grid tbody tr td[data-label].fw-bold {
        font-size: 0.9rem;
        color: var(--mud-palette-success);
    }

    /* ── Last regular field: no border ── */
    .nexus-data-grid tbody tr td:not([data-label="#"]):not(.grid-action-cell):nth-last-child(2) {
        border-bottom: none !important;
    }

    /* ── EMPTY STATE FIX FOR MOBILE ── */
    .nexus-data-grid tbody tr.mud-table-empty-row td {
        display: block !important;
        text-align: center !important;
        padding: 3rem 1rem !important;
    }

    .nexus-data-grid tbody tr.mud-table-empty-row td::before {
        display: none !important;
    }

    /* ════════════════════════════════════════════════════════
       DELETE ACTION CELL — accent red footer in card
       ════════════════════════════════════════════════════════ */
    .nexus-data-grid tbody tr td.grid-action-cell {
        display: flex !important;
        justify-content: center !important;
        align-items: center;
        padding: 0.5rem !important;
        background: var(--mud-palette-background-grey);
        border-top: 1px dashed var(--grid-border) !important;
        border-bottom: none !important;
    }

    .nexus-data-grid tbody tr td.grid-action-cell::before {
        display: none !important;
    }

    /* ── Force input right-alignment for numeric fields ── */
    .nexus-data-grid tbody tr td.text-end input,
    .nexus-data-grid tbody tr td .text-end input,
    .nexus-data-grid tbody tr td .mud-input-control.text-end input {
        text-align: right !important;
    }

    /* ── Adjust MudDatePicker ETA right-alignment ── */
    .nexus-data-grid tbody tr td[data-label="ETA"] input {
        text-align: right !important;
    }
}



/* Global highlight for total amount in data grids */
.nexus-data-grid td.fw-bold {
    color: var(--mud-palette-success) !important;
}


/* Fix Breadcrumb Alignment */



/* GLOBAL FIX: Hide text and expand icons when sidebar is mini */
.nexus-sidebar-menu.is-mini .mud-nav-link-text {
    display: none !important;
}

.nexus-sidebar-menu.is-mini .mud-nav-group-expand-icon {
    display: none !important;
}

.nexus-sidebar-menu.is-mini .nav-badge {
    display: none !important;
}

.nexus-sidebar-menu.is-mini .mud-nav-link {
    justify-content: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 8px !important;
    margin-right: 8px !important;
}

.nexus-sidebar-menu.is-mini .mud-nav-link-icon-default {
    margin-right: 0 !important;
}

.nexus-sidebar-menu.is-mini .mud-icon-root {
    margin-right: 0 !important;
}

/* Fix missing nx-bg dark mode override for .master-page */
.dark-mode {
    --nx-bg: #0F172A;
    --nx-text: #F8FAFC;

    /* Override MudBlazor CSS variables — all mud-paper, mud-list, mud-input surfaces inherit dark */
    --mud-palette-surface: #1E293B;
    --mud-palette-background: #0F172A;
    --mud-palette-background-grey: #0F172A;
    --mud-palette-text-primary: #F8FAFC;
    --mud-palette-text-secondary: #94A3B8;
    --mud-palette-text-disabled: rgba(148, 163, 184, 0.45);
    --mud-palette-divider: #334155;
    --mud-palette-lines-default: #334155;
    --mud-palette-lines-inputs: #475569;
    --mud-palette-action-default: #94A3B8;
    --mud-palette-action-default-hover: color-mix(in srgb, var(--nexus-primary, #2BA5AB) 10%, transparent);
    --mud-palette-action-disabled: rgba(148, 163, 184, 0.38);
    --mud-palette-table-hover: color-mix(in srgb, var(--nexus-primary, #2BA5AB) 10%, transparent);
    --mud-palette-table-striped: color-mix(in srgb, var(--nexus-primary, #2BA5AB) 4%, transparent);
    --mud-palette-overlay-dark: rgba(0, 0, 0, 0.5);
    --mud-palette-overlay-light: rgba(255, 255, 255, 0.05);
}

/* Fix margins for inputs inside erp-datagrid */
.erp-datagrid tbody tr td .mud-input-control {
    margin: 0 !important;
}

/* ==========================================================
   GLOBAL LAYOUT HARMONIZATION (Odoo-Style Premium Flat UI)
   ========================================================== */

/* Force all container widths to stretch fully like container-fluid */
.container-xl,
.container-lg,
.container-md {
    max-width: 100% !important;
}

/* Unify inner container padding within main-wrapper to prevent double-padding and enforce consistent horizontal margins */
.main-wrapper .container-fluid,
.main-wrapper .container-xl,
.main-wrapper .container-lg,
.main-wrapper .container-md,
.main-wrapper .master-page {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Shared horizontal inset for MudTabs wrappers inside master-page (replaces ad-hoc mx-3 duplicated per-page) */
.nexus-tab-inset {
    margin-left: 1rem !important;
    margin-right: 1rem !important;
}


/* Standardize all cards across the system to strict 4px corners and flat outlines */
.card,
.mud-card {
    border-radius: 4px !important;
    border: 1px solid #E2E8F0 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    background-color: var(--mud-palette-surface) !important;
    transition: box-shadow var(--nexus-transition), transform var(--nexus-transition) !important;
}

/* Dark Mode support for cards and headers */
.dark-mode .card,
.dark-mode .mud-card {
    border-color: var(--mud-palette-divider, #334155) !important;
    background-color: var(--mud-palette-surface, #1E293B) !important;
}

.dark-mode .card-header {
    border-color: var(--mud-palette-divider, #334155) !important;
    background-color: var(--mud-palette-surface, #1E293B) !important;
}

/* Force all cards in master, transaction, and system pages to align perfectly to the gutter */
.main-wrapper .master-page .card,
.main-wrapper .master-page .mud-card,
.main-wrapper .container-fluid .card,
.main-wrapper .container-fluid .mud-card,
.main-wrapper .container-xl .card,
.main-wrapper .container-xl .mud-card,
.main-wrapper .container-lg .card,
.main-wrapper .container-lg .mud-card,
.main-wrapper .container-md .card,
.main-wrapper .container-md .mud-card {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* ==========================================================
   Dashboard KPI Grid — Enterprise Flat
   ========================================================== */
.nx-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.nx-kpi-card {
    background: var(--bg-card, #FFFFFF);
    border: 1px solid var(--border-color, #E2E8F0);
    border-radius: 6px;
    padding: 16px 20px;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.nx-kpi-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
    transform: translateY(-1px);
}

.nx-kpi-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--nexus-primary, #01757A);
    border-radius: 6px 0 0 6px;
}

.nx-kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.nx-kpi-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary, #64748B);
}

.nx-kpi-cat-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.nx-kpi-cat-finance {
    background: color-mix(in srgb, var(--nexus-primary, #01757A) 10%, transparent);
    color: var(--nexus-primary, #01757A);
}

.nx-kpi-cat-inventory {
    background: rgba(245, 158, 11, 0.1);
    color: #B45309;
}

.nx-kpi-cat-system {
    background: rgba(100, 116, 139, 0.1);
    color: #475569;
}

.nx-kpi-cat-default {
    background: var(--bg-surface-alt, #F1F5F9);
    color: #475569;
}

.nx-kpi-value {
    font-size: 1.625rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
    margin-bottom: 10px;
}

.nx-kpi-progress-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nx-kpi-target {
    font-size: 0.7rem;
    color: var(--text-secondary, #94A3B8);
}

.nx-kpi-status-dot {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.nx-kpi-dot-good {
    background: #10B981;
}

.nx-kpi-dot-warning {
    background: #F59E0B;
}

.nx-kpi-dot-critical {
    background: #EF4444;
}

.nx-kpi-dot-normal {
    background: #CBD5E1;
}

/* ==========================================================
   Dashboard Chart Cards
   ========================================================== */
.nx-chart-card {
    background: var(--bg-card, #FFFFFF);
    border: 1px solid var(--border-color, #E2E8F0);
    border-radius: 6px;
    overflow: hidden;
}

.nx-chart-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 20px 0;
    border-bottom: 1px solid var(--border-color, #F1F5F9);
    padding-bottom: 12px;
}

.nx-chart-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-heading, #111827);
    letter-spacing: -0.1px;
}

.nx-chart-sub {
    font-size: 0.72rem;
    color: var(--text-secondary, #94A3B8);
    margin-top: 2px;
}

.nx-chart-body {
    padding: 12px 16px 16px;
}

.nx-empty-chart {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 3rem 0;
    color: var(--text-secondary, #94A3B8);
    font-size: 0.8rem;
}

/* ==========================================================
   Dashboard Notifications
   ========================================================== */
.nx-notif-card {
    background: var(--bg-card, #FFFFFF);
    border: 1px solid var(--border-color, #E2E8F0);
    border-radius: 6px;
    overflow: hidden;
}

.nx-notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, #F1F5F9);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-heading, #334155);
}

.nx-notif-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #EF4444;
    color: #fff;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
}

.nx-notif-read-btn {
    background: none;
    border: 1px solid var(--border-color, #E2E8F0);
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary, #475569);
    cursor: pointer;
    transition: background 0.15s ease;
}

.nx-notif-read-btn:hover {
    background: var(--bg-surface-alt, #F8FAFC);
}

.nx-notif-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color, #F8FAFC);
    transition: background 0.12s;
}

.nx-notif-row:last-child {
    border-bottom: none;
}

.nx-notif-unread {
    background: var(--bg-surface-alt, #F8FAFC);
}

.nx-notif-priority {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.nx-prio-high {
    background: #FEE2E2;
    color: #B91C1C;
}

.nx-prio-normal {
    background: #DBEAFE;
    color: #1D4ED8;
}

.nx-notif-body {
    flex: 1;
    min-width: 0;
}

.nx-notif-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-heading, #1E293B);
}

.nx-notif-msg {
    font-size: 0.75rem;
    color: var(--text-secondary, #64748B);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nx-notif-time {
    font-size: 0.7rem;
    color: var(--text-secondary, #94A3B8);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ==========================================================
   Dashboard Quick Links
   ========================================================== */
.nx-quicklinks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.nx-ql-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card, #FFFFFF);
    border: 1px solid var(--border-color, #E2E8F0);
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.nx-ql-item:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    border-color: var(--border-hover, #CBD5E1);
    transform: translateY(-1px);
    text-decoration: none;
    color: inherit;
}

.nx-ql-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nx-ql-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-heading, #1E293B);
    line-height: 1.3;
}

.nx-ql-sub {
    font-size: 0.72rem;
    color: var(--text-secondary, #94A3B8);
    margin-top: 1px;
}

/* Fix MudBlazor Outlined Input Legend overlap under Bootstrap/Tabler */
.mud-input-outlined-border legend {
    float: none !important;
    width: auto !important;
    max-width: 0.01px !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 0.75em !important;
    line-height: inherit !important;
    border: none !important;
    display: block !important;
}

/* Open the notch when the input is focused, dirty, or has focus */
.mud-input-focused .mud-input-outlined-border legend,
.mud-input-dirty .mud-input-outlined-border legend,
.mud-input-has-focus .mud-input-outlined-border legend,
.mud-input-control:focus-within .mud-input-outlined-border legend,
.mud-input:focus-within .mud-input-outlined-border legend {
    max-width: 1000px !important;
    padding: 0 6px !important;
}

/* ==========================================================
   UNIFIED MUDBLAZOR OUTLINED INPUT STYLING (Zero Patchiness)
   ========================================================== */
.mud-input-outlined {
    background-color: var(--mud-palette-surface, #FFFFFF) !important;
    border-radius: 4px !important;
}

.mud-input-outlined .mud-input-slot,
.mud-input-outlined input,
.mud-input-outlined .mud-select-input,
.mud-input-outlined .mud-input-adornment,
.mud-input-control-input-container {
    background-color: transparent !important;
}

/* Floating Label background matches surface color seamlessly */
.mud-input-label-outlined,
.mud-input-label-animated,
.mud-input-control > .mud-input-control-input-container > .mud-input-label-outlined {
    background-color: var(--mud-palette-surface, #FFFFFF) !important;
    padding: 0 4px !important;
    margin-left: -2px !important;
    border-radius: 2px !important;
    z-index: 5 !important;
    max-width: calc(100% - 20px) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* Disabled & Readonly input consistency */
.mud-input-control .mud-input-root.mud-disabled,
.mud-input.mud-disabled,
.mud-input-outlined.mud-disabled {
    background-color: var(--mud-palette-surface, #FFFFFF) !important;
    color: #334155 !important;
    opacity: 1 !important;
}

.mud-input-control .mud-input-root.mud-disabled .mud-input-slot,
.mud-input-control .mud-input-root.mud-disabled input,
.mud-input-control .mud-input-root.mud-disabled .mud-select-input {
    color: #334155 !important;
    -webkit-text-fill-color: #334155 !important;
    background-color: transparent !important;
    font-weight: 500;
}

.mud-input-control .mud-input-root.mud-disabled ~ .mud-input-label-outlined,
.mud-input-label-outlined.mud-disabled {
    color: #64748B !important;
}

/* Dark Mode Overrides */
.dark-mode .mud-input-outlined,
.dark-mode .mud-input-label-outlined,
.dark-mode .mud-input-label-animated,
.dark-mode .mud-input-control > .mud-input-control-input-container > .mud-input-label-outlined,
.dark-mode .mud-input-control .mud-input-root.mud-disabled,
.dark-mode .mud-input.mud-disabled,
.dark-mode .mud-input-outlined.mud-disabled {
    background-color: var(--mud-palette-surface, #1E293B) !important;
}

.dark-mode .mud-input-control .mud-input-root.mud-disabled .mud-input-slot,
.dark-mode .mud-input-control .mud-input-root.mud-disabled input,
.dark-mode .mud-input-control .mud-input-root.mud-disabled .mud-select-input {
    color: var(--mud-palette-text-primary, #F8FAFC) !important;
    -webkit-text-fill-color: var(--mud-palette-text-primary, #F8FAFC) !important;
}

/* ==========================================================
   Quill Editor Resizing & Scroll Overrides
   ========================================================== */
.ql-container.ql-snow {
    resize: vertical;
    overflow: auto;
    min-height: 250px;
    max-height: 900px;
}

/* Allow vertical resizing for all multi-line inputs (textareas) across the system */
textarea,
textarea.mud-input-slot {
    resize: vertical !important;
}




/* Smart Buttons for Master Data UI */
.smart-button {
    min-width: 80px;
    transition: all 0.2s ease;
}

.smart-button:hover {
    background-color: #e2e8f0 !important;
    transform: translateY(-2px);
}

/* ==========================================================
   Shared ERP Badges & Code Link Styling
   ========================================================== */
.code-link {
    color: var(--nexus-primary, #01757A);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none !important;
    border-bottom: none !important;
}

.code-link:hover {
    text-decoration: underline !important;
    border-bottom: none !important;
}

.rounded-1 {
    border-radius: 4px !important;
}

.nexus-soft-badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
}

.nexus-soft-badge-success,
.nexus-soft-badge.success {
    background-color: #D1FAE5 !important;
    color: #047857 !important;
}

.nexus-soft-badge-info,
.nexus-soft-badge.info {
    background-color: #E0F2FE !important;
    color: #0369A1 !important;
}

.nexus-soft-badge-warning,
.nexus-soft-badge.warning {
    background-color: #FEF3C7 !important;
    color: #B45309 !important;
}

.nexus-soft-badge-danger,
.nexus-soft-badge.danger,
.nexus-soft-badge-error,
.nexus-soft-badge.error {
    background-color: #FEE2E2 !important;
    color: #B91C1C !important;
}

.nexus-soft-badge-dark,
.nexus-soft-badge.dark {
    background-color: #E2E8F0 !important;
    color: #1E293B !important;
}

.nexus-soft-badge-secondary,
.nexus-soft-badge.secondary {
    background-color: #F1F5F9 !important;
    color: #475569 !important;
}

/* Global Master Page Layout & Teal utilities */
/* .master-page's background/layout is already defined near the top of this file using
   the --nx-bg/--nx-text variables (theme-aware); this used to be a second, later rule
   that hardcoded the light-mode values (#F8FAFC/#334155) with the same specificity,
   so it won the cascade and permanently overrode dark mode's background regardless of
   theme. Removed — keep only the variable-based definition. */
.text-teal {
    color: var(--nexus-primary, #01757A) !important;
}

/* ==========================================================
   Business Partner View Custom Input & Tab Styles (Theme-Aware)
   ========================================================== */
.erp-input .mud-input-outlined-border {
    border-color: #cbd5e1 !important;
    transition: all 0.2s ease;
}

.erp-input .mud-input:focus-within .mud-input-outlined-border {
    border-color: #3b82f6 !important;
    border-width: 2px !important;
}

.erp-input .mud-input-slot {
    color: #334155 !important;
    font-weight: 500;
}

.erp-input .mud-input-root.mud-disabled {
    background-color: #f8fafc !important;
    border-radius: 4px;
    opacity: 0.85;
}

.erp-tab {
    color: #475569 !important;
    text-transform: none !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px;
    padding: 12px 24px !important;
}

.mud-tabs-tab.mud-tab-active {
    color: var(--nexus-primary, #01757A) !important;
    background-color: white !important;
}

/* Dark Mode Overrides for Business Partner View */
.dark-mode .erp-input .mud-input-outlined-border {
    border-color: #30363d !important;
}

.dark-mode .erp-input .mud-input:focus-within .mud-input-outlined-border {
    border-color: var(--mud-palette-primary) !important;
}

.dark-mode .erp-input .mud-input-slot {
    color: var(--mud-palette-text-primary) !important;
}

.dark-mode .erp-input .mud-input-root.mud-disabled {
    background-color: var(--mud-palette-surface) !important;
    /* Slate-800 (#1E293B) - matches card bg */
    border-radius: 4px;
    opacity: 0.85;
}

.dark-mode .mud-tabs-tab.mud-tab-active {
    color: var(--mud-palette-primary) !important;
    background-color: var(--mud-palette-surface) !important;
}

/* ==========================================================
   MudBlazor Global Fix: Xóa underline khỏi Outlined inputs
   MudBlazor render ::before/::after underline trên .mud-input
   cho material-design effect — Outlined variant vẫn có, cần ẩn.
   Áp dụng toàn bộ hệ thống — không cần fix từng màn hình.
   ========================================================== */
.mud-input-outlined::before,
.mud-input-outlined::after {
    border-bottom: none !important;
    content: none !important;
}

/* ==========================================================
   Nexus Expansion Panels (Collapsible Cards / WordPress Style)
   ========================================================== */
.nexus-expansion-panels {
    background: transparent !important;
}

.nexus-expansion-panels .mud-expansion-panel {
    border: 1px solid var(--mud-palette-lines-default, #E2E8F0) !important;
    border-radius: 4px !important;
    background-color: var(--mud-palette-surface, #FFFFFF) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    margin-bottom: 1rem !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nexus-expansion-panels .mud-expansion-panel::before {
    display: none !important;
    /* Remove MudBlazor's default top separator lines */
}

.nexus-expansion-panels .mud-expansion-panel-header {
    padding: 12px 16px !important;
    min-height: 48px !important;
}

.nexus-expansion-panels .mud-expansion-panel-content {
    padding: 16px 20px 20px 20px !important;
    border-top: 1px solid var(--mud-palette-lines-default, #F1F5F9) !important;
}

.dark-mode .nexus-expansion-panels .mud-expansion-panel,
.dark-mode .nexus-expansion-panels .mud-expansion-panel-header,
.dark-mode .nexus-expansion-panels .mud-expansion-panel-content,
.dark-mode .nexus-expansion-panels .mud-collapse-container {
    background-color: var(--bg-card, #161b22) !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

/* ==========================================================
   Nexus Transaction/Master-Detail Table & Input Styling
   Standardizes grid controls, tables, and alignment globally.
   ========================================================== */
.master-page {
    background-color: var(--mud-palette-background-grey);
    color: var(--mud-palette-text-primary, #334155);
    min-height: 100vh;
    padding-bottom: 2rem;
}




.master-page .table td,
.master-page .table-responsive td {
    padding: 4px 8px !important;
    height: 48px;
    vertical-align: middle !important;
}

.master-page .table th,
.master-page .table-responsive th {
    padding: 8px 8px !important;
    vertical-align: middle !important;
}

.master-page .table input,
.master-page .table-responsive input {
    font-size: 0.9rem !important;
}

.master-page .table td .mud-input-control,
.master-page .table-responsive td .mud-input-control {
    margin-top: 0 !important;
    /* Bỏ khoảng trống chừa label của MudInput để input không trồi lệch dòng */
}

.master-page .table td .mud-input,
.master-page .table-responsive td .mud-input {
    width: 100% !important;
    /* MudInput mặc định co theo nội dung — ép trải hết cột để thẳng hàng với header */
}

.master-page .text-end-input input,
.master-page .table-responsive .text-end-input input {
    text-align: right !important;
    padding-right: 0 !important;
}

.master-page .text-end-input .mud-select-input,
.master-page .table-responsive .text-end-input .mud-select-input {
    text-align: right !important;
    justify-content: flex-end !important;
    flex-grow: 1 !important;
    padding-right: 16px !important;
}

/* ── Float-label mask: white bg behind outlined labels so fieldset border doesn't strike through ── */
.master-page .mud-input-control > .mud-input-control-input-container > .mud-input-label.mud-input-label-outlined.mud-input-label-inputcontrol {
    background-color: var(--mud-palette-surface) !important;
    padding: 0 4px !important;
    border-radius: 2px !important;
    max-width: calc(100% - 10px) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    z-index: 3 !important;
}

/* ══════════════════════════════════════════════════════════════
   User Guide Page
   ══════════════════════════════════════════════════════════════ */
/* Overrides the global `.master-page .card-body { flex-direction: column !important }`
   so the TOC sidebar sits BESIDE the content instead of stacked above it.
   !important is required here specifically because that global rule uses it —
   higher specificity alone does not win against an !important declaration. */
.master-page .card-body.guide-split {
    display: flex !important;
    flex-direction: row !important;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.guide-toc {
    width: 240px;
    flex-shrink: 0;
    border-right: 1px solid var(--mud-palette-lines-default);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.18s ease;
}

.guide-toc.collapsed {
    width: 52px;
}

.guide-toc-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    display: flex;
    align-items: center;
    gap: 4px;
}

.guide-toc.collapsed .guide-toc-header {
    padding: 0.75rem 0.5rem;
    justify-content: center;
}

.guide-toc-title {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.guide-toc.collapsed .guide-toc-title {
    display: none;
}

.guide-toc-toggle {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 4px;
    background: transparent;
    color: var(--mud-palette-text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.guide-toc-toggle:hover {
    background: var(--mud-palette-background-grey);
    color: var(--nx-primary, #01757A);
    border-color: var(--nx-primary, #01757A);
}

.guide-toc.collapsed .guide-toc-toggle {
    margin-left: 0;
}

.guide-toc-body {
    padding: 0.5rem 0;
    flex: 1;
    overflow-y: auto;
}

.guide-toc-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.82rem;
    color: var(--mud-palette-text-secondary);
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.guide-toc-item:hover {
    background: var(--mud-palette-background-grey);
    color: var(--nx-primary, #01757A);
    border-left-color: var(--nx-primary, #01757A);
}

.guide-toc-item.active {
    background: var(--mud-palette-background-grey);
    color: var(--nx-primary, #01757A);
    border-left-color: var(--nx-primary, #01757A);
    font-weight: 600;
}

.guide-toc.collapsed .guide-toc-item {
    justify-content: center;
    padding: 0.65rem 0;
}

.guide-toc-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.guide-toc.collapsed .guide-toc-label {
    display: none;
}

.guide-toc.collapsed .guide-toc-item .mud-icon-root {
    margin-right: 0 !important;
}

.guide-content {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 1.75rem 2.5rem 3rem;
}

.guide-steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 0.85rem;
    align-items: start;
}

.guide-steps-grid .guide-step {
    margin-bottom: 0;
    height: 100%;
}

/* ── PDF export ──
   "Xuất PDF" calls window.print(). Browsers rasterize nothing here — @page + @media print
   drive real, native A4 pagination, which is far more reliable than a DOM-to-canvas
   library (html2canvas) trying to rasterize a long, complex page: no risk of the tab
   freezing on a huge canvas, crisp vector text instead of a blurry bitmap, and correct
   page geometry because the browser's own print engine computes it, not JS math. */
.guide-pdf-index {
    display: none;
}

.guide-pdf-cover {
    text-align: center;
    padding: 3rem 1rem 2.5rem;
}

.guide-pdf-cover-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: var(--nx-primary, #01757A);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.guide-pdf-cover h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0 0 0.4rem;
    color: var(--mud-palette-text-primary);
}

.guide-pdf-cover-sub {
    font-size: 0.95rem;
    color: var(--mud-palette-text-secondary);
    margin: 0;
}

.guide-pdf-cover-date {
    font-size: 0.8rem;
    color: var(--mud-palette-text-secondary);
    margin: 0.35rem 0 0;
}

.guide-pdf-index-title {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--mud-palette-text-secondary);
    border-bottom: 2px solid var(--nx-primary, #01757A);
    padding-bottom: 0.5rem;
    margin: 0 0 1rem;
}

.guide-pdf-index-list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: guide-pdf-index;
}

.guide-pdf-index-list li {
    counter-increment: guide-pdf-index;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.65rem 0.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
    border-bottom: 1px dashed var(--mud-palette-lines-default);
}

.guide-pdf-index-list li::before {
    content: counter(guide-pdf-index, decimal-leading-zero);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--mud-palette-text-secondary);
    width: 22px;
    flex-shrink: 0;
}

.guide-pdf-index-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

@media print {
    /* BR-KHO-LBL-05: trang CÓ TÊN, chỉ cho Hướng dẫn sử dụng. Trước là @page không tên ⇒ áp cho MỌI trang in
       và đè khổ tem pallet (TSC/Godex) thành A4 có lề + tiêu đề trình duyệt. */
    @page user-guide {
        size: A4;
        margin: 15mm 12mm;
    }

    /* Print only #guideContent — hide the rest of the SPA shell (top nav, sidebar,
       breadcrumb, action bar) when printing the user guide. Scoped via :has to prevent
       hiding other print pages across the system. */
    body:has(#guideContent) * {
        visibility: hidden;
    }

    body:has(#guideContent) #guideContent,
    body:has(#guideContent) #guideContent * {
        visibility: visible;
    }

    #guideContent {
        page: user-guide;
        position: absolute;
        inset: 0;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        background: #ffffff !important;
        color: #1a1a1a !important;
    }

    .guide-pdf-index {
        display: block !important;
        page-break-after: always;
        break-after: page;
    }

    .guide-pdf-cover h1,
    .guide-pdf-index-list li {
        color: #1a1a1a !important;
    }

    .guide-steps-grid {
        grid-template-columns: 1fr !important;
    }

    .guide-section {
        page-break-before: always;
        break-before: page;
    }

    .guide-section:first-of-type {
        page-break-before: avoid;
        break-before: avoid;
    }

    .guide-step {
        page-break-inside: avoid;
        break-inside: avoid;
        background: #ffffff !important;
        border-color: #d0d5dd !important;
    }

    .guide-step-content h3,
    .guide-step-content p,
    .guide-step-content li,
    .guide-section-title,
    .guide-section-desc {
        color: #1a1a1a !important;
    }

    .guide-open-btn {
        display: none;
    }

    .guide-flow-diagram pre.mermaid,
    .guide-callout {
        background: #ffffff !important;
        border-color: #d0d5dd !important;
    }
}

.guide-section {
    margin-bottom: 2.5rem;
    scroll-margin-top: 1rem;
}

.guide-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--nx-primary, #01757A);
}

.guide-section-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.guide-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--mud-palette-text-primary);
    margin: 0;
}

.guide-section-desc {
    font-size: 0.85rem;
    color: var(--mud-palette-text-secondary);
    margin: 2px 0 0;
}

.guide-flow-diagram {
    margin: 1rem 0 1.25rem;
    max-width: 900px;
}

.guide-flow-diagram pre.mermaid {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
}

.guide-step {
    display: flex;
    gap: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-left: 3px solid var(--nx-primary, #01757A);
    border-radius: 8px;
}

.guide-step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--nx-primary, #01757A);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.guide-step-content {
    flex: 1;
    min-width: 0;
}

.guide-step-content h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--mud-palette-text-primary);
    margin: 0 0 0.4rem;
}

.guide-step-content p {
    font-size: 0.85rem;
    color: var(--mud-palette-text-secondary);
    margin-bottom: 0.4rem;
}

.guide-step-content ul {
    padding-left: 1.25rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.guide-step-content li {
    margin-bottom: 0.2rem;
    color: var(--mud-palette-text-secondary);
}

/* Real-screenshot preview: shown before the "Mở trang" button so the reader can see
   the actual screen (with the relevant control highlighted) before clicking through.
   Framed like a card — padding + tinted background + its own shadow on the image —
   rather than a raw screenshot glued flush to the edges. */
.guide-screenshot-wrap {
    margin: 0.75rem 0;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--mud-palette-lines-default);
    background: linear-gradient(180deg, #F8FAFC 0%, #EEF2F6 100%);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.05);
}

.guide-screenshot-wrap img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
    cursor: zoom-in;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.guide-screenshot-wrap img:hover {
    box-shadow: 0 4px 14px color-mix(in srgb, var(--nexus-primary, #01757A) 25%, transparent), 0 1px 4px rgba(15, 23, 42, 0.08);
    transform: scale(1.005);
}

.dark-mode .guide-screenshot-wrap {
    background: linear-gradient(180deg, #1E293B 0%, #17212F 100%);
    border-color: var(--mud-palette-lines-default);
}

.dark-mode .guide-screenshot-wrap img {
    border-color: rgba(255, 255, 255, 0.08);
}

/* Screenshot lightbox — click any guide screenshot to view it full-size.
   Toggled by JS (initGuideLightbox in index.html) adding/removing .visible;
   kept out of @media print so it never shows up in the exported PDF. */
.guide-lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: 48px;
    background: rgba(15, 23, 42, 0.86);
    cursor: zoom-out;
}

.guide-lightbox-overlay.visible {
    display: flex;
}

.guide-lightbox-overlay img {
    max-width: 92vw;
    max-height: 88vh;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    cursor: default;
}

.guide-lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease;
}

.guide-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.22);
}

@media print {
    .guide-lightbox-overlay {
        display: none !important;
    }
}

.guide-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: var(--nx-primary, #01757A);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 0.4rem;
    margin-right: 0.5rem;
}

.guide-open-btn:hover {
    background: #015A5E;
}

.guide-callout {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    font-size: 0.82rem;
    margin: 0.75rem 0;
}

.guide-callout-info {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.guide-callout-warn {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.guide-callout-tip {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

@media (max-width: 768px) {
    .guide-toc {
        display: none;
    }

    .guide-content {
        padding: 1rem;
    }
}
/* BR-KHO-MOVES-KPI-DRILL-01 — thẻ KPI bấm được (chỉ khi khai báo ClickKey).
   Thẻ không có khoá giữ nguyên hành vi tĩnh: không con trỏ tay, không hover, không viền focus. */
.nexus-stat-card-clickable {
    cursor: pointer;
    user-select: none;
}

.nexus-stat-card-clickable:hover {
    border-color: var(--nexus-primary, #01757A) !important;
    transform: translateY(-2px);
}

.nexus-stat-card-clickable:active {
    transform: translateY(0);
}

.nexus-stat-card-clickable:focus-visible {
    outline: 2px solid var(--nexus-primary, #01757A);
    outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════
   BR-UI-TWOLINE-CELL-01 — ô lưới hai dòng.

   Định nghĩa MỘT chỗ ở đây, dùng qua component <NexusTwoLineCell />.
   Cấm từng màn hình tự tô màu cho cặp mã + tên: đó chính là lý do cùng một
   cột Mã hàng mà lưới hiện xanh còn hộp thoại hiện đen (15/08/2026).
   ═══════════════════════════════════════════════════════════════════════ */
.nexus-cell-2line {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.nexus-cell-2line-primary {
    font-weight: 600;
    color: var(--nexus-primary-ink, #014D51);
}

.nexus-cell-2line-neutral .nexus-cell-2line-primary {
    color: #334155 !important;
    font-weight: 500;
}

.nexus-cell-2line-secondary {
    font-size: 0.8rem;
    color: var(--mud-palette-text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BR-UI-GRID-RESPONSIVE-01 — NexusDataGrid tự nén trên màn hình hẹp.

   Khách dùng màn desktop nhỏ. Đo trên /moves-history ở khung 1280px: bảng cần
   1839px trong khi khung chỉ 1154px — thừa 685px, buộc cuộn ngang để đọc hết
   một dòng. Cuộn ngang trong bảng là trải nghiệm tệ: đọc tới cột cuối thì mất
   dấu dòng đang xem.

   Ba đòn bẩy, KHÔNG giấu cột nào (giấu cột là mất dữ liệu):
     1. Thu nhỏ đệm ô — 12 cột × 32px đệm = 384px, cắt còn phân nửa.
     2. Thu nhỏ cỡ chữ một bậc.
     3. Hạ trần min-width mà từng màn đặt cứng (150-250px) xuống mức vừa đủ.

   Đặt ở đây theo class .erp-datagrid nên MỌI lưới trong hệ thống đều hưởng,
   không phải sửa từng màn. Màn hình >1440px giữ nguyên như cũ.
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1440px) {
    .erp-datagrid {
        --grid-th-font: 0.68rem;
        --grid-td-font: 0.80rem;
    }

    .erp-datagrid .mud-table-cell,
    .erp-datagrid th.mud-table-cell {
        padding: 7px 8px !important;
    }

    /* Trần min-width do từng màn đặt cứng — hạ xuống để bảng co được. */
    .erp-datagrid th[style*="min-width"],
    .erp-datagrid td[style*="min-width"] {
        min-width: 96px !important;
    }
}

@media (max-width: 1280px) {
    .erp-datagrid {
        --grid-th-font: 0.65rem;
        --grid-td-font: 0.76rem;
    }

    .erp-datagrid .mud-table-cell,
    .erp-datagrid th.mud-table-cell {
        padding: 6px 6px !important;
    }

    .erp-datagrid th[style*="min-width"],
    .erp-datagrid td[style*="min-width"] {
        min-width: 80px !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BR-UI-GRID-RESPONSIVE-01 — chế độ THẺ cho màn hẹp (≤ 991px).

   Mỗi dòng thành một thẻ: nhãn cột bên trái, giá trị bên phải, xếp dọc.
   Người dùng đọc trọn một bản ghi mà không cuộn ngang lấy một lần.

   Nhãn lấy từ data-label do nexus-datagrid.js dán vào; cột không có tiêu đề
   (ô chọn, nút thao tác) thì không in nhãn.

   Chỉ áp cho lưới mang class .nexus-grid-cards — component tự gắn, và tự
   TRÁNH những màn đã dựng bản riêng (xem ResponsiveGridRule).
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 991.98px) {
    .nexus-grid-cards table.mud-table-root thead {
        display: none;
    }

    .nexus-grid-cards table.mud-table-root,
    .nexus-grid-cards table.mud-table-root tbody,
    .nexus-grid-cards table.mud-table-root tr,
    .nexus-grid-cards table.mud-table-root td {
        display: block;
        width: auto;
    }

    .nexus-grid-cards table.mud-table-root tbody tr {
        border: 1px solid var(--mud-palette-lines-default);
        border-radius: 10px;
        margin: 0 0 12px 0;
        padding: 2px 0;
        background: var(--mud-palette-surface);

        /* Gỡ chiều cao dòng bị ép — xem giải thích ở khối .nexus-grid-cards-auto cuối file. */
        height: auto !important;
    }

    .nexus-grid-cards table.mud-table-root tbody td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        border: none !important;
        padding: 6px 12px !important;
        text-align: right;
        min-width: 0 !important;
    }

    .nexus-grid-cards table.mud-table-root tbody td::before {
        content: attr(data-label);
        flex: 0 0 40%;
        text-align: left;
        font-size: 0.78rem;
        font-weight: 400;
        color: var(--mud-palette-text-secondary);
    }

    /* Vạch mờ giữa các dòng trong thẻ — mắt lần theo từng cặp nhãn/giá trị, đỡ rối. */
    .nexus-grid-cards table.mud-table-root tbody td + td {
        border-top: 1px solid var(--mud-palette-lines-default) !important;
    }

    /* Ô rỗng chỉ làm thẻ dài thêm — bỏ hẳn. */
    .nexus-grid-cards table.mud-table-root tbody td:empty {
        display: none;
    }

    /* Cột phụ Bootstrap — xem giải thích ở khối .nexus-grid-cards-auto cuối file. */
    /* Chế độ thẻ không có gì để cuộn ngang — xem giải thích ở khối .nexus-grid-cards-auto. */
    .nexus-grid-cards .mud-table-container {
        overflow-x: hidden !important;
    }

    /* Ghim cột là khái niệm của cuộn ngang — trong chế độ thẻ không còn ý nghĩa. */
    .nexus-grid-cards .mud-table-cell.sticky-left,
    .nexus-grid-cards .nexus-sticky-col2,
    .nexus-grid-cards .mud-table-body .mud-table-row:nth-child(odd) .mud-table-cell.sticky-left,
    .nexus-grid-cards .mud-table-body .mud-table-row:nth-child(even) .mud-table-cell.sticky-left,
    .nexus-grid-cards .mud-table-body .mud-table-row:hover .mud-table-cell.sticky-left,
    .nexus-grid-cards .mud-table-body .mud-table-row:nth-child(odd) .nexus-sticky-col2,
    .nexus-grid-cards .mud-table-body .mud-table-row:nth-child(even) .nexus-sticky-col2,
    .nexus-grid-cards .mud-table-body .mud-table-row:hover .nexus-sticky-col2 {
        position: static !important;
        left: auto !important;
        background-color: transparent !important;
    }

    .nexus-grid-cards .mud-table-toolbar,
    .nexus-grid-cards .mud-grid-toolbar {
        display: none !important;
    }

    /* Ô hai dòng nằm trong thẻ thì căn phải cho thẳng cột giá trị. */
    .nexus-grid-cards table.mud-table-root tbody td .nexus-cell-2line {
        align-items: flex-end;
    }

    /* Dòng TỔNG — xem giải thích ở khối .nexus-grid-cards-auto cuối file.
       Sửa một khối thì phải sửa cả khối kia. */
    .nexus-grid-cards table.mud-table-root tfoot {
        display: block;
    }

    .nexus-grid-cards table.mud-table-root tfoot tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 4px 20px;
        padding: 10px 12px;
        margin-top: 4px;
        background: var(--mud-palette-background-grey);
        border: 1px solid var(--mud-palette-lines-default);
        border-radius: 10px;
    }

    .nexus-grid-cards table.mud-table-root tfoot td {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        width: auto !important;
        border: none !important;
        padding: 0 !important;
        white-space: nowrap;
        text-align: right;
    }

    .nexus-grid-cards table.mud-table-root tfoot td:empty {
        display: none;
    }

    .nexus-grid-cards table.mud-table-root tfoot td::before {
        content: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BR-UI-KPI-WRAP-01 — dải thẻ KPI phải xuống hàng trên màn hẹp.

   Sự cố: markup có sẵn class responsive (col-6 col-sm-4 col-md-2) nhưng bị
   style="width: 14.28%" inline ĐÈ LÊN, nên 7 thẻ luôn ép vào một hàng ở mọi
   kích thước. Ở khung 900px mỗi thẻ chỉ còn ~55px, số "62,099.00" bị bẻ dọc
   thành từng ký tự — không đọc nổi.

   Bài học: inline style thắng mọi class, nên đặt bề rộng inline là giết
   responsive. Bề rộng thuộc về CSS, không thuộc về markup.
   ═══════════════════════════════════════════════════════════════════════════ */
.nexus-kpi-col-7 {
    width: 14.2857%;
    padding: 0 6px;
}

@media (max-width: 1399.98px) {
    .nexus-kpi-col-7 { width: 25%; margin-bottom: 8px; }   /* 4 thẻ / hàng */
}

@media (max-width: 991.98px) {
    .nexus-kpi-col-7 { width: 33.3333%; }                  /* 3 thẻ / hàng */
}

@media (max-width: 575.98px) {
    .nexus-kpi-col-7 { width: 50%; }                       /* 2 thẻ / hàng */
}

/* Số liệu KPI: tuyệt đối không bẻ dòng giữa chừng — thà thu nhỏ chữ còn hơn
   để "62,099.00" vỡ thành 5 dòng. */
.stat-card .card-body > div {
    white-space: nowrap;
}

@media (max-width: 1399.98px) {
    .stat-card .card-body { padding: 6px 8px !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BR-UI-SECTION-COLLAPSE-01 — vùng thu gọn được (thanh lọc, dải KPI).

   Đo 15/08/2026 ở khung 900x790: thanh lọc + dải KPI chiếm ~520px, lưới chỉ còn
   ~2 dòng. Gấp cả hai lại trả về ~440px cho dữ liệu.

   Định nghĩa MỘT chỗ; màn hình chỉ việc bọc <NexusCollapsibleSection>.
   ═══════════════════════════════════════════════════════════════════════════ */
.nexus-section-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.nexus-section-head:hover {
    background: var(--mud-palette-background-grey);
}

.nexus-section-head:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: -2px;
}

.nexus-section-title {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--mud-palette-text-secondary);
}

.nexus-section-summary {
    font-size: 0.78rem;
    color: var(--mud-palette-text-secondary);
    opacity: 0.85;
    margin-left: 4px;
}

.nexus-section-caret {
    color: var(--mud-palette-text-secondary);
}

/* Gấp: ẩn bằng CSS chứ không gỡ khỏi DOM — mở lại không mất giá trị đang gõ dở
   trong ô lọc và không phải nạp lại dữ liệu. */
.nexus-section-collapsed > .nexus-section-body {
    display: none;
}

.nexus-section-collapsed > .nexus-section-head {
    border-bottom: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BR-UI-KPI-COMPACT-01 — thẻ KPI gọn lại, nhường chiều cao cho dữ liệu.

   Dải KPI đang ăn quá nhiều chiều cao: trên /sales-orders ở khung 900px, 6 thẻ
   chiếm ~290px trong khi lưới bên dưới trống trơn. Người dùng vào màn danh sách
   là để xem DANH SÁCH, KPI chỉ là phần phụ.

   Chỉnh MỘT chỗ ở đây, áp cho cả hai hook đang tồn tại:
     .nexus-stat-card  — component NexusStatCards (11 màn)
     .stat-card        — markup tự viết còn sót (6 màn)

   Màn nào viết markup bespoke hoàn toàn (không mang class nào) thì KHÔNG hưởng —
   phải chuyển sang <NexusStatCards> mới ăn theo. Xem code-standards §2.6.
   ═══════════════════════════════════════════════════════════════════════════ */
.nexus-stat-card {
    padding: 0.45rem 0.75rem !important;
}

.nexus-stat-card .nexus-stat-card-inner {
    padding: 0 !important;
    gap: 0.6rem !important;
}

.stat-card .card-body {
    padding: 0.45rem 0.75rem !important;
}

.nexus-stat-card .nexus-stat-value {
    font-size: 1.05rem !important;
    line-height: 1.15;
}

.nexus-stat-card .nexus-stat-label {
    font-size: 12px !important;
    line-height: 1.25;
    color: #475569 !important;
    font-weight: 600;
}

.nexus-stat-card .nexus-stat-icon {
    width: 30px !important;
    height: 30px !important;
}

.nexus-stat-card .nexus-stat-icon .mud-icon-root {
    font-size: 1rem !important;
}

/* Màn hẹp: gọn thêm một bậc nữa. */
@media (max-width: 1399.98px) {
    .nexus-stat-card,
    .stat-card .card-body {
        padding: 0.35rem 0.6rem !important;
    }

    .nexus-stat-card .nexus-stat-value {
        font-size: 0.95rem !important;
    }

    .nexus-stat-card .nexus-stat-icon {
        width: 26px !important;
        height: 26px !important;
    }
}

/* ============================================================
   BR-UI-TABLE-RESPONSIVE-01 — bang HTML thuan cung thanh the tren man nho
   ------------------------------------------------------------
   Do 15/08/2026: 59 man co @page van dung <table> thuan (128 the table).
   Rule cam <table> thuan, nhung chung DA ton tai va chuyen het sang
   NexusDataGrid la refactor lon o 59 man. Trong luc cho, chung bat nguoi
   dung man nho cuon ngang — thu trai nghiem te nhat.

   Lam o MOT cho: JS tu dan data-label cho moi table.table, CSS o day bien
   moi dong thanh mot the. Man hinh KHONG phai khai bao gi.
   Muon giu nguyen kieu bang: them lop "nexus-no-cards".
   ============================================================ */
@media (max-width: 991.98px) {

    /* Khong con can cuon ngang khi da xep thanh the. */
    .table-responsive:has(> table.table:not(.nexus-no-cards)) {
        overflow-x: unset !important;
    }

    table.table:not(.nexus-no-cards):not(.nexus-data-grid table) > thead {
        display: none !important;
    }

    table.table:not(.nexus-no-cards) > tbody {
        display: block !important;
    }

    table.table:not(.nexus-no-cards) > tbody > tr {
        display: block !important;
        border: 1px solid var(--grid-border, #E2E8F0) !important;
        border-radius: 8px;
        margin-bottom: 0.5rem;
        padding: 0.5rem 0.75rem;
        background: var(--mud-palette-surface, #FFF);
    }

    table.table:not(.nexus-no-cards) > tbody > tr > td {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        border: none !important;
        padding: 0.3rem 0 !important;
        text-align: right !important;
        white-space: normal !important;
    }

    /* Nhan cot lay tu data-label do JS dan vao. */
    table.table:not(.nexus-no-cards) > tbody > tr > td[data-label]:not([data-label=""])::before {
        content: attr(data-label);
        flex: 0 0 40%;
        text-align: left;
        font-size: 0.7rem;
        font-weight: 600;
        color: #64748B;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

    /* O khong co nhan (checkbox, nut thao tac) thi tra ve mot hang rieng. */
    table.table:not(.nexus-no-cards) > tbody > tr > td:not([data-label]),
    table.table:not(.nexus-no-cards) > tbody > tr > td[data-label=""] {
        justify-content: flex-end;
    }

    /* So lieu khong duoc vo dong — tha nho chu con hon vo. */
    table.table:not(.nexus-no-cards) > tbody > tr > td.text-end,
    table.table:not(.nexus-no-cards) > tbody > tr > td.text-right {
        white-space: nowrap !important;
    }

    /* Dong tong o tfoot: giu mot hang, khong bien thanh the. */
    table.table:not(.nexus-no-cards) > tfoot > tr > td {
        white-space: nowrap !important;
    }
}

/* ============================================================
   BR-UI-SHORTVIEWPORT-01 - man THAP thi nen chieu cao dong
   ------------------------------------------------------------
   Khung muc tieu da chot: 1366x768. Tru thanh trinh duyet con ~660px.
   Do that tren /expiry-report o dung khung do: moi dong cao 76px
   -> chi nhin thay ~5 dong. Nguoi dung vao man danh sach la de xem
   DANH SACH, 5 dong thi khong lam viec duoc.

   Nen ve 52px (dung con so rule §2.2 da dat) chi khi man THAP.
   Man cao van giu 76px cho thoang - khong danh doi tham my o man to
   de cuu man nho.
   ============================================================ */
@media (max-height: 800px) {
    /* Moc DUNG la .erp-datagrid (130 rule) - .nexus-data-grid khong khop phan tu nao
       luc chay, do that: document.querySelectorAll('.nexus-data-grid').length === 0. */
    .erp-datagrid tbody tr,
    .nexus-table tbody tr {
        height: 52px !important;
    }

    .erp-datagrid tbody td,
    .nexus-table tbody td {
        padding-top: 6px !important;
        padding-bottom: 6px !important;
    }

    /* O hai dong: thu dong phu lai chu khong bo di - bo di la mat du lieu. */
    .nexus-cell-2line .nexus-cell-2line-secondary {
        font-size: 0.68rem;
        line-height: 1.15;
    }

    /* Dai KPI cung phai nhuong chieu cao o man thap. */
    .nexus-stat-card-inner {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
}

/* ============================================================
   BR-UI-COLFIT-01 - man hep: thu nho cum bieu tuong o tieu de cot
   ------------------------------------------------------------
   Do that tren /expiry-report, khung muc tieu 1366x660:
     o tieu de cot UOM rong 160px, trong do chu "UOM" chi chiem 28px
     con .column-options chiem 116px (4 nut bieu tuong 26px + chi so sap xep)
     10 cot -> ~1160px cua bang 1360px la BIEU TUONG, khong phai du lieu
     bang thieu 110px so voi khung 1250px -> nguoi dung phai cuon ngang

   Thu nho nut 26px -> ~18px o man hep: tiet kiem ~8px x 4 nut x 10 cot = 320px,
   du bu 110px con thieu ma KHONG bo chuc nang nao (sap xep/loc/keo cot van con).
   Man rong giu nguyen kich thuoc thoai mai.
   ============================================================ */
@media (max-width: 1440px) {
    .erp-datagrid .column-options .mud-icon-button {
        padding: 2px !important;
        min-width: 0 !important;
        height: auto !important;
        width: auto !important;
    }

    .erp-datagrid .column-options .mud-icon-button .mud-icon-root {
        font-size: 1rem !important;
    }

    /* Khoang cach giua cac nut cung phai co lai theo. */
    .erp-datagrid .column-options {
        gap: 0 !important;
    }

    /* Bu not phan con thieu: padding ngang 8px -> 5px moi ben.
       Do that sau khi thu nho bieu tuong: bang 1288px / khung 1250px, con thieu 38px.
       Giam 3px x 2 ben x 10 cot = 60px, du bu ma khong lam bang qua chat. */
    .erp-datagrid table.mud-table-root th,
    .erp-datagrid table.mud-table-root td {
        padding-left: 5px !important;
        padding-right: 5px !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BR-UI-COLFIT-02 — CUNG luat nen o tren, nhung KHONG theo moc man hinh.
   Lop .nexus-grid-tight do nexus-datagrid.js gan khi DO THAY bang khong vua khung.

   Ly do: moc 1440px chon cho khung dich 1366px, con khach dung khung 1463px — rong
   hon moc nen quy tac khong chay, trong khi luoi van khong vua. Cuu ho bi tat dung
   luc con can. Do that 18/08/2026 tren /inventory-inquiry, khung 1463px, 10 cot:
   bang can 1766px trong khung 1337px; nen xong con 1499px.

   Nhan ban co y (giong khoi .nexus-grid-cards-auto): giu media query lam duong lui
   neu JS khong chay. Sua luat nen thi phai sua CA HAI khoi.
   ═══════════════════════════════════════════════════════════════════════════ */
.nexus-grid-tight .column-options .mud-icon-button {
    padding: 2px !important;
    min-width: 0 !important;
    height: auto !important;
    width: auto !important;
}

.nexus-grid-tight .column-options .mud-icon-button .mud-icon-root {
    font-size: 1rem !important;
}

.nexus-grid-tight .column-options {
    gap: 0 !important;
}

.nexus-grid-tight table.mud-table-root th,
.nexus-grid-tight table.mud-table-root td {
    padding-left: 5px !important;
    padding-right: 5px !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BR-UI-GRID-AUTOCARD-01 — CUNG luat the o tren, nhung KHONG theo moc man hinh.
   Lop .nexus-grid-cards-auto do nexus-datagrid.js gan khi do thay bang KHONG VUA
   khung. Ly do: man nhap phieu kho 14 cot o khung 1366 can 1940px trong khung
   1202px, ma 1366 > 991.98 nen moc co dinh khong bat.

   Nhan ban co y: giu nguyen khoi media query lam duong lui neu JS khong chay.
   Sua luat the thi phai sua CA HAI khoi.
   ═══════════════════════════════════════════════════════════════════════════ */
    .nexus-grid-cards-auto table.mud-table-root thead {
        display: none;
    }

    .nexus-grid-cards-auto table.mud-table-root,
    .nexus-grid-cards-auto table.mud-table-root tbody,
    .nexus-grid-cards-auto table.mud-table-root tr,
    .nexus-grid-cards-auto table.mud-table-root td {
        display: block;
        width: auto;
    }

    .nexus-grid-cards-auto table.mud-table-root tbody tr {
        border: 1px solid var(--mud-palette-lines-default);
        border-radius: 10px;
        margin: 0 0 12px 0;
        padding: 2px 0;
        background: var(--mud-palette-surface);

        /* BẮT BUỘC: gỡ chiều cao dòng bị ép bởi BR-UI-SHORTVIEWPORT-01
           (@media max-height:800px đặt tr { height: 52px !important }).
           Ở chế độ thẻ một dòng cần ~524px; giữ 52px thì nội dung tràn ra ngoài
           hộp dòng và dòng TỔNG rơi vào giữa thẻ — đã nhìn thấy thật. */
        height: auto !important;
    }

    .nexus-grid-cards-auto table.mud-table-root tbody td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        border: none !important;
        padding: 6px 12px !important;
        text-align: right;
        min-width: 0 !important;
    }

    .nexus-grid-cards-auto table.mud-table-root tbody td::before {
        content: attr(data-label);
        flex: 0 0 40%;
        text-align: left;
        font-size: 0.78rem;
        font-weight: 400;
        color: var(--mud-palette-text-secondary);
    }

    /* Vạch mờ giữa các dòng trong thẻ — mắt lần theo từng cặp nhãn/giá trị, đỡ rối. */
    .nexus-grid-cards-auto table.mud-table-root tbody td + td {
        border-top: 1px solid var(--mud-palette-lines-default) !important;
    }

    /* Ô rỗng chỉ làm thẻ dài thêm — bỏ hẳn. */
    .nexus-grid-cards-auto table.mud-table-root tbody td:empty {
        display: none;
    }

    /* 8 màn tự dựng bản mobile bằng cột phụ Bootstrap (d-none d-md-table-cell / d-md-none).
       Utility Bootstrap có !important nên đè luật thẻ ở trên -> ô vẫn nằm NGANG, thẻ không
       thành hình. Đo thật trên /transactions: hàng vẫn rộng 1738px trong khung 1250px dù
       lớp thẻ đã gắn và thead đã ẩn.
       Ở chế độ thẻ thì dùng CỘT DESKTOP (đủ dữ liệu) và tắt cột phụ mobile, tránh hiện hai lần. */
    /* Ở chế độ thẻ KHÔNG có gì để cuộn ngang. Nhưng <tr> vốn là hàng bảng vẫn giữ lại
       bề rộng cũ trong scrollWidth (đo trên /transactions: tr báo 1738px dù mọi ô con
       chỉ rộng 1248px và không con nào tràn) — nên khung vẫn cuộn được 489px vào
       VÙNG TRỐNG. Nhìn thì không thấy gì bị cắt, nhưng người dùng lỡ vuốt là nội dung
       trôi đi mất. Chặn hẳn — an toàn vì nội dung đã xếp dọc. */
    .nexus-grid-cards-auto .mud-table-container {
        overflow-x: hidden !important;
    }

    /* Ghim cột là khái niệm của cuộn ngang — trong chế độ thẻ không còn ý nghĩa. */
    .nexus-grid-cards-auto .mud-table-cell.sticky-left,
    .nexus-grid-cards-auto .nexus-sticky-col2,
    .nexus-grid-cards-auto .mud-table-body .mud-table-row:nth-child(odd) .mud-table-cell.sticky-left,
    .nexus-grid-cards-auto .mud-table-body .mud-table-row:nth-child(even) .mud-table-cell.sticky-left,
    .nexus-grid-cards-auto .mud-table-body .mud-table-row:hover .mud-table-cell.sticky-left,
    .nexus-grid-cards-auto .mud-table-body .mud-table-row:nth-child(odd) .nexus-sticky-col2,
    .nexus-grid-cards-auto .mud-table-body .mud-table-row:nth-child(even) .nexus-sticky-col2,
    .nexus-grid-cards-auto .mud-table-body .mud-table-row:hover .nexus-sticky-col2 {
        position: static !important;
        left: auto !important;
        background-color: transparent !important;
    }

    .nexus-grid-cards-auto .mud-table-toolbar,
    .nexus-grid-cards-auto .mud-grid-toolbar {
        display: none !important;
    }

    /* Ô hai dòng nằm trong thẻ thì căn phải cho thẳng cột giá trị. */
    .nexus-grid-cards-auto table.mud-table-root tbody td .nexus-cell-2line {
        align-items: flex-end;
    }

    /* Dòng TỔNG: table thành block nên tfoot mất chỗ và ĐÈ lên các thẻ
       (nhìn thấy thật: "Total:" nằm đè lên dòng Input Qty).
       Ghim nó thành một hàng riêng ở đáy. */
    .nexus-grid-cards-auto table.mud-table-root tfoot {
        display: block;
    }

    .nexus-grid-cards-auto table.mud-table-root tfoot tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 4px 20px;
        padding: 10px 12px;
        margin-top: 4px;
        background: var(--mud-palette-background-grey);
        border: 1px solid var(--mud-palette-lines-default);
        border-radius: 10px;
    }

    .nexus-grid-cards-auto table.mud-table-root tfoot td {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        width: auto !important;
        border: none !important;
        padding: 0 !important;
        white-space: nowrap;      /* số tổng không được vỡ dòng */
        text-align: right;
    }

    .nexus-grid-cards-auto table.mud-table-root tfoot td:empty {
        display: none;
    }

    /* tfoot không dán data-label nên đừng in nhãn rỗng. */
    .nexus-grid-cards-auto table.mud-table-root tfoot td::before {
        content: none;
    }

/* ============================================================================
   BR-MOB-UI-03 - An phan khong hop ly khi chay trong app cam tay
   ----------------------------------------------------------------------------
   An theo MOI TRUONG, khong theo be rong man hinh. An theo be rong thi nguoi
   dung web thu nho cua so se mat nut Xuat Excel - do la hoi quy, khong phai
   cai tien. Dau nhan biet .nexus-mobile-app do NexusErp.Mobile/wwwroot/app.html
   gan len the body, chi ton tai trong app MAUI.

     .nexus-action-desktop-only  - nut/thao tac chi hop voi desktop (Xuat Excel, in)
     .nexus-hide-in-app          - khoi noi dung thua tren may cam tay (footer ban quyen)
   ============================================================================ */
body.nexus-mobile-app .nexus-action-desktop-only,
body.nexus-mobile-app .nexus-hide-in-app {
    display: none !important;
}

/* BR-MOB-HRM-DATE-UI-01 - 2 o ngay dat canh nhau (col-6) tren man 360dp: padding 14px + nut lich
   48px lam "13/10/2026" bi cat thanh "13/10/202". Thu padding trai, nut lich con 32px, chu 15px. */
.mobile-date-compact .mud-input-slot {
    padding-left: 10px !important;
    padding-right: 0 !important;
    font-size: 15px !important;
    letter-spacing: -0.2px;
}
.mobile-date-compact .mud-input-adornment-end {
    margin-left: 0 !important;
}
.mobile-date-compact .mud-input-adornment-end .mud-icon-button {
    padding: 4px !important;
    margin-right: -6px !important;
}

/* BR-KHO-MOB-15 - Thanh menu day DUNG CHUNG (MobileAppBottomNav) cho MainLayout app + khung Kho.
   .nexus-app-only: an mac dinh, chi hien khi body co .nexus-mobile-app (app MAUI) - ban web
   dung chung MobileLayout nhung khong doi. An theo MOI TRUONG, khong theo be rong (BR-MOB-UI-03). */
.app-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--mud-palette-surface, #FFFFFF);
    border-top: 1px solid var(--mud-palette-lines-default, #E2E8F0);
    box-shadow: 0 -2px 8px rgba(15, 23, 42, 0.06);
}
.app-bottom-nav-item {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--mud-palette-text-secondary, #64748B);
    text-decoration: none !important;
    transition: color 0.2s ease-in-out;
}
.app-bottom-nav-item .app-bottom-nav-label {
    margin-top: 2px;
    font-size: 10px;
    font-weight: 600;
}
.app-bottom-nav-item.active {
    color: var(--mud-palette-primary, #01757A);
}
.app-bottom-nav-item:active {
    background-color: var(--mud-palette-action-default-hover, rgba(0, 0, 0, 0.04));
}
.app-bottom-nav.nexus-app-only {
    display: none !important;
}
body.nexus-mobile-app .app-bottom-nav.nexus-app-only {
    display: flex !important;
}
/* Khung Kho trong app: chua cho thanh menu (60px) + thanh gat cu chi */
body.nexus-mobile-app .mobile-shell-body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
}
/* Thanh nut co dinh day man Kho (vd "Nhan hang") dat TREN thanh menu, khong de len nhau.
   !important vi thanh nay dat bottom:0 bang style inline. */
body.nexus-mobile-app .wms-sticky-action {
    bottom: calc(60px + env(safe-area-inset-bottom, 0px)) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BR-UI-CARD-LAYOUT-01 — bo cuc BEN TRONG the (thiet ke lai 15/08/2026)

   Ban dau bung nguyen bo cuc "nhan trai / gia tri phai" von danh cho dien thoai
   375px len the rong 1550px -> moi dong co ~1200px TRONG o giua, the cao ~380px
   cho MOT dong chung tu, mat phai quet ngang 1550px de noi nhan voi gia tri.

   Thiet ke lai:
     - nhan DAT TREN gia tri, khong phai trai-phai
     - luoi nhieu cot tu co: auto-fit minmax(210px, 1fr) -> ~5 cot o khung 1250px
     - so thu tu + trang thai + nut xoa = hang tieu de the
     - bo duong ke giua cac truong, nhom bang KHOANG CACH
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── che do the tu dong (luoi khong vua khung) ── */
.nexus-grid-cards-auto table.mud-table-root tbody tr {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0 24px;
    align-items: start;
    padding: 10px 16px 12px !important;
}

.nexus-grid-cards-auto table.mud-table-root tbody td {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 1px;
    min-width: 0 !important;
    border: none !important;
    padding: 5px 0 !important;
    text-align: left !important;
}

/* Nhãn ĐẶT TRÊN giá trị — mắt không phải quét ngang 1.550px để nối cặp. */
.nexus-grid-cards-auto table.mud-table-root tbody td::before {
    content: attr(data-label);
    flex: none;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Bỏ đường kẻ giữa các trường — trong lưới nhiều cột nó thành vạch ngang vô nghĩa.
   Nhóm bằng KHOẢNG CÁCH, ít nhiễu hơn đường kẻ. */
.nexus-grid-cards-auto table.mud-table-root tbody td + td {
    border-top: none !important;
}

/* Giá trị: chữ trái, KHÔNG căn phải nữa vì nhãn đã nằm ngay trên. */
.nexus-grid-cards-auto table.mud-table-root tbody td.text-end,
.nexus-grid-cards-auto table.mud-table-root tbody td.text-right {
    text-align: left !important;
}

/* Ô DỮ LIỆU trong thẻ — màn hình hay đặt inline "width/max-width" cho cột hẹp vì
   ở DẠNG BẢNG nó là cột hẹp. Sang chế độ thẻ, bề rộng cứng làm ô thụt vào giữa
   làn 210px. Inline style thắng mọi selector thường nên phải !important.
   CHỈ áp cho ô có nhãn — ô thao tác có luật riêng ghim ở góc trên phải thẻ,
   đè lên nó thì biểu tượng văng ra 215px (đo 18/08/2026). */
.nexus-grid-cards-auto table.mud-table-root tbody td[data-label] {
    width: auto !important;
    max-width: none !important;
    align-items: flex-start !important;
}

/* Phù hiệu / thẻ trạng thái trong ô: để nguyên bề rộng của chữ, đừng kéo giãn
   hết làn rồi tự canh giữa — đó là lý do giá trị lệch phải so với nhãn. */
.nexus-grid-cards-auto table.mud-table-root tbody td > .nexus-soft-badge,
.nexus-grid-cards-auto table.mud-table-root tbody td > .mud-chip {
    align-self: flex-start;
}

/* Ô nhập chiếm trọn bề ngang cột của nó. */
.nexus-grid-cards-auto table.mud-table-root tbody td .mud-input-control,
.nexus-grid-cards-auto table.mud-table-root tbody td .mud-select,
.nexus-grid-cards-auto table.mud-table-root tbody td .mud-picker,
.nexus-grid-cards-auto table.mud-table-root tbody td > .d-flex {
    width: 100% !important;
}

/* HÀNG TIÊU ĐỀ thẻ: số thứ tự bên trái, nút thao tác bên phải — CÙNG một hàng.
   Đặt vị trí tường minh (grid-row: 1) vì để lưới tự xếp thì cụm nút rơi xuống một
   hàng riêng ở đáy, tốn ~30px mà chẳng chứa gì. */
.nexus-grid-cards-auto table.mud-table-root tbody td[data-label="#"] {
    grid-row: 1;
    grid-column: 1 / -2;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px !important;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--mud-palette-lines-default) !important;
    font-weight: 700;
}

.nexus-grid-cards-auto table.mud-table-root tbody td[data-label="#"]::before {
    content: "#";
    font-size: 0.7rem;
    color: var(--mud-palette-text-disabled);
}

/* Con so phai nam SAT nhan "#", khong dat sang phai canh nut xoa —
   de vay doc thanh "1 [xoa]" chu khong phai "#1". */
.nexus-grid-cards-auto table.mud-table-root tbody td[data-label="#"] > * {
    text-align: left !important;
    margin-right: auto;
}

/* BR-UI-CARD-EMPTY-01 — o RONG bien mat han, khong de lai nhan tro.
   nexus-datagrid.js danh dau data-empty, va CHI danh cho o khong co gi de nhap. */
.nexus-grid-cards-auto table.mud-table-root tbody td[data-empty] {
    display: none !important;
}

/* Ma dai (vi tri kho: WH-TP-A-R01-A01-B001-L01-D01) duoc ngat o dau gach,
   khong cat giua ky tu. */
.nexus-grid-cards-auto table.mud-table-root tbody td {
    overflow-wrap: anywhere;
    word-break: normal;
}

.nexus-grid-cards-auto table.mud-table-root tbody td:not([data-label]),
.nexus-grid-cards-auto table.mud-table-root tbody td[data-label=""] {
    grid-row: 1;
    grid-column: -2 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 8px !important;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--mud-palette-lines-default) !important;
}

/* Ô hai dòng nằm trong thẻ: căn trái cho thẳng cột nhãn. */
.nexus-grid-cards-auto table.mud-table-root tbody td .nexus-cell-2line {
    align-items: flex-start;
}

/* BR-UI-CARD-LAYOUT-01 cho che do the theo moc man hinh — sua khoi nay thi phai
   sua ca khoi .nexus-grid-cards-auto o cuoi file. */
@media (max-width: 991.98px) {

/* ── che do the theo moc man hinh ── */
.nexus-grid-cards table.mud-table-root tbody tr {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0 24px;
    align-items: start;
    padding: 10px 16px 12px !important;
}

.nexus-grid-cards table.mud-table-root tbody td {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 1px;
    min-width: 0 !important;
    border: none !important;
    padding: 5px 0 !important;
    text-align: left !important;
}

/* Nhãn ĐẶT TRÊN giá trị — mắt không phải quét ngang 1.550px để nối cặp. */
.nexus-grid-cards table.mud-table-root tbody td::before {
    content: attr(data-label);
    flex: none;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Bỏ đường kẻ giữa các trường — trong lưới nhiều cột nó thành vạch ngang vô nghĩa.
   Nhóm bằng KHOẢNG CÁCH, ít nhiễu hơn đường kẻ. */
.nexus-grid-cards table.mud-table-root tbody td + td {
    border-top: none !important;
}

/* Giá trị: chữ trái, KHÔNG căn phải nữa vì nhãn đã nằm ngay trên. */
.nexus-grid-cards table.mud-table-root tbody td.text-end,
.nexus-grid-cards table.mud-table-root tbody td.text-right {
    text-align: left !important;
}

/* Ô nhập chiếm trọn bề ngang cột của nó. */
.nexus-grid-cards table.mud-table-root tbody td .mud-input-control,
.nexus-grid-cards table.mud-table-root tbody td .mud-select,
.nexus-grid-cards table.mud-table-root tbody td .mud-picker,
.nexus-grid-cards table.mud-table-root tbody td > .d-flex {
    width: 100% !important;
}

/* HÀNG TIÊU ĐỀ thẻ: số thứ tự bên trái, nút thao tác bên phải — CÙNG một hàng.
   Đặt vị trí tường minh (grid-row: 1) vì để lưới tự xếp thì cụm nút rơi xuống một
   hàng riêng ở đáy, tốn ~30px mà chẳng chứa gì. */
.nexus-grid-cards table.mud-table-root tbody td[data-label="#"] {
    grid-row: 1;
    grid-column: 1 / -2;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px !important;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--mud-palette-lines-default) !important;
    font-weight: 700;
}

.nexus-grid-cards table.mud-table-root tbody td[data-label="#"]::before {
    content: "#";
    font-size: 0.7rem;
    color: var(--mud-palette-text-disabled);
}

/* Con so phai nam SAT nhan "#", khong dat sang phai canh nut xoa —
   de vay doc thanh "1 [xoa]" chu khong phai "#1". */
.nexus-grid-cards table.mud-table-root tbody td[data-label="#"] > * {
    text-align: left !important;
    margin-right: auto;
}

/* BR-UI-CARD-EMPTY-01 — o RONG bien mat han, khong de lai nhan tro.
   nexus-datagrid.js danh dau data-empty, va CHI danh cho o khong co gi de nhap. */
.nexus-grid-cards table.mud-table-root tbody td[data-empty] {
    display: none !important;
}

/* Ma dai (vi tri kho: WH-TP-A-R01-A01-B001-L01-D01) duoc ngat o dau gach,
   khong cat giua ky tu. */
.nexus-grid-cards table.mud-table-root tbody td {
    overflow-wrap: anywhere;
    word-break: normal;
}

.nexus-grid-cards table.mud-table-root tbody td:not([data-label]),
.nexus-grid-cards table.mud-table-root tbody td[data-label=""] {
    grid-row: 1;
    grid-column: -2 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 8px !important;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--mud-palette-lines-default) !important;
}

/* Ô hai dòng nằm trong thẻ: căn trái cho thẳng cột nhãn. */
.nexus-grid-cards table.mud-table-root tbody td .nexus-cell-2line {
    align-items: flex-start;
}
}

/* ═══════════════════════════════════════════════════════════════════════════
   BR-UI-GRID-BANDS-01 — mot dong vat tu tach thanh 2-3 BANG khi khung hep

   Khac che do the o cho quyet dinh:
     - The : moi TRUONG mot dong -> mat truc so sanh giua cac vat tu
     - Bang: giu nguyen luoi cot, chi cho cot tran xuong hang duoi -> cot "SL nhap"
             cua MOI vat tu van nam dung mot cot, ra mat xuong van so sanh duoc

   Do tren /transaction-edit: the 231px moi dong · bang 2 khoang 96px · bang 52px.

   JS (nexus-datagrid.js) tinh so cot moi bang roi dat --nexus-band-cols va danh dau
   data-band cho tung o. nth-child khong nhan bien CSS nen phai danh dau o JS.
   ═══════════════════════════════════════════════════════════════════════════ */
.nexus-grid-bands table.mud-table-root thead tr,
.nexus-grid-bands table.mud-table-root tbody tr {
    display: grid !important;
    /* JS dat --nexus-band-template khi cot dau la cot hep (so thu tu): lan 1 dung
       be rong that cua no, phan du chia deu cho cac cot that (BR-UI-GRID-BANDS-03). */
    grid-template-columns: var(--nexus-band-template, repeat(var(--nexus-band-cols, 6), minmax(0, 1fr)));
    align-items: center;
    column-gap: 10px;
}

.nexus-grid-bands table.mud-table-root thead,
.nexus-grid-bands table.mud-table-root tbody {
    display: block !important;
}

.nexus-grid-bands table.mud-table-root tbody tr {
    padding: 8px 10px !important;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    height: auto !important;   /* go chieu cao ep boi BR-UI-SHORTVIEWPORT-01 */
}

.nexus-grid-bands table.mud-table-root th,
.nexus-grid-bands table.mud-table-root td {
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    /* Man hinh dat inline "max-width: 40px" cho cot #. Inline thang moi selector thuong,
       va width:auto khong go duoc max-width -> o tieu de chi rong 40px trong lan 133px,
       ho ra khe 103px. Do la doan hut dai nhat cua duong ke. Phai go ca max-width. */
    max-width: none !important;
    border: none !important;
    /* MudBlazor ve duong ke duoi tieu de bang box-shadow inset TREN TUNG O, khong phai
       border. "border: none" khong dung toi box-shadow, nen duong ke van dut tai moi
       khe cot -> con lai mot duong mo dut quang. Duong lien mach da ve o thead. */
    box-shadow: none !important;
    padding: 4px 2px !important;
    white-space: normal;
}

/* DIEM 1 — duong ke ngang duoi tieu de phai LIEN MACH.
   Bo border xuong tung o thi moi o ve mot doan, con khoang cach cot (column-gap)
   thi khong ai ve -> duong ke dut thanh tung khuc. Ve o THEAD (phan tu block trai
   het be ngang) moi lien mach. Khach chi ra: "line ngang bi che". */
.nexus-grid-bands table.mud-table-root thead {
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

/* Thanh trang trí teal 3px (thead::before) ve cho tieu de MOT hang. Sang che do bang,
   cac o tieu de nen trang de len no khong deu -> nhin nhu duong ke bi dut tung khuc.
   Trang tri ma ra rac thi bo han; duong ke duoi thead o tren da lien mach roi. */
.nexus-grid-bands table.mud-table-root thead::before {
    content: none !important;
}

.nexus-grid-bands table.mud-table-root thead tr {
    border: none !important;
    /* Hang du lieu co padding 8px 10px; hang tieu de khong -> hai luoi khac be ngang 21px,
       cot lech dan tu +10px den -7px. Hai hang phai cung padding NGANG thi cot moi thang. */
    padding: 0 10px !important;
}

/* DIEM 2 — nut xoa dong ve CUOI dong.
   O thao tac khong mang data-label; de luoi tu xep thi no roi vao khe trong ke sau
   o cuoi cung co du lieu, nam lung chung giua bang. Ep vao cot cuoi cua hang cuoi. */
.nexus-grid-bands table.mud-table-root tbody td:not([data-label]),
.nexus-grid-bands table.mud-table-root tbody td[data-label=""] {
    grid-column: -2 / -1;
    justify-self: end;
    align-self: center;
}

/* Lan 1 danh RIENG cho cot so thu tu, nen o dau cua bang 2,3 phai bat dau tu lan 2.
   Khong ep thi no roi vao lan hep 40px va bi bop (BR-UI-GRID-BANDS-03). */
.nexus-grid-bands table.mud-table-root tbody td[data-band-start] {
    grid-column-start: 2;
}

/* Tieu de chi mo ta bang 1 — bang 2,3 in nhan ngay trong o. */
.nexus-grid-bands table.mud-table-root thead th[data-band] {
    display: none !important;
}

.nexus-grid-bands table.mud-table-root tbody td[data-band]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* O nhap chiem tron be ngang cot cua no. */
.nexus-grid-bands table.mud-table-root tbody td .mud-input-control,
.nexus-grid-bands table.mud-table-root tbody td .mud-select,
.nexus-grid-bands table.mud-table-root tbody td .mud-picker {
    width: 100% !important;
}

/* Ghim cot la khai niem cua cuon ngang — chia bang roi thi khong con y nghia. */
.nexus-grid-bands .mud-table-cell.sticky-left,
.nexus-grid-bands .nexus-sticky-col2,
.nexus-grid-bands .mud-table-body .mud-table-row:nth-child(odd) .mud-table-cell.sticky-left,
.nexus-grid-bands .mud-table-body .mud-table-row:nth-child(even) .mud-table-cell.sticky-left,
.nexus-grid-bands .mud-table-body .mud-table-row:hover .mud-table-cell.sticky-left,
.nexus-grid-bands .mud-table-body .mud-table-row:nth-child(odd) .nexus-sticky-col2,
.nexus-grid-bands .mud-table-body .mud-table-row:nth-child(even) .nexus-sticky-col2,
.nexus-grid-bands .mud-table-body .mud-table-row:hover .nexus-sticky-col2 {
    position: static !important;
    left: auto !important;
    background-color: transparent !important;
}

/* Khong con gi de cuon ngang. */
.nexus-grid-bands .mud-table-container {
    overflow-x: hidden !important;
}

/* Dong TONG giu mot hang rieng o day. */
.nexus-grid-bands table.mud-table-root tfoot {
    display: block !important;
}

.nexus-grid-bands table.mud-table-root tfoot tr {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 20px;
    padding: 10px;
    background: var(--mud-palette-background-grey);
    border-top: 1px solid var(--mud-palette-lines-default);
}

.nexus-grid-bands table.mud-table-root tfoot td {
    display: inline-flex !important;
    width: auto !important;
    white-space: nowrap;
}

.nexus-grid-bands table.mud-table-root tfoot td:empty {
    display: none !important;
}


/* ── Date picker popup must not inherit the field's width ───────────────────────────────
   MudBlazor 8 copies a picker's Style onto its popover paper as well as its input. A
   screen writing Style="max-width:145px" to keep the filter field narrow therefore also
   clamps the calendar, which needs 310px. Measured on the P/L screen: the calendar
   container rendered 310px inside a .mud-picker-paper pinned to 145px, so the popup showed
   three weekday columns and a vertically clipped header.
   Scoped to the popover paper only — the field itself keeps whatever width the screen set. */
.mud-picker-inline-paper .mud-picker-paper,
.mud-popover .mud-picker-paper {
    max-width: none !important;
    min-width: max-content;
    width: auto !important;
}
.mud-picker-inline-paper .mud-picker-container,
.mud-popover .mud-picker-container { width: auto; }

/* Field width stays with each screen — see the date filters, which state a width that
   clears a full dd/MM/yyyy plus its icons. */

/* A field the last save rejected. Needed because rules written over a whole model have no input
   to bind to, so MudForm cannot colour them and the toast was the only signal — it named the rule
   but not the place, leaving the user to hunt for it. */
.fwd-field-rejected {
    border: 1px solid var(--mud-palette-error) !important;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--mud-palette-error) 18%, transparent);
}
.fwd-rejected-label { color: var(--mud-palette-error); }

/* ── Dropdown / Autocomplete & Select Popover Max-Height ───────────────────────
   MudBlazor sets inline style "max-height: 300px" on relative-width popovers (MudAutocomplete
   and MudSelect), which can expand excessively and obscure inputs or preceding table rows.
   Enforce compact height (200px) and geometric sharpness (4px radius) across all modules in ERP. */
.mud-popover.mud-popover-relative-width {
    max-height: 200px !important;
    border-radius: 4px !important;
}

.mud-popover.mud-popover-relative-width .mud-list {
    max-height: 200px !important;
}

/* ── FWD: loại phiếu Tạm ứng / Thanh toán (BR-FWD-ADV-13) ─────────────────────── */
.fwd-adv-type { gap: 12px; padding: 0 0 8px; border-bottom: 1px solid var(--mud-palette-lines-default); }
.fwd-adv-type-label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
                      color: var(--mud-palette-text-secondary); white-space: nowrap; }
/* MudRadioGroup lồng con một cấp — cả hai cấp phải flex thì hai lựa chọn mới nằm cùng hàng. */
.fwd-adv-type-radio, .fwd-adv-type-radio > div { display: flex !important; flex-direction: row; align-items: center; gap: 4px; }
.fwd-adv-type-radio .mud-radio { margin: 0; white-space: nowrap; }
.fwd-adv-type-radio .mud-radio .mud-icon-button { padding: 3px; }
.fwd-adv-type-hint { font-size: 12px; color: var(--mud-palette-text-secondary); }

.fwd-adv-type-badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; line-height: 1.4;
                      padding: 1px 8px; border-radius: 4px; white-space: nowrap;
                      border: 1px solid var(--mud-palette-lines-default); color: var(--mud-palette-text-primary); }
.fwd-adv-type-badge.is-payment { border-color: color-mix(in srgb, var(--nexus-primary, #01757A) 35%, transparent); background: color-mix(in srgb, var(--nexus-primary, #01757A) 8%, transparent); color: var(--mud-palette-primary); }

/* ── FWD: thu tiền khách của job + Debit Note chi hộ (BR-FWD-COL-03, BR-FWD-DN-01) ── */
.fwd-collection { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 20px; font-size: 13px; }
.fwd-collection-item { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.fwd-collection-item .lbl { font-size: 12px; color: var(--mud-palette-text-secondary); }
.fwd-collection-item .val { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--mud-palette-text-primary); }
.fwd-collection-item .val.is-due { color: var(--mud-palette-error); }

/* BR-FWD-STL-03..10 — quyết toán tạm ứng (hộp chi tiết phiếu + hộp lập quyết toán) */
.fwd-stl-panel { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--mud-palette-lines-default); border-left: 3px solid var(--nexus-primary, #01757A); border-radius: 4px; background: var(--mud-palette-surface); }
.fwd-stl-title { font-size: .72rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; color: var(--nexus-primary, #01757A); }
.fwd-stl-status { font-size: .72rem; font-weight: 650; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; }
.fwd-stl-status.s-0 { color: #B45309; }
.fwd-stl-status.s-1 { color: #0369A1; }
.fwd-stl-status.s-2 { color: #047857; }
.fwd-stl-status.s-9 { color: #B91C1C; }
.fwd-stl-status.s-none { color: #B45309; background: #FFFBEB; border-color: #FCD34D; }
.fwd-stl-totals { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; margin-bottom: 6px; }
.fwd-stl-totals > div { display: inline-flex; flex-direction: column; }
.fwd-stl-totals .lbl { font-size: 11px; color: var(--mud-palette-text-secondary); }
.fwd-stl-totals .val { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fwd-stl-totals .is-surplus .val { color: #B45309; }
.fwd-stl-totals .is-shortfall .val { color: #B91C1C; }
.fwd-stl-totals .is-full .val { color: #047857; }
.fwd-stl-lines { width: 100%; border-collapse: collapse; font-size: .8rem; }
.fwd-stl-lines th { text-align: left; font-size: .68rem; font-weight: 700; text-transform: uppercase; color: var(--mud-palette-text-secondary); padding: 6px; border-bottom: 1px solid var(--mud-palette-lines-default); white-space: nowrap; }
.fwd-stl-lines td { padding: 4px 6px; border-bottom: 1px solid var(--mud-palette-lines-default); vertical-align: middle; }
.fwd-stl-lines .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fwd-stl-lines.compact td { padding: 4px 6px; }
.fwd-stl-extra { margin-left: 6px; font-size: .66rem; padding: 0 6px; border-radius: 4px; background: #F1F5F9; color: #475569; }
.fwd-stl-clear { margin-top: 8px; padding: 8px 10px; border-radius: 4px; background: #ECFEFF; border: 1px solid #67E8F9; display: flex; flex-direction: column; gap: 6px; }

/* UI-LOOKUP-01 — chân danh sách NxLookup: số dòng đang hiện + tải thêm khi cuộn tới */
.nx-lookup-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 6px;
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary);
    border-top: 1px solid var(--mud-palette-lines-default);
    position: relative;
    cursor: default;
    user-select: none;
}
.nx-lookup-footer .mud-button-root { margin-left: auto; min-width: 0; padding: 0 6px; font-size: 0.75rem; }
.nx-lookup-footer .nx-lookup-spin { width: 14px !important; height: 14px !important; }
.nx-lookup-sentinel { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; pointer-events: none; }

/* Header Job (DocumentationEdit): ô ngày chỉ cần ~190px (dd/MM/yyyy + lịch); phần còn lại chia cho Phụ trách nghiệp vụ /
   Nhân viên KD để hiện đủ "Mã - Họ tên" khi có mũi tên + nút xoá (UI-LOOKUP-02). Chỉ áp từ màn hình sm trở lên. */
@media (min-width: 600px) {
    .fwd-zone-body .mud-grid-item.fwd-hdr-date { flex: 0 0 190px; max-width: 190px; }
    .fwd-zone-body .mud-grid-item.fwd-hdr-person { flex: 1 1 0; max-width: none; }
}

/* UI-FILTER-01 (2026-10-10) — hàng điều kiện tìm kiếm màn danh sách, theo mẫu màn Quản lý OPS:
   nằm dưới hàng tiêu đề, có đường kẻ trên; ô có độ rộng cố định, nằm sát nhau (BR-UI-VISUAL-QA-01). */
.nx-filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 10px; border-top: 1px solid var(--border-color); }
/* Ô lọc MudBlazor có khoảng đệm dưới riêng — bỏ đi để ô và nút cùng một đường giữa khi xuống dòng. */
.nx-filter-row .mud-input-control { margin-top: 0 !important; margin-bottom: 0 !important; }
.nx-filter-cell { flex: 1 1 165px; min-width: 145px; }
.nx-filter-cell.nx-filter-sm { flex: 0.85 1 140px; min-width: 130px; }
.nx-filter-cell.nx-filter-lg { flex: 1.4 1 220px; min-width: 180px; }
.nx-filter-cell.nx-filter-xl { flex: 1.8 1 280px; min-width: 220px; }
.nx-filter-cell.nx-filter-date { flex: 1 1 165px; min-width: 150px; }
.nx-filter-actions { flex-shrink: 0; display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nx-filter-actions .mud-button-root { height: 40px !important; }
/* Nhãn mềm dùng chung cho cột loại / trạng thái / hình thức (cùng màu màn OPS). */
.nx-badge.nx-badge-green { background: #DEF7EC; color: #03543F; }
.nx-badge.nx-badge-amber { background: #FEF3C7; color: #B45309; }
.nx-badge.nx-badge-blue  { background: #E0F2FE; color: #0369A1; }
.nx-badge.nx-badge-red   { background: #FDE8E8; color: #9B1C1C; }
.nx-badge.nx-badge-grey  { background: #F3F4F6; color: #4B5563; }

/* ══════════════════════════════════════════════════════════════
   BR-SYS-PAGE-ERROR-01 — thẻ lỗi của NexusPageErrorBoundary
   (thay banner "An unhandled error has occurred" khi trang con lỗi)
   ══════════════════════════════════════════════════════════════ */
.nexus-page-error {
    display: flex;
    justify-content: center;
    padding: 48px 16px;
}

.nexus-page-error-card {
    width: 100%;
    max-width: 480px;
    padding: 28px 24px !important;
    border-radius: 4px !important;
    border: 1px solid #E2E8F0 !important;
    background: var(--mud-palette-surface) !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.nexus-page-error-icon {
    color: var(--nexus-primary, #01757A) !important;
    font-size: 2.5rem !important;
}

.nexus-page-error-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

.nexus-page-error-text {
    font-size: 0.875rem;
    color: var(--mud-palette-text-secondary);
    line-height: 1.5;
}

.nexus-page-error-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--mud-palette-text-secondary);
}

.nexus-page-error-retry {
    margin-top: 6px;
    border-radius: 4px !important;
    text-transform: none !important;
}

.nexus-page-error-progress {
    border-radius: 0 !important;
}

/* BR-FIN-UI-07 (2026-10-15) — Báo cáo tuổi nợ: một thanh phân bổ dư nợ theo nhóm tuổi.
   Màu nói mức độ rủi ro: chưa đến hạn = Teal, càng quá hạn càng nóng (vàng → cam → đỏ). Không dùng tím. */
.fin-aging-dist {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 4px;
    padding: 0.75rem 1rem;
    background: var(--mud-palette-surface);
}

.fin-aging-bar {
    display: flex;
    height: 14px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--mud-palette-lines-default);
}

.fin-aging-seg { height: 100%; min-width: 2px; }
.fin-aging-seg-NotDue { background: var(--nexus-primary, #01757A); }
.fin-aging-seg-Days1to30 { background: #FBBF24; }
.fin-aging-seg-Days31to60 { background: #F59E0B; }
.fin-aging-seg-Days61to90 { background: #EA580C; }
.fin-aging-seg-Over90Days { background: #DC2626; }

.fin-aging-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin-top: 0.625rem;
    font-size: 0.8125rem;
}

.fin-aging-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    white-space: nowrap;
}

.fin-aging-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}

.fin-aging-detail { padding: 0.5rem 0.75rem 0.75rem 2.5rem; }
.fin-aging-detail-table td, .fin-aging-detail-table th { white-space: nowrap; }

/* ── BR-FWD-RPT-NAV-01: Nhãn phân nhóm & Hint giải thích nghiệp vụ trên 8 màn Báo cáo Giao nhận ── */
.fwd-rpt-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--qcs-primary, #01757A);
    background: color-mix(in srgb, var(--nexus-primary, #01757A) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--nexus-primary, #01757A) 25%, transparent);
    white-space: nowrap;
}
.fwd-rpt-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--mud-palette-text-secondary, #64748B);
    background: rgba(241, 245, 249, 0.75);
    border: 1px solid var(--mud-palette-lines-default, #E2E8F0);
    border-radius: 4px;
    padding: 4px 10px;
    line-height: 1.35;
}
.dark-mode .fwd-rpt-hint {
    background: rgba(30, 41, 59, 0.6);
}
/* BR-FWD-RPT-SOA-05 — Thanh lọc Công nợ đối tác (Tab Tổng hợp & Tab Sao kê SOA):
   Dùng Flexbox 1 dòng ngang (flex-wrap) + gap cố định 8px 10px; mỗi trường có width rõ ràng, không bao giờ tràn đè lên nhau hoặc tách 2 dòng sớm khi bên phải còn trống. */
.fsoa-filter-bar { padding: 10px 14px; flex: 0 0 auto !important; }
.fsoa-sum-grid,
.fsoa-filter-grid,
.fsoa-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px 10px;
}
.fsoa-field { flex: 0 0 auto; min-width: 0; box-sizing: border-box; }
.fsoa-field > *,
.fsoa-field .mud-input-control,
.fsoa-field .mud-select,
.fsoa-field .mud-autocomplete,
.fsoa-field .mud-picker { width: 100% !important; min-width: 0 !important; max-width: none !important; margin-top: 0 !important; margin-bottom: 0 !important; }
.fsoa-field .mud-input-slot { padding-left: 10px !important; padding-right: 4px !important; }
.fsoa-field-partner { width: 230px; }
.fsoa-field-month { width: 96px; }
.fsoa-field-date { width: 152px; }
.fsoa-field-date input.mud-input-slot { padding-left: 10px !important; padding-right: 2px !important; font-variant-numeric: tabular-nums; }
.fsoa-field-date .mud-input-adornment-end { margin-left: 0 !important; }
.fsoa-field-date .mud-input-adornment-end .mud-icon-button { padding: 4px !important; margin-right: -4px !important; }
.fsoa-field-cur { width: 106px; }
.fsoa-field-source { width: 154px; }
.fsoa-field-paid { width: 122px; }
.fsoa-field-obh { width: 126px; }
.fsoa-field-svc { width: 124px; }
.fsoa-field-type { width: 136px; }
.fsoa-field-search { width: 210px; }
.fsoa-field-switch { display: inline-flex; align-items: center; }
.fsoa-field-switch .mud-input-control,
.fsoa-field-switch .mud-switch { margin: 0 !important; width: auto !important; }
.fsoa-filter-actions,
.fsoa-sum-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; margin-left: 0 !important; }
.fsoa-action-btn { height: 36px; white-space: nowrap; font-weight: 600; }

/* BR-FWD-RPT-SOA-06 / BR-FWD-RPT-03c — khối tổng theo tiền tệ dùng chung (Công nợ đối tác, Tuổi nợ AP/AR): lưới 6 cột thẳng hàng, số căn phải. */
.fdebt-sum {
    flex: 0 0 auto !important;
    height: auto !important;
    max-height: none !important;
    max-width: 860px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 4px;
    background: var(--mud-palette-surface);
    font-size: 0.8rem;
    overflow: visible !important;
}
.fdebt-sum-title {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    font-weight: 600; color: #0F172A;
    background: #F0FDFA;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}
.fdebt-sum-row {
    display: grid;
    grid-template-columns: 90px 90px repeat(4, minmax(120px, 1fr));
    gap: 0 12px;
    align-items: center;
    padding: 5px 12px;
    font-variant-numeric: tabular-nums;
}
.fdebt-sum-row + .fdebt-sum-row { border-top: 1px solid #F1F5F9; }
.fdebt-sum-row .r { text-align: right; font-weight: 600; }
.fdebt-sum-row .muted { color: #64748B; font-weight: 500; }
.fdebt-sum-head { background: #F8FAFC; color: #64748B; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.3px; }
.fdebt-sum-head .r { font-weight: 600; }
.fdebt-cur {
    display: inline-block; min-width: 42px; text-align: center;
    padding: 1px 8px; border: 1px solid var(--nexus-primary, #01757A); border-radius: 4px;
    color: var(--nexus-primary, #01757A); font-weight: 700; font-size: 0.72rem;
}
@media (max-width: 640px) {
    .fsoa-field,
    .fsoa-field-partner,
    .fsoa-field-search,
    .fsoa-filter-actions,
    .fsoa-sum-actions { width: 100% !important; max-width: none !important; flex: 1 1 100%; }
}
.fdebt-sum-row.ap { grid-template-columns: 70px repeat(6, minmax(110px, 1fr)) 70px; }
.fdebt-sum.wide { max-width: 1120px; }
.fap-vendor { display: inline-block; max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.fap-muted { color: #94A3B8; font-style: italic; }

/* BR-SYS-MYWORK-02 — Việc của tôi (/my-work): thẻ việc một nút, chip viền theo màu ý nghĩa (cam cần làm · xanh đủ điều kiện · đỏ ngoại lệ). */
.mywork { width: 100%; }   /* BR-SYS-MYWORK-12: màn lớn dùng hết bề ngang, lưới thẻ tự thêm cột */
.mywork-hello { font-size: 1.35rem; font-weight: 500; }
.mywork-muted { color: var(--mud-palette-text-secondary); }
.mywork-group-title { font-size: 1rem; font-weight: 600; margin: 0; }
.mywork-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.mywork-card { border: 1px solid var(--mud-palette-lines-default); border-radius: 4px; background: var(--mud-palette-surface); padding: 12px 14px; min-width: 0; overflow: hidden; }
.mywork-docno { color: var(--mud-palette-primary); font-weight: 600; white-space: nowrap; }
.mywork-party { margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mywork-detail { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 4px; row-gap: 2px; min-width: 0; font-size: 0.8125rem; line-height: 1.45; overflow-wrap: anywhere; }
.mywork-amount, .mywork-nowrap { white-space: nowrap; }
.mywork-amount { font-weight: 600; color: var(--mud-palette-text-primary); }
.mywork-chip { font-size: 0.75rem; font-weight: 600; padding: 1px 8px; border-radius: 10px; border: 1px solid currentColor; white-space: nowrap; }
.mywork-chip-todo { color: var(--mud-palette-warning-darken, var(--mud-palette-warning)); }
.mywork-chip-ready { color: var(--mud-palette-success-darken, var(--mud-palette-success)); }
.mywork-chip-exception { color: var(--mud-palette-error); }
html.dark-mode .mywork-chip-todo { color: var(--mud-palette-warning); }
html.dark-mode .mywork-chip-ready { color: var(--mud-palette-success); }
.mywork-waiting-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--mud-palette-lines-default); color: var(--mud-palette-text-primary); text-decoration: none; }
.mywork-waiting-row:hover { background: var(--mud-palette-action-default-hover); }
.mywork-empty { padding: 24px; text-align: center; border: 1px dashed var(--mud-palette-lines-default); border-radius: 4px; color: var(--mud-palette-text-secondary); }
.mywork .min-w-0 { min-width: 0; }
.mywork .mywork-btn { text-transform: none; }
.mywork-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }   /* BR-SYS-MYWORK-09a: ô quét + nút việc kho một hàng */
.mywork-scan { width: 360px; }
.mywork-scan .mud-input-control { margin-top: 0; }
.mywork .mywork-quick-btn { text-transform: none; min-height: 40px; white-space: nowrap; }

/* ── BR-SYS-MYWORK-KANBAN-01..11 (system.md §116, 12/11) — Việc của tôi dạng Kanban ─────────────────── */
.mwk-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.mwk-progress { display: flex; align-items: center; gap: 8px; border: 1px solid var(--mud-palette-lines-default); border-radius: 4px; padding: 4px 10px; font-size: 0.85rem; white-space: nowrap; background: var(--mud-palette-surface); }
.mwk-bar { display: inline-block; width: 120px; height: 8px; border-radius: 4px; background: var(--mud-palette-action-disabled-background); overflow: hidden; }
.mwk-bar > i { display: block; height: 100%; background: var(--mud-palette-success); }
.mwk-overdue-link { border: 0; background: none; padding: 0; color: var(--mud-palette-error); font-weight: 700; cursor: pointer; font-size: inherit; }
.mwk-overdue-link.on { text-decoration: underline; }
.mwk-tool { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.mwk-search { width: 300px; max-width: 100%; }
/* KANBAN-13 — lời chào + giờ cập nhật + Tải lại trên hàng đường dẫn; ô tìm + chip + Tạo phiếu một hàng */
.mwk-head-inline { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.mwk-head-hello { font-weight: 600; font-size: 0.95rem; white-space: nowrap; }
.mwk-head-meta { font-size: 0.8rem; color: var(--mud-palette-text-secondary); white-space: nowrap; }
.mwk-tool .mwk-chips { margin: 0; }
.mwk-banner { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 6px 12px; border-radius: 4px; font-size: 0.85rem; color: var(--mud-palette-error); background: rgba(220, 38, 38, 0.08); border: 1px solid rgba(220, 38, 38, 0.35); }
.mwk-link { border: 0; background: none; padding: 0; color: var(--mud-palette-primary); font-weight: 600; text-decoration: underline; cursor: pointer; font-size: 0.8rem; white-space: nowrap; }
.mwk-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
.mwk-chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--mud-palette-lines-inputs); border-radius: 14px; padding: 3px 11px; font-size: 0.8rem; background: var(--mud-palette-surface); color: var(--mud-palette-text-primary); cursor: pointer; white-space: nowrap; }
.mwk-chip.on { background: var(--mud-palette-primary); border-color: var(--mud-palette-primary); color: var(--mud-palette-primary-text); }
.mwk-chip-od { display: inline-block; min-width: 18px; text-align: center; border-radius: 9px; padding: 0 5px; font-size: 0.72rem; font-weight: 700; background: var(--mud-palette-error); color: #fff; }
.mwk-chip-late { border-color: var(--mud-palette-error); color: var(--mud-palette-error); }
.mwk-chip-late.on { background: var(--mud-palette-error); color: #fff; }
.mwk-tabs { display: none; }
.mwk-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) 58px; gap: 12px; align-items: start; }
.mwk-board.mwk-done-open { grid-template-columns: repeat(3, minmax(0, 1fr)) 300px; }
.mwk-col { --mwk-c: #64748B; display: flex; flex-direction: column; background: var(--mud-palette-background-gray); border-radius: 6px; padding: 0 8px 8px; max-height: calc(100vh - 230px); overflow-y: auto; min-width: 0; }
.mwk-col-todo { --mwk-c: #B45309; }
.mwk-col-doing { --mwk-c: #01757A; }
.mwk-col-wait { --mwk-c: #64748B; }
.mwk-col-done { --mwk-c: #15803D; }
.mwk-colh { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 10px 4px 8px; margin-bottom: 8px; background: var(--mud-palette-background-gray); border-bottom: 3px solid var(--mwk-c); }
.mwk-colh h2 { font-size: 0.95rem; font-weight: 700; margin: 0; white-space: nowrap; }
.mwk-cnt { background: var(--mwk-c); color: #fff; border-radius: 10px; padding: 0 8px; font-weight: 700; font-size: 0.75rem; }
.mwk-card { background: var(--mud-palette-surface); border: 1px solid var(--mud-palette-lines-default); border-radius: 4px; padding: 8px 10px; margin-bottom: 8px; }
.mwk-card.mwk-late { border-left: 4px solid var(--mud-palette-error); }
.mwk-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mwk-type { font-size: 0.75rem; font-weight: 600; color: var(--mud-palette-text-secondary); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mwk-tag { margin-left: auto; font-size: 0.75rem; font-weight: 600; border-radius: 3px; padding: 1px 6px; white-space: nowrap; }
.mwk-tag-red { background: rgba(220, 38, 38, 0.1); color: var(--mud-palette-error); }
.mwk-tag-green { background: rgba(22, 128, 61, 0.12); color: var(--mud-palette-success-darken); }
.mwk-tag-orange { background: rgba(217, 119, 6, 0.14); color: var(--mud-palette-warning-darken); }
.mwk-tag-teal { background: rgba(1, 117, 122, 0.1); color: var(--mud-palette-primary); }
.mwk-doc { display: block; font-weight: 700; color: var(--mud-palette-primary); margin-top: 2px; word-break: break-word; }
.mwk-party { font-size: 0.85rem; }
.mwk-wait { display: inline-block; margin-top: 3px; padding: 2px 6px; border-radius: 3px; font-size: 0.78rem; font-weight: 600; background: var(--mud-palette-background-gray); }
.mwk-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.mwk-age { margin-left: auto; font-size: 0.75rem; white-space: nowrap; color: var(--mud-palette-text-secondary); }
.mwk-age-late { color: var(--mud-palette-error); font-weight: 700; }
.mwk-more { border: 0; background: none; color: var(--mud-palette-primary); font-weight: 600; font-size: 0.8rem; padding: 6px; cursor: pointer; }
/* BR-SYS-MYWORK-FWD-06 — tiêu đề nhóm trong menu "+ Tạo mới" khi có cả Kho và Giao nhận */
.mwk-menu-head { padding: 6px 16px 2px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--mud-palette-text-secondary); }
.mwk-empty { text-align: center; padding: 24px 8px; font-size: 0.85rem; color: var(--mud-palette-text-secondary); }
.mwk-seg { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.mwk-seg-btn { border: 1px solid var(--mud-palette-lines-inputs); border-radius: 12px; padding: 2px 9px; font-size: 0.75rem; background: var(--mud-palette-surface); color: var(--mud-palette-text-primary); cursor: pointer; white-space: nowrap; }
.mwk-seg-btn.on { background: var(--mud-palette-success); border-color: var(--mud-palette-success); color: #fff; }
.mwk-rail { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; min-height: 320px; border: 0; border-radius: 6px; background: rgba(22, 128, 61, 0.1); color: var(--mud-palette-success-darken); cursor: pointer; }
.mwk-rail-icon { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--mud-palette-success); color: #fff; font-weight: 700; }
.mwk-rail-n { font-weight: 700; font-size: 1.1rem; }
.mwk-rail-t { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 700; font-size: 0.9rem; }
.mwk-done-btn { display: none !important; }

/* KANBAN-06 — máy khách 1366px: cột Xong thu vào nút "✓ N" trên đầu */
@media (max-width: 1365px) {
    .mwk-board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .mwk-board.mwk-done-open { grid-template-columns: repeat(3, minmax(0, 1fr)) 260px; }
    .mwk-rail { display: none; }
    .mwk-done-btn { display: inline-flex !important; }
}

/* KANBAN-06 — PDA / điện thoại: cột thành tab */
@media (max-width: 991px) {
    .mwk-tabs { display: flex; gap: 2px; margin: 0 0 8px; border-bottom: 1px solid var(--mud-palette-lines-default); overflow-x: auto; }
    .mwk-tab { flex: 1 0 auto; border: 0; border-bottom: 3px solid transparent; background: none; padding: 8px 6px; font-size: 0.8rem; font-weight: 600; color: var(--mud-palette-text-secondary); white-space: nowrap; cursor: pointer; }
    .mwk-tab.on { color: var(--mud-palette-primary); border-bottom-color: var(--mud-palette-primary); }
    .mwk-tab-done.on { color: var(--mud-palette-success-darken); border-bottom-color: var(--mud-palette-success); }
    .mwk-board, .mwk-board.mwk-done-open { grid-template-columns: minmax(0, 1fr); }
    .mwk-col { display: none; max-height: none; overflow: visible; }
    .mwk-col.mwk-active { display: flex; }
    .mwk-done-btn { display: none !important; }
    .mwk-search { width: 100%; }
    .mwk-progress { white-space: normal; }
}
@media (max-width: 576px) {
    .mywork-scan { width: 100%; }
    .mywork .mywork-quick-btn { flex: 1 1 calc(50% - 8px); }
}

/* BR-SAL-ORDER-TRACK-01..04 — ngăn tiến độ đơn: 4 bước (xanh xong · cam đang làm · đỏ ngoại lệ · xám chưa tới), dòng hàng, lịch sử. */
.track-title { font-size: 1.15rem; font-weight: 600; color: var(--mud-palette-primary); }
.track-muted { color: var(--mud-palette-text-secondary); }
.track-btn { text-transform: none; }
.track-head { padding-right: 36px; } /* chừa chỗ nút đóng của hộp thoại */
.track-empty { padding: 24px; text-align: center; color: var(--mud-palette-text-secondary); }
.track-steps { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.track-step { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.track-bar { height: 4px; border-radius: 2px; background: var(--mud-palette-lines-default); }
.track-step-title { font-size: 0.85rem; font-weight: 600; }
.track-step-note { font-size: 0.78rem; color: var(--mud-palette-text-secondary); }
.track-step--done .track-bar { background: var(--mud-palette-success); }
.track-step--done .track-step-note { color: var(--mud-palette-success-darken, var(--mud-palette-success)); }
.track-step--current .track-bar { background: var(--mud-palette-warning); }
.track-step--current .track-step-note { color: var(--mud-palette-warning-darken, var(--mud-palette-warning)); }
.track-step--exception .track-bar { background: var(--mud-palette-error); }
.track-step--exception .track-step-note { color: var(--mud-palette-error); }
html.dark-mode .track-step--done .track-step-note { color: var(--mud-palette-success); }
html.dark-mode .track-step--current .track-step-note { color: var(--mud-palette-warning); }
.track-alert { border: 1px solid var(--mud-palette-error); color: var(--mud-palette-error); border-radius: 4px; padding: 8px 12px; font-size: 0.85rem; margin-bottom: 8px; }
.track-h { font-size: 0.9rem; font-weight: 600; margin: 14px 0 4px; }
.track-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 72px 72px 135px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--mud-palette-lines-default); font-size: 0.85rem; }
.track-row--head { font-size: 0.75rem; color: var(--mud-palette-text-secondary); white-space: nowrap; }
.track-num { text-align: right; white-space: nowrap; }
.track-ev { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--mud-palette-lines-default); font-size: 0.85rem; }
.track-ev .min-w-0, .track-title + .small { min-width: 0; }
@media (max-width: 576px) { .track-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } .track-row { grid-template-columns: minmax(0, 1fr) 90px 64px 64px; } }

/* BR-SYS-EXEC-02..04 — Tổng quan điều hành: hộp chờ duyệt (rộng) + tổng kết cuối ngày (hẹp), xuống hàng trên màn nhỏ. */
.exec-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
@media (max-width: 992px) { .exec-cols { grid-template-columns: 1fr; } }
.exec-approvals { min-width: 0; display: flex; flex-direction: column; }
.exec-eod { min-width: 0; display: flex; flex-direction: column; }
.exec-appr-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--mud-palette-lines-default); flex-wrap: wrap; }
.exec-appr-row .mywork-chip { min-width: 110px; text-align: center; }
.exec-amount { font-weight: 600; }
/* BR-SYS-EXEC-07..08 — Thiết kế, câu từ và bố cục chuẩn UI 4 V6 (/executive) */
.exec-v6-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 992px) { .exec-v6-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 576px) { .exec-v6-kpi-grid { grid-template-columns: 1fr; } }
.exec-v6-kpi-card { background: var(--mud-palette-surface, #FFFFFF); border: 1px solid var(--mud-palette-lines-default, #E2E8F0); border-radius: 4px; padding: 14px 16px; cursor: pointer; transition: border-color 0.15s ease, background-color 0.15s ease; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 4px; }
.exec-v6-kpi-card:hover { border-color: var(--nexus-primary, #01757A); }
.exec-v6-kpi-card--highlight { border: 1.5px solid var(--nexus-primary, #01757A); background: color-mix(in srgb, var(--nexus-primary, #01757A) 4%, var(--mud-palette-surface, #FFFFFF)); }
.exec-v6-kpi-label { font-size: 0.8125rem; color: var(--mud-palette-text-secondary, #64748B); font-weight: 500; }
.exec-v6-kpi-value { font-size: 1.5rem; font-weight: 700; line-height: 1.25; color: var(--mud-palette-text-primary, #0F172A); }
.exec-v6-kpi-value--primary { color: var(--nexus-primary, #01757A); }
.exec-v6-kpi-sub { font-size: 0.78rem; font-weight: 600; color: var(--nexus-primary, #01757A); margin-top: 2px; }
.exec-v6-count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 4px; background: #FEF3C7; color: #B45309; font-size: 0.78rem; font-weight: 700; }
.exec-v6-chip-t5 { background: #FEF3C7; color: #B45309; font-weight: 700; padding: 3px 8px; border-radius: 4px; font-size: 0.75rem; white-space: nowrap; }
.exec-v6-chip-credit { background: color-mix(in srgb, var(--nexus-primary, #01757A) 12%, transparent); color: var(--nexus-primary, #01757A); font-weight: 700; padding: 3px 8px; border-radius: 4px; font-size: 0.75rem; white-space: nowrap; }
.exec-v6-empty-approvals { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 28px 16px; margin-top: 4px; border: 1px dashed var(--mud-palette-lines-default, #E2E8F0); border-radius: 4px; background: var(--mud-palette-background-grey, #F8FAFC); color: var(--mud-palette-text-secondary, #64748B); font-size: 0.85rem; text-align: center; }
.exec-v6-empty-icon { width: 30px; height: 30px; border-radius: 9999px; background: #ECFDF5; color: #059669; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.95rem; }
.exec-v6-approvals-list { max-height: 310px; overflow-y: auto; }
.exec-v6-alert-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 4px; margin-bottom: 6px; text-decoration: none; font-size: 0.85rem; font-weight: 500; }
.exec-v6-alert-row--danger { background: #FEF2F2; color: #0F172A; border: 1px solid #FECACA; }
.exec-v6-alert-row--warning { background: #FFFBEB; color: #0F172A; border: 1px solid #FDE68A; }
.exec-v6-chart-card { background: var(--mud-palette-surface, #FFFFFF); border: 1.5px solid var(--nexus-primary, #01757A); border-radius: 4px; padding: 14px 16px; }
.exec-v6-chart-badge { display: inline-block; background: var(--nexus-primary, #01757A); color: #FFFFFF; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; padding: 4px 10px; border-radius: 4px; text-transform: uppercase; }
/* BR-SAL-RPT-DAILY-06 — khối Hình thức thanh toán trên Tổng quan điều hành (màu = báo cáo bán hàng) */
.exec-paymix-bar { display: flex; height: 14px; border-radius: 4px; overflow: hidden; background: var(--mud-palette-lines-default, #E5E7EB); }
.exec-paymix-bar > span { display: block; height: 100%; }
.exec-paymix-cash { background: #01757A; }
.exec-paymix-transfer { background: #2563EB; }
.exec-paymix-debt { background: #F59E0B; }
.exec-paymix-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }


/* BR-KHO-SME-UI-14 — Lưới Giao dịch kho (/transactions): hiển thị trọn vẹn 100% bề ngang,
   không sinh thanh cuộn ngang và không sinh thanh cuộn dọc nội bộ. */
.master-page > .card.transaction-list-card {
    flex: 0 0 auto !important;
    overflow: visible !important;
}
.erp-datagrid.transaction-grid,
.erp-datagrid.transaction-grid .mud-table-container {
    overflow-x: hidden !important;
    overflow-y: visible !important;
    max-height: none !important;
    height: auto !important;
}
.erp-datagrid.transaction-grid table.mud-table-root th {
    padding: 8px 8px !important;
    font-size: 0.72rem !important;
    white-space: nowrap !important;
}
.erp-datagrid.transaction-grid table.mud-table-root td {
    padding: 5px 8px !important;
    font-size: 0.8125rem !important;
    white-space: nowrap !important;
    vertical-align: middle !important;
}
.erp-datagrid.transaction-grid table.mud-table-root tbody tr {
    height: 38px !important;
}
.erp-datagrid.transaction-grid .column-options .mud-icon-button {
    padding: 1px !important;
    min-width: 0 !important;
}
.erp-datagrid.transaction-grid table.mud-table-root th:nth-child(2),
.erp-datagrid.transaction-grid table.mud-table-root td:nth-child(2) {
    width: 36px !important;
    max-width: 36px !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
}
.erp-datagrid.transaction-grid .column-options {
    gap: 0 !important;
}
.txn-docno-cell {
    white-space: nowrap !important;
    font-weight: 700;
    color: #1e40af;
    cursor: pointer;
}
.txn-date-cell {
    white-space: nowrap !important;
    font-variant-numeric: tabular-nums;
    font-size: 0.8rem;
}

/* ==========================================================
   BR-MST-UI-TOOLBAR-01 — Unified 2-Tier Card Toolbar
   (Card Top Bar: Status Chips left + Action Buttons right;
    Card Filter Bar: 100% Full-Width Filter Inputs + Search Button at right end)
   ========================================================== */
.nexus-card-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 16px;
    border-bottom: 1px solid #F1F5F9 !important;
    background-color: var(--mud-palette-surface, #FFFFFF);
    border-radius: 12px 12px 0 0;
}

.nexus-card-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.nexus-card-filterbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid #F1F5F9 !important;
    background-color: var(--mud-palette-surface, #FFFFFF);
    width: 100%;
    flex-wrap: wrap;
}

.nexus-card-filterbar-inputs {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 0%;
    min-width: 0;
    flex-wrap: wrap;
}

.nexus-card-filterbar-inputs > .mud-input-control,
.nexus-card-filterbar-inputs > .mud-picker,
.nexus-card-filterbar-inputs > div {
    flex: 1 1 180px !important;
    max-width: none !important;
    min-width: 160px !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.nexus-card-filterbar-inputs > div > .mud-input-control,
.nexus-card-filterbar-inputs > div > .mud-picker,
.nexus-card-filterbar-inputs > div > .mud-picker .mud-input-control {
    width: 100% !important;
    max-width: none !important;
}

.nexus-card-filterbar-inputs > :first-child {
    flex: 1.3 1 220px !important;
}

.nexus-card-filterbar-searchbtn {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    align-self: flex-end;
    min-height: 38px;
    gap: 8px;
    margin-left: auto;
}

/* BR-UI-SEARCHPANEL-03 / BR-MST-UI-TOOLBAR-01:
   Trong NexusSearchPanel (.nexus-filter-bar.nexus-filter-bar-responsive):
   - Các ô điều kiện lọc (div bọc ngoài hoặc .mud-input-control trực tiếp) tự giãn 100% bề ngang.
   - Cụm .nexus-search-actions (Xóa bộ lọc + Tìm kiếm) dồn sát phải cuối dòng lọc (margin-left: auto). */
.nexus-filter-bar.nexus-filter-bar-responsive > div:not(.nexus-search-actions),
.nexus-filter-bar.nexus-filter-bar-responsive > .mud-input-control {
    flex: 1 1 180px !important;
    min-width: 160px !important;
    max-width: none !important;
    width: auto !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* BR-UI-SEARCHPANEL-04 (17/11/2026): màn rộng, thanh lọc xuống hàng thì ô lẻ ở hàng dưới không giãn hết cả hàng.
   Chỉ từ 992px — dưới đó luật BR-UI-FILTERBAR-01 xếp 2 ô / 1 ô một hàng. */
@media (min-width: 992px) {
    .nexus-filter-bar.nexus-filter-bar-responsive > div:not(.nexus-search-actions),
    .nexus-filter-bar.nexus-filter-bar-responsive > .mud-input-control {
        max-width: 340px !important;
    }
}

/* BR-UI-GRID-NUMCELL-CLEAR-01 (18/11/2026, Henry: "UI bị che col giá tối thiểu" — Bảng giá, cột Giá tối thiểu).
   Ô số sửa tại chỗ canh phải + nút × xoá: nút chiếm chỗ của chữ số cuối nên "100.000" đọc thành "100.00".
   Thu nhỏ nút × và bỏ đệm phải của ô nhập để con số luôn đọc đủ. */
.text-end-input .mud-input-clear-button,
.erp-datagrid .mud-input-clear-button {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    padding: 0 !important;
    margin-left: 2px !important;
    flex: 0 0 auto !important;
}

.text-end-input input.mud-input-slot,
.erp-datagrid .text-end-input input.mud-input-slot {
    padding-right: 2px !important;
    min-width: 0 !important;
}

/* BR-UI-SEARCHPANEL-05 (18/11/2026, Henry: "chỉnh UI phần hiển thị đk search rộng hơn" — màn Bảng giá).
   Màn tự dựng <MudGrid> bên trong thanh lọc: luật trên coi cả lưới là MỘT ô lọc nên ép max-width 340px
   ⇒ 2 ô nhập co còn "Tìm theo…" / "Hiệu l…", chừa một khoảng trống lớn tới cụm nút.
   Lưới phải được giãn hết phần còn lại của hàng, và ô nhập bên trong lưới lấp kín cột của nó. */
.nexus-filter-bar.nexus-filter-bar-responsive > .mud-grid {
    flex: 1 1 auto !important;
    max-width: none !important;
    min-width: 320px !important;
}

.nexus-filter-bar .mud-grid .mud-input-control {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
}

.nexus-filter-bar.nexus-filter-bar-responsive > div:not(.nexus-search-actions):first-child,
.nexus-filter-bar.nexus-filter-bar-responsive > .mud-input-control:first-child {
    flex: 1.3 1 220px !important;
}

.nexus-filter-bar > .nexus-search-actions {
    margin-left: auto !important;
}

/* BR-SYS-BRAND-COLOR-07: Nút [🔍 Tìm kiếm] ở Tầng 2 dùng Variant.Outlined + nền Tonal 8%
   để phân cấp rõ với nút [+ Tạo mới] (Variant.Filled ở Tầng 1), tránh 2 khối màu đặc chồng dọc. */
.nexus-search-actions .mud-button-outlined.mud-button-outlined-primary,
.nexus-card-filterbar-searchbtn .mud-button-outlined.mud-button-outlined-primary,
.nexus-card-filterbar-searchbtn .mud-button-filled.mud-button-filled-primary {
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 8%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--nexus-primary, #01757A) 45%, transparent) !important;
    color: var(--nexus-primary, #01757A) !important;
    box-shadow: none !important;
    font-weight: 600;
}

.nexus-search-actions .mud-button-outlined.mud-button-outlined-primary:hover,
.nexus-card-filterbar-searchbtn .mud-button-outlined.mud-button-outlined-primary:hover,
.nexus-card-filterbar-searchbtn .mud-button-filled.mud-button-filled-primary:hover {
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 15%, transparent) !important;
    border-color: var(--nexus-primary, #01757A) !important;
}


.text-primary {
    color: var(--nexus-primary, #01757A) !important;
}

.bg-primary {
    background-color: var(--nexus-primary, #01757A) !important;
}

.border-primary {
    border-color: var(--nexus-primary, #01757A) !important;
}

/* Mobile Profile (/settings/profile) — cho phép nhãn vai trò dài xuống dòng tự nhiên, không tràn ngang màn hình PDA */
.mobile-profile-role-chip.mud-chip {
    height: auto !important;
    min-height: 24px;
    max-width: 100%;
    white-space: normal !important;
    padding: 4px 10px !important;
    border-radius: 12px !important;
    line-height: 1.35;
    text-align: left;
}

.mobile-profile-role-chip .mud-chip-content {
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    display: block;
}
/* BR-SYS-BRAND-COLOR-08:
   1. Ghi đè toàn bộ Bootstrap .btn-primary & .btn-outline-primary theo --nexus-primary (chặn xanh dương #0d6efd).
   2. Modern Segmented Pill Bar (.nexus-segmented-pills) cho /system/workflow.
   3. Micro-Gradient + Inner Highlight cho nút [+ Tạo mới] (CTA bậc 1) và icon nhóm đang mở. */
.btn-primary,
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-check:checked + .btn-primary,
.btn-primary.active {
    color: #FFFFFF !important;
    background: linear-gradient(135deg, color-mix(in srgb, var(--nexus-primary, #01757A) 90%, #ffffff) 0%, var(--nexus-primary, #01757A) 55%, color-mix(in srgb, var(--nexus-primary, #01757A) 85%, #000000) 100%) !important;
    border-color: var(--nexus-primary, #01757A) !important;
    box-shadow: 0 2px 6px color-mix(in srgb, var(--nexus-primary, #01757A) 25%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
}

.btn-outline-primary {
    color: var(--nexus-primary, #01757A) !important;
    border-color: color-mix(in srgb, var(--nexus-primary, #01757A) 45%, transparent) !important;
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 6%, transparent) !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active,
.btn-check:checked + .btn-outline-primary,
.btn-outline-primary.active {
    color: #FFFFFF !important;
    background-color: var(--nexus-primary, #01757A) !important;
    border-color: var(--nexus-primary, #01757A) !important;
}

.nexus-segmented-pills {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    background-color: #F1F5F9;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
}

.dark-mode .nexus-segmented-pills {
    background-color: #1E293B;
    border-color: #334155;
}

.nexus-segmented-pill {
    min-width: 124px;
    padding: 6px 16px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: #475569;
    font-size: 0.84rem;
    font-weight: 600;
    transition: all 0.18s ease;
}

.dark-mode .nexus-segmented-pill {
    color: #94A3B8;
}

.nexus-segmented-pill:hover:not(.active) {
    color: var(--nexus-primary, #01757A);
    background-color: rgba(255, 255, 255, 0.7);
}

.dark-mode .nexus-segmented-pill:hover:not(.active) {
    color: var(--nexus-primary, #2BA5AB);
    background-color: rgba(255, 255, 255, 0.06);
}

.nexus-segmented-pill.active {
    background-color: var(--nexus-primary-solid, #015E63) !important;
    background: var(--nexus-primary-solid, #015E63) !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

/* BR-SYS-WORKFLOW-04, 07: Thanh tiêu đề nhóm quy tắc & Banner đồng bộ Cài đặt phân hệ */
.wf-rule-group-card {
    border: 1px solid #E2E8F0;
    border-radius: 4px;
    background-color: #FFFFFF;
    margin-bottom: 16px;
    overflow: hidden;
}

.wf-rule-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 16px;
    background-color: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
}

.wf-rule-group-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: nowrap;
}

.wf-module-status-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 4px;
    border: 1px solid #CBD5E1;
    background-color: #F8FAFC;
}

.wf-module-status-banner.status-enabled {
    border-color: #A7F3D0;
    background-color: #ECFDF5;
}

.wf-module-status-banner.status-disabled {
    border-color: #FDE68A;
    background-color: #FFFBEB;
}

/* Micro-Gradient + Specular Inner Highlight cho nút [+ Tạo mới] (CTA bậc 1) — đảm bảo WCAG AA >= 4.5:1 */
.nexus-card-topbar-actions .mud-button-filled.mud-button-filled-primary {
    background-color: var(--nexus-primary-solid, #015E63) !important;
    background: var(--nexus-primary-solid, #015E63) !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
}

.nexus-sidebar-menu .mud-nav-group.mud-nav-group-expanded > .mud-nav-group-button > .mud-nav-link .mud-nav-link-icon-default,
.nexus-sidebar-menu .mud-nav-group.mud-nav-group-expanded > .mud-nav-group-button > .mud-nav-link .mud-icon-root {
    color: var(--nexus-primary, #01757A) !important;
    opacity: 1 !important;
}

/* ==========================================================
   BR-SYS-BRAND-COLOR-09 — World-Class SaaS 10.0/10 Polish
   1. Perceptual Tonal Scale Tokens (--nexus-primary-50..200, glow, gradient)
   2. Theme Swatch Pills (.nexus-theme-swatch-pill) + Live Mini-Preview
   3. Floating Pill MudTabs + 3px Soft Glow Focus Ring on Outlined Inputs
   4. KPI Soft Squircle 8px + Specular Card Highlight + Linear 3px Row Hover Bar
   5. Header Avatar Double Ring (.nexus-header-avatar-ring)
   ========================================================== */
:root {
    --nexus-primary-50: color-mix(in srgb, var(--nexus-primary, #01757A) 6%, #ffffff);
    --nexus-primary-100: color-mix(in srgb, var(--nexus-primary, #01757A) 12%, #ffffff);
    --nexus-primary-200: color-mix(in srgb, var(--nexus-primary, #01757A) 24%, #ffffff);
    --nexus-primary-border: color-mix(in srgb, var(--nexus-primary, #01757A) 32%, transparent);
    --nexus-primary-glow: 0 0 0 3px color-mix(in srgb, var(--nexus-primary, #01757A) 15%, transparent);
    --nexus-primary-gradient: linear-gradient(135deg, color-mix(in srgb, var(--nexus-primary, #01757A) 88%, #ffffff) 0%, var(--nexus-primary, #01757A) 55%, color-mix(in srgb, var(--nexus-primary, #01757A) 84%, #000000) 100%);
}

.nexus-theme-swatch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 6px;
}

.nexus-theme-swatch-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--mud-palette-lines-default, #E2E8F0);
    background-color: var(--mud-palette-background, #F8FAFC);
    color: var(--mud-palette-text-primary, #334155);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.16s ease;
}

.nexus-theme-swatch-pill:hover {
    border-color: var(--nexus-primary, #01757A);
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 5%, var(--mud-palette-surface, #FFFFFF));
    transform: translateY(-1px);
}

.nexus-theme-swatch-pill.active {
    border-color: var(--nexus-primary, #01757A) !important;
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 9%, var(--mud-palette-surface, #FFFFFF)) !important;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--nexus-primary, #01757A) 20%, transparent);
    font-weight: 700;
}

.nexus-theme-swatch-dot {
    width: 18px;
    height: 18px;
    border-radius: 9999px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.nexus-theme-swatch-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nexus-theme-live-preview {
    background-color: var(--mud-palette-background, #F8FAFC);
    border: 1px solid var(--mud-palette-lines-default, #E2E8F0);
}

.nexus-theme-preview-logo {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    background: var(--nexus-primary-gradient);
    color: #FFFFFF;
    font-size: 10px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Floating Pill MudTabs + 3px Soft Glow Focus Ring on Outlined Inputs */
.mud-tabs .mud-tab {
    border-radius: 6px !important;
    margin: 4px 2px !important;
    padding: 7px 14px !important;
}

.mud-input-control .mud-input-outlined:focus-within .mud-input-outlined-border {
    border-color: var(--nexus-primary, #01757A) !important;
    border-width: 1.5px !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--nexus-primary, #01757A) 15%, transparent) !important;
}

/* KPI Soft Squircle 8px + Tonal Mesh Surface + Semantic Harmony + Smooth 2px DataGrid Top Line */
.nexus-stat-card {
    --kpi-accent: var(--nexus-primary, #01757A);
    --kpi-ink: var(--nexus-primary, #01757A);
    background:
        radial-gradient(120px 60px at 100% 0%, color-mix(in srgb, var(--kpi-accent) 13%, transparent), transparent 72%),
        linear-gradient(135deg, var(--mud-palette-surface, #FFFFFF) 35%, color-mix(in srgb, var(--kpi-accent) 6%, var(--mud-palette-surface, #FFFFFF)) 100%) !important;
    border: 1px solid color-mix(in srgb, var(--kpi-accent) 22%, var(--mud-palette-lines-default, #E2E8F0)) !important;
    border-left: 3.5px solid var(--kpi-accent) !important;
    border-radius: 6px !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.75) !important;
}

.nexus-stat-card.kpi-tone-warning { --kpi-accent: #F59E0B; --kpi-ink: #B45309; }
.nexus-stat-card.kpi-tone-success { --kpi-accent: #10B981; --kpi-ink: #047857; }
.nexus-stat-card.kpi-tone-info    { --kpi-accent: #0284C7; --kpi-ink: #0369A1; }
.nexus-stat-card.kpi-tone-error   { --kpi-accent: #EF4444; --kpi-ink: #B91C1C; }

.dark-mode .nexus-stat-card.kpi-tone-warning { --kpi-ink: #FBBF24; }
.dark-mode .nexus-stat-card.kpi-tone-success { --kpi-ink: #34D399; }
.dark-mode .nexus-stat-card.kpi-tone-info    { --kpi-ink: #38BDF8; }
.dark-mode .nexus-stat-card.kpi-tone-error   { --kpi-ink: #F87171; }

.nexus-stat-icon,
.nexus-stat-icon.nexus-stat-primary,
.nexus-stat-icon.nexus-stat-success,
.nexus-stat-icon.nexus-stat-warning,
.nexus-stat-icon.nexus-stat-error,
.nexus-stat-icon.nexus-stat-danger,
.nexus-stat-icon.nexus-stat-info {
    border-radius: 8px !important;
    background: linear-gradient(135deg, color-mix(in srgb, var(--kpi-accent) 18%, var(--mud-palette-surface, #FFFFFF)) 0%, color-mix(in srgb, var(--kpi-accent) 10%, var(--mud-palette-surface, #FFFFFF)) 100%) !important;
    border: 1px solid color-mix(in srgb, var(--kpi-accent) 28%, transparent) !important;
    color: var(--kpi-ink) !important;
    box-shadow: 0 2px 5px color-mix(in srgb, var(--kpi-accent) 12%, transparent) !important;
    transition: transform 0.18s ease;
}

.nexus-stat-icon .mud-icon-root,
.nexus-stat-primary .mud-icon-root,
.nexus-stat-success .mud-icon-root,
.nexus-stat-warning .mud-icon-root,
.nexus-stat-error .mud-icon-root,
.nexus-stat-danger .mud-icon-root,
.nexus-stat-info .mud-icon-root {
    color: var(--kpi-ink) !important;
}

.nexus-stat-card:hover .nexus-stat-icon {
    transform: scale(1.05);
}

/* MudSwitch — Sync all active toggle switches to --nexus-primary */
.mud-switch .mud-switch-base.mud-checked {
    color: var(--nexus-primary, #01757A) !important;
}

.mud-switch .mud-switch-base.mud-checked + .mud-switch-track {
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 48%, transparent) !important;
}

.erp-datagrid thead::before {
    height: 2px !important;
    background: linear-gradient(90deg, var(--grid-accent) 0%, color-mix(in srgb, var(--grid-accent) 42%, transparent) 65%, transparent 100%) !important;
}

.erp-datagrid .mud-table-body .mud-table-row:hover td:first-child {
    box-shadow: inset 3px 0 0 var(--nexus-primary, #01757A);
}

/* BR-UI-GRID-HOVER-01 (Henry 17/11, ảnh Bảng giá BG-QUAY khoanh đỏ: "line đỏ nhìn kỳ khi rê chuột vào").
   Vạch nhấn hover ở trên đặt vào Ô ĐẦU — đúng với bảng thường (ô đầu cao bằng cả dòng). Sang chế độ thẻ / băng,
   ô đầu chỉ còn là ô "#" nhỏ ⇒ vạch cụt dựng cạnh dấu #. Ở các chế độ đó vạch chuyển sang CẢ THẺ. */
.nexus-grid-cards-auto .mud-table-body .mud-table-row:hover td:first-child,
.nexus-grid-bands .mud-table-body .mud-table-row:hover td:first-child {
    box-shadow: none !important;
}

.nexus-grid-cards-auto .mud-table-body .mud-table-row:hover,
.nexus-grid-bands .mud-table-body .mud-table-row:hover {
    box-shadow: inset 3px 0 0 var(--nexus-primary, #01757A);
}

/* .nexus-grid-cards do component gắn ở MỌI bề rộng, kiểu thẻ chỉ bật ≤991.98px ⇒ chỉ đổi vạch trong mốc đó. */
@media (max-width: 991.98px) {
    .nexus-grid-cards .mud-table-body .mud-table-row:hover td:first-child {
        box-shadow: none !important;
    }

    .nexus-grid-cards .mud-table-body .mud-table-row:hover {
        box-shadow: inset 3px 0 0 var(--nexus-primary, #01757A);
    }
}

/* BR-UI-GRID-EMPTYFOOT-01 (Henry 17/11, ảnh Lịch sử bán hàng khoanh đỏ: "vùng này là gì").
   MudDataGrid luôn vẽ <tfoot><tr class="mud-table-row"></tr></tfoot> kể cả khi không cột nào có chân bảng.
   Bảng thường: dòng rỗng cao 0, không thấy. Chế độ thẻ / băng: luật "Dòng TỔNG" cho tfoot tr viền + đệm ⇒ thành
   một thẻ trống trên thanh phân trang. Dòng chân không có ô nào thì ẩn. Hai luật tách riêng: trình duyệt không hiểu
   :has() bỏ cả danh sách chọn, :empty vẫn chạy. */
.erp-datagrid table.mud-table-root tfoot tr:empty {
    display: none !important;
}

.erp-datagrid table.mud-table-root tfoot tr:not(:has(> td, > th)) {
    display: none !important;
}

/* BR-UI-GRID-CARD-ALIGN-01 (17/11/2026) — thẻ tự động: nhãn đặt TRÊN giá trị, chữ canh trái. Ô nào bên trong
   dùng "justify-end" (dạng bảng canh phải số) thì dòng phụ (vd. % tỷ suất dưới Lợi nhuận gộp) bị đẩy ra mép phải
   làn 210px, nằm rời khỏi số của nó (Henry 17/11, Danh sách Job). */
.nexus-grid-cards-auto table.mud-table-root tbody td[data-label] :is(.justify-end, .justify-content-end) {
    justify-content: flex-start !important;
}

/* Header Avatar Double Ring */
.nexus-header-avatar-ring {
    background: var(--nexus-primary-gradient) !important;
    box-shadow: 0 0 0 2px var(--bg-surface, #FFFFFF), 0 0 0 3.5px color-mix(in srgb, var(--nexus-primary, #01757A) 38%, transparent) !important;
}

/* ==========================================================
   World-Class Notification System: Toasts, Alerts, Bell Popover & Dialogs (BR-SYS-BRAND-COLOR-10)
   ========================================================== */
.mud-dialog-container .mud-dialog {
    border: 1px solid #E2E8F0 !important;
    border-top: 3px solid var(--nexus-primary, #01757A) !important;
    border-radius: 8px !important;
    box-shadow: 0 12px 32px -6px rgba(15, 23, 42, 0.14), 0 4px 10px -2px rgba(15, 23, 42, 0.06) !important;
}

.mud-dialog .mud-dialog-title .mud-icon-root {
    color: var(--nexus-primary, #01757A);
}

/* ── World-Class Glass Surface Toast (MudSnackbar) ── */
.mud-snackbar {
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(12px) saturate(1.2) !important;
    -webkit-backdrop-filter: blur(12px) saturate(1.2) !important;
    color: #0F172A !important;
    border: 1px solid #E2E8F0 !important;
    border-left-width: 4px !important;
    border-radius: 6px !important;
    box-shadow: 0 12px 28px -6px rgba(15, 23, 42, 0.14), 0 4px 10px -3px rgba(15, 23, 42, 0.07) !important;
    padding: 10px 14px !important;
}

.mud-snackbar .mud-snackbar-content-message {
    color: #0F172A !important;
    font-weight: 600 !important;
    font-size: 0.84375rem !important;
    line-height: 1.4 !important;
}

.mud-snackbar .mud-snackbar-content-action button,
.mud-snackbar .mud-snackbar-content-action .mud-icon-button {
    color: #64748B !important;
}

.mud-snackbar .mud-snackbar-content-action .mud-icon-button:hover {
    background: rgba(148, 163, 184, 0.15) !important;
    color: #0F172A !important;
}

.mud-snackbar .mud-snackbar-icon {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    border-radius: 6px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-right: 10px !important;
    padding: 5px !important;
}

/* 1. Brand / System / Info Toast -> 100% synced to --nexus-primary */
.mud-snackbar.mud-alert-filled-normal,
.mud-snackbar.mud-alert-outlined-normal,
.mud-snackbar.mud-alert-text-normal,
.mud-snackbar.mud-alert-filled-info,
.mud-snackbar.mud-alert-outlined-info,
.mud-snackbar.mud-alert-text-info,
.mud-snackbar.mud-alert-filled-primary {
    border-left-color: var(--nexus-primary, #01757A) !important;
}

.mud-snackbar.mud-alert-filled-normal .mud-snackbar-icon,
.mud-snackbar.mud-alert-outlined-normal .mud-snackbar-icon,
.mud-snackbar.mud-alert-text-normal .mud-snackbar-icon,
.mud-snackbar.mud-alert-filled-info .mud-snackbar-icon,
.mud-snackbar.mud-alert-outlined-info .mud-snackbar-icon,
.mud-snackbar.mud-alert-text-info .mud-snackbar-icon,
.mud-snackbar.mud-alert-filled-primary .mud-snackbar-icon {
    background: color-mix(in srgb, var(--nexus-primary, #01757A) 14%, transparent) !important;
    color: var(--nexus-primary, #01757A) !important;
    border: 1px solid color-mix(in srgb, var(--nexus-primary, #01757A) 28%, transparent) !important;
}

/* 2. Success Toast -> Emerald (#10B981) Accent on Glass Surface */
.mud-snackbar.mud-alert-filled-success,
.mud-snackbar.mud-alert-outlined-success,
.mud-snackbar.mud-alert-text-success {
    border-left-color: #10B981 !important;
}

.mud-snackbar.mud-alert-filled-success .mud-snackbar-icon,
.mud-snackbar.mud-alert-outlined-success .mud-snackbar-icon,
.mud-snackbar.mud-alert-text-success .mud-snackbar-icon {
    background: rgba(16, 185, 129, 0.12) !important;
    color: #059669 !important;
    border: 1px solid rgba(16, 185, 129, 0.28) !important;
}

/* 3. Warning Toast -> Amber (#F59E0B) Accent on Glass Surface */
.mud-snackbar.mud-alert-filled-warning,
.mud-snackbar.mud-alert-outlined-warning,
.mud-snackbar.mud-alert-text-warning {
    border-left-color: #F59E0B !important;
}

.mud-snackbar.mud-alert-filled-warning .mud-snackbar-icon,
.mud-snackbar.mud-alert-outlined-warning .mud-snackbar-icon,
.mud-snackbar.mud-alert-text-warning .mud-snackbar-icon {
    background: rgba(245, 158, 11, 0.14) !important;
    color: #D97706 !important;
    border: 1px solid rgba(245, 158, 11, 0.30) !important;
}

/* 4. Error Toast -> Rose (#EF4444) Accent on Glass Surface */
.mud-snackbar.mud-alert-filled-error,
.mud-snackbar.mud-alert-outlined-error,
.mud-snackbar.mud-alert-text-error {
    border-left-color: #EF4444 !important;
}

.mud-snackbar.mud-alert-filled-error .mud-snackbar-icon,
.mud-snackbar.mud-alert-outlined-error .mud-snackbar-icon,
.mud-snackbar.mud-alert-text-error .mud-snackbar-icon {
    background: rgba(239, 68, 68, 0.12) !important;
    color: #DC2626 !important;
    border: 1px solid rgba(239, 68, 68, 0.28) !important;
}

/* Dark Mode Toast Overrides */
.dark-mode .mud-snackbar {
    background: rgba(30, 41, 59, 0.96) !important;
    border-color: #334155 !important;
    color: #F8FAFC !important;
    box-shadow: 0 14px 32px -6px rgba(0, 0, 0, 0.5), 0 4px 12px -2px rgba(0, 0, 0, 0.35) !important;
}

.dark-mode .mud-snackbar .mud-snackbar-content-message {
    color: #F8FAFC !important;
}

.dark-mode .mud-snackbar.mud-alert-filled-success .mud-snackbar-icon {
    color: #34D399 !important;
}

.dark-mode .mud-snackbar.mud-alert-filled-warning .mud-snackbar-icon {
    color: #FBBF24 !important;
}

.dark-mode .mud-snackbar.mud-alert-filled-error .mud-snackbar-icon {
    color: #F87171 !important;
}

/* ── Inline MudAlert (Info/Normal synced to --nexus-primary) ── */
.mud-alert:not(.mud-snackbar).mud-alert-filled-info,
.mud-alert:not(.mud-snackbar).mud-alert-outlined-info,
.mud-alert:not(.mud-snackbar).mud-alert-text-info,
.mud-alert:not(.mud-snackbar).mud-alert-filled-normal,
.mud-alert:not(.mud-snackbar).mud-alert-outlined-normal,
.mud-alert:not(.mud-snackbar).mud-alert-text-normal {
    background: color-mix(in srgb, var(--nexus-primary, #01757A) 8%, #FFFFFF) !important;
    color: #0F172A !important;
    border: 1px solid color-mix(in srgb, var(--nexus-primary, #01757A) 24%, transparent) !important;
    border-left: 4px solid var(--nexus-primary, #01757A) !important;
}

.mud-alert:not(.mud-snackbar).mud-alert-filled-info .mud-alert-icon,
.mud-alert:not(.mud-snackbar).mud-alert-outlined-info .mud-alert-icon,
.mud-alert:not(.mud-snackbar).mud-alert-text-info .mud-alert-icon,
.mud-alert:not(.mud-snackbar).mud-alert-filled-normal .mud-alert-icon {
    color: var(--nexus-primary, #01757A) !important;
}

.dark-mode .mud-alert:not(.mud-snackbar).mud-alert-filled-info,
.dark-mode .mud-alert:not(.mud-snackbar).mud-alert-outlined-info,
.dark-mode .mud-alert:not(.mud-snackbar).mud-alert-text-info,
.dark-mode .mud-alert:not(.mud-snackbar).mud-alert-filled-normal {
    background: color-mix(in srgb, var(--nexus-primary, #2BA5AB) 14%, #1E293B) !important;
    color: #F8FAFC !important;
}

/* ── Header Notification Bell Popover (.nexus-notif-popover) ── */
.nexus-notif-popover {
    border-top: 3px solid var(--nexus-primary, #01757A);
    background: var(--bg-card, #FFFFFF);
}

.nexus-notif-head {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color, #E2E8F0);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nexus-notif-count-pill {
    background: color-mix(in srgb, var(--nexus-primary, #01757A) 14%, transparent);
    color: var(--nexus-primary, #01757A);
    border: 1px solid color-mix(in srgb, var(--nexus-primary, #01757A) 25%, transparent);
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
}

.nexus-notif-mark-btn {
    background: transparent;
    border: none;
    color: var(--nexus-primary, #01757A);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.nexus-notif-mark-btn:hover {
    background: color-mix(in srgb, var(--nexus-primary, #01757A) 10%, transparent);
}

.nexus-notif-list {
    display: flex;
    flex-direction: column;
}

.nexus-notif-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color, #E2E8F0);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.nexus-notif-item:hover {
    background: color-mix(in srgb, var(--nexus-primary, #01757A) 4%, transparent);
}

.nexus-notif-item.unread {
    background: color-mix(in srgb, var(--nexus-primary, #01757A) 7%, transparent);
    border-left: 3px solid var(--nexus-primary, #01757A);
}

.nexus-notif-item-icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--nexus-primary, #01757A) 14%, transparent);
    color: var(--nexus-primary, #01757A);
    border: 1px solid color-mix(in srgb, var(--nexus-primary, #01757A) 25%, transparent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nexus-notif-item-icon.read {
    background: rgba(148, 163, 184, 0.14);
    color: #64748B;
    border-color: transparent;
}

.nexus-notif-dot {
    width: 7px;
    height: 7px;
    min-width: 7px;
    border-radius: 999px;
    background: var(--nexus-primary, #01757A);
    margin-top: 6px;
}

/* ── Filter Bar MudChip & Global MudChip Close Button Overflow Protection ── */
.nexus-filter-bar.nexus-filter-bar-responsive > div.nexus-filter-chip-wrap,
.nexus-filter-bar.nexus-filter-bar-responsive > div:has(.mud-chip) {
    flex: 0 0 auto !important;
    min-width: max-content !important;
    width: auto !important;
}

.nexus-filter-bar .mud-chip {
    max-width: none !important;
    height: 36px !important;
    border-radius: 6px !important;
    padding: 0 10px 0 12px !important;
    margin: 0 !important;
    font-size: 0.8125rem !important;
    font-weight: 600 !important;
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 8%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--nexus-primary, #01757A) 45%, transparent) !important;
    color: var(--nexus-primary, #01757A) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.nexus-filter-bar .mud-chip > .mud-chip-content {
    max-width: none !important;
    overflow: visible !important;
}

.nexus-filter-bar .mud-chip .mud-chip-close-button {
    margin-left: 4px !important;
    margin-right: -2px !important;
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    border-radius: 999px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    color: var(--nexus-primary, #01757A) !important;
}

.nexus-filter-bar .mud-chip .mud-chip-close-button:hover {
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 18%, transparent) !important;
}

.mud-chip > .mud-chip-content {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mud-chip .mud-chip-close-button {
    flex-shrink: 0;
}

/* BR-UI-CHIP-CLOSE-01 (17/11/2026) — luật trên cắt nội dung chip (overflow:hidden) để chữ dài có "…".
   MudBlazor 8 đặt nút × BÊN TRONG .mud-chip-content với lề phải âm (-4px) ⇒ mép phải nút × bị cắt / dính chữ
   (chip "Đang lọc" màn Danh sách Job, Henry 17/11). Bỏ lề âm để nút × nằm trọn trong chip. */
.mud-chip .mud-chip-close-button {
    margin-right: 0 !important;
    margin-inline-end: 0 !important;
    overflow: visible;
}

/* BR-UI-CHIP-CLOSE-02 (18/11/2026, Henry: "phần đầu x bị che" — chip giờ chốt đợt màn Cấu hình Kho).
   Nút × nằm TRONG .mud-chip-content đang overflow:hidden + chip bo tròn ⇒ mép phải nút × bị góc bo cắt.
   Chừa chỗ bên phải chip và cho nút × tràn ra khỏi vùng cắt chữ. */
.mud-chip:has(.mud-chip-close-button) {
    padding-right: 6px;
}

.mud-chip:has(.mud-chip-close-button) > .mud-chip-content {
    padding-right: 2px;
}

.code-link {
    color: var(--nexus-primary-ink, var(--nexus-primary, #01757A)) !important;
}

/* ── BR-SYS-UX-A11Y-01: WCAG AA (>= 4.5:1) Primary Solid & Primary Ink Tokens ── */
:root {
    --nexus-primary-solid: color-mix(in srgb, var(--nexus-primary, #01757A) 76%, #000000);
    --nexus-primary-ink: color-mix(in srgb, var(--nexus-primary, #01757A) 58%, #0F172A);
}

html:not(.dark-mode) .btn-primary:not(:disabled),
html:not(.dark-mode) .mud-button-filled.mud-button-filled-primary:not(:disabled):not(.mud-disabled) {
    background-color: var(--nexus-primary-solid, #01757A) !important;
    border-color: var(--nexus-primary-solid, #01757A) !important;
    color: #FFFFFF !important;
}

/* BR-SYS-UX-A11Y-06: nút bị khoá phải trông bị khoá — lớp ép màu ở trên không được áp cho nút disabled */
html:not(.dark-mode) .mud-button-filled.mud-button-filled-primary:disabled,
html:not(.dark-mode) .mud-button-filled.mud-button-filled-primary.mud-disabled {
    background-color: var(--mud-palette-action-disabled-background, rgba(0, 0, 0, 0.12)) !important;
    border-color: transparent !important;
    color: var(--mud-palette-action-disabled) !important;
    cursor: not-allowed;
}

html:not(.dark-mode) .nexus-sidebar-menu .mud-nav-link.active,
html:not(.dark-mode) .nexus-sidebar-menu .nx-nav-active .mud-nav-link,
html:not(.dark-mode) .nexus-sidebar-menu .mud-nav-link.nx-nav-active {
    color: var(--nexus-primary-ink, #015E63) !important;
    border-right-color: var(--nexus-primary-solid, #01757A) !important;
}

/* ── BR-SYS-APPROVAL-08: WCAG AA (>= 4.5:1) Tab Badges, Outlined Buttons, Table Links & Neutral Date Cell ── */
.nexus-cell-2line-neutral .nexus-cell-2line-primary {
    color: #334155 !important;
    font-weight: 500;
}

.nexus-doc-link,
html:not(.dark-mode) .mud-table-cell a:not(.btn):not(.mud-button-root) {
    color: var(--nexus-primary-ink, #014D51) !important;
    text-decoration: none;
}

.nexus-doc-link:hover,
html:not(.dark-mode) .mud-table-cell a:not(.btn):not(.mud-button-root):hover {
    text-decoration: underline;
}

html:not(.dark-mode) .mud-button-outlined.mud-button-outlined-primary {
    color: var(--nexus-primary-ink, #014D51) !important;
    border-color: color-mix(in srgb, var(--nexus-primary-solid, #01757A) 55%, transparent) !important;
}

html:not(.dark-mode) .mud-badge.mud-badge-warning {
    background-color: #B45309 !important;
    color: #FFFFFF !important;
}

html:not(.dark-mode) .mud-badge.mud-badge-info {
    background-color: #0369A1 !important;
    color: #FFFFFF !important;
}

html:not(.dark-mode) .mud-badge.mud-badge-error {
    background-color: #B91C1C !important;
    color: #FFFFFF !important;
}


/* ── BR-MST-ITEM-08: High-contrast WCAG AA (>= 5.8:1) SKU code link & operational badges ── */
.nexus-sku-code-link {
    font-size: 13px;
    font-weight: 700;
    color: #014D51 !important;
    text-decoration: none;
    cursor: pointer;
    display: inline-block;
}

.nexus-sku-code-link:hover {
    color: #0F5132 !important;
    text-decoration: underline;
}

.nexus-sku-trait-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background-color: #F0FDFA;
    color: #0F766E;
    border: 1px solid #99F6E4;
}


/* BR-MST-EMP-07: WCAG AAA avatar initials (#115E59 on #CCFBF1, contrast 7.4:1) */
.nexus-emp-avatar-initial {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    background-color: #CCFBF1 !important;
    color: #115E59 !important;
    border: 1px solid #99F6E4 !important;
    flex-shrink: 0;
}

/* BR-SYS-UI-DEDUP-01: Suppress duplicate NexusPageHeader breadcrumb inside SettingsApp (.settings-content) */
.settings-content .page-header,
.settings-content .nexus-page-header,
.settings-content .mud-breadcrumbs {
    display: none !important;
}

/* BR-SYS-UI-DEDUP-03: WCAG AA/AAA High-Contrast Soft Badges (.bg-*-lt & .badge.bg-*-lt) — Prevents Bootstrap 5 white-text-on-light-bg */
.bg-primary-lt,
.badge.bg-primary-lt,
.bg-teal-lt,
.badge.bg-teal-lt {
    background-color: #CCFBF1 !important;
    color: #115E59 !important;
    border: 1px solid #99F6E4;
}

.bg-blue-lt,
.badge.bg-blue-lt,
.bg-info-lt,
.badge.bg-info-lt,
.bg-azure-lt,
.badge.bg-azure-lt,
.bg-cyan-lt,
.badge.bg-cyan-lt {
    background-color: #E0F2FE !important;
    color: #075985 !important;
    border: 1px solid #BAE6FD;
}

.bg-green-lt,
.badge.bg-green-lt,
.bg-success-lt,
.badge.bg-success-lt {
    background-color: #DCFCE7 !important;
    color: #166534 !important;
    border: 1px solid #BBF7D0;
}

.bg-warning-lt,
.badge.bg-warning-lt,
.bg-orange-lt,
.badge.bg-orange-lt,
.bg-yellow-lt,
.badge.bg-yellow-lt {
    background-color: #FEF3C7 !important;
    color: #92400E !important;
    border: 1px solid #FDE68A;
}

.bg-danger-lt,
.badge.bg-danger-lt,
.bg-red-lt,
.badge.bg-red-lt {
    background-color: #FEE2E2 !important;
    color: #991B1B !important;
    border: 1px solid #FECACA;
}

.bg-secondary-lt,
.badge.bg-secondary-lt,
.bg-muted-lt,
.badge.bg-muted-lt {
    background-color: #F1F5F9 !important;
    color: #334155 !important;
    border: 1px solid #CBD5E1;
}

.badge.bg-green,
.bg-green {
    background-color: #16A34A !important;
    color: #FFFFFF !important;
}

.badge.bg-blue,
.bg-blue {
    background-color: #0284C7 !important;
    color: #FFFFFF !important;
}

/* ── BR-KHO-UI-BADGE-01: High-Contrast Warehouse & Soft Opacity Badges (WCAG AA >= 4.5:1) ── */
.bg-primary.bg-opacity-10,
.badge.bg-primary.bg-opacity-10,
.nexus-warehouse-badge {
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 12%, #FFFFFF) !important;
    color: var(--nexus-primary-ink, #014D51) !important;
    border: 1px solid color-mix(in srgb, var(--nexus-primary, #01757A) 25%, transparent) !important;
}

html.dark-mode .bg-primary.bg-opacity-10,
html.dark-mode .badge.bg-primary.bg-opacity-10,
html.dark-mode .nexus-warehouse-badge {
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 20%, #1E293B) !important;
    color: color-mix(in srgb, var(--nexus-primary, #01757A) 80%, #FFFFFF) !important;
    border-color: color-mix(in srgb, var(--nexus-primary, #01757A) 35%, transparent) !important;
}

.bg-info.bg-opacity-10,
.badge.bg-info.bg-opacity-10 {
    background-color: #E0F2FE !important;
    color: #075985 !important;
    border: 1px solid #BAE6FD !important;
}

.bg-success.bg-opacity-10,
.badge.bg-success.bg-opacity-10 {
    background-color: #DCFCE7 !important;
    color: #166534 !important;
    border: 1px solid #BBF7D0 !important;
}

.bg-secondary.bg-opacity-10,
.badge.bg-secondary.bg-opacity-10 {
    background-color: #F1F5F9 !important;
    color: #334155 !important;
    border: 1px solid #CBD5E1 !important;
}

/* BR-SYS-A11Y-AA — breadcrumb mục hiện tại: MudBlazor để opacity .38 ⇒ 1.88:1; đưa về #334155 đặc (≥ 10:1). */
.mud-breadcrumbs .mud-breadcrumb-item.mud-disabled,
.mud-breadcrumbs .mud-breadcrumb-item.mud-disabled a,
.mud-breadcrumbs .mud-breadcrumb-item.mud-disabled span {
    color: #334155 !important;
    opacity: 1 !important;
    font-weight: 600;
}

/* BR-PUR-CONTRAST-01: Breadcrumb current item high contrast (#64748B / #475569) */
.nexus-premium-breadcrumbs .mud-breadcrumb-item.mud-disabled,
.nexus-premium-breadcrumbs .mud-breadcrumb-item.mud-disabled a,
.nexus-premium-breadcrumbs .mud-breadcrumb-item.mud-disabled span,
.nexus-premium-breadcrumbs .mud-breadcrumb-item:last-child {
    color: #475569 !important;
    opacity: 1 !important;
    font-weight: 600;
}

/* ==========================================================================
   BR-FIN-APINV-UI-05 — WCAG AA cho nút trang đang chọn của MudPagination.
   Trang đang chọn từng hiện chữ xám #64748B trên nền cam #C2410C (1.09:1 — không đọc được số).
   Ép chữ trắng + nền "ink" đậm của thương hiệu (≥ 4.5:1) cho mọi nút filled trong phân trang.
   ========================================================================== */
.mud-pagination .mud-pagination-item button.mud-button-filled,
.mud-pagination .mud-pagination-item .mud-button-root.mud-button-filled,
.mud-pagination .mud-pagination-item button.mud-button-filled .mud-button-label {
    color: #FFFFFF !important;
}

.mud-pagination .mud-pagination-item button.mud-button-filled,
.mud-pagination .mud-pagination-item .mud-button-root.mud-button-filled {
    background-color: var(--nexus-primary-ink, #01757A) !important;
}

/* BR-FWD-UI-47: forwarding status / warning colours as tokens with dark-mode values. Used by the job
   list, the job screen and its dialogs (dialogs render outside the page root, hence :root). */
:root {
    --fwd-warn: #B45309; --fwd-neg: #B91C1C; --fwd-ok: #047857; --fwd-obh: #0369A1;
    --fwd-st-draft: #475569; --fwd-st-active: #0369A1; --fwd-st-done: #01656A; --fwd-st-cancel: #B91C1C;
}
html.dark-mode {
    --fwd-warn: #FBBF24; --fwd-neg: #F87171; --fwd-ok: #34D399; --fwd-obh: #7DD3FC;
    --fwd-st-draft: #CBD5E1; --fwd-st-active: #7DD3FC; --fwd-st-done: #5EEAD4; --fwd-st-cancel: #FCA5A5;
}

/* BR-FWD-PLS-03: P/L dialog tabs share one fixed height, so switching tabs never resizes the dialog. */
.fwd-plh-panel { height: calc(65vh + 52px); overflow: auto; }
/* BR-FWD-UI-48: tab-strip toolbar never wraps or squeezes its buttons. */
.fwd-tab-toolbar { flex-shrink: 0; white-space: nowrap; }
.fwd-tab-toolbar .mud-button-root { flex-shrink: 0; white-space: nowrap; }

/* BR-SYS-JOURNAL-LOG-05 (review 09/11): ô lọc hẹp hơn CHỈ ở màn Lịch sử truy cập — không đổi 97 màn dùng chung thanh lọc. */
.journals-page .nexus-card-filterbar-inputs > .mud-input-control,
.journals-page .nexus-card-filterbar-inputs > .mud-picker,
.journals-page .nexus-card-filterbar-inputs > div {
    flex: 1 1 140px !important;
    min-width: 130px !important;
}

.journals-page .nexus-card-filterbar-inputs > :first-child {
    flex: 1.2 1 160px !important;
}

/* Dòng đang mở chi tiết (trước nằm trong <style> của Journals.razor) */
html.dark-mode .journals-page .table-active { background-color: var(--mud-palette-background-grey) !important; }
.journals-page .table-active {
    background-color: #F0F9FF !important;
}

/* ── BR-SYS-JOURNAL-LOG-05 & 06: Access History (/log-histories) Avatar, Action Badges & Record Pill ── */
.journal-user-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background-color: var(--nexus-primary-aa, #01757A) !important;
    color: #FFFFFF !important;
    flex-shrink: 0;
}

.action-INSERT, .action-ADD, .action-CREATE {
    background-color: #15803D !important;
}

.action-UPDATE, .action-EDIT {
    background-color: #B45309 !important;
}

.action-DELETE, .action-REMOVE {
    background-color: #B91C1C !important;
}

.action-LOGIN {
    background-color: #0E7490 !important;
}

.action-LOGOUT {
    background-color: #475569 !important;
}

.journal-record-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.74rem;
    font-weight: 700;
    background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 10%, #FFFFFF);
    color: var(--nexus-primary-ink, #014D51);
    border: 1px solid color-mix(in srgb, var(--nexus-primary, #01757A) 28%, transparent);
    flex-shrink: 0;
}

html.dark-mode .journal-record-pill {
    background-color: color-mix(in srgb, var(--nexus-primary, #2BA5AB) 18%, #1E293B);
    color: #5EEAD4;
    border-color: color-mix(in srgb, var(--nexus-primary, #2BA5AB) 35%, transparent);
}

/* ============================================================================
   BR-SAL-SETTINGS-UX-01 · BR-INV-SETTINGS-UX-01 · BR-PUR-SETTINGS-UX-01
   Màn Cài đặt module (Bán · Kho · Mua): thẻ phẳng 4px, viền #E2E8F0, nền #F1F5F9, màu nhấn theo tenant.
   ============================================================================ */
.nx-settings-shell { background: #FFFFFF; border: 1px solid #E2E8F0; border-radius: 4px; overflow: hidden; }
.nx-settings-topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.65rem 1rem; background: #FFFFFF; border-bottom: 1px solid #E2E8F0; }
.nx-settings-tabbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; padding: 0 1rem; background: #FFFFFF; border-bottom: 1px solid #E2E8F0; }
.nx-settings-tab { appearance: none; background: transparent; border: none; border-bottom: 2px solid transparent; padding: 0.65rem 1rem; font-size: 0.875rem; font-weight: 600; color: #475569; cursor: pointer; transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease; }
.nx-settings-tab:hover { color: var(--nexus-primary, #01757A); background: #F8FAFC; }
.nx-settings-tab.active { color: var(--nexus-primary, #01757A); border-bottom-color: var(--nexus-primary, #01757A); background: color-mix(in srgb, var(--nexus-primary, #01757A) 7%, #FFFFFF); }
.nx-settings-canvas { background: #F1F5F9; padding: 1rem; }
.nx-settings-card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 4px;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.nx-settings-card + .nx-settings-card { margin-top: 1rem; }
.nx-settings-card-header { display: flex; align-items: center; gap: 0.65rem; padding: 0.75rem 1rem; background: #F8FAFC; border-bottom: 1px solid #E2E8F0; }
.nx-settings-step { width: 24px; height: 24px; border-radius: 4px; background: var(--nexus-primary, #01757A); color: #FFFFFF; font-size: 0.75rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nx-settings-card-title { font-size: 0.925rem; font-weight: 700; color: #0F172A; line-height: 1.25; margin: 0; }
.nx-settings-card-sub { font-size: 0.75rem; color: #64748B; line-height: 1.3; margin-top: 2px; }
.nx-settings-card-body { padding: 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.65rem; flex: 1; }
.nx-settings-toggle { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.6rem 0.75rem; background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 4px; }
.nx-settings-toggle.sub-toggle { margin-left: 1.5rem; border-left: 3px solid var(--nexus-primary, #01757A); background: color-mix(in srgb, var(--nexus-primary, #01757A) 4%, #FFFFFF); }
.nx-settings-toggle-title { font-size: 0.84rem; font-weight: 600; color: #0F172A; line-height: 1.3; }
.nx-settings-toggle-desc { font-size: 0.75rem; color: #64748B; line-height: 1.35; margin-top: 2px; }
.nx-settings-help { font-size: 0.75rem; color: #64748B; line-height: 1.35; margin-top: -0.35rem; }
.nx-settings-banner { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; padding: 0.5rem 0.75rem; border-radius: 4px; background: color-mix(in srgb, var(--nexus-primary, #01757A) 7%, #FFFFFF); border: 1px solid color-mix(in srgb, var(--nexus-primary, #01757A) 25%, #E2E8F0); font-size: 0.76rem; color: #334155; }
.nx-settings-subsection { margin-top: 0.25rem; padding-top: 0.65rem; border-top: 1px dashed #CBD5E1; }
.nx-settings-group-title { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; font-weight: 700; color: #0F172A; margin: 0.25rem 0 0.1rem; }
.nx-settings-count { font-size: 0.72rem; font-weight: 600; color: #475569; background: #E2E8F0; border-radius: 4px; padding: 1px 6px; }
.nx-settings-code { font-size: 11px; font-weight: 600; color: #0F172A; background: #E2E8F0; border-radius: 4px; padding: 2px 6px; }
.nx-docnum-item { padding: 0.75rem; background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 4px; }
.nx-docnum-ymd { display: flex; justify-content: space-around; align-items: center; height: 36px; padding: 0 0.5rem; background: #FFFFFF; border: 1px solid #CBD5E1; border-radius: 4px; }
.nx-docnum-preview { font-family: 'JetBrains Mono', Consolas, monospace; font-variant-numeric: tabular-nums; font-size: 0.78rem; font-weight: 700; color: var(--nexus-primary, #01757A); background: color-mix(in srgb, var(--nexus-primary, #01757A) 8%, #FFFFFF); border: 1px solid color-mix(in srgb, var(--nexus-primary, #01757A) 25%, #E2E8F0); border-radius: 4px; padding: 2px 8px; }

/* BR-SYS-EXEC-DEBT-01..06 — Tổng quan điều hành · Theo dõi công nợ (system.md §114). Màu: đỏ / cam / teal / xanh dương / xanh lá (không tím). */
.exec-debt { background: var(--mud-palette-surface, #FFFFFF); border: 1.5px solid var(--nexus-primary, #01757A); border-radius: 4px; padding: 12px 14px; }
.exec-debt-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.exec-debt-tabs { display: inline-flex; border: 1px solid var(--mud-palette-lines-default, #CBD5E1); border-radius: 4px; overflow: hidden; }
.exec-debt-tabs button { border: 0; background: transparent; padding: 5px 12px; font-size: 0.8rem; font-weight: 600; color: var(--mud-palette-text-secondary, #475569); white-space: nowrap; cursor: pointer; }
.exec-debt-tabs button.is-on { background: var(--nexus-primary, #01757A); color: #FFFFFF; }
.exec-debt-grid { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 16px; margin-top: 10px; }
@media (max-width: 992px) { .exec-debt-grid { grid-template-columns: 1fr; } }
.exec-debt-total { font-size: 1.5rem; font-weight: 700; color: var(--nexus-primary, #01757A); white-space: nowrap; line-height: 1.3; }
.exec-debt-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.exec-debt-kv { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
@media (max-width: 768px) { .exec-debt-kv { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.exec-debt-stat { display: flex; flex-direction: column; gap: 1px; border: 1px solid var(--mud-palette-lines-default, #E2E8F0); border-radius: 4px; padding: 8px 10px; min-width: 0; }
.exec-debt-stat-label { font-size: 0.78rem; color: var(--mud-palette-text-secondary, #64748B); }
.exec-debt-stat-value { font-size: 1rem; font-weight: 700; white-space: nowrap; }
.exec-debt-stat-sub { font-size: 0.75rem; color: var(--mud-palette-text-secondary, #64748B); }
.exec-debt-stat--red { background: #FEF2F2; border-color: #FECACA; }
.exec-debt-stat--red .exec-debt-stat-value { color: #B91C1C; }
.exec-debt-stat--amber { background: #FFFBEB; border-color: #FDE68A; }
.exec-debt-stat--amber .exec-debt-stat-value { color: #B45309; }
.exec-debt-stat--orange { background: #FFF7ED; border-color: #FED7AA; }
.exec-debt-stat--orange .exec-debt-stat-value { color: #C2410C; }
.exec-debt-bar { display: flex; height: 12px; border-radius: 3px; overflow: hidden; margin-top: 12px; background: #E2E8F0; }
.exec-debt-bar > span { flex-basis: 0; min-width: 2px; }
.exec-debt-bar-b0 { background: var(--nexus-primary, #01757A); }
.exec-debt-bar-b1 { background: #FBBF24; }
.exec-debt-bar-b2 { background: #F97316; }
.exec-debt-bar-b3 { background: #EF4444; }
.exec-debt-bar-b4 { background: #991B1B; }
.exec-debt-bar-cn { background: #94A3B8; }
.exec-debt-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 12px; margin-top: 8px; font-size: 0.78rem; }
.exec-debt-legend span { display: flex; align-items: center; gap: 6px; min-width: 0; }
.exec-debt-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; }
.exec-debt-legend b { margin-left: auto; white-space: nowrap; }
.exec-debt-link { color: var(--nexus-primary, #01757A); font-weight: 600; text-decoration: none; white-space: nowrap; }
.exec-debt-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.exec-debt-fc { border: 1px solid var(--mud-palette-lines-default, #CBD5E1); border-radius: 14px; padding: 2px 10px; font-size: 0.78rem; background: transparent; color: var(--mud-palette-text-primary, #334155); white-space: nowrap; cursor: pointer; }
.exec-debt-fc.is-on { border-color: var(--nexus-primary, #01757A); background: color-mix(in srgb, var(--nexus-primary, #01757A) 10%, transparent); color: var(--nexus-primary, #01757A); font-weight: 600; }
.exec-debt-row { display: grid; grid-template-columns: 136px minmax(0, 1fr) 96px 128px auto; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--mud-palette-lines-default, #EEF2F6); }
@media (max-width: 768px) { .exec-debt-row { grid-template-columns: minmax(0, 1fr) auto; } .exec-debt-row .exec-debt-paid { display: none; } .exec-debt-tags { grid-column: 1 / -1; } }
.exec-debt-tags { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.exec-debt-tags--row { flex-direction: row; flex-wrap: wrap; }
.exec-debt-chip { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.exec-debt-chip--red { background: #FEE2E2; color: #B91C1C; }
.exec-debt-chip--orange { background: #FFEDD5; color: #C2410C; }
.exec-debt-chip--teal { background: color-mix(in srgb, var(--nexus-primary, #01757A) 12%, transparent); color: var(--nexus-primary, #01757A); }
.exec-debt-chip--blue { background: #E0F2FE; color: #0369A1; }
.exec-debt-chip--green { background: #DCFCE7; color: #15803D; }
.exec-debt-chip--grey { background: #F1F5F9; color: #475569; }
.exec-debt-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exec-debt-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exec-debt-prog { height: 6px; background: #E2E8F0; border-radius: 3px; overflow: hidden; }
.exec-debt-prog i { display: block; height: 100%; background: var(--nexus-primary, #01757A); }
.exec-debt-amount { font-weight: 700; text-align: right; white-space: nowrap; }
.exec-debt-more { border: 0; background: transparent; padding: 6px 0 0; color: var(--nexus-primary, #01757A); font-weight: 600; font-size: 0.8rem; cursor: pointer; }
.exec-debt-pay { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
@media (max-width: 992px) { .exec-debt-pay { grid-template-columns: 1fr; } }
.exec-debt-pay-card { display: flex; align-items: center; gap: 10px; border: 1px solid var(--mud-palette-lines-default, #E2E8F0); border-radius: 4px; padding: 8px 12px; color: inherit; text-decoration: none; white-space: nowrap; min-width: 0; }
.exec-debt-pay-card:hover { border-color: var(--nexus-primary, #01757A); }
.exec-debt-pay-card b { font-size: 1rem; }
.exec-debt-drawer { max-width: 100vw; }
/* END BR-SYS-EXEC-DEBT */
/* BR-SYS-EXEC-LAYOUT-01..04 — Tổng quan điều hành: thu nhỏ / phóng lớn từng khối (system.md §117). */
.exec-card-tools { display: inline-flex; align-items: center; gap: 0; margin-right: -6px; }
.exec-card-tools .mud-icon-button { padding: 4px; color: var(--mud-palette-text-secondary, #64748B); }
.exec-card-tools .mud-icon-button:hover { color: var(--nexus-primary, #01757A); }
.exec-card--collapsed { padding-bottom: 8px; }
.exec-card--collapsed > .d-flex, .exec-card--collapsed .exec-debt-head { margin-bottom: 2px !important; }
.exec-collapsed-summary { font-size: 0.82rem; color: var(--mud-palette-text-secondary, #64748B); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exec-cols.exec-cols--single { grid-template-columns: minmax(0, 1fr); margin-top: 0; }
.exec-cols:empty { display: none; }
.exec-focus-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin-bottom: 12px; border-radius: 4px; border: 1px solid color-mix(in srgb, var(--nexus-primary, #01757A) 35%, transparent); background: color-mix(in srgb, var(--nexus-primary, #01757A) 6%, transparent); color: var(--nexus-primary, #01757A); font-weight: 600; font-size: 0.85rem; }
.exec-head-inline { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.exec-head-hello { font-weight: 600; font-size: 0.95rem; white-space: nowrap; }
.exec-head-meta { font-size: 0.8rem; color: var(--mud-palette-text-secondary, #64748B); white-space: nowrap; }
/* END BR-SYS-EXEC-LAYOUT */

/* ── BR-SYS-NAV-SEARCH-01 / PIN-01 / RECENT-01 — ô tìm màn, ghim, gần đây (system.md §115) ── */
.nav-quick-search {
    display: flex; align-items: center; gap: 6px; width: 100%;
    padding: 6px 8px; border: 1px solid var(--mud-palette-lines-default, #E2E8F0);
    border-radius: 4px; background: var(--mud-palette-surface, #fff);
    color: var(--mud-palette-text-secondary, #64748B); font-size: 0.8125rem; cursor: pointer; text-align: left;
}
.nav-quick-search:hover { border-color: var(--nexus-primary, #01757A); }
.nav-quick-search__text { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-quick-kbd {
    flex-shrink: 0; padding: 0 5px; border: 1px solid var(--mud-palette-lines-default, #CBD5E1); border-radius: 4px;
    font-size: 0.6875rem; line-height: 1.5; white-space: nowrap; color: var(--mud-palette-text-secondary, #64748B);
}
.nav-quick-section {
    padding: 6px 8px 2px; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--mud-palette-text-secondary, #94A3B8); white-space: nowrap;
}
.nav-quick-pin {
    display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 4px;
    color: var(--mud-palette-text-primary, #0F172A); text-decoration: none; font-size: 0.875rem;
}
.nav-quick-pin:hover, .nav-quick-pin.active { background: rgba(1, 117, 122, 0.08); color: var(--nexus-primary, #01757A); }
.nav-quick-pin__label { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-quick-pin__module { flex-shrink: 0; font-size: 0.6875rem; color: var(--mud-palette-text-secondary, #94A3B8); white-space: nowrap; }
.nav-quick-divider { margin: 6px 8px 0; border-top: 1px solid var(--mud-palette-lines-default, #E2E8F0); }
.nav-quick-star--on { color: #D97706 !important; }
.nav-quick-row {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 6px 8px; border-radius: 4px; cursor: pointer; min-width: 0;
}
.nav-quick-row:hover { background: rgba(1, 117, 122, 0.06); }
.nav-quick-row--active { background: rgba(1, 117, 122, 0.10); }
.nav-quick-footer {
    display: flex; gap: 16px; margin-top: 8px; padding-top: 6px; white-space: nowrap;
    border-top: 1px solid var(--mud-palette-lines-default, #E2E8F0);
    font-size: 0.75rem; color: var(--mud-palette-text-secondary, #94A3B8);
}
html.dark-mode .nav-quick-search { background: transparent; }

/* ── BR-SYS-NAV-LAYOUT-03 — "MenuRail": false: menu trái một cột, không thanh phân hệ (system.md §115) ── */
/* Henry 14/11 "menu xấu quá": danh sách dùng đúng MudNavGroup / MudNavLink / .nav-section-header của menu cũ (.nexus-sidebar-menu);
   chỉ thêm khoảng cách cho dòng phân hệ. */
.sbn-menu .sbn-module-group > .mud-nav-group > .mud-nav-link .mud-nav-link-text { font-weight: 600; }
.sbn-menu .sbn-module-group .mud-collapse-wrapper-inner { padding-bottom: 4px; }

/* Thu gọn: cột icon 64px + danh sách màn bật bên cạnh */
.sbn-mini-col {
    position: fixed; left: 0; top: 48px; bottom: 0; width: 64px; z-index: 1099; padding: 12px 0;
    display: flex; flex-direction: column; align-items: center; overflow-y: auto;
    background: var(--bg-surface, #F8FAFC); border-right: 1px solid var(--border-color, #E2E8F0);
}
.sbn-mini { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sbn-mini-btn {
    width: 40px; height: 40px; border-radius: 4px; border: 1px solid transparent; background: transparent;
    color: var(--mud-palette-text-secondary, #64748B); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.sbn-mini-btn i { font-size: 18px; }
.sbn-mini-btn:hover { background: rgba(1, 117, 122, 0.08); color: var(--nexus-primary, #01757A); }
.sbn-mini-btn.active { color: var(--nexus-primary, #01757A); border-color: var(--nexus-primary, #01757A); }
.sbn-mini-btn.open { background: rgba(1, 117, 122, 0.10); }
.sbn-flyout-backdrop { position: fixed; inset: 48px 0 0 64px; z-index: 1100; }
.sbn-flyout {
    position: fixed; left: 70px; top: 56px; width: 260px; max-height: calc(100vh - 72px); overflow-y: auto; z-index: 1101;
    padding: 8px; border-radius: 4px; background: var(--mud-palette-surface, #fff);
    border: 1px solid var(--mud-palette-lines-default, #E2E8F0); box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
.sbn-flyout-title { padding: 4px 8px 6px; font-weight: 600; color: var(--nexus-primary, #01757A); white-space: nowrap; }

/* BR-SAL-ROWCOLOR-01..03 (sales.md ND13-05) — nền nhạt cả dòng theo nhóm trạng thái đơn bán.
   Pha với màu nền bề mặt (đục) để cột cố định (sticky) cũng được tô; chữ giữ nguyên màu; chế độ tối tự theo --mud-palette-surface. */
tr.nx-row-tone-entry > td    { background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 9%, var(--mud-palette-surface, #FFFFFF)) !important; }
tr.nx-row-tone-shipping > td { background-color: color-mix(in srgb, #F59E0B 14%, var(--mud-palette-surface, #FFFFFF)) !important; }
tr.nx-row-tone-done > td     { background-color: color-mix(in srgb, #16A34A 11%, var(--mud-palette-surface, #FFFFFF)) !important; }
tr.nx-row-tone-problem > td  { background-color: color-mix(in srgb, #DC2626 10%, var(--mud-palette-surface, #FFFFFF)) !important; }
tr.nx-row-tone-entry:hover > td    { background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 15%, var(--mud-palette-surface, #FFFFFF)) !important; }
tr.nx-row-tone-shipping:hover > td { background-color: color-mix(in srgb, #F59E0B 22%, var(--mud-palette-surface, #FFFFFF)) !important; }
tr.nx-row-tone-done:hover > td     { background-color: color-mix(in srgb, #16A34A 18%, var(--mud-palette-surface, #FFFFFF)) !important; }
tr.nx-row-tone-problem:hover > td  { background-color: color-mix(in srgb, #DC2626 16%, var(--mud-palette-surface, #FFFFFF)) !important; }
/* BR-SAL-ROWCOLOR-04 (Henry 17/11 18:40, ảnh Đơn bán hàng: "phần col số SO ko tô màu như màu row") — ô GHIM (cột 1 sticky-left,
   cột 2 nexus-sticky-col2, ô chọn) tự tô nền đục theo luật "Sticky Column 1/2" (độ ưu tiên 0,6,0) nên đè màu dòng (0,1,2) ⇒ cột Số SO
   trắng / xám. Các luật dưới (0,6,1 · khi rê 0,7,1) cho ô ghim cùng màu dòng; vẫn đục để che nội dung cuộn ngang bên dưới. */
.erp-datagrid .mud-table-body .mud-table-row.nx-row-tone-entry:nth-child(n) > td:is(.sticky-left, .nexus-sticky-col2, .mud-table-cell-checkbox) { background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 9%, var(--mud-palette-surface, #FFFFFF)) !important; }
.erp-datagrid .mud-table-body .mud-table-row.nx-row-tone-shipping:nth-child(n) > td:is(.sticky-left, .nexus-sticky-col2, .mud-table-cell-checkbox) { background-color: color-mix(in srgb, #F59E0B 14%, var(--mud-palette-surface, #FFFFFF)) !important; }
.erp-datagrid .mud-table-body .mud-table-row.nx-row-tone-done:nth-child(n) > td:is(.sticky-left, .nexus-sticky-col2, .mud-table-cell-checkbox) { background-color: color-mix(in srgb, #16A34A 11%, var(--mud-palette-surface, #FFFFFF)) !important; }
.erp-datagrid .mud-table-body .mud-table-row.nx-row-tone-problem:nth-child(n) > td:is(.sticky-left, .nexus-sticky-col2, .mud-table-cell-checkbox) { background-color: color-mix(in srgb, #DC2626 10%, var(--mud-palette-surface, #FFFFFF)) !important; }
.erp-datagrid .mud-table-body .mud-table-row.nx-row-tone-entry:nth-child(n):hover > td:is(.sticky-left, .nexus-sticky-col2, .mud-table-cell-checkbox) { background-color: color-mix(in srgb, var(--nexus-primary, #01757A) 15%, var(--mud-palette-surface, #FFFFFF)) !important; }
.erp-datagrid .mud-table-body .mud-table-row.nx-row-tone-shipping:nth-child(n):hover > td:is(.sticky-left, .nexus-sticky-col2, .mud-table-cell-checkbox) { background-color: color-mix(in srgb, #F59E0B 22%, var(--mud-palette-surface, #FFFFFF)) !important; }
.erp-datagrid .mud-table-body .mud-table-row.nx-row-tone-done:nth-child(n):hover > td:is(.sticky-left, .nexus-sticky-col2, .mud-table-cell-checkbox) { background-color: color-mix(in srgb, #16A34A 18%, var(--mud-palette-surface, #FFFFFF)) !important; }
.erp-datagrid .mud-table-body .mud-table-row.nx-row-tone-problem:nth-child(n):hover > td:is(.sticky-left, .nexus-sticky-col2, .mud-table-cell-checkbox) { background-color: color-mix(in srgb, #DC2626 16%, var(--mud-palette-surface, #FFFFFF)) !important; }
.nx-row-tone-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; font-size: 0.8rem; color: var(--mud-palette-text-secondary); padding: 0 4px 8px; }   /* BR-SAL-ROWCOLOR-03: nằm trên lưới */
.nx-row-tone-legend > span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.nx-row-tone-legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--mud-palette-lines-default, #E5E7EB); }
.nx-row-tone-legend i.nx-row-tone-entry    { background: color-mix(in srgb, var(--nexus-primary, #01757A) 9%, var(--mud-palette-surface, #FFFFFF)); }
.nx-row-tone-legend i.nx-row-tone-shipping { background: color-mix(in srgb, #F59E0B 14%, var(--mud-palette-surface, #FFFFFF)); }
.nx-row-tone-legend i.nx-row-tone-done     { background: color-mix(in srgb, #16A34A 11%, var(--mud-palette-surface, #FFFFFF)); }
.nx-row-tone-legend i.nx-row-tone-problem  { background: color-mix(in srgb, #DC2626 10%, var(--mud-palette-surface, #FFFFFF)); }
/* BR-UI-SEARCHPANEL-06: nội dung ngay sau chữ "Bộ lọc" (chú giải màu dòng…) — cùng hàng tiêu đề, không lề dưới */
.nexus-section-title-extra { display: inline-flex; align-items: center; min-width: 0; margin-left: 16px; cursor: default; }
.nexus-section-title-extra .nx-row-tone-legend { padding: 0; }

/* BR-SAL-CUST360-01 — Lịch sử bán hàng (ND13-04): mã khách / số đơn bấm được, số nợ, quá hạn, dòng lâu không mua. */
.ch-code { color: var(--nexus-primary, #01757A); font-weight: 600; text-decoration: none; white-space: nowrap; }
.ch-code:hover { text-decoration: underline; }
.ch-balance { color: #b45309; }
.ch-overdue { color: #b91c1c; }
.ch-pay-ok { color: #047857; }
.ch-muted { color: #94a3b8; }
.ch-row-inactive > td { background-color: #fef2f2; }
.ch-head-title { font-size: 1.15rem; font-weight: 700; }
.ch-drawer-head { border-bottom: 1px solid var(--mud-palette-lines-default, #e2e8f0); }

/* BR-SAL-RPT-DAILY-11 (Henry 17/11 "1,12 tỷ thu nhỏ lại cho lọt vào ô hình tròn, màu khác màu đen"):
   chữ giữa vòng Donut. SVG của MudChart Donut có viewBox 42×42, lỗ giữa bán kính 13.4 ⇒ cỡ chữ tính theo
   đơn vị của viewBox, không phải px màn hình — 4.5 đơn vị ≈ 7 ký tự vừa trong lỗ 26.8. */
.mud-chart-donut .donut-inner-text {
    font-size: 4.5px;
    font-weight: 700;
    fill: var(--nexus-primary, #01757A);
}

/* BR-UI-FORM-FOCUS-02 (17/11/2026) — ô bị báo lỗi (nexus-form.js focusField gắn .nx-field-invalid tới khi người dùng sửa).
   Ô nhập Mud: viền đỏ 2px như trạng thái lỗi sẵn có của MudBlazor. Ô không phải ô gõ (chip chọn Đơn vị vận hành /
   NV Sales, nút): viền đỏ quanh chính nó. Màu lấy từ bảng màu lỗi (không tím). */
.nx-field-invalid.mud-input-control .mud-input-outlined-border,
.nx-field-invalid .mud-input.mud-input-outlined .mud-input-outlined-border {
    border-color: var(--mud-palette-error) !important;
    border-width: 2px !important;
}
.nx-field-invalid.mud-input-control .mud-input-label,
.nx-field-invalid .mud-input-label {
    color: var(--mud-palette-error) !important;
}
.nx-field-invalid:not(.mud-input-control) {
    outline: 2px solid var(--mud-palette-error);
    outline-offset: 2px;
    border-radius: 4px;
}
.nx-field-invalid:not(.mud-input-control) .mud-button-outlined {
    border-color: var(--mud-palette-error) !important;
}
/* BR-UI-FORM-FOCUS-04: thông báo liệt kê đủ lỗi khi bấm Lưu */
.nx-error-list ul { margin: 4px 0 0; padding-left: 18px; }
.nx-error-list li { line-height: 1.45; }
