/* Font hệ thống local — không phụ thuộc fonts.googleapis.com */

* {

    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

}



/* Thêm vào phần đầu file, sau phần reset */

body {

    overflow-x: hidden; /* Ngăn scroll ngang khi menu mở */

}



/* Thêm nút toggle menu */

.menu-toggle {

    display: none; /* Ẩn mặc định trên desktop */

    position: fixed;

    top: 10px;

    right: 10px; /* Thay đổi từ left thành right */

    z-index: 1070;

    background: #2c3e50;

    border: none;

    color: white;

    width: 40px;

    height: 40px;

    border-radius: 4px;

    cursor: pointer;

    transition: all 0.3s;

}



.menu-toggle:hover {

    background: #3498db;

}



/* Sidebar styles */

.sidebar {

    min-height: 100vh;

    background: #2c3e50;

    padding: 0;

    position: fixed;

    top: 0;

    left: 0;

    width: 250px;

    height: 100vh;

    z-index: 1060;

    box-shadow: 0 0 20px rgba(0,0,0,0.1);

    overflow-y: auto;

    font-family: 'Roboto', sans-serif;

    transition: transform 0.3s ease, visibility 0.3s ease;

    visibility: hidden;

}



/* Brand/Logo area */

.sidebar .navbar-brand {

    color: #ecf0f1;

    padding: 15px 20px;

    margin-bottom: 0;

    display: block;

    font-size: 14px;

    font-weight: 500;

    text-align: left;

    background: rgba(0,0,0,0.1);

    border-bottom: 1px solid rgba(255,255,255,0.05);

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;

    font-family: 'Roboto', sans-serif;

}



/* Navigation menu */

.sidebar .nav {

    padding: 10px 0;

    margin-bottom: 60px; /* Để không bị user-info che */

}



/* Menu items */

.sidebar .nav-item {

    margin: 2px 0;

}



/* All menu links - đồng nhất font size và padding */

.sidebar .nav-link {

    color: #b8c7ce;

    padding: 10px 20px;

    display: flex;

    align-items: center;

    transition: all 0.3s ease;

    font-size: 14px;

    font-weight: 400;

    font-family: 'Roboto', sans-serif;

    border: none;

    border-left: 3px solid transparent;

    border-radius: 0;

    white-space: nowrap;

    width: 100%;

}



/* Icons in menu */

.sidebar .nav-link i {

    width: 20px;

    margin-right: 10px;

    font-size: 14px;

    text-align: center;

    color: #8aa4af;

    transition: all 0.3s ease;

}



/* Hover effect */

.sidebar .nav-link:hover {

    background: rgba(255,255,255,0.05);

    color: #fff;

    border-left-color: #3498db;

}



.sidebar .nav-link:hover i {

    color: #3498db;

}



/* Active state */

.sidebar .nav-link.active {

    background: rgba(52, 152, 219, 0.1);

    color: #3498db;

    border-left-color: #3498db;

}



.sidebar .nav-link.active i {

    color: #3498db;

}



/* Submenu */

.submenu {

    background: rgba(0,0,0,0.1);

    padding: 5px 0;

}



.submenu .nav-link {

    padding: 8px 20px 8px 53px; /* 53px = 20px + 20px(icon) + 13px */

    font-size: 14px;

    color: #b8c7ce;

}



/* Dropdown arrow */

.nav-link.dropdown-toggle::after {

    margin-left: auto;

    font-size: 12px;

    transition: transform 0.3s;

    opacity: 0.5;

}



.nav-link.dropdown-toggle[aria-expanded="true"]::after {

    transform: rotate(180deg);

}



/* User info section */

.user-info {

    position: fixed;

    bottom: 0;

    left: 0;

    width: 250px;

    background: rgba(0,0,0,0.2);

    padding: 15px 20px;

    border-top: 1px solid rgba(255,255,255,0.05);

    font-family: 'Roboto', sans-serif;

}



.user-info .fw-medium {

    color: #ecf0f1;

    font-size: 14px;

    font-weight: 500;

}



.user-info .small {

    color: #95a5a6;

    font-size: 12px;

    font-weight: 400;

}



/* Logout button */

.btn-outline-light {

    background: transparent;

    border: 1px solid rgba(255,255,255,0.1);

    color: #b8c7ce;

    transition: all 0.3s ease;

    margin-top: 10px;

    font-size: 14px;

    padding: 8px 15px;

    font-family: 'Roboto', sans-serif;

    font-weight: 400;

}



.btn-outline-light:hover {

    background: #3498db;

    border-color: #3498db;

    color: #fff;

}



/* Main content */
.main-content {
    margin-left: 250px;
    padding: 20px;
    background: #f5f6fa;
    min-height: 100vh;
    font-family: 'Roboto', sans-serif;
    transition: margin-left 0.3s ease;
}

/* Page header */
.page-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.page-header h1 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 24px;
    font-weight: 600;
}

.page-header .breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 14px;
}

.page-header .breadcrumb-item a {
    color: #3498db;
    text-decoration: none;
}

.page-header .breadcrumb-item a:hover {
    color: #2980b9;
    text-decoration: underline;
}

.page-header .breadcrumb-item.active {
    color: #7f8c8d;
}



/* Box styles for AdminLTE compatibility */
.box {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.box-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.box-header.with-border {
    border-bottom: 1px solid #e0e0e0;
}

.box-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.box-body {
    padding: 20px;
}

/* Card styles */
.card {
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);

}



.card-body {

    padding: 20px;

}



/* Dashboard stats */

.stats-card h2 {

    color: #0d6efd;

    font-size: 2.5rem;

    margin: 15px 0;

}



/* Utility classes */

.mb-20 {

    margin-bottom: 20px;

}



.mt-20 {

    margin-top: 20px;

}



/* Table styles */

.table img {

    border-radius: 4px;

}



.table td {

    vertical-align: middle;

}



/* Button styles */

.btn-sm {

    padding: 0.25rem 0.5rem;

    font-size: 0.875rem;

}



.btn-sm i {

    font-size: 0.75rem;

}



/* Form đơn hàng */

.order-form {

    background: #fff;

    border-radius: 8px;

    box-shadow: 0 2px 4px rgba(0,0,0,0.1);

}



.order-form .section-title {

    color: #2c3e50;

    font-size: 1.1rem;

    font-weight: 600;

    padding-bottom: 8px;

    border-bottom: 2px solid #3498db;

    margin-bottom: 20px;

}



/* Trường input chỉ đọc */

.form-control[readonly] {

    background-color: #f8f9fa;

    border-color: #e9ecef;

    cursor: not-allowed;

}



/* Danh sách sản phẩm */

.product-list {

    border: 1px solid #e9ecef;

    border-radius: 6px;

    padding: 15px;

    background: #f8f9fa;

}



.product-item {

    background: #fff;

    border-radius: 4px;

    padding: 10px;

    margin-bottom: 10px;

    box-shadow: 0 1px 3px rgba(0,0,0,0.05);

}



/* Các trường tính toán */

.calculation-field {

    font-weight: 500;

    background-color: #e9ecef !important;

}



/* Nút thêm/xóa sản phẩm */

.btn-add-product {

    color: #3498db;

    border-color: #3498db;

}



.btn-add-product:hover {

    background-color: #3498db;

    color: #fff;

}



.btn-remove-product {

    padding: 4px 8px;

    border-radius: 4px;

}



/* Trường giảm giá */

.discount-input {

    position: relative;

}



.input-group .discount-type {

    min-width: 50px;

    width: 50px !important;

    flex: 0 0 auto;

    padding: 0.375rem 0.5rem;

}



.input-group .product-discount {

    border-right: 0;

}



/* Scrollbar */

.sidebar::-webkit-scrollbar {

    width: 4px;

}



.sidebar::-webkit-scrollbar-track {

    background: transparent;

}



.sidebar::-webkit-scrollbar-thumb {

    background: rgba(255,255,255,0.1);

    border-radius: 2px;

}



/* Responsive styles - Sửa lại hoàn toàn phần media queries */

@media (max-width: 768px) {

    /* Hiện nút toggle menu */

    .menu-toggle {

        display: flex;

        align-items: center;

        justify-content: center;

    }

    .col-4 {

        width: 100%;

    }

    .product-list .text-muted {

        display: none;

    }

    .mb-sl, .mb-gia, .mb-giamgia, .mb-tensp {

        display: inline;

        align-items: center;

        gap: 5px;

    }

    .mb-4 .col {

        flex: 1 0 50%;

    }

    .mb-sl::before {

        content: "SL:";

        font-size: 14px;

        color: #6c757d;

        width: 50px;

    }

    .mb-gia::before {

        content: "Giá:";

        font-size: 14px;

        color: #6c757d;

        width: 50px;

    }

    .mb-giamgia::before {

        content: "Giảm:";

        font-size: 14px;

        color: #6c757d;

        width: 50px;

    }

    .mb-tensp::before {

        content: "Tên:";

        font-size: 14px;

        color: #6c757d;

        width: 50px;

    }

    



    /* Điều chỉnh sidebar */

    .sidebar {

        width: 280px;

        transform: translateX(-100%);

        position: fixed;

        z-index: 1050;

    }



    /* Khi sidebar được mở */
    .sidebar.show,
    .sidebar.active {
        transform: translateX(0);
        visibility: visible;
    }



    /* Điều chỉnh main content */

    .main-content {

        margin-left: 0;

        padding: 20px;

    }



    /* Overlay khi menu mở */

    .sidebar-overlay {

        display: none;

        position: fixed;

        top: 0;

        left: 0;

        right: 0;

        bottom: 0;

        background: rgba(0,0,0,0.5);

        z-index: 1040;

    }



    .sidebar-overlay.show,
    .sidebar-overlay.active {
        display: block;
    }



    /* Điều chỉnh các bảng */

    .table-responsive {

        margin: 0 -20px;

        padding: 0 20px;

        width: calc(100% + 40px);

    }



    /* Điều chỉnh form và card */

    .card {


        border-radius: 0;

    }



    .form-group {

        margin-bottom: 1rem;

    }



    /* Điều chỉnh modal */

    .modal-dialog {

        margin: 0.5rem;

    }



    /* Điều chỉnh dropdown menu */

    .dropdown-menu {

        position: fixed !important;

        top: auto !important;

        left: 0 !important;

        right: 0 !important;

        margin: 0;

        border-radius: 15px 15px 0 0;

        max-height: 80vh;

        transform: none !important;

    }



    /* Điều chỉnh các button group */

    .btn-group {

        display: flex;

        width: 100%;

    }



    .btn-group .btn {

        flex: 1;

    }



    /* Cải thiện form filter */

    .filter-form .row {

        margin: 0 -5px;

    }



    .filter-form .col-md-1,

    .filter-form .col-md-2,

    .filter-form .col-md-3 {

        padding: 0 5px;

        margin-bottom: 10px;

    }



    /* Cải thiện hiển thị bảng */

    .table {

        font-size: 13px;

    }



    .table td, .table th {

        padding: 0.5rem;

    }



    /* Thêm bottom navigation bar */

    .bottom-nav {

        display: block;

    }



    .main-content {

        padding-bottom: 70px; /* Tăng padding bottom để không bị che bởi bottom nav */

    }



    /* Ẩn các menu này trong sidebar trên mobile */

    .mobile-hidden {

        display: none;

    }

}



/* Animation cho menu */

@keyframes slideIn {

    from { transform: translateX(-100%); }

    to { transform: translateX(0); }

}



@keyframes slideOut {

    from { transform: translateX(0); }

    to { transform: translateX(-100%); }

}



/* Thêm class animation */

.sidebar.sliding-in {

    animation: slideIn 0.3s forwards;

}



.sidebar.sliding-out {

    animation: slideOut 0.3s forwards;

}



/* Card titles */

.card-title {

    font-family: 'Roboto', sans-serif;

    font-weight: 500;

}



/* Table content */

.table {

    font-family: 'Roboto', sans-serif;

    font-size: 14px;

}



/* Form controls */

.form-control {

    font-family: 'Roboto', sans-serif;

    font-size: 14px;

}



/* Buttons */

.btn {

    font-family: 'Roboto', sans-serif;

    font-size: 14px;

    font-weight: 400;

}



/* Thêm vào cuối file */

.search-results {

    position: absolute;

    top: 100%;

    left: 0;

    right: 0;

    background: white;

    border: 1px solid #ddd;

    border-radius: 4px;

    margin-top: 5px;

    max-height: 300px;

    overflow-y: auto;

    z-index: 1050;

    display: none;

}



.search-results.show {

    display: block;

}



.product-search-item {

    padding: 12px 15px;

    cursor: pointer;

    border-bottom: 1px solid #eee;

}



.product-search-item:hover {

    background-color: #f8f9fa;

}



.product-search-item .product-name {

    font-weight: 500;

    margin-bottom: 4px;

}



.product-search-item .product-info {

    display: flex;

    gap: 10px;

    font-size: 0.85em;

    color: #6c757d;

}



.product-search-item .product-price {

    color: #dc3545;

    font-weight: 500;

}



.selected-product {

    background: #f8f9fa;

    border: 1px solid #dee2e6;

    border-radius: 4px;

    padding: 15px;

    margin-bottom: 15px;

}



.product-search-item {

    padding: 12px 15px;

    cursor: pointer;

    border-bottom: 1px solid #eee;

}



.product-search-item:last-child {

    border-bottom: none;

}



.product-search-item:hover {

    background-color: #f8f9fa;

}



.product-search-item .product-name {

    font-weight: 500;

    margin-bottom: 4px;

}



.product-search-item .product-info {

    display: flex;

    gap: 10px;

    font-size: 0.85em;

    color: #6c757d;

}



.product-search-item .product-price {

    color: #dc3545;

    font-weight: 500;

}



#product_search_results {

    position: absolute;

    width: 100%;

    max-height: 300px;

    overflow-y: auto;

    background: white;

    border: 1px solid #ddd;

    border-radius: 4px;

    margin-top: 5px;

    z-index: 1050;

    display: none;

}



#product_search_results.show {

    display: block;

}



/* Thêm vào cuối file */

.modal-product-search {

    position: relative;

}



.modal-product-search .dropdown-menu {

    width: 100%;

    max-height: 300px;

    overflow-y: auto;

}



.batch-list {

    max-height: 400px;

    overflow-y: auto;

}



.store-group {

    border: 1px solid #dee2e6;

    border-radius: 0.25rem;

    padding: 1rem;

    margin-bottom: 1rem;

}



.store-group .store-name {

    color: #0d6efd;

    margin-bottom: 1rem;

}



.batch-item {

    background: #f8f9fa;

    border: 1px solid #dee2e6;

    border-radius: 0.25rem;

    padding: 0.75rem;

    margin-bottom: 0.5rem;

}



.batch-header {

    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 0.5rem;

}



.batch-info {

    font-size: 0.875rem;

    color: #6c757d;

}



.selected-batches {

    border: 1px solid #dee2e6;

    border-radius: 0.25rem;

    padding: 1rem;

    margin-bottom: 1rem;

}



.batch-quantity-input {

    width: 100px;

}



.product-total {

    font-weight: bold;

    color: #198754;

}



/* Thêm transition cho mượt hơn */

.sidebar.show {

    visibility: visible;

    transform: translateX(0);

}



@media (min-width: 769px) {

    .sidebar {

        visibility: visible;

        transform: none;

    }

}



/* Bottom Navigation Bar */

.bottom-nav {

    display: none; /* Ẩn mặc định trên desktop */

    position: fixed;

    bottom: 0;

    left: 0;

    right: 0;

    width: 100%;

    background: #fff;

    border-top: 1px solid #e5e7eb;

    box-shadow: 0 -2px 10px rgba(0,0,0,0.08);

    z-index: 1060;

    padding: 6px 0;

    padding-bottom: max(6px, env(safe-area-inset-bottom, 6px));

}

/* Tránh bottom nav bị nhảy lên giữa màn hình khi mở bàn phím điện thoại */
body.keyboard-open .bottom-nav,
body.keyboard-open .mobile-bottom-nav,
body.keyboard-open .bottom-menu {
    display: none !important;
}





.bottom-nav-menu {

    display: flex;

    justify-content: space-around;

    align-items: center;

    list-style: none;

    margin: 0;

    padding: 0;

}



.bottom-nav-item {

    flex: 1;

    text-align: center;

}



.bottom-nav-link {

    display: flex;

    flex-direction: column;

    align-items: center;

    color: #6c757d;

    text-decoration: none;

    font-size: 12px;

    padding: 5px;

}



.bottom-nav-link i {

    font-size: 20px;

    margin-bottom: 3px;

}



.bottom-nav-link.active {

    color: #3498db;

}



/* Thêm hiệu ứng hover cho bottom nav */

.bottom-nav-link:hover {

    color: #3498db;

}



/* Thêm hiệu ứng active state rõ ràng hơn */

.bottom-nav-link.active {

    color: #3498db;

    position: relative;

}



.bottom-nav-link.active::after {

    content: '';

    position: absolute;

    bottom: 0;

    left: 50%;

    transform: translateX(-50%);

    width: 5px;

    height: 5px;

    background: #3498db;

    border-radius: 50%;

}



/* Hiển thị bottom nav trên mobile */

@media (max-width: 768px) {

    .bottom-nav {

        display: block;

    }



    .main-content {

        margin-left: 0;

        padding: 20px;

        padding-bottom: 70px; /* Tăng padding bottom để không bị che bởi bottom nav */

    }



    /* Ẩn các menu này trong sidebar trên mobile */

    .mobile-hidden {

        display: none;

    }

}



/* Style cho toast notifications */

.toast-container {

    position: fixed;

    top: 20px;

    right: 20px;

    z-index: 1060;

}



/* Tùy chỉnh style cho Toastr */

#toast-container {

    position: fixed;

    top: 20px;

    right: 20px;

    z-index: 1060;

}



#toast-container .toast {

    opacity: 1;

    margin-bottom: 10px;

}



#toast-container > div {

    opacity: 1;

    margin-bottom: 10px;

    padding: 15px 15px 15px 50px;

    width: 300px;

}



.toast-success {

    background-color: #51A351;

}



.toast-error {

    background-color: #BD362F;

}



.toast-info {

    background-color: #2F96B4;

}



.toast-warning {

    background-color: #F89406;

}

/* --- SỔ QUỸ & QUẢN LÝ NHÀ CUNG CẤP & CSKH & KHÁCH HÀNG MOBILE FIRST DESIGN --- */
@media (max-width: 767.98px) {
    /* Prevent horizontal overflow on bank + supplier + cskh + customers pages */
    html.page-bank-accounts,
    body.page-bank-accounts,
    html.page-suppliers,
    body.page-suppliers,
    html.page-customers,
    body.page-customers,
    html.page-supplier-returns,
    body.page-supplier-returns,
    html.page-cskh,
    body.page-cskh,
    html.page-cskh-overview,
    body.page-cskh-overview,
    html.page-send-zalo,
    body.page-send-zalo {
        overflow-x: hidden !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* Hide desktop elements - Ẩn triệt để ngay từ đầu trên Mobile */
    .desktop-layout,
    body.page-bank-accounts .desktop-layout,
    body.page-suppliers .desktop-layout,
    body.page-customers .desktop-layout,
    body.page-supplier-returns .desktop-layout,
    body.page-cskh .desktop-layout,
    body.page-cskh-overview .desktop-layout,
    body.page-send-zalo .desktop-layout {
        display: none !important;
    }

    /* Hide top menu toggle globally on mobile, using bottom nav Menu instead */
    .menu-toggle {
        display: none !important;
    }
    
    /* Reset layout for mobile */
    body.page-bank-accounts,
    body.page-suppliers,
    body.page-customers,
    body.page-supplier-returns,
    body.page-cskh,
    body.page-cskh-overview,
    body.page-send-zalo {
        background-color: #f8fafc !important;
        padding-bottom: 70px !important; /* Space for bottom nav */
    }
    
    body.page-bank-accounts .container-fluid,
    body.page-suppliers .container-fluid,
    body.page-customers .container-fluid,
    body.page-supplier-returns .container-fluid,
    body.page-cskh .container-fluid,
    body.page-cskh-overview .container-fluid,
    body.page-send-zalo .container-fluid {
        padding-left: 0 !important;
        padding-right: 0 !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
    
    body.page-bank-accounts .main-content,
    body.page-suppliers .main-content,
    body.page-customers .main-content,
    body.page-supplier-returns .main-content,
    body.page-cskh .main-content,
    body.page-cskh-overview .main-content,
    body.page-send-zalo .main-content {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    /* Mobile layout specific styles */
    body.page-bank-accounts .mobile-layout,
    body.page-suppliers .mobile-layout,
    body.page-customers .mobile-layout,
    body.page-supplier-returns .mobile-layout,
    body.page-cskh .mobile-layout,
    body.page-cskh-overview .mobile-layout,
    body.page-send-zalo .mobile-layout {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    /* Modal mobile overrides */
    body.page-bank-accounts .modal,
    body.page-suppliers .modal,
    body.page-customers .modal,
    body.page-supplier-returns .modal,
    body.page-cskh .modal,
    body.page-cskh-overview .modal,
    body.page-send-zalo .modal {
        padding-right: 0 !important;
        z-index: 2050 !important;
    }
    body.page-bank-accounts .modal-backdrop,
    body.page-suppliers .modal-backdrop,
    body.page-customers .modal-backdrop,
    body.page-supplier-returns .modal-backdrop,
    body.page-cskh .modal-backdrop,
    body.page-cskh-overview .modal-backdrop,
    body.page-send-zalo .modal-backdrop {
        z-index: 2040 !important;
    }

    /* Đảm bảo tuyệt đối không bao giờ hiển thị backdrop đen khi modal chưa mở */
    body:not(.modal-open) .modal-backdrop {
        display: none !important;
    }

    /* Đảm bảo Sidebar và Overlay hiển thị chuẩn trên Mobile */
    body.page-bank-accounts .sidebar,
    body.page-suppliers .sidebar,
    body.page-customers .sidebar,
    body.page-supplier-returns .sidebar,
    body.page-cskh .sidebar,
    body.page-cskh-overview .sidebar,
    body.page-send-zalo .sidebar {
        z-index: 1070 !important;
    }
    body.page-bank-accounts .sidebar-overlay,
    body.page-suppliers .sidebar-overlay,
    body.page-customers .sidebar-overlay,
    body.page-supplier-returns .sidebar-overlay,
    body.page-cskh .sidebar-overlay,
    body.page-cskh-overview .sidebar-overlay,
    body.page-send-zalo .sidebar-overlay {
        z-index: 1060 !important;
    }
    body.page-bank-accounts .modal-dialog,
    body.page-suppliers .modal-dialog,
    body.page-customers .modal-dialog,
    body.page-supplier-returns .modal-dialog {
        margin: 10px auto !important;
        max-width: calc(100% - 20px) !important;
        display: block !important;
        min-height: auto !important;
        transform: none !important;
    }
    body.page-bank-accounts .modal-dialog-centered,
    body.page-suppliers .modal-dialog-centered,
    body.page-customers .modal-dialog-centered,
    body.page-supplier-returns .modal-dialog-centered {
        min-height: auto !important;
        align-items: flex-start !important;
    }
    body.page-bank-accounts .modal-content,
    body.page-suppliers .modal-content,
    body.page-customers .modal-content,
    body.page-supplier-returns .modal-content {
        max-height: calc(100vh - 20px) !important;
        display: flex !important;
        flex-direction: column !important;
        border-radius: 12px !important;
        overflow: hidden !important;
    }
    body.page-bank-accounts .modal-content > form,
    body.page-suppliers .modal-content > form,
    body.page-customers .modal-content > form,
    body.page-supplier-returns .modal-content > form {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }
    body.page-bank-accounts .modal-body,
    body.page-suppliers .modal-body,
    body.page-customers .modal-body,
    body.page-supplier-returns .modal-body {
        overflow-y: auto !important;
        flex: 1 1 auto !important;
        -webkit-overflow-scrolling: touch;
        min-height: 0 !important;
    }
    body.page-bank-accounts .modal-body .form-label:not(.show-label-mobile) {
        display: none !important;
    }
    body.page-bank-accounts .modal-body .form-label.show-label-mobile {
        display: block !important;
        margin-top: 8px !important;
        margin-bottom: 4px !important;
        font-weight: 500 !important;
        font-size: 13px !important;
        color: #475569 !important;
    }
    body.page-bank-accounts .modal-header,
    body.page-bank-accounts .modal-footer,
    body.page-suppliers .modal-header,
    body.page-suppliers .modal-footer,
    body.page-customers .modal-header,
    body.page-customers .modal-footer,
    body.page-supplier-returns .modal-header,
    body.page-supplier-returns .modal-footer {
        flex-shrink: 0 !important;
    }
    
    /* When user is actively editing/typing inside the modal */
    body.page-bank-accounts .modal:focus-within .modal-content {
        max-height: none !important;
        display: block !important;
    }
    body.page-bank-accounts .modal:focus-within .modal-body {
        overflow-y: visible !important;
        flex: none !important;
    }
    /* Supplier returns & Customers & Suppliers: giữ footer nút luôn hiện, không bung layout khi focus input */
    body.page-supplier-returns .modal:focus-within .modal-content,
    body.page-customers .modal:focus-within .modal-content,
    body.page-suppliers .modal:focus-within .modal-content {
        display: flex !important;
        flex-direction: column !important;
    }
    body.page-supplier-returns .modal:focus-within .modal-body,
    body.page-customers .modal:focus-within .modal-body,
    body.page-suppliers .modal:focus-within .modal-body {
        overflow-y: auto !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
    }
    
    /* Fix screen shaking when modal opens on mobile */
    body.page-bank-accounts.modal-open,
    body.page-suppliers.modal-open,
    body.page-customers.modal-open,
    body.page-supplier-returns.modal-open {
        padding-right: 0 !important;
        overflow: hidden !important;
    }

    /* Force auto-complete suggestions list to display directly below the inputs in modals */
    body.page-bank-accounts .modal .dropdown-menu,
    body.page-suppliers .modal .dropdown-menu,
    body.page-customers .modal .dropdown-menu,
    body.page-supplier-returns .modal .dropdown-menu {
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
        border-radius: 4px !important;
        max-height: 200px !important;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1) !important;
        z-index: 1000 !important;
        margin: 0 !important;
    }

    /* Mobile Header Hiện Đại Sang Trọng */
    .mobile-header {
        background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
        color: #ffffff;
        padding: 10px 12px 6px 12px;
        position: sticky;
        top: 0;
        z-index: 999;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    }

    .mobile-header-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
    }

    .mobile-header-title {
        font-size: 16px;
        font-weight: 700;
        color: #ffffff;
        margin: 0;
        letter-spacing: -0.2px;
    }

    .mobile-header-btn {
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: #ffffff;
        font-size: 14px;
        width: 32px;
        height: 32px;
        border-radius: 8px;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        transition: all 0.15s ease;
    }
    
    .mobile-header-btn:active {
        transform: scale(0.94);
        background: rgba(255, 255, 255, 0.2);
    }

    /* Sub Navigation Segmented Control cho 3 Menu CSKH */
    .mobile-sub-nav-tabs {
        display: flex;
        gap: 4px;
        background: rgba(255, 255, 255, 0.1);
        padding: 3px;
        border-radius: 10px;
        margin-bottom: 8px;
        border: 1px solid rgba(255, 255, 255, 0.06);
    }
    .mobile-sub-nav-item {
        flex: 1;
        text-align: center;
        padding: 6px 4px;
        font-size: 11.5px;
        font-weight: 500;
        color: rgba(255, 255, 255, 0.75);
        text-decoration: none;
        border-radius: 7px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .mobile-sub-nav-item i {
        font-size: 12px;
    }
    .mobile-sub-nav-item.active {
        background: #ffffff !important;
        color: #0f172a !important;
        font-weight: 700 !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    }
    /* Mobile Header Flat Button */
    .mobile-header-btn {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.12);
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: #ffffff !important;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 13px;
        text-decoration: none;
        transition: all 0.2s ease;
    }
    .mobile-header-btn:active {
        background: rgba(255, 255, 255, 0.25);
        transform: scale(0.92);
        color: #ffffff !important;
    }

    /* Mobile Search Bar Flexbox Chuẩn - Chống giật nhảy vị trí */
    .mobile-search-box {
        position: relative;
        margin-bottom: 6px;
        height: 38px;
        background-color: rgba(255, 255, 255, 0.12);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 20px;
        display: flex;
        align-items: center;
        padding: 0 4px 0 14px;
        transition: background-color 0.2s ease, border-color 0.2s ease;
        box-sizing: border-box;
    }

    .mobile-search-box:focus-within {
        background-color: rgba(255, 255, 255, 0.22);
        border-color: #3b82f6;
    }

    .mobile-search-box input {
        background: transparent !important;
        border: none !important;
        color: #ffffff !important;
        font-size: 13px !important;
        height: 100% !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        padding: 0 8px 0 0 !important;
        outline: none !important;
        box-shadow: none !important;
    }

    .mobile-search-box input::placeholder {
        color: rgba(255, 255, 255, 0.6) !important;
    }

    .mobile-search-clear {
        flex-shrink: 0;
        color: rgba(255, 255, 255, 0.65) !important;
        font-size: 14px;
        padding: 4px 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        transition: color 0.15s ease;
    }

    .mobile-search-clear:hover,
    .mobile-search-clear:active {
        color: #ffffff !important;
    }

    .mobile-search-submit {
        flex-shrink: 0;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        background: #3b82f6;
        color: #ffffff !important;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        cursor: pointer;
        padding: 0;
        margin: 0;
        box-shadow: 0 2px 4px rgba(0,0,0,0.25);
        transform: none !important; /* Ngăn chặn triệt để bị nhảy vị trí */
        position: static !important;
        transition: background-color 0.15s ease, opacity 0.15s ease;
    }

    .mobile-search-submit:active {
        background: #2563eb;
        opacity: 0.85;
        transform: none !important;
    }

    /* Scrollable lists */
    .mobile-scroll-container {
        display: flex;
        overflow-x: auto;
        gap: 6px;
        padding: 4px 0;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-scroll-container::-webkit-scrollbar {
        display: none;
    }
    
    .mobile-scroll-container {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    /* Filter Chips Thanh Lịch */
    .filter-chip {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        padding: 5px 12px;
        background: rgba(255, 255, 255, 0.12);
        color: rgba(255, 255, 255, 0.85);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 20px;
        font-size: 11.5px;
        font-weight: 500;
        white-space: nowrap;
        cursor: pointer;
        transition: all 0.15s ease;
        text-decoration: none;
        flex-shrink: 0;
    }
    .filter-chip:hover {
        background: rgba(255, 255, 255, 0.2);
        color: #ffffff;
    }
    .filter-chip.active-status-chip,
    .filter-chip.active-time-chip,
    .filter-chip.bg-primary {
        background: #00b884 !important;
        color: #ffffff !important;
        border-color: #00b884 !important;
        font-weight: 700 !important;
        box-shadow: 0 2px 6px rgba(0, 184, 132, 0.35) !important;
    }

    body.page-cskh-overview,
    .page-cskh-overview .mobile-layout {
        background-color: #f5f4ef !important;
    }

    /* Summary Card Chuẩn Sổ Quỹ Hiện Đại */
    .mobile-summary-card {
        background: #ffffff;
        border-radius: 14px;
        margin: 10px 12px;
        padding: 12px 14px;
        border: 1px solid #e2e8f0;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    }

    .summary-card-title {
        color: #64748b;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .summary-card-main-balance {
        font-size: 20px;
        font-weight: 800;
        color: #0f172a;
        margin-top: 4px;
        margin-bottom: 8px;
        display: flex;
        align-items: baseline;
        justify-content: space-between;
    }

    .trend-badge {
        font-size: 11px;
        padding: 3px 8px;
        border-radius: 6px;
        font-weight: 700;
    }
    
    .trend-badge.up {
        background-color: #ecfdf5;
        color: #047857;
    }
    
    .trend-badge.down {
        background-color: #fef2f2;
        color: #b91c1c;
    }

    .summary-card-details {
        display: flex;
        border-top: 1px dashed #e2e8f0;
        padding-top: 8px;
    }

    .summary-detail-col {
        flex: 1;
        text-align: left;
    }
    
    .summary-detail-col:not(:last-child) {
        border-right: 1px solid #f1f5f9;
        padding-right: 8px;
    }
    
    .summary-detail-col:not(:first-child) {
        padding-left: 8px;
    }

    .summary-detail-label {
        font-size: 11px;
        color: #64748b;
        margin-bottom: 2px;
        font-weight: 500;
    }

    .summary-detail-value {
        font-size: 14px;
        font-weight: 700;
        word-break: break-all;
    }

    /* Accounts Section */
    .mobile-section-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 16px;
        margin-top: 8px;
        margin-bottom: 6px;
    }

    .mobile-section-title {
        font-size: 15px;
        font-weight: 700;
        color: #1e293b;
        margin: 0;
    }

    .mobile-section-link {
        font-size: 12px;
        color: #3b82f6;
        text-decoration: none;
        font-weight: 500;
    }

    .mobile-account-card {
        flex: 0 0 150px;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 12px;
        scroll-snap-align: start;
        text-decoration: none;
        color: inherit;
        transition: all 0.2s;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    }

    .mobile-account-card.active {
        border-color: #3b82f6;
        background-color: #eff6ff;
    }

    .mobile-account-bank {
        font-size: 12px;
        font-weight: 600;
        color: #334155;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .mobile-account-number {
        font-size: 11px;
        color: #64748b;
        margin-top: 2px;
    }

    .mobile-account-holder {
        font-size: 9px;
        color: #94a3b8;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-top: 2px;
    }

    .mobile-account-balance {
        font-size: 13px;
        font-weight: 700;
        color: #1e293b;
        margin-top: 8px;
    }

    /* Action Chips Container */
    .mobile-actions-container {
        padding: 10px 16px;
    }
    
    .action-chip {
        background-color: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 20px;
        padding: 8px 14px;
        font-size: 12px;
        font-weight: 600;
        white-space: nowrap;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        color: #334155;
        cursor: pointer;
        box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    }
    
    .action-chip.chip-thu {
        color: #16a34a;
        background-color: #f0fdf4;
        border-color: #bbf7d0;
    }
    
    .action-chip.chip-chi {
        color: #dc2626;
        background-color: #fef2f2;
        border-color: #fee2e2;
    }
    
    .action-chip.chip-chuyen {
        color: #0891b2;
        background-color: #ecfeff;
        border-color: #cffafe;
    }

    /* Transactions */
    .mobile-transactions-list {
        padding: 0 16px;
        margin-top: 8px;
    }

    .mobile-date-group-header {
        font-size: 11px;
        font-weight: 700;
        color: #64748b;
        margin-top: 16px;
        margin-bottom: 8px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .mobile-tx-card {
        background: #ffffff;
        border-radius: 12px;
        border: 1px solid #e2e8f0;
        margin-bottom: 8px;
        padding: 12px;
        position: relative;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(0,0,0,0.01);
    }

    .mobile-tx-card.tx-in {
        border-left: 4px solid #10b981;
    }

    .mobile-tx-card.tx-out {
        border-left: 4px solid #ef4444;
    }

    .mobile-tx-row1 {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 4px;
    }

    .mobile-tx-object {
        font-size: 14px;
        font-weight: 700;
        color: #1e293b;
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding-right: 8px;
    }

    .mobile-tx-amount {
        font-size: 14px;
        font-weight: 700;
        text-align: right;
    }
    
    .mobile-tx-amount.text-success {
        color: #10b981 !important;
    }
    
    .mobile-tx-amount.text-danger {
        color: #ef4444 !important;
    }

    .mobile-tx-row2 {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 4px;
    }

    .mobile-tx-badge {
        font-size: 10px;
        padding: 2px 6px;
        border-radius: 4px;
        font-weight: 600;
    }
    
    .mobile-tx-badge.bg-success {
        background-color: #d1fae5 !important;
        color: #065f46 !important;
    }

    .mobile-tx-badge.bg-danger {
        background-color: #fee2e2 !important;
        color: #991b1b !important;
    }

    .mobile-tx-details {
        font-size: 12px;
        color: #3b82f6;
        font-weight: 500;
        text-decoration: none;
    }
    
    .mobile-tx-note {
        font-size: 12px;
        color: #475569;
    }

    .mobile-tx-row3 {
        font-size: 11px;
        color: #94a3b8;
        display: flex;
        justify-content: space-between;
    }

    .mobile-tx-meta {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Admin options & action row in mobile card */
    .mobile-tx-admin-row {
        border-top: 1px solid #f1f5f9;
        margin-top: 8px;
        padding-top: 8px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 11px;
    }

    .mobile-tx-creator {
        color: #94a3b8;
    }

    .mobile-tx-actions {
        display: flex;
        gap: 12px;
    }

    .mobile-tx-action-btn {
        color: #3b82f6;
        text-decoration: none;
        font-weight: 600;
        background: none;
        border: none;
        padding: 0;
        font-size: 11px;
        cursor: pointer;
    }
    
    .mobile-tx-action-btn.btn-delete {
        color: #ef4444;
    }
    
    .mobile-tx-advance-actions {
        border-top: 1px solid #f1f5f9;
        margin-top: 8px;
        padding-top: 8px;
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .mobile-tx-btn-advance {
        font-size: 10px;
        padding: 4px 8px;
        border-radius: 6px;
    }

    /* Bottom Navigation Bar */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(8px);
        border-top: 1px solid #e2e8f0;
        display: flex;
        justify-content: space-around;
        padding: 6px 0;
        z-index: 1000;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.03);
    }

    .mobile-bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: #94a3b8;
        text-decoration: none;
        font-size: 10px;
        font-weight: 500;
        flex: 1;
    }

    .mobile-bottom-nav-item i {
        font-size: 18px;
        margin-bottom: 2px;
    }

    .mobile-bottom-nav-item.active {
        color: #3b82f6;
    }

    /* Bottom Sheet Filter Modal */
    .bottom-sheet-modal .modal-dialog {
        margin: 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        transform: translateY(100%);
        transition: transform 0.3s ease-out;
    }
    
    .bottom-sheet-modal.show .modal-dialog {
        transform: translateY(0);
    }
    
    .bottom-sheet-modal .modal-content {
        border-radius: 20px 20px 0 0;
        border: none;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.15);
    }
    
    .bottom-sheet-drag-handle {
        width: 40px;
        height: 4px;
        background-color: #cbd5e1;
        border-radius: 2px;
        margin: 8px auto 0 auto;
    }

    .bottom-sheet-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px;
        border-bottom: 1px solid #f1f5f9;
    }

    .bottom-sheet-title {
        font-size: 16px;
        font-weight: 700;
        color: #1e293b;
        margin: 0;
    }

    .bottom-sheet-body {
        padding: 20px 16px;
    }

    .bottom-sheet-footer {
        padding: 12px 16px 24px 16px;
        display: flex;
        gap: 12px;
    }

    .bottom-sheet-btn-cancel {
        flex: 1;
        background-color: #f1f5f9;
        border: none;
        border-radius: 10px;
        padding: 12px;
        font-weight: 600;
        color: #475569;
    }

    .bottom-sheet-btn-apply {
        flex: 2;
        background-color: #1e3a8a;
        border: none;
        border-radius: 10px;
        padding: 12px;
        font-weight: 600;
        color: #ffffff;
    }
    
    /* Pagination mobile style */
    .mobile-pagination {
        padding: 16px;
        display: flex;
        justify-content: center;
        gap: 8px;
    }
    
    .mobile-pagination .page-link {
        border-radius: 8px !important;
        border: 1px solid #e2e8f0;
        color: #475569;
        padding: 6px 12px;
    }
    
    .mobile-pagination .page-item.active .page-link {
        background-color: #3b82f6;
        border-color: #3b82f6;
        color: #ffffff;
    }

    /* Supplier returns mobile extras */
    body.page-supplier-returns .mobile-tx-card .form-check-input {
        width: 1.15rem;
        height: 1.15rem;
        margin-top: 0;
    }
    body.page-supplier-returns .mobile-stat-scroll .mobile-account-card {
        flex: 0 0 130px;
    }
    body.page-supplier-returns .mobile-tx-actions .btn {
        font-size: 11px;
        padding: 4px 8px;
    }
    /* Đảm bảo bottom Menu không bị che khi chọn hàng */
    body.page-supplier-returns .bottom-nav {
        display: block !important;
        z-index: 1060 !important;
    }
}

@media (min-width: 768px) {
    .mobile-layout {
        display: none !important;
    }
}

/* Ensure modals are always on top of the sidebar */
.modal {
    z-index: 1080 !important;
}
.modal-backdrop {
    z-index: 1075 !important;
}

/* Custom styling for iframe mode inside modals */
body.iframe-mode {
    background-color: #fff !important;
}
body.iframe-mode .sidebar,
body.iframe-mode .menu-toggle,
body.iframe-mode .sidebar-overlay,
body.iframe-mode .bottom-nav,
body.iframe-mode .mobile-header,
body.iframe-mode .mobile-bottom-nav,
body.iframe-mode .btn-secondary:has(.fa-arrow-left),
body.iframe-mode .btn-secondary:has(.fa-arrow-left-long),
body.iframe-mode .btn-secondary:has(.fa-chevron-left),
body.iframe-mode a.btn-secondary[href*="index.php"],
body.iframe-mode a.btn-secondary[href*="payments.php"] {
    display: none !important;
}

/* Pipeline CSKH nhúng trong chat: vẫn hiện bộ lọc (ẩn chỉ header/nav trùng với topbar embed) */
body.iframe-mode.page-cskh .mobile-header {
    display: block !important;
}
body.iframe-mode.page-cskh .mobile-header-top,
body.iframe-mode.page-cskh .mobile-sub-nav-tabs {
    display: none !important;
}

body.iframe-mode .main-content {
    margin-left: 0 !important;
    padding: 15px !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

body.iframe-mode .container-fluid {
    padding: 0 !important;
}

body.iframe-mode .row > .col-md-10 {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
}