/* =========================================================
 * V74.1.34 - GHI CHÚ FULL CODE
 * ---------------------------------------------------------
 * File: assets/css/app-layout.css
 *
 * Mục đích:
 * - Ghi chú rõ vai trò CSS để các trang sau giữ thống nhất giao diện.
 * - Không tự ý đổi màu/nút/bảng/form nếu yêu cầu chỉ là bổ sung ghi chú.
 * - CSS riêng từng trang chỉ dùng cho phần đặc thù, còn nút/bảng/form
 *   nên ưu tiên class chung app-*.
 * ========================================================= */

/* =========================================================
   KHO V3 - STYLE CHUNG
   Phong cach: Modern Internal Business Web App / Dashboard
   ========================================================= */

/* RESET */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background: #eef3f8;
    color: #0f172a;
}

a {
    text-decoration: none;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

/* LAYOUT */
.app-layout {
    min-height: 100vh;
    display: flex;
}

/* SIDEBAR */
.app-sidebar {
    width: 270px;
    background: linear-gradient(180deg, #071a46 0%, #08122e 100%);
    color: #ffffff;
    padding: 22px 18px;
    flex-shrink: 0;
    position: relative;
    z-index: 20;
    box-shadow: 6px 0 18px rgba(2, 8, 23, 0.10);
}

.app-brand {
    padding: 8px 8px 22px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 18px;
}

.app-brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: bold;
    color: #ffffff;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.35);
    margin-bottom: 12px;
}

.app-brand h2 {
    margin: 0;
    font-size: 28px;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.app-brand p {
    margin: 8px 0 0 0;
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.5;
}

.app-menu {
    margin-top: 6px;
}

.app-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #e2e8f0;
    padding: 13px 14px;
    border-radius: 14px;
    margin-bottom: 8px;
    font-size: 15px;
    transition: all 0.2s ease;
}

.app-menu a:hover {
    background: rgba(255,255,255,0.08);
    color: #ffffff;
    transform: translateX(2px);
}

.app-menu a.active {
    background: linear-gradient(135deg, rgba(37,99,235,0.95), rgba(29,78,216,0.95));
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.30);
}

.app-menu-icon {
    width: 22px;
    text-align: center;
    font-size: 16px;
}

/* MAIN */
.app-main {
    flex: 1;
    min-width: 0;
    padding: 24px;
}

/* TOPBAR */
/* 2026-07-22 20:09 - ĐỢT THONG-BAO-ZINDEX-CARD.1
 * Nâng stacking context của topbar trên Stats Cards,
 * giữ panel thông báo dưới sidebar, overlay và modal.
 */
.app-topbar {
    position: relative;
    z-index: 2;
    background: rgba(255,255,255,0.88);
    border: 1px solid rgba(255,255,255,0.7);
    padding: 20px 22px;
    border-radius: 24px;
    box-shadow: 0 15px 40px rgba(15, 23, 42, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.app-topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.app-page-title h1 {
    margin: 0;
    font-size: 38px;
    line-height: 1.1;
    color: #1d4ed8;
    font-weight: bold;
}

.app-page-title p {
    margin: 8px 0 0 0;
    color: #64748b;
    font-size: 16px;
}

.app-menu-toggle {
    display: none;
    width: 54px;
    height: 54px;
    border: none;
    border-radius: 18px;
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.28);
}

.app-user-box {
    min-width: 250px;
    background: linear-gradient(135deg, #f8fbff, #eef5ff);
    border: 1px solid #dbeafe;
    border-radius: 18px;
    padding: 16px 18px;
}

.app-user-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.app-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1d4ed8, #60a5fa);
    color: #ffffff;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.20);
}

.app-user-name {
    font-size: 18px;
    font-weight: bold;
    color: #0f172a;
    margin: 0;
}

.app-user-role {
    display: inline-block;
    margin-top: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: bold;
}

.app-logout {
    display: inline-block;
    margin-top: 10px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: bold;
    box-shadow: 0 10px 18px rgba(239, 68, 68, 0.20);
}

.app-panel,
.app-form-card,
.app-table-card {
    background: #ffffff;
    border-radius: 22px;
    padding: 20px;
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.08);
    border: 1px solid #edf2f7;
}

.blue  { background: #dbeafe; color: #1d4ed8; }
.green { background: #dcfce7; color: #16a34a; }
.red   { background: #fee2e2; color: #dc2626; }
.amber { background: #fef3c7; color: #d97706; }
.purple { background: #ede9fe; color: #7c3aed; }

/* GRID */
.app-content-grid {
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    gap: 20px;
}

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

.app-panel-title {
    margin: 0;
    font-size: 22px;
    color: #0f172a;
}

.app-panel-sub {
    color: #64748b;
    font-size: 14px;
}

/* ACTIONS */
.app-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 14px;
}

.app-action-btn {
    display: block;
    padding: 18px 16px;
    border-radius: 18px;
    background: linear-gradient(135deg, #f8fbff, #eef5ff);
    border: 1px solid #dbeafe;
    color: #1e3a8a;
    font-weight: bold;
    font-size: 15px;
    transition: all 0.2s ease;
}

.app-action-btn span {
    display: block;
    font-size: 24px;
    margin-bottom: 10px;
}

/* TABLE */
.app-table-wrap {
    overflow-x: auto;
}

.app-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.app-table th {
    background: #eff6ff;
    color: #1e3a8a;
    text-align: left;
    padding: 12px;
    font-size: 14px;
}

.app-table td {
    border-bottom: 1px solid #edf2f7;
    padding: 12px;
    font-size: 14px;
}

.app-table tr:hover td {
    background: #f8fbff;
}

/* FORM */
.app-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 16px;
}

.app-form-group {
    margin-bottom: 16px;
}

.app-form-group label {
    display: block;
    font-weight: bold;
    color: #334155;
    margin-bottom: 8px;
}

.app-form-group input,
.app-form-group select,
.app-form-group textarea {
    width: 100%;
    min-height: 46px;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    padding: 10px 13px;
    outline: none;
    font-size: 15px;
}

.app-form-group input:focus,
.app-form-group select:focus,
.app-form-group textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.app-btn {
    display: inline-block;
    border: none;
    border-radius: 13px;
    padding: 12px 18px;
    font-weight: bold;
    cursor: pointer;
}

.app-btn-primary {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #ffffff;
}

.app-btn-light {
    background: #eef2ff;
    color: #1d4ed8;
}

.app-alert {
    padding: 12px 14px;
    border-radius: 14px;
    margin-bottom: 16px;
}

.app-alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.app-alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

/* STATUS */
.app-status-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.app-status-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #eef2f7;
    font-size: 15px;
}

.app-status-list li:last-child {
    border-bottom: none;
}

.app-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: bold;
}

.badge-blue  { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red   { background: #fee2e2; color: #b91c1c; }
.badge-amber { background: #fef3c7; color: #b45309; }

/* LOGIN */
.app-login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
}

.app-login-left {
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.35), transparent 36%),
        linear-gradient(135deg, #0f172a, #1e3a8a);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}

.app-login-brand {
    max-width: 520px;
}

.app-login-logo {
    width: 92px;
    height: 92px;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.26);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: 800;
    margin-bottom: 24px;
}

.app-login-brand h1 {
    margin: 0 0 14px;
    font-size: 42px;
    line-height: 1.15;
}

.app-login-brand p {
    margin: 0;
    color: #dbeafe;
    font-size: 18px;
    line-height: 1.6;
}

.app-login-right {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 36px;
}

.app-login-card {
    width: 100%;
    max-width: 430px;
    background: white;
    border-radius: 24px;
    padding: 34px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
    border: 1px solid #e5e7eb;
}

.app-login-title h2 {
    margin: 0 0 8px;
    font-size: 30px;
    color: #1e3a8a;
}

.app-login-title p {
    margin: 0 0 24px 0;
    color: #64748b;
}

.app-password-wrap {
    display: flex;
    gap: 8px;
}

.app-password-wrap input {
    flex: 1;
}

.app-password-wrap button {
    min-width: 70px;
    border: 0;
    border-radius: 14px;
    background: #e0f2fe;
    color: #075985;
    font-weight: bold;
    cursor: pointer;
}

.app-btn-login {
    width: 100%;
    min-height: 50px;
    border: 0;
    border-radius: 15px;
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

.app-login-note {
    margin-top: 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

/* MOBILE OVERLAY */
.app-overlay {
    display: none;
}

/* RESPONSIVE */
@media (max-width: 1200px) {
.app-content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 920px) {
    .app-layout {
        display: block;
    }

    .app-sidebar {
        position: fixed;
        top: 0;
        left: -290px;
        height: 100%;
        overflow-y: auto;
        transition: left 0.25s ease;
    }

    .app-sidebar.open {
        left: 0;
    }

    .app-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.42);
        z-index: 10;
    }

    .app-overlay.show {
        display: block;
    }

    .app-main {
        padding: 14px;
    }

    .app-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .app-topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 18px;
        border-radius: 22px;
    }

    .app-topbar-left {
        align-items: flex-start;
    }

    .app-page-title h1 {
        font-size: 30px;
    }

    .app-page-title p {
        font-size: 14px;
    }

    .app-user-box {
        min-width: 0;
        width: 100%;
    }

    .app-actions {
        grid-template-columns: 1fr;
    }

    .app-form-grid {
        grid-template-columns: 1fr;
    }

    .app-login-page {
        grid-template-columns: 1fr;
    }

    .app-login-left {
        min-height: 250px;
        padding: 32px 22px;
        text-align: center;
    }

    .app-login-logo {
        margin-left: auto;
        margin-right: auto;
    }

    .app-login-brand h1 {
        font-size: 30px;
    }

    .app-login-right {
        padding: 22px;
    }

    .app-login-card {
        padding: 24px;
        border-radius: 20px;
    }
}

@media (max-width: 520px) {
    .app-page-title h1 {
        font-size: 28px;
    }

    .app-brand h2 {
        font-size: 24px;
    }

    .app-panel,
.app-form-card,
.app-table-card {
        padding: 18px;
        border-radius: 20px;
    }
}

/* =========================================================
   ERP - GLOBAL FONT + SIDEBAR COLLAPSE V1
   ---------------------------------------------------------
   Cập nhật:
   - Dùng Google Font Be Vietnam Pro cho toàn hệ thống.
   - Sidebar có thể thu gọn trên desktop.
   - Menu vẫn hoạt động dạng drawer trên mobile.
   ========================================================= */

/* Font tổng cho ERP */
html,
body,
body *,
button,
input,
select,
textarea {
    font-family: "Be Vietnam Pro", "Segoe UI", Arial, sans-serif !important;
}

body {
    font-weight: 400;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Chỉnh lại chữ cho thanh hơn */
.app-page-title h1,
.app-panel-title,
.app-brand h2,
.app-brand-title {
    font-weight: 700 !important;
    letter-spacing: -0.025em;
}

.app-page-title p,
.app-panel-sub,
.app-brand p,
.app-brand-subtitle {
    font-weight: 400 !important;
}

.app-menu a {
    font-weight: 500 !important;
    letter-spacing: -0.01em;
}

.app-table th,
.app-table td {
    font-weight: 400;
}

/* Brand top có logo và nút thu gọn */
.app-brand-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* Nút thu gọn sidebar */
.app-sidebar-collapse {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 13px;
    background: rgba(255,255,255,0.08);
    color: #ffffff;
    cursor: pointer;
    font-size: 26px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.app-sidebar-collapse:hover {
    background: rgba(255,255,255,0.15);
}

/* Sidebar có hiệu ứng khi thu gọn */
.app-sidebar {
    transition: width 0.22s ease, left 0.25s ease, padding 0.22s ease;
}

/* Trạng thái thu gọn desktop */
.app-sidebar.is-collapsed {
    width: 86px;
    padding-left: 12px;
    padding-right: 12px;
}

/* Khi thu gọn: logo canh giữa */
.app-sidebar.is-collapsed .app-brand {
    padding-left: 0;
    padding-right: 0;
    text-align: center;
}

.app-sidebar.is-collapsed .app-brand-top {
    justify-content: center;
}

.app-sidebar.is-collapsed .app-brand-logo {
    margin-left: auto;
    margin-right: auto;
}

/* Ẩn chữ thương hiệu khi thu gọn */
.app-sidebar.is-collapsed .app-brand-title,
.app-sidebar.is-collapsed .app-brand-subtitle {
    display: none;
}

/* Ẩn nút collapse nhỏ, chỉ hiện khi hover để gọn */
.app-sidebar.is-collapsed .app-sidebar-collapse {
    position: absolute;
    top: 22px;
    right: -15px;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: #2563eb;
    box-shadow: 0 8px 22px rgba(37,99,235,0.35);
    font-size: 22px;
}

/* Menu khi thu gọn */
.app-sidebar.is-collapsed .app-menu a {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    gap: 0;
    min-height: 48px;
}

/* Ẩn chữ menu, chỉ còn icon */
.app-sidebar.is-collapsed .app-menu-text {
    display: none;
}

/* Icon menu to và rõ hơn khi thu gọn */
.app-sidebar.is-collapsed .app-menu-icon {
    width: 42px;
    font-size: 18px;
}

/* Hover khi thu gọn không đẩy ngang */
.app-sidebar.is-collapsed .app-menu a:hover {
    transform: none;
}

/* Mobile: không dùng chế độ thu gọn, chỉ dùng drawer */
@media (max-width: 920px) {
    .app-sidebar.is-collapsed {
        width: 270px;
        padding: 22px 18px;
    }

    .app-sidebar.is-collapsed .app-brand-title,
    .app-sidebar.is-collapsed .app-brand-subtitle,
    .app-sidebar.is-collapsed .app-menu-text {
        display: inline;
    }

    .app-sidebar.is-collapsed .app-brand-title,
    .app-sidebar.is-collapsed .app-brand-subtitle {
        display: block;
    }

    .app-sidebar.is-collapsed .app-menu a {
        justify-content: flex-start;
        padding: 13px 14px;
        gap: 12px;
        min-height: 0;
    }

    .app-sidebar.is-collapsed .app-menu-icon {
        width: 22px;
        font-size: 16px;
    }

    .app-sidebar-collapse {
        display: none;
    }
}

/* =========================================================
   ERP - V49 SIDEBAR PRELOAD COLLAPSE
   ---------------------------------------------------------
   Mục đích:
   - Khi sidebar đang thu gọn, bấm qua menu khác không bị hiện rộng
     rồi mới tự thu gọn lại.
   - Class app-sidebar-collapsed-preload được gắn rất sớm trong <head>.
   - FIX - 2026-06-22 22:02 - ĐỢT 0L-FIX: đổi class preload sidebar sang app-sidebar-collapsed-preload.
   - Các rule dưới đây giống trạng thái .app-sidebar.is-collapsed.
   ========================================================= */
html.app-sidebar-collapsed-preload .app-sidebar {
    width: 86px;
    padding-left: 12px;
    padding-right: 12px;
}

html.app-sidebar-collapsed-preload .app-sidebar .app-brand {
    padding-left: 0;
    padding-right: 0;
    text-align: center;
}

html.app-sidebar-collapsed-preload .app-sidebar .app-brand-top {
    justify-content: center;
}

html.app-sidebar-collapsed-preload .app-sidebar .app-brand-logo {
    margin-left: auto;
    margin-right: auto;
}

html.app-sidebar-collapsed-preload .app-sidebar .app-brand-title,
html.app-sidebar-collapsed-preload .app-sidebar .app-brand-subtitle {
    display: none;
}

html.app-sidebar-collapsed-preload .app-sidebar .app-sidebar-collapse {
    position: absolute;
    top: 22px;
    right: -15px;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: #2563eb;
    box-shadow: 0 8px 22px rgba(37,99,235,0.35);
    font-size: 22px;
}

html.app-sidebar-collapsed-preload .app-sidebar .app-menu a {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    gap: 0;
    min-height: 48px;
}

html.app-sidebar-collapsed-preload .app-sidebar .app-menu-text {
    display: none;
}

html.app-sidebar-collapsed-preload .app-sidebar .app-menu-icon {
    width: 42px;
    font-size: 18px;
}

html.app-sidebar-collapsed-preload .app-sidebar .app-menu a:hover {
    transform: none;
}

@media (max-width: 920px) {
    html.app-sidebar-collapsed-preload .app-sidebar {
        width: 270px;
        padding: 22px 18px;
    }

    html.app-sidebar-collapsed-preload .app-sidebar .app-brand-title,
    html.app-sidebar-collapsed-preload .app-sidebar .app-brand-subtitle,
    html.app-sidebar-collapsed-preload .app-sidebar .app-menu-text {
        display: inline;
    }

    html.app-sidebar-collapsed-preload .app-sidebar .app-brand-title,
    html.app-sidebar-collapsed-preload .app-sidebar .app-brand-subtitle {
        display: block;
    }

    html.app-sidebar-collapsed-preload .app-sidebar .app-menu a {
        justify-content: flex-start;
        padding: 13px 14px;
        gap: 12px;
        min-height: 0;
    }

    html.app-sidebar-collapsed-preload .app-sidebar .app-menu-icon {
        width: 22px;
        font-size: 16px;
    }
}

/* =========================================================
   ERP - V7 COMPACT TOPBAR
   ---------------------------------------------------------
   Làm phần tiêu đề / user box phía trên nhỏ hơn.
   Áp dụng toàn ERP, đặc biệt hữu ích cho trang Kho.
   ========================================================= */

.app-main {
    padding-top: 18px !important;
}

.app-topbar {
    padding: 14px 16px !important;
    border-radius: 20px !important;
    margin-bottom: 16px !important;
    gap: 12px !important;
}

.app-page-title h1 {
    font-size: 30px !important;
    line-height: 1.1 !important;
}

.app-page-title p {
    font-size: 14px !important;
    margin-top: 4px !important;
}

.app-menu-toggle {
    width: 44px !important;
    height: 44px !important;
    border-radius: 14px !important;
    font-size: 22px !important;
}

.app-user-box {
    min-width: 220px !important;
    padding: 10px 12px !important;
    border-radius: 15px !important;
}

.app-user-top {
    margin-bottom: 6px !important;
    gap: 9px !important;
}

.app-avatar {
    width: 40px !important;
    height: 40px !important;
    font-size: 15px !important;
}

.app-user-name {
    font-size: 15px !important;
}

.app-user-role {
    padding: 3px 8px !important;
    font-size: 11px !important;
}

.app-logout {
    margin-top: 6px !important;
    padding: 8px 13px !important;
    border-radius: 11px !important;
    font-size: 13px !important;
}

/* Mobile compact */
@media (max-width: 920px) {
    .app-main {
        padding: 10px !important;
    }

    .app-topbar {
        padding: 11px !important;
        border-radius: 17px !important;
        margin-bottom: 10px !important;
        gap: 9px !important;
    }

    .app-topbar-left {
        gap: 9px !important;
        align-items: center !important;
    }

    .app-page-title h1 {
        font-size: 22px !important;
    }

    .app-page-title p {
        display: none !important;
    }

    .app-menu-toggle {
        width: 40px !important;
        height: 40px !important;
        border-radius: 13px !important;
        font-size: 20px !important;
    }

    .app-user-box {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
        width: 100% !important;
        min-width: 0 !important;
        padding: 9px 10px !important;
        border-radius: 14px !important;
    }

    .app-user-top {
        margin-bottom: 0 !important;
        min-width: 0 !important;
    }

    .app-avatar {
        width: 34px !important;
        height: 34px !important;
        font-size: 13px !important;
        flex-shrink: 0 !important;
    }

    .app-user-name {
        font-size: 14px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 120px !important;
    }

    .app-user-role {
        padding: 2px 7px !important;
        font-size: 10.5px !important;
    }

    .app-logout {
        margin-top: 0 !important;
        padding: 7px 10px !important;
        border-radius: 10px !important;
        font-size: 12.5px !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }
}

@media (max-width: 420px) {
    .app-topbar {
        padding: 9px !important;
    }

    .app-page-title h1 {
        font-size: 20px !important;
    }

    .app-user-box {
        padding: 8px 9px !important;
    }
}

/* =========================================================
   V50 - SAP XEP TAT CA BANG
   ---------------------------------------------------------
   Dung chung cho moi table co thead/tbody trong he thong.
   ========================================================= */
/*
   FIX - 2026-06-22 21:44 - ĐỢT 0K-FIX
   Đổi class CSS sort table sang tiền tố app-; không đổi style hoặc cấu trúc selector.
*/
.app-sortable-table th.app-sortable-th {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 30px;
    white-space: nowrap;
}

.app-sortable-table th.app-sortable-th:hover {
    background: #dbeafe;
}

.app-sort-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #64748b;
    font-weight: 900;
}

.app-sortable-table th.is-sort-asc .app-sort-icon,
.app-sortable-table th.is-sort-desc .app-sort-icon {
    color: #1d4ed8;
}

.app-sortable-table th.is-sort-asc .app-sort-icon {
    font-size: 0;
}

.app-sortable-table th.is-sort-asc .app-sort-icon:after {
    content: "▲";
    font-size: 12px;
}

.app-sortable-table th.is-sort-desc .app-sort-icon {
    font-size: 0;
}

.app-sortable-table th.is-sort-desc .app-sort-icon:after {
    content: "▼";
    font-size: 12px;
}

.app-sortable-table th.app-sortable-th:focus {
    outline: 2px solid rgba(37, 99, 235, 0.35);
    outline-offset: -2px;
}

/* =========================================================
   V58 - CHỌN MỤC CON XONG TỰ THU GỌN
   ---------------------------------------------------------
   - Click nhóm menu để mở/thu mục con.
   - Kho chứa các menu kho theo yêu cầu.
   - Sản xuất / Kế toán / Nhân sự có thể hiện dòng chưa có mục con.
   - Khi sidebar thu gọn, chỉ hiện icon nhóm cho gọn.
   ========================================================= */
.app-menu-group {
    margin: 8px 0;
}

.app-menu-group:first-child {
    margin-top: 0;
}

.app-menu-group-toggle {
    width: 100%;
    border: 0;
    outline: none;
    background: transparent;
    color: #e2e8f0;
    padding: 11px 12px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 11px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 900;
    text-align: left;
    transition: all 0.18s ease;
}

.app-menu-group-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.app-menu-group-icon {
    width: 24px;
    min-width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.app-menu-group-text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-menu-group-arrow {
    width: 18px;
    text-align: center;
    font-size: 12px;
    color: #93c5fd;
    transition: transform 0.18s ease;
}

.app-menu-group.is-open .app-menu-group-arrow {
    transform: rotate(180deg);
}

.app-submenu {
    display: none;
    padding: 4px 0 4px 10px;
    margin-left: 9px;
    border-left: 1px solid rgba(148, 163, 184, 0.20);
}

.app-menu-group.is-open .app-submenu {
    display: block;
}

.app-submenu .app-menu-icon {
    width: 22px;
    min-width: 22px;
    font-size: 16px;
}

.app-submenu a {
    margin-bottom: 5px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
}

.app-submenu a.active {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.32);
}

.app-submenu-empty {
    color: rgba(226, 232, 240, 0.58);
    font-size: 13px;
    font-weight: 700;
    padding: 9px 12px 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    margin: 3px 0 6px 0;
}

.app-menu-group-logout {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Sidebar thu gọn: chỉ hiện icon nhóm, ẩn text/arrow/submenu */
.app-sidebar.is-collapsed .app-menu-group {
    margin: 8px 0;
}

.app-sidebar.is-collapsed .app-menu-group-toggle {
    justify-content: center;
    padding: 13px 0;
    min-height: 48px;
}

.app-sidebar.is-collapsed .app-menu-group-text,
.app-sidebar.is-collapsed .app-menu-group-arrow {
    display: none !important;
}

/* V49 preload thu gọn: tránh nháy khi chuyển trang */
html.app-sidebar-collapsed-preload .app-sidebar .app-menu-group-toggle {
    justify-content: center;
    padding: 13px 0;
    min-height: 48px;
}

html.app-sidebar-collapsed-preload .app-sidebar .app-menu-group-text,
html.app-sidebar-collapsed-preload .app-sidebar .app-menu-group-arrow {
    display: none !important;
}

html.app-sidebar-collapsed-preload .app-sidebar .app-menu-group-icon {
    width: 24px;
    min-width: 24px;
}

/* Mobile: mở đầy đủ chữ nhóm và submenu */
@media (max-width: 920px) {
    .app-sidebar.is-collapsed .app-menu-group-toggle,
    html.app-sidebar-collapsed-preload .app-sidebar .app-menu-group-toggle {
        justify-content: flex-start;
        padding: 11px 12px;
        min-height: 0;
    }

    .app-sidebar.is-collapsed .app-menu-group-text,
    .app-sidebar.is-collapsed .app-menu-group-arrow,
    html.app-sidebar-collapsed-preload .app-sidebar .app-menu-group-text,
    html.app-sidebar-collapsed-preload .app-sidebar .app-menu-group-arrow {
        display: inline-flex !important;
    }

    .app-sidebar.is-collapsed .app-menu-group.is-flyout-open .app-submenu,
    html.app-sidebar-collapsed-preload .app-sidebar .app-menu-group.is-flyout-open .app-submenu {
        display: block !important;
    }
}

/* =========================================================
   V57 - SIDEBAR THU GỌN VẪN SỔ MENU CON
   ---------------------------------------------------------
   Khi sidebar đang thu gọn:
   - Click icon menu cha sẽ sổ submenu dạng nổi bên phải.
   - Menu nổi giữ mở cho đến khi click lại menu cha hoặc mở nhóm khác.
   ========================================================= */
.app-sidebar.is-collapsed {
    overflow: visible;
}

.app-sidebar.is-collapsed .app-menu {
    overflow: visible;
}

.app-sidebar.is-collapsed .app-menu-group {
    position: relative;
}

.app-sidebar.is-collapsed .app-submenu {
    display: none !important;
    position: absolute;
    left: calc(100% + 10px);
    top: 0;
    z-index: 9999;
    min-width: 245px;
    max-width: 320px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 10px;
    margin: 0;
    border-left: 0;
    border-radius: 16px;
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.38);
}

.app-sidebar.is-collapsed .app-menu-group.is-flyout-open .app-submenu {
    display: block !important;
}

.app-sidebar.is-collapsed .app-submenu:before {
    content: "";
    position: absolute;
    left: -7px;
    top: 18px;
    width: 14px;
    height: 14px;
    background: #0f172a;
    border-left: 1px solid rgba(148, 163, 184, 0.28);
    border-bottom: 1px solid rgba(148, 163, 184, 0.28);
    transform: rotate(45deg);
}

.app-sidebar.is-collapsed .app-submenu a {
    margin-bottom: 6px;
    padding: 10px 12px;
    white-space: nowrap;
}

.app-sidebar.is-collapsed .app-submenu .app-menu-text {
    display: inline-block;
}

/* Preload thu gọn: nếu trang đang load mà sidebar đã thu gọn, vẫn giữ flyout đúng kiểu */
html.app-sidebar-collapsed-preload .app-sidebar {
    overflow: visible;
}

html.app-sidebar-collapsed-preload .app-sidebar .app-menu {
    overflow: visible;
}

html.app-sidebar-collapsed-preload .app-sidebar .app-menu-group {
    position: relative;
}

html.app-sidebar-collapsed-preload .app-sidebar .app-submenu {
    display: none !important;
    position: absolute;
    left: calc(100% + 10px);
    top: 0;
    z-index: 9999;
    min-width: 245px;
    max-width: 320px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 10px;
    margin: 0;
    border-left: 0;
    border-radius: 16px;
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.38);
}

html.app-sidebar-collapsed-preload .app-sidebar .app-menu-group.is-flyout-open .app-submenu {
    display: block !important;
}

html.app-sidebar-collapsed-preload .app-sidebar .app-submenu a {
    margin-bottom: 6px;
    padding: 10px 12px;
    white-space: nowrap;
}

html.app-sidebar-collapsed-preload .app-sidebar .app-submenu .app-menu-text {
    display: inline-block;
}

/* Mobile không dùng flyout, giữ kiểu menu thường */
@media (max-width: 920px) {
    .app-sidebar.is-collapsed .app-submenu,
    html.app-sidebar-collapsed-preload .app-sidebar .app-submenu {
        position: static;
        left: auto;
        top: auto;
        z-index: auto;
        min-width: 0;
        max-width: none;
        max-height: none;
        overflow: visible;
        padding: 4px 0 4px 10px;
        margin-left: 9px;
        border-left: 1px solid rgba(148, 163, 184, 0.20);
        border-radius: 0;
        background: transparent;
        border-top: 0;
        border-right: 0;
        border-bottom: 0;
        box-shadow: none;
    }

    .app-sidebar.is-collapsed .app-submenu:before {
        display: none;
    }
}

/* =========================================================
   V58 - SAU KHI CHỌN MỤC CON THÌ MENU NỔI TỰ THU
   ---------------------------------------------------------
   Lưu ý:
   - is-open dùng cho sidebar mở rộng và nhóm active.
   - is-flyout-open dùng riêng cho sidebar thu gọn.
   - Vì vậy sau khi chọn mục con và chuyển trang, nhóm active vẫn giữ
     logic, nhưng menu nổi không tự bung lại.
   ========================================================= */
.app-sidebar.is-collapsed .app-menu-group.is-open:not(.is-flyout-open) .app-submenu {
    display: none !important;
}

html.app-sidebar-collapsed-preload .app-sidebar .app-menu-group.is-open:not(.is-flyout-open) .app-submenu {
    display: none !important;
}

/* =========================================================
   V74.1 - CANH TRÁI MENU CON KHI SIDEBAR THU GỌN
   ---------------------------------------------------------
   Nền phát triển: V74.
   Mục đích:
   - Khi sidebar đang thu gọn, click icon menu cha sẽ hiện menu con dạng nổi.
   - Các mục con trong menu nổi được canh trái để dễ đọc hơn.
   - Không thay đổi database, không thay đổi phân quyền, không lấy V75-V78 làm nền.
   ========================================================= */

/* Menu con dạng nổi trong trạng thái sidebar thu gọn: canh trái nội dung */
.app-sidebar.is-collapsed .app-submenu a {
    justify-content: flex-start !important;
    text-align: left !important;
    gap: 12px !important;
    width: 100%;
    padding-left: 14px !important;
    padding-right: 14px !important;
}

/* Icon trong menu con nổi: giữ kích thước vừa phải, không bị chiếm khoảng trống quá lớn */
.app-sidebar.is-collapsed .app-submenu .app-menu-icon {
    width: 26px !important;
    min-width: 26px !important;
    text-align: center;
    font-size: 17px;
}

/* Chữ trong menu con nổi: hiện đầy đủ và canh trái */
.app-sidebar.is-collapsed .app-submenu .app-menu-text {
    display: inline-block !important;
    text-align: left !important;
    flex: 1 1 auto;
}

/* Trạng thái preload thu gọn: áp dụng giống trạng thái thu gọn thật để tránh nháy giao diện */
html.app-sidebar-collapsed-preload .app-sidebar .app-submenu a {
    justify-content: flex-start !important;
    text-align: left !important;
    gap: 12px !important;
    width: 100%;
    padding-left: 14px !important;
    padding-right: 14px !important;
}

html.app-sidebar-collapsed-preload .app-sidebar .app-submenu .app-menu-icon {
    width: 26px !important;
    min-width: 26px !important;
    text-align: center;
    font-size: 17px;
}

html.app-sidebar-collapsed-preload .app-sidebar .app-submenu .app-menu-text {
    display: inline-block !important;
    text-align: left !important;
    flex: 1 1 auto;
}

/* 2026-07-21 10:06 - ĐỢT 3.7B.4B:
   Định dạng icon chuông và badge thông báo chưa đọc. */
.app-topbar-user-area {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    flex-shrink: 0;
}

.app-notification-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    flex-shrink: 0;
    border: 1px solid #dbeafe;
    border-radius: 13px;
    background: #ffffff;
    color: #1d4ed8;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.12);
}

.app-notification-bell:hover {
    background: #eff6ff;
}

.app-notification-bell:focus {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

.app-notification-bell-icon {
    width: 21px;
    height: 21px;
    pointer-events: none;
}

/*
 * 2026-07-22 20:35 - ĐỢT THONG-BAO-CHUONG-RUNG-KHI-CHUA-DOC.1
 * Rung nhẹ icon chuông khi còn thông báo chưa đọc.
 */
.app-notification-bell.has-unread .app-notification-bell-icon {
    transform-origin: 50% 15%;
    /* Chu kỳ 2 giây */
	animation: app-notification-bell-ring 3s ease-in-out infinite;
}

@keyframes app-notification-bell-ring {
    0%,
    12%,
    100% {
        transform: rotate(0deg);
    }

    2% {
        transform: rotate(-12deg);
    }

    4% {
        transform: rotate(10deg);
    }

    6% {
        transform: rotate(-8deg);
    }

    8% {
        transform: rotate(6deg);
    }

    10% {
        transform: rotate(-3deg);
    }
}

.app-notification-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 2px solid #ffffff;
    border-radius: 999px;
    background: #dc2626;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    white-space: nowrap;
    box-sizing: border-box;
}

.app-notification-badge[hidden] {
    display: none !important;
}

@media (max-width: 920px) {
    .app-topbar-user-area {
        width: 100%;
        align-items: center;
    }

    .app-topbar .app-topbar-user-area .app-user-box {
        width: auto !important;
        min-width: 0 !important;
        flex: 1 1 auto;
    }

    .app-notification-bell {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 420px) {
    .app-topbar-user-area {
        gap: 8px;
    }

    .app-notification-bell {
        width: 38px;
        height: 38px;
        border-radius: 12px;
    }
}

/* 2026-07-21 10:47 - ĐỢT 3.7B.4C:
   Định dạng panel và danh sách thông báo Cần xử lý. */
.app-notification-center {
    position: relative;
    flex-shrink: 0;
}

.app-notification-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 1000;
    width: 380px;
    max-width: calc(100vw - 40px);
    overflow: hidden;
    border: 1px solid #dbeafe;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
}

.app-notification-panel[hidden] {
    display: none !important;
}

/*
 * 2026-07-23 20:24
 * ĐỢT TOPBAR-THONG-BAO-DANH-DAU-TAT-CA-DA-DOC.1
 * Căn tiêu đề và nút Đã đọc trên cùng một hàng trong panel thông báo.
 */
.app-notification-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 15px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fbff;
    color: #0f172a;
    font-size: 15px;
    font-weight: 700;
}

/*
 * 2026-07-23 22:53
 * ĐỢT TOPBAR-THONG-BAO-NUT-DA-DOC-TEXT-DANGER.1
 * Bỏ nền và viền đỏ, giữ chữ ✓ Đã đọc in đậm màu Danger.
 */
.app-notification-mark-all-read {
    min-height: 28px;
    padding: 4px 10px;
    flex-shrink: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #dc2626;
    font-size: 12px;
    font-weight: 700;
    line-height: 18px;
    cursor: pointer;
    transition:
        color 0.16s ease,
        opacity 0.16s ease;
}

.app-notification-mark-all-read:hover {
    border-color: transparent;
    background: transparent;
    color: #b91c1c;
}

.app-notification-mark-all-read:focus {
    outline: 2px solid #fca5a5;
    outline-offset: 2px;
}

.app-notification-mark-all-read:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* 2026-07-21 19:50 - ĐỢT 3.7B.4G.2C:
   Chia panel thành Cần xử lý và Kết quả chưa xem. */
.app-notification-section + .app-notification-section {
    border-top: 1px solid #dbeafe;
}

.app-notification-section-title {
    padding: 9px 15px;
    border-bottom: 1px solid #eef2f7;
    background: #ffffff;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
}

/*
 * 2026-07-23 23:20
 * ĐỢT TOPBAR-THONG-BAO-THANH-CHI-BAO-NHOM.1
 * Bỏ nền màu tiêu đề nhóm, bổ sung thanh chỉ báo success/warning
 * và chữ in đậm theo trạng thái.
 */
.app-notification-section-title.is-primary {
    border-left: 4px solid #16a34a;
    color: #15803d;
}

.app-notification-section-title.is-success {
    border-left: 4px solid #f59e0b;
    color: #b45309;
}

.app-notification-section .app-notification-list {
    max-height: 210px;
}

.app-notification-list {
    max-height: 420px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.app-notification-item {
    display: block;
    width: 100%;
    margin: 0;
    padding: 13px 15px;
    border: 0;
    border-bottom: 1px solid #eef2f7;
    border-radius: 0;
    background: #ffffff;
    color: #0f172a;
    font-family: inherit;
    text-align: left;
    word-break: break-word;
}

.app-notification-item:last-child {
    border-bottom: 0;
}

button.app-notification-item {
    cursor: pointer;
}

button.app-notification-item:hover,
button.app-notification-item:focus {
    background: #f8fbff;
}

button.app-notification-item:focus {
    outline: 2px solid #93c5fd;
    outline-offset: -2px;
}

.app-notification-item.is-unread {
    background: #eff6ff;
}

.app-notification-item.is-unread .app-notification-item-title {
    font-weight: 700;
}

.app-notification-item-title {
    color: #0f172a;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
}

.app-notification-item-message {
    margin-top: 5px;
    color: #475569;
    font-size: 12.5px;
    line-height: 1.5;
}

.app-notification-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 10px;
    margin-top: 7px;
    color: #64748b;
    font-size: 11.5px;
    line-height: 1.4;
}

.app-notification-state {
    padding: 22px 16px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
}

.app-notification-state.is-error {
    color: #b91c1c;
}

@media (max-width: 920px) {
    .app-notification-panel {
        right: auto;
        left: 0;
        width: 380px;
        max-width: calc(100vw - 40px);
    }
}

@media (max-width: 420px) {
    .app-notification-panel {
        top: calc(100% + 8px);
        width: calc(100vw - 38px);
        max-width: none;
    }

    .app-notification-section .app-notification-list {
        max-height: 180px;
    }
}

