/* ============ CSS VARIABLES ============ */
    :root {
        --primary: #4CAF50;
        --primary-light: #81C784;
        --primary-bg: #E8F5E9;
        --danger: #e94849;
        --danger-light: #f28b8b;
        --danger-bg: #fdeaea;
        --info: #3782f4;
        --info-light: #6fa4f7;
        --info-bg: #e8f0fe;
        --success: #24c560;
        --success-light: #5dd88a;
        --success-bg: #e6f9ee;
        --warning: #f59e0b;
        --warning-light: #fbbf24;
        --warning-bg: #fef3c7;
        --purple: #8b5cf6;
        --purple-bg: #f5f3ff;
        --teal: #14b8a6;
        --teal-bg: #f0fdfa;
        --bg: #f0f2f5;
        --bg-card: #ffffff;
        --bg-sidebar: #1a1a2e;
        --bg-sidebar-hover: #2a2a4a;
        --bg-sidebar-active: #4CAF50;
        --text: #1a1a2e;
        --text-secondary: #6b7280;
        --text-light: #9ca3af;
        --text-sidebar: #a0a3b1;
        --border: #e5e7eb;
        --border-light: #f3f4f6;
        --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, .08);
        --shadow-lg: 0 8px 24px rgba(0, 0, 0, .12);
        --radius: 10px;
        --radius-lg: 16px;
        --sidebar-width: 170px;
        --sidebar-collapsed-width: 64px;
        --header-height: 60px;
        --transition: .25s cubic-bezier(.4, 0, .2, 1);
    }

    /* ============ RESET ============ */
    *,
    *::before,
    *::after {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }

    html {
        font-size: 14px;
        -webkit-text-size-adjust: 100%;
    }

    body {
        font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
        background: var(--bg);
        color: var(--text);
        line-height: 1.6;
        overflow-x: hidden;
    }

    a {
        text-decoration: none;
        color: inherit;
    }

    button {
        cursor: pointer;
        border: none;
        background: none;
        font: inherit;
    }

    input,
    select,
    textarea {
        font: inherit;
    }

    table {
        border-collapse: collapse;
        width: 100%;
    }

    /* ============ SCROLLBAR ============ */
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }

    ::-webkit-scrollbar-track {
        background: transparent;
    }

    ::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 3px;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: #aaa;
    }

    /* ============ LOADING OVERLAY ============ */
    .loading-overlay {
        position: fixed;
        inset: 0;
        z-index: 9999;
        background: #fff;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 20px;
        transition: opacity .4s;
    }

    .loading-overlay.hide {
        opacity: 0;
        pointer-events: none;
    }

    .loading-spinner {
        width: 48px;
        height: 48px;
        border: 4px solid var(--border);
        border-top-color: var(--primary);
        border-radius: 50%;
        animation: spin .8s linear infinite;
    }

    .loading-text {
        color: var(--text-secondary);
        font-size: .95rem;
    }

    @keyframes spin {
        to {
            transform: rotate(360deg);
        }
    }

    /* ============ APP LAYOUT ============ */
    .app-container {
        display: flex;
        min-height: 100vh;
    }

    /* ============ SIDEBAR ============ */
    .sidebar {
        width: var(--sidebar-width);
        background: var(--bg-sidebar);
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 100;
        display: flex;
        flex-direction: column;
        transition: width var(--transition), transform var(--transition);
        overflow-y: auto;
        overflow-x: hidden;
    }

    .sidebar-header {
        padding: 20px;
        display: flex;
        align-items: center;
        gap: 12px;
        border-bottom: 1px solid rgba(255, 255, 255, .08);
        min-height: 62px;
    }

    .sidebar-header i {
        font-size: 1.5rem;
        color: var(--primary);
        flex-shrink: 0;
    }

    .sidebar-header .sidebar-text {
        font-size: .95rem;
        font-weight: 700;
        color: #fff;
        white-space: nowrap;
        overflow: hidden;
        transition: opacity var(--transition), width var(--transition);
    }

    .sidebar-nav {
        flex: 1;
        padding: 8px 0;
    }

    .sidebar-nav a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 20px;
        color: var(--text-sidebar);
        font-size: .9rem;
        font-weight: 500;
        transition: all var(--transition);
        border-left: 3px solid transparent;
        cursor: pointer;
        position: relative;
        white-space: nowrap;
    }

    .sidebar-nav a:hover {
        background: var(--bg-sidebar-hover);
        color: #fff;
    }

    .sidebar-nav a.active {
        background: rgba(76, 175, 80, .1);
        color: var(--primary);
        border-left-color: var(--primary);
    }

    .sidebar-nav a i {
        width: 20px;
        text-align: center;
        font-size: 1rem;
        flex-shrink: 0;
    }

    .sidebar-nav a .sidebar-text {
        white-space: nowrap;
        overflow: hidden;
        transition: opacity var(--transition);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .4);
        z-index: 99;
    }

    /* Nav Group Labels */
    .nav-group-label {
        padding: 16px 20px 6px;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .nav-group-label .sidebar-text {
        font-size: .7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .08em;
        color: rgba(255, 255, 255, .35);
        white-space: nowrap;
        overflow: hidden;
        transition: opacity var(--transition);
    }

    .nav-group-label .nav-group-line {
        flex: 1;
        height: 1px;
        background: rgba(255, 255, 255, .08);
    }

    /* Sidebar Collapse Button */
    .sidebar-collapse {
        padding: 14px 20px;
        display: flex;
        align-items: center;
        gap: 12px;
        color: var(--text-sidebar);
        font-size: .85rem;
        cursor: pointer;
        border-top: 1px solid rgba(255, 255, 255, .08);
        transition: all var(--transition);
        white-space: nowrap;
    }

    .sidebar-copyright {
        padding: 12px 20px;
        font-size: .75rem;
        color: rgba(255, 255, 255, .4);
        text-align: center;
        border-top: 1px solid rgba(255, 255, 255, .08);
        line-height: 1.5;
    }

    .sidebar-copyright a {
        color: var(--primary);
        text-decoration: none;
        font-weight: 600;
    }

    .sidebar.collapsed .sidebar-copyright {
        padding: 0;
        height: 0;
        overflow: hidden;
        border-top: none;
    }

    .sidebar-collapse:hover {
        background: var(--bg-sidebar-hover);
        color: #fff;
    }

    .sidebar-collapse i {
        width: 20px;
        text-align: center;
        transition: transform var(--transition);
        flex-shrink: 0;
    }

    .sidebar-collapse .sidebar-text {
        overflow: hidden;
        transition: opacity var(--transition);
    }

    /* ============ SIDEBAR COLLAPSED ============ */
    .sidebar.collapsed {
        width: var(--sidebar-collapsed-width);
    }

    .sidebar.collapsed .sidebar-text {
        opacity: 0;
        width: 0;
        pointer-events: none;
    }

    .sidebar.collapsed .sidebar-header {
        padding: 20px 0;
        justify-content: center;
    }

    .sidebar.collapsed .sidebar-nav a {
        padding: 10px 0;
        justify-content: center;
        border-left-width: 0;
    }

    .sidebar.collapsed .nav-group-label {
        padding: 12px 16px 4px;
        justify-content: center;
    }

    .sidebar.collapsed .nav-group-label .nav-group-line {
        flex: 1;
    }

    .sidebar.collapsed .sidebar-collapse {
        padding: 14px 0;
        justify-content: center;
    }

    .sidebar.collapsed .sidebar-collapse i {
        transform: rotate(180deg);
    }

    /* Tooltip on hover when collapsed */
    .sidebar.collapsed .sidebar-nav a:hover::after {
        content: attr(title);
        position: absolute;
        left: calc(var(--sidebar-collapsed-width) - 4px);
        top: 50%;
        transform: translateY(-50%);
        background: var(--bg-sidebar);
        color: #fff;
        padding: 6px 14px;
        border-radius: 6px;
        font-size: .82rem;
        white-space: nowrap;
        box-shadow: var(--shadow-md);
        z-index: 200;
        pointer-events: none;
    }

    .sidebar.collapsed+.main-content,
    .main-content.sidebar-collapsed {
        margin-left: var(--sidebar-collapsed-width);
    }

    /* ============ MAIN CONTENT ============ */
    .main-content {
        flex: 1;
        margin-left: var(--sidebar-width);
        display: flex;
        flex-direction: column;
        min-height: 100vh;
        min-width: 0;
        transition: margin-left var(--transition);
    }

    /* ============ HEADER ============ */
    .app-header {
        height: var(--header-height);
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        display: flex;
        align-items: center;
        padding: 0 24px;
        gap: 16px;
        position: sticky;
        top: 0;
        z-index: 50;
        box-shadow: var(--shadow);
    }

    .btn-toggle-sidebar {
        display: none;
        width: 36px;
        height: 36px;
        border-radius: 8px;
        font-size: 1.1rem;
        color: var(--text-secondary);
        transition: all var(--transition);
    }

    .btn-toggle-sidebar:hover {
        background: var(--bg);
    }

    .header-title {
        font-size: 1.15rem;
        font-weight: 700;
        color: var(--text);
    }

    .header-user {
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: .85rem;
        margin-left: auto;
    }

    .header-user-name {
        color: var(--text);
        font-weight: 600;
    }

    .header-user-role {
        color: var(--text-secondary);
    }

    /* ============ PAGE CONTENT ============ */
    .page-content {
        padding: 24px;
        flex: 1;
        min-width: 0;
    }

    .page {
        display: none;
        animation: fadeIn .3s ease;
    }

    .page.active {
        display: block;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translateY(8px);
        }

        to {
            opacity: 1;
            transform: none;
        }
    }

    /* ============ STAT CARDS ============ */
    .stats-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 16px;
        margin-bottom: 24px;
    }

    .stat-card {
        background: var(--bg-card);
        border-radius: var(--radius-lg);
        padding: 14px 16px;
        box-shadow: var(--shadow);
        display: flex;
        align-items: center;
        gap: 14px;
        transition: transform var(--transition), box-shadow var(--transition);
    }

    .stat-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

    .stat-icon {
        width: 42px;
        height: 42px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
    }

    .stat-icon.orange {
        background: var(--primary-bg);
        color: var(--primary);
    }

    .stat-icon.blue {
        background: var(--info-bg);
        color: var(--info);
    }

    .stat-icon.green {
        background: var(--success-bg);
        color: var(--success);
    }

    .stat-icon.red {
        background: var(--danger-bg);
        color: var(--danger);
    }

    .stat-icon.purple {
        background: var(--purple-bg);
        color: var(--purple);
    }

    .stat-icon.teal {
        background: var(--teal-bg);
        color: var(--teal);
    }

    .stat-info h3 {
        font-size: 1.25rem;
        font-weight: 700;
        line-height: 1.2;
    }

    .stat-info p {
        font-size: .8rem;
        color: var(--text-secondary);
        margin-top: 2px;
    }

    @media (min-width: 1024px) {
        #pageFinance .stats-grid {
            grid-template-columns: repeat(6, 1fr);
            gap: 12px;
        }

        #pageFinance .stat-card {
            padding: 10px 12px;
            gap: 10px;
        }

        #pageFinance .stat-icon {
            width: 36px;
            height: 36px;
            font-size: 0.95rem;
            border-radius: 8px;
        }

        #pageFinance .stat-info h3 {
            font-size: 1.05rem;
        }

        #pageFinance .stat-info p {
            font-size: 0.75rem;
        }
    }

    /* ============ CARD ============ */
    .card {
        background: var(--bg-card);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow);
        overflow: hidden;
    }

    .card-header {
        padding: 16px 20px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 12px;
        border-bottom: 1px solid var(--border-light);
    }

    .card-header h3 {
        font-size: 1rem;
        font-weight: 700;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .card-body {
        padding: 20px;
    }

    .card-body.no-padding {
        padding: 0;
    }

    /* ============ TAB MENU ============ */
    .tab-menu {
        display: flex;
        border-bottom: 1px solid var(--border-light);
        padding: 0 20px;
        background: var(--bg-card);
        gap: 24px;
    }

    .tab-item {
        padding: 14px 4px 10px;
        cursor: pointer;
        font-weight: 600;
        font-size: 0.9rem;
        color: var(--text-secondary);
        border-bottom: 3px solid transparent;
        transition: all var(--transition);
        user-select: none;
    }

    .tab-item:hover {
        color: var(--primary);
    }

    .tab-item.active {
        color: var(--primary);
        border-bottom-color: var(--primary);
    }

    /* ============ TOOLBAR ============ */
    .toolbar {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
    }

    .search-box {
        position: relative;
        display: flex;
        align-items: center;
    }

    .search-box i {
        position: absolute;
        left: 12px;
        color: var(--text-light);
        font-size: .85rem;
    }

    .search-box input {
        padding: 8px 12px 8px 34px;
        border: 1px solid var(--border);
        border-radius: 8px;
        font-size: .85rem;
        width: 220px;
        transition: border-color var(--transition), box-shadow var(--transition);
        background: var(--bg);
    }

    .search-box input:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(76, 175, 80, .15);
        background: #fff;
    }

    .filter-select {
        padding: 8px 12px;
        border: 1px solid var(--border);
        border-radius: 8px;
        font-size: .85rem;
        background: var(--bg);
        cursor: pointer;
        transition: border-color var(--transition);
        appearance: none;
        -webkit-appearance: none;
        padding-right: 28px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 10px center;
    }

    .filter-select:focus {
        outline: none;
        border-color: var(--primary);
    }

    /* ============ BUTTONS ============ */
    .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 8px 16px;
        border-radius: 8px;
        font-size: .85rem;
        font-weight: 600;
        transition: all var(--transition);
        white-space: nowrap;
    }

    .btn i {
        font-size: .85rem;
    }

    .btn-primary {
        background: var(--primary);
        color: #fff;
    }

    .btn-primary:hover {
        background: #43A047;
        box-shadow: 0 2px 8px rgba(76, 175, 80, .3);
    }

    .btn-danger {
        background: var(--danger);
        color: #fff;
    }

    .btn-danger:hover {
        background: #d13a3b;
    }

    .btn-info {
        background: var(--info);
        color: #fff;
    }

    .btn-info:hover {
        background: #2a6fd4;
    }

    .btn-success {
        background: var(--success);
        color: #fff;
    }

    .btn-success:hover {
        background: #1da84f;
    }

    .btn-outline {
        background: transparent;
        border: 1px solid var(--border);
        color: var(--text-secondary);
    }

    .btn-outline:hover {
        background: var(--bg);
        border-color: var(--text-light);
    }

    .btn-sm {
        padding: 5px 10px;
        font-size: .78rem;
    }

    .btn-icon {
        width: 28px;
        height: 28px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px;
        font-size: .8rem;
        color: var(--text-secondary);
        transition: all var(--transition);
    }

    .btn-icon:hover {
        background: var(--bg);
    }

    .btn-icon.edit:hover {
        color: var(--info);
    }

    .btn-icon.delete:hover {
        color: var(--danger);
    }

    .btn-icon.view:hover {
        color: var(--success);
    }

    /* ============ TABLE ============ */
    .table-container {
        overflow-x: auto;
        overflow-y: auto;
        max-height: calc(100vh - 260px);
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
        will-change: scroll-position;
        transform: translateZ(0);
        backface-visibility: hidden;
    }

    .data-table {
        width: 100%;
        font-size: .85rem;
        border-collapse: collapse;
    }

    .data-table thead th {
        padding: 6px 12px;
        text-align: left;
        font-weight: 600;
        color: #475569;
        background: #f8fafc;
        border-bottom: 1px solid #e2e8f0;
        white-space: nowrap;
        position: sticky;
        top: 0;
        z-index: 2;
        cursor: pointer;
        user-select: none;
    }

    .data-table thead th:hover {
        color: #1e293b;
    }

    .data-table thead th .sort-icon {
        margin-left: 4px;
        font-size: .7rem;
        opacity: .4;
    }

    .data-table thead th.sorted .sort-icon {
        opacity: 1;
        color: var(--primary);
    }

    .data-table tbody tr {
        border-bottom: 1px solid #f1f5f9;
        transition: background var(--transition);
    }

    .data-table tbody tr:hover {
        background: #f8fafc;
    }

    .data-table tbody td {
        padding: 4px 12px;
        vertical-align: middle;
        white-space: nowrap;
        color: #334155;
        font-size: .85rem;
    }

    .data-table th.actions-head,
    .data-table td.actions {
        position: sticky;
        right: 0;
        box-shadow: -4px 0 8px -4px rgba(0, 0, 0, 0.05);
    }

    .data-table th.actions-head {
        background: var(--bg);
        z-index: 20;
    }

    .data-table td.actions {
        background: var(--bg-card);
        z-index: 10;
        vertical-align: middle;
        text-align: center;
        white-space: nowrap;
    }

    .data-table td.actions > .btn-icon,
    .data-table td.actions > button {
        display: inline-flex;
        margin: 0 2px;
        vertical-align: middle;
    }

    .data-table tbody tr:hover td.actions {
        background: var(--primary-bg);
    }

    .empty-state {
        text-align: center;
        padding: 48px 20px;
        color: var(--text-light);
    }

    .empty-state i {
        font-size: 2.5rem;
        margin-bottom: 12px;
        display: block;
    }

    .empty-state p {
        font-size: .9rem;
    }

    /* ============ BADGE ============ */
    .badge {
        display: inline-flex;
        align-items: center;
        padding: 1px 7px;
        border-radius: 12px;
        font-size: .7rem;
        font-weight: 600;
        line-height: 1.25;
        white-space: nowrap;
    }

    /* Ghim cột 1 (Mã HS) & cột 2 (Học sinh) & Ghim Tiêu đề cho Đánh giá Khối */
    #evalKhoiTable th:nth-child(1),
    #evalKhoiTable td:nth-child(1) {
        position: sticky;
        left: 0;
        z-index: 3;
        background: #ffffff;
        border-right: 1px solid #f1f5f9 !important;
    }

    #evalKhoiTable th:nth-child(2),
    #evalKhoiTable td:nth-child(2) {
        position: sticky;
        left: 65px;
        z-index: 3;
        background: #ffffff;
        border-right: 1px solid #e2e8f0 !important;
    }

    #evalKhoiTable thead tr:nth-child(1) th {
        position: sticky;
        top: 0;
        z-index: 4;
        background: #f8fafc !important;
    }

    #evalKhoiTable thead tr:nth-child(2) th {
        position: sticky;
        top: 31px;
        z-index: 4;
        background: #f8fafc !important;
    }

    #evalKhoiTable th[rowspan]:nth-child(1) {
        position: sticky;
        left: 0;
        top: 0;
        z-index: 6 !important;
        background: #f8fafc !important;
    }

    #evalKhoiTable th[rowspan]:nth-child(2) {
        position: sticky;
        left: 65px;
        top: 0;
        z-index: 6 !important;
        background: #f8fafc !important;
    }

    .badge i {
        margin-right: 5px;
    }

    .badge-success {
        background: var(--success-bg);
        color: var(--success);
    }

    .badge-danger {
        background: var(--danger-bg);
        color: var(--danger);
    }

    .badge-warning {
        background: var(--primary-bg);
        color: var(--primary);
    }

    .badge-info {
        background: var(--info-bg);
        color: var(--info);
    }

    .badge-secondary {
        background: var(--border-light);
        color: var(--text-secondary);
    }

    /* ============ PAGINATION ============ */
    .pagination {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 20px;
        border-top: 1px solid var(--border-light);
        flex-wrap: wrap;
        gap: 10px;
    }

    .pagination-info {
        font-size: .8rem;
        color: var(--text-secondary);
    }

    .pagination-buttons {
        display: flex;
        gap: 4px;
    }

    .pagination-buttons button {
        min-width: 32px;
        height: 32px;
        border-radius: 6px;
        font-size: .8rem;
        font-weight: 500;
        color: var(--text-secondary);
        transition: all var(--transition);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .pagination-buttons button:hover {
        background: var(--bg);
    }

    .pagination-buttons button.active {
        background: var(--primary);
        color: #fff;
    }

    .pagination-buttons button:disabled {
        opacity: .4;
        cursor: not-allowed;
    }

    /* ============ MODAL ============ */
    .modal-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .5);
        z-index: 1000;
        display: none;
        align-items: center;
        justify-content: center;
        padding: 20px;
        animation: modalFadeIn .25s ease;
        overflow-y: auto;
    }

    .modal-overlay.show {
        display: flex;
    }

    @keyframes modalFadeIn {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }

    .modal-box {
        background: var(--bg-card);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-lg);
        width: 100%;
        max-width: 560px;
        max-height: 90vh;
        display: flex;
        flex-direction: column;
        animation: modalSlideIn .3s ease;
    }

    .modal-box.wide {
        max-width: 1280px;
        width: 96%;
    }

    @keyframes modalSlideIn {
        from {
            opacity: 0;
            transform: translateY(-20px);
        }

        to {
            opacity: 1;
            transform: none;
        }
    }

    .modal-header {
        padding: 18px 24px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid var(--border-light);
    }

    .modal-header h3 {
        font-size: 1.05rem;
        font-weight: 700;
    }

    .modal-close {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--text-secondary);
        transition: all var(--transition);
    }

    .modal-close:hover {
        background: var(--danger-bg);
        color: var(--danger);
    }

    .modal-body {
        padding: 24px;
        overflow-y: auto;
        flex: 1;
    }

    .modal-footer {
        padding: 16px 24px;
        display: flex;
        justify-content: flex-end;
        gap: 10px;
        border-top: 1px solid var(--border-light);
    }

    /* Modal Table Scroll Wrapper with Sticky Header and First Column */
    .modal-table-wrapper {
        max-height: 480px;
        overflow: auto;
        border: 1px solid var(--border-light);
        border-radius: var(--radius);
        position: relative;
        margin-bottom: 12px;
        will-change: scroll-position;
        transform: translateZ(0);
        backface-visibility: hidden;
    }

    .modal-table-wrapper table {
        border-collapse: separate !important;
        border-spacing: 0 !important;
        width: 100%;
    }

    .modal-table-wrapper thead th {
        position: sticky !important;
        top: 0 !important;
        z-index: 10 !important;
        background-color: var(--bg-card) !important;
        border-bottom: 2px solid var(--border) !important;
        will-change: transform;
        transform: translateZ(0);
    }

    .modal-table-wrapper td:first-child,
    .modal-table-wrapper th:first-child {
        position: sticky !important;
        left: 0 !important;
        z-index: 5 !important;
        background-color: var(--bg-card) !important;
        border-right: 2px solid var(--border) !important;
        will-change: transform;
        transform: translateZ(0);
    }

    .modal-table-wrapper th:first-child {
        z-index: 15 !important;
    }

    /* ============ FORM ============ */
    .form-group {
        margin-bottom: 16px;
    }

    .form-group label {
        display: block;
        font-size: .82rem;
        font-weight: 600;
        color: var(--text-secondary);
        margin-bottom: 6px;
    }

    .form-group label .required {
        color: var(--danger);
    }

    .form-control {
        width: 100%;
        padding: 8px 14px;
        border: 1px solid var(--border);
        border-radius: 8px;
        font-size: .88rem;
        transition: border-color var(--transition), box-shadow var(--transition);
        background: #fff;
    }

    select.form-control,
    input.form-control {
        height: 40px;
    }

    .form-control:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(76, 175, 80, .12);
    }

    .form-control.error {
        border-color: var(--danger);
    }

    .form-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .form-hint {
        font-size: .75rem;
        color: var(--text-light);
        margin-top: 4px;
    }

    /* ============ TOAST ============ */
    .toast-container {
        position: fixed;
        top: 20px;
        right: 20px;
        z-index: 10000;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .toast {
        padding: 12px 20px;
        border-radius: 10px;
        font-size: .85rem;
        font-weight: 500;
        color: #fff;
        box-shadow: var(--shadow-md);
        display: flex;
        align-items: center;
        gap: 10px;
        animation: toastIn .35s ease;
        min-width: 260px;
        max-width: 400px;
    }

    .toast.success {
        background: var(--success);
    }

    .toast.error {
        background: var(--danger);
    }

    .toast.warning {
        background: var(--primary);
    }

    .toast.info {
        background: var(--info);
    }

    .toast.removing {
        animation: toastOut .3s ease forwards;
    }

    @keyframes toastIn {
        from {
            opacity: 0;
            transform: translateX(40px);
        }

        to {
            opacity: 1;
            transform: none;
        }
    }

    @keyframes toastOut {
        to {
            opacity: 0;
            transform: translateX(40px);
        }
    }

    /* ============ CONFIRM DIALOG ============ */
    .confirm-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .5);
        z-index: 10001;
        display: none;
        align-items: center;
        justify-content: center;
    }

    .confirm-overlay.show {
        display: flex;
    }

    .confirm-box {
        background: #fff;
        border-radius: var(--radius-lg);
        padding: 32px;
        max-width: 380px;
        width: 100%;
        text-align: center;
        box-shadow: var(--shadow-lg);
    }

    .confirm-box i {
        font-size: 2.5rem;
        color: var(--primary);
        margin-bottom: 16px;
    }

    .confirm-box h4 {
        font-size: 1.05rem;
        margin-bottom: 8px;
    }

    .confirm-box p {
        font-size: .88rem;
        color: var(--text-secondary);
        margin-bottom: 24px;
    }

    .confirm-buttons {
        display: flex;
        gap: 10px;
        justify-content: center;
    }

    /* ============ ATTENDANCE GRID ============ */
    .attendance-grid {
        display: grid;
        gap: 8px;
    }

    .attendance-row {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 16px;
        background: var(--bg);
        border-radius: 10px;
        transition: background var(--transition);
    }

    .attendance-row:hover {
        background: var(--border-light);
    }

    .attendance-name {
        flex: 1;
        font-weight: 500;
        font-size: .9rem;
    }

    .attendance-status-group {
        display: flex;
        gap: 6px;
    }

    .attendance-status-btn {
        padding: 5px 12px;
        border-radius: 6px;
        font-size: .78rem;
        font-weight: 600;
        border: 1px solid var(--border);
        color: var(--text-secondary);
        transition: all var(--transition);
    }

    .attendance-status-btn.selected {
        color: #fff;
        border-color: transparent;
    }

    .attendance-status-btn[data-status="Có"].selected {
        background: var(--success);
    }

    .attendance-status-btn[data-status="Vắng"].selected {
        background: var(--danger);
    }

    .attendance-status-btn[data-status="Phép"].selected {
        background: var(--info);
    }

    .attendance-status-btn[data-status="Trễ"].selected {
        background: var(--primary);
    }

    /* ============ INVOICE ============ */
    .invoice-print {
        background: #fff;
        padding: 32px;
    }

    .invoice-header {
        text-align: center;
        margin-bottom: 24px;
    }

    .invoice-header h2 {
        font-size: 1.3rem;
        color: var(--primary);
    }

    .invoice-header p {
        color: var(--text-secondary);
        font-size: .85rem;
    }

    .invoice-info {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        margin-bottom: 20px;
        font-size: .88rem;
    }

    .invoice-info strong {
        color: var(--text);
    }

    .invoice-table {
        width: 100%;
        border: 1px solid var(--border);
        margin-bottom: 16px;
    }

    .invoice-table th,
    .invoice-table td {
        padding: 8px 12px;
        border: 1px solid var(--border);
        font-size: .85rem;
    }

    .invoice-table th {
        background: var(--primary-bg);
        font-weight: 600;
    }

    .invoice-total {
        text-align: right;
        font-size: 1rem;
        font-weight: 700;
    }

    /* ============ SETTINGS FORM ============ */
    .settings-section {
        background: var(--bg-card);
        border-radius: var(--radius-lg);
        padding: 24px;
        margin-bottom: 16px;
        box-shadow: var(--shadow);
    }

    .settings-section h4 {
        font-size: .95rem;
        font-weight: 700;
        margin-bottom: 16px;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--border-light);
        display: flex;
        align-items: center;
        gap: 8px;
    }

    /* ============ OPTIMISTIC UI ============ */
    .row-saving {
        opacity: .6;
        pointer-events: none;
    }

    .row-saved {
        animation: rowSaved .5s ease;
    }

    @keyframes rowSaved {

        0%,
        100% {
            background: transparent;
        }

        50% {
            background: var(--success-bg);
        }
    }

    /* ============ QUICK ACTION CARDS ============ */
    .quick-actions {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 12px;
        margin-bottom: 24px;
    }

    .quick-action {
        padding: 16px;
        border-radius: var(--radius);
        border: 1px solid var(--border);
        background: var(--bg-card);
        display: flex;
        align-items: center;
        gap: 12px;
        cursor: pointer;
        transition: all var(--transition);
    }

    .quick-action:hover {
        border-color: var(--primary);
        box-shadow: var(--shadow-md);
        transform: translateY(-2px);
    }

    .quick-action i {
        font-size: 1.2rem;
    }

    .quick-action span {
        font-size: .85rem;
        font-weight: 600;
    }

    /* ============ SCHEDULE TAGS ============ */
    .schedule-tag {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 2px 8px;
        border-radius: 4px;
        font-size: .75rem;
        background: var(--info-bg);
        color: var(--info);
        margin: 2px;
    }

    /* ============ SUB-TABS ============ */
    .sub-tabs {
        display: inline-flex;
        gap: 2px;
        margin-bottom: 16px;
        background: var(--border-light);
        padding: 3px;
        border-radius: 8px;
    }

    .sub-tab {
        padding: 7px 18px;
        border-radius: 6px;
        font-size: .82rem;
        font-weight: 600;
        color: var(--text-secondary);
        display: flex;
        align-items: center;
        gap: 6px;
        transition: all var(--transition);
        white-space: nowrap;
    }

    .sub-tab:hover {
        color: var(--text);
        background: rgba(255, 255, 255, .6);
    }

    .sub-tab.active {
        background: var(--bg-card);
        color: var(--text);
        box-shadow: var(--shadow);
    }

    .sub-tab i {
        font-size: .8rem;
    }

    .sub-tab-content {
        display: none;
        animation: fadeIn .3s ease;
    }

    .sub-tab-content.active {
        display: block;
    }

    /* Modal Form Segmented Tabs */
    .form-tabs {
        display: flex;
        width: 100%;
        gap: 8px;
        margin-bottom: 16px;
        background: var(--bg);
        padding: 4px;
        border-radius: 8px;
        border: 1px solid var(--border);
    }

    .form-tab {
        flex: 1;
        padding: 10px 16px;
        border-radius: 6px;
        font-size: 0.9rem;
        font-weight: 600;
        text-align: center;
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        color: var(--text-secondary);
        background: transparent;
        border: none;
    }

    .form-tab:hover {
        background: rgba(0, 0, 0, 0.04);
    }

    .form-tab.active-chi {
        background: #fee2e2;
        color: #dc2626;
        border: 1px solid #fca5a5;
        font-weight: 700;
    }

    .form-tab.active-thu {
        background: #dcfce7;
        color: #16a34a;
        border: 1px solid #86efac;
        font-weight: 700;
    }

    /* ============ TIMELINE GRID (Bảng chấm công) ============ */
    .timeline-month-label {
        font-weight: 700;
        font-size: .88rem;
        color: var(--text);
        min-width: 110px;
        text-align: center;
    }

    .timeline-wrapper {
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: #ccc transparent;
    }

    .timeline-wrapper::-webkit-scrollbar {
        height: 7px;
    }

    .timeline-wrapper::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 4px;
    }

    .timeline-wrapper::-webkit-scrollbar-thumb:hover {
        background: #aaa;
    }

    .timeline-grid {
        display: grid;
        width: 100%;
        min-width: max-content;
    }

    .timeline-grid .tl-cell {
        padding: 6px 2px;
        text-align: center;
        font-size: .72rem;
        border-bottom: 1px solid var(--border-light);
        border-right: 1px solid var(--border-light);
        min-width: 30px;
    }

    .timeline-grid .tl-cell-head {
        font-weight: 700;
        color: var(--text-secondary);
        background: var(--bg);
        position: sticky;
        top: 0;
        z-index: 2;
        padding: 6px 2px;
        font-size: .68rem;
        line-height: 1.3;
    }

    .timeline-grid .tl-cell-head.weekend {
        background: #fef3e2;
        color: var(--primary);
    }

    .timeline-grid .tl-cell-name {
        text-align: left;
        padding: 6px 10px;
        font-weight: 600;
        font-size: .78rem;
        color: var(--text);
        white-space: nowrap;
        position: sticky;
        left: 0;
        z-index: 3;
        background: var(--bg-card);
        border-right: 2px solid var(--border);
        min-width: 120px;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .timeline-grid .tl-cell-name.head {
        background: var(--bg);
        font-weight: 700;
        color: var(--text-secondary);
        font-size: .72rem;
        z-index: 4;
    }

    .tl-dot {
        width: 20px;
        height: 20px;
        border-radius: 5px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: .58rem;
        font-weight: 700;
        color: #fff;
        cursor: default;
        position: relative;
    }

    .tl-dot.co {
        background: var(--success);
    }

    .tl-dot.vang {
        background: var(--danger);
    }

    .tl-dot.phep {
        background: var(--info);
    }

    .tl-dot.tre {
        background: var(--primary);
    }

    .tl-dot.none {
        background: var(--border);
        color: transparent;
    }

    .tl-dot:hover::after {
        content: attr(title);
        position: absolute;
        bottom: calc(100% + 6px);
        left: 50%;
        transform: translateX(-50%);
        background: var(--bg-sidebar);
        color: #fff;
        padding: 4px 10px;
        border-radius: 6px;
        font-size: .72rem;
        font-weight: 500;
        white-space: nowrap;
        z-index: 10;
        pointer-events: none;
        box-shadow: var(--shadow-md);
    }

    /* Legend */
    .timeline-legend {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 10px 16px;
        border-top: 1px solid var(--border-light);
        flex-wrap: wrap;
    }

    .legend-item {
        display: flex;
        align-items: center;
        gap: 5px;
        font-size: .72rem;
        color: var(--text-secondary);
        font-weight: 500;
    }

    .legend-dot {
        width: 12px;
        height: 12px;
        border-radius: 3px;
        display: inline-block;
    }

    .legend-dot.co {
        background: var(--success);
    }

    .legend-dot.vang {
        background: var(--danger);
    }

    .legend-dot.phep {
        background: var(--info);
    }

    .legend-dot.tre {
        background: var(--primary);
    }

    .legend-dot.none {
        background: var(--border);
    }

    #dashboardFilterContainer {
        margin-right: 80px;
    }

    #dashboardFilterClassInput {
        max-width: 250px;
    }

    .fin-badge {
        font-size: .95rem;
    }

    /* ============ RESPONSIVE ============ */
    .charts-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        margin-bottom: 20px;
    }

    @media (max-width: 768px) {
        /* Cỡ chữ input tối thiểu 16px để tránh Safari/Chrome mobile
           tự động zoom-in màn hình khi người dùng chạm vào ô nhập liệu. */
        input.form-control,
        select.form-control,
        textarea.form-control,
        .search-box input,
        .filter-select {
            font-size: 16px !important;
        }

        .charts-container {
            grid-template-columns: 1fr;
        }

        #dashboardFilterContainer {
            margin-right: 15px;
            margin-left: 10px;
        }

        #dashboardFilterClassInput {
            max-width: 100%;
            width: 100%;
        }

        .fin-badge {
            font-size: .8rem;
        }

        :root {
            --sidebar-width: 260px;
        }

        .sidebar {
            transform: translateX(-100%);
            width: var(--sidebar-width) !important;
        }

        .sidebar.open {
            transform: none;
            box-shadow: var(--shadow-lg);
        }

        .sidebar.collapsed {
            width: var(--sidebar-width) !important;
        }

        .sidebar.collapsed .sidebar-text {
            opacity: 1;
            width: auto;
            pointer-events: auto;
        }

        .sidebar.collapsed .sidebar-header {
            padding: 20px;
            justify-content: flex-start;
        }

        .sidebar.collapsed .sidebar-nav a {
            padding: 10px 20px;
            justify-content: flex-start;
            border-left-width: 3px;
        }

        .sidebar.collapsed .nav-group-label {
            padding: 16px 20px 6px;
            justify-content: flex-start;
        }

        .sidebar.collapsed .sidebar-collapse {
            padding: 14px 20px;
            justify-content: flex-start;
        }

        .sidebar.collapsed .sidebar-collapse i {
            transform: none;
        }

        .sidebar-overlay.show {
            display: block;
        }

        .main-content,
        .main-content.sidebar-collapsed {
            margin-left: 0 !important;
        }

        .btn-toggle-sidebar {
            display: flex;
        }

        .sidebar-collapse {
            display: none;
        }

        .app-header {
            padding: 0 16px;
        }

        .page-content {
            padding: 16px;
        }

        .stats-grid {
            grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
            gap: 10px;
        }

        .stat-card {
            padding: 14px;
        }

        .stat-icon {
            width: 40px;
            height: 40px;
            font-size: 1rem;
        }

        .stat-info h3 {
            font-size: 0.9rem;
        }

        .card-header {
            padding: 12px 16px;
        }

        .card-body {
            padding: 16px;
        }

        .form-row {
            grid-template-columns: 1fr;
        }

        .search-box input {
            width: 160px;
        }

        .modal-box {
            max-height: 95vh;
            margin: 10px;
        }

        .modal-body {
            padding: 16px;
        }

        .attendance-row {
            flex-wrap: wrap;
        }

        .attendance-status-group {
            flex-wrap: wrap;
        }

        .quick-actions {
            grid-template-columns: repeat(2, 1fr);
        }

        .data-table {
            font-size: .8rem;
        }

        .data-table thead th {
            padding: 5px 10px;
        }

        .data-table tbody td {
            padding: 4px 10px;
        }

        .header-user-name {
            display: none;
        }

        .pagination {
            padding: 10px 16px;
        }

        .invoice-info {
            grid-template-columns: 1fr;
        }

        .toolbar {
            width: 100%;
        }
    }

    @media (max-width: 480px) {
        .stats-grid {
            grid-template-columns: 1fr 1fr;
        }

        .quick-actions {
            grid-template-columns: 1fr 1fr;
        }

        .toolbar {
            display: grid !important;
            grid-template-columns: repeat(2, 1fr) !important;
            gap: 8px !important;
            width: 100% !important;
            margin-top: 8px;
        }

        .toolbar>* {
            width: 100% !important;
            min-width: 0 !important;
            max-width: 100% !important;
            margin: 0 !important;
            box-sizing: border-box !important;
            justify-content: center;
            text-align: center;
        }

        .toolbar>.search-box {
            width: 100% !important;
        }

        .toolbar>.search-box input {
            width: 100% !important;
        }

        .toolbar>.datalist-container {
            width: 100% !important;
        }

        .toolbar>.datalist-container>.datalist-input {
            width: 100% !important;
        }

        .toolbar input[type="month"].filter-select {
            width: 100% !important;
        }

        .desktop-only {
            display: none !important;
        }

        .search-box input {
            width: 100%;
        }
    }

    /* ============ THỜI KHOÁ BIỂU ============ */
    .schedule-column {
        background: var(--bg);
        border: 1px solid var(--border-light);
        border-radius: 8px;
        padding: 12px;
    }

    .schedule-column h4 {
        text-align: center;
        margin-bottom: 12px;
        font-size: 1rem;
        color: var(--primary);
        border-bottom: 1px solid var(--primary-bg);
        padding-bottom: 6px;
    }

    .schedule-empty {
        text-align: center;
        font-size: .8rem;
        color: var(--text-light);
    }

    .schedule-card {
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-left: 3px solid var(--primary);
        border-radius: 6px;
        padding: 8px;
        margin-bottom: 8px;
        font-size: .8rem;
        box-shadow: var(--shadow-sm);
    }

    .schedule-card strong {
        color: var(--text);
        display: block;
        margin-bottom: 2px;
    }

    .schedule-card div {
        color: var(--text-secondary);
        font-size: .75rem;
    }

    .schedule-teacher {
        color: var(--info) !important;
        font-size: .75rem;
        margin-top: 2px;
    }

    @media (max-width: 1200px) {
        #scheduleGrid {
            grid-template-columns: repeat(4, 1fr) !important;
        }
    }

    @media (max-width: 900px) {
        #scheduleGrid {
            grid-template-columns: repeat(3, 1fr) !important;
        }
    }

    @media (max-width: 600px) {
        #scheduleGrid {
            grid-template-columns: repeat(2, 1fr) !important;
        }
    }

    @media (max-width: 400px) {
        #scheduleGrid {
            grid-template-columns: 1fr !important;
        }
    }

    /* ============ PRINT ============ */
    @media print {

        .sidebar,
        .app-header,
        .btn,
        .pagination,
        .toolbar,
        .modal-footer,
        .no-print {
            display: none !important;
        }

        .main-content {
            margin: 0;
        }

        .page-content {
            padding: 0;
        }

        .card {
            box-shadow: none;
            border: 1px solid #ddd;
        }

        .invoice-print {
            padding: 0;
        }

        .invoice-info {
            grid-template-columns: 1fr 1fr !important;
        }
    }

    /* ============ ĐÁNH GIÁ - EVAL BADGES ============ */
    .eval-badge {
        display: inline-block;
        padding: 3px 10px;
        border-radius: 6px;
        font-size: .75rem;
        font-weight: 600;
        white-space: nowrap;
    }

    .eval-badge.tot {
        background: var(--success-bg);
        color: var(--success);
    }

    .eval-badge.kha {
        background: var(--info-bg);
        color: var(--info);
    }

    .eval-badge.tb {
        background: var(--warning-bg);
        color: var(--warning);
    }

    .eval-badge.yeu {
        background: var(--danger-bg);
        color: var(--danger);
    }

    /* ============ STAR RATING ============ */
    .quality-stars {
        display: inline-flex;
        gap: 2px;
        font-size: .9rem;
    }

    .quality-stars .fa-star {
        color: #ddd;
    }

    .quality-stars .fa-star.active {
        color: #f59e0b;
    }

    .star-rating-input {
        display: inline-flex;
        gap: 4px;
        font-size: 1.3rem;
        cursor: pointer;
    }

    .star-rating-input .fa-star {
        color: #ddd;
        transition: color .15s;
    }

    .star-rating-input .fa-star:hover,
    .star-rating-input .fa-star.active {
        color: #f59e0b;
    }

    /* ============ LESSON ROW IN TIMELINE ============ */
    .tl-lesson-label {
        position: sticky;
        left: 0;
        z-index: 2;
    }

    .tl-lesson-cell {
        background: var(--bg);
        display: flex;
        align-items: center;
        justify-content: center;
        border-bottom: 2px solid var(--primary-light, rgba(99, 102, 241, .15));
        min-height: 24px;
    }

    .tl-lesson-cell:hover {
        background: var(--primary-light, rgba(99, 102, 241, .08));
    }

    /* ============ PROGRESS BAR ============ */
    .hw-progress {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .hw-progress-bar {
        display: flex;
        flex: 1;
        height: 8px;
        background: var(--border);
        border-radius: 4px;
        overflow: hidden;
        min-width: 60px;
    }

    .hw-progress-fill {
        height: 100%;
        transition: width .4s ease;
    }

    .hw-progress-fill.green {
        background: var(--success);
    }

    .hw-progress-fill.orange {
        background: var(--warning);
    }

    .hw-progress-fill.red {
        background: var(--danger);
    }

    .hw-progress-text {
        font-size: .75rem;
        font-weight: 600;
        color: var(--text-secondary);
        white-space: nowrap;
    }

    /* ============ GRADE COLORS ============ */
    .grade-value {
        display: inline-block;
        font-weight: 700;
        font-size: .9rem;
        padding: 2px 8px;
        border-radius: 6px;
    }

    .grade-value.excellent {
        background: var(--success-bg);
        color: var(--success);
    }

    .grade-value.good {
        background: var(--info-bg);
        color: var(--info);
    }

    .grade-value.average {
        background: var(--warning-bg);
        color: var(--warning);
    }

    .grade-value.poor {
        background: var(--danger-bg);
        color: var(--danger);
    }

    /* ============ ATT STATS ============ */
    .att-stat-cell {
        text-align: center;
        font-weight: 600;
        font-size: .85rem;
    }

    .att-stat-cell.co {
        color: var(--success);
    }

    .att-stat-cell.vang {
        color: var(--danger);
    }

    .att-stat-cell.phep {
        color: var(--info);
    }

    .att-stat-cell.tre {
        color: var(--warning);
    }

    .att-rate-bar {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        width: 100%;
        justify-content: center;
    }

    .att-rate-bar .bar {
        width: 50px;
        height: 6px;
        background: var(--border);
        border-radius: 3px;
        overflow: hidden;
    }

    .att-rate-bar .bar-fill {
        height: 100%;
        border-radius: 3px;
        background: var(--success);
        transition: width .3s;
    }

    /* Eval status btn group */
    .eval-level-group {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
    }

    .eval-level-btn {
        padding: 6px 14px;
        border: 2px solid var(--border);
        border-radius: 8px;
        font-size: .82rem;
        font-weight: 600;
        cursor: pointer;
        transition: all .2s;
        background: var(--bg);
        color: var(--text-secondary);
    }

    .eval-level-btn:hover {
        border-color: var(--primary);
        color: var(--primary);
    }

    .eval-level-btn.selected {
        background: var(--primary);
        color: #fff;
        border-color: var(--primary);
    }

    /* HW status badges */
    .hw-status-done {
        background: var(--success-bg);
        color: var(--success);
        padding: 2px 8px;
        border-radius: 4px;
        font-size: .75rem;
        font-weight: 600;
    }

    .hw-status-pending {
        background: var(--warning-bg);
        color: var(--warning);
        padding: 2px 8px;
        border-radius: 4px;
        font-size: .75rem;
        font-weight: 600;
    }

    .hw-status-late {
        background: var(--danger-bg);
        color: var(--danger);
        padding: 2px 8px;
        border-radius: 4px;
        font-size: .75rem;
        font-weight: 600;
    }

    /* Colored Select Elements */
    .status-select {
        transition: all 0.2s ease;
        font-weight: 600;
        cursor: pointer;
        font-size: 0.72rem !important;
        white-space: normal !important;
        height: auto !important;
        line-height: 1.3;
        min-height: 32px;
        padding: 6px 24px 6px 8px !important;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        background-repeat: no-repeat;
        background-position: right 8px center;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    }

    .status-select option {
        background-color: #ffffff !important;
        color: #333333 !important;
    }

    /* Level 1 (Success/Green) */
    .status-select[data-val="Có"],
    .status-select[data-val="Tốt"],
    .status-select[data-val="Đã nộp"],
    .status-select[data-val="Đúng giờ"],
    .status-select[data-val="Đã làm đầy đủ và đúng"],
    .status-select[data-val="Ghi đầy đủ, sạch đẹp"],
    .status-select[data-val="Chăm chú nghe giảng, tích cực trong giờ học"],
    .status-select[data-val^="Con hoàn thành xuất sắc yêu cầu"] {
        background-color: var(--success-bg) !important;
        color: var(--success) !important;
        border-color: var(--success) !important;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2324c560' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
    }

    /* Level 2 (Info/Blue) */
    .status-select[data-val="Phép"],
    .status-select[data-val="Khá"],
    .status-select[data-val="Đi muộn"],
    .status-select[data-val="Đã làm đủ nhưng còn nhầm lẫn đôi chút"],
    .status-select[data-val="Ghi đầy đủ, cần khoa học hơn"],
    .status-select[data-val="Chăm chú nghe giảng. Cần tích cực hơn trong giờ học"],
    .status-select[data-val^="Con hoàn thành khá tốt"] {
        background-color: #e8f0fe !important;
        color: #3782f4 !important;
        border-color: #3782f4 !important;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%233782f4' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
    }

    /* Level 3 (Warning/Orange) */
    .status-select[data-val="Trễ"],
    .status-select[data-val="TB"],
    .status-select[data-val="Nộp trễ"],
    .status-select[data-val="Nghỉ CP"],
    .status-select[data-val="Làm thiếu"],
    .status-select[data-val="Ghi thiếu"],
    .status-select[data-val="Có nghe giảng, đôi khi mất tập trung"],
    .status-select[data-val="Đạt"],
    .status-select[data-val^="Con hoàn thành yêu cầu buổi học"] {
        background-color: var(--warning-bg) !important;
        color: var(--warning) !important;
        border-color: var(--warning) !important;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23f59e0b' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
    }

    /* Level 4 (Danger/Red) */
    .status-select[data-val="Vắng"],
    .status-select[data-val="Yếu"],
    .status-select[data-val="Chưa nộp"],
    .status-select[data-val="Nghỉ KP"],
    .status-select[data-val="Chưa làm"],
    .status-select[data-val="Không ghi"],
    .status-select[data-val="Chưa tập trung trong giờ học"],
    .status-select[data-val="Chưa đạt"],
    .status-select[data-val^="Con chưa hoàn thành yêu cầu"] {
        background-color: var(--danger-bg) !important;
        color: var(--danger) !important;
        border-color: var(--danger) !important;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e94849' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
    }

    /* Thời khoá biểu: ghim header + cột đầu, căn trái */
    #scheduleGrid {
        max-height: calc(100vh - 200px);
        overflow: auto;
        will-change: scroll-position;
        transform: translateZ(0);
        backface-visibility: hidden;
    }

    #scheduleGrid thead th {
        position: sticky;
        top: 0;
        z-index: 5;
        background: var(--bg);
        will-change: transform;
        transform: translateZ(0);
    }

    #scheduleGrid thead th:first-child,
    #scheduleGrid tbody td:first-child {
        position: sticky;
        left: 0;
        text-align: left !important;
        background: var(--bg-card);
        z-index: 4;
        border-right: 2px solid var(--border) !important;
        will-change: transform;
        transform: translateZ(0);
    }

    #scheduleGrid thead th:first-child {
        z-index: 6;
    }

    /* ============ DATALIST STYLING ============ */
    .datalist-container {
        position: relative;
        display: inline-block;
        vertical-align: middle;
    }

    .form-group>.datalist-container,
    .form-row>.datalist-container,
    .form-row-custom>.datalist-container {
        display: block;
        width: 100%;
    }

    .datalist-container .datalist-clear-btn {
        position: absolute;
        right: 14px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 1.1rem;
        color: var(--text-light);
        cursor: pointer;
        opacity: 0.6;
        transition: opacity 0.2s;
        z-index: 5;
        width: 16px;
        height: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

    .datalist-container .datalist-clear-btn:hover {
        opacity: 1;
        color: var(--danger);
    }

    .datalist-input {
        padding-right: 30px !important;
        background-image: none !important;
        /* Hide custom SVG background arrow from .filter-select */
    }

    .datalist-input::-webkit-calendar-picker-indicator {
        opacity: 0.6;
        cursor: pointer;
        padding: 2px;
    }

    .datalist-input::-webkit-calendar-picker-indicator:hover {
        opacity: 1;
    }

    .toolbar>.datalist-container>.datalist-input {
        min-width: 140px;
    }

    /* ============ BASE UTILITY & POPUP CLASSES ============ */
    .status-select {
        width: 100%;
        max-width: 100%;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .eval-meta-grid {
        display: grid;
        grid-template-columns: 180px 1fr 1fr;
        gap: 12px;
    }

    .grade-charts-flex {
        display: flex;
        justify-content: space-around;
        align-items: center;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        padding: 12px;
        margin-bottom: 12px;
        gap: 12px;
    }

    .grade-charts-divider {
        border-left: 1px solid #e2e8f0;
        height: 110px;
    }

    .finance-sub-tabs-btns {
        display: flex;
        gap: 8px;
        align-items: center;
    }

    .modal-footer-content {
        display: flex;
        justify-content: space-between;
        width: 100%;
        align-items: center;
    }

    .modal-footer-group {
        display: flex;
        gap: 8px;
    }

    .flatpickr-input-range {
        padding-left: 30px;
        padding-right: 28px;
        min-width: 220px;
        background-image: none;
        background: var(--bg-card);
        cursor: pointer;
    }

    /* ============ MOBILE RESPONSIVE STYLES (NO !IMPORTANT) ============ */
    @media (max-width: 768px) {
        .toolbar {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 8px;
            width: 100%;
        }

        .toolbar > * {
            width: 100%;
            min-width: 0;
            max-width: 100%;
            margin: 0;
            box-sizing: border-box;
        }

        .toolbar > .datalist-container {
            width: 100%;
            flex: none;
        }

        .toolbar > .datalist-container > .datalist-input {
            width: 100%;
            min-width: 0;
        }

        /* Mobile Schedule Form Layout */
        .schedule-row-item {
            flex-direction: column;
            align-items: stretch;
            background: var(--bg);
            padding: 12px 10px;
            border-radius: var(--radius-md);
            position: relative;
            gap: 6px;
            border: 1px solid var(--border-light);
            margin-bottom: 12px;
        }

        .schedule-row-item .form-group {
            margin: 0;
            width: 100%;
        }

        .schedule-row-item .btn-icon.delete {
            position: absolute;
            right: 8px;
            top: 8px;
            z-index: 10;
        }

        /* Mobile Evaluation Meta Grid */
        .eval-meta-grid {
            grid-template-columns: 1fr;
        }

        /* Mobile Grade Charts Layout */
        .grade-charts-flex {
            flex-direction: column;
            align-items: center;
        }

        .grade-charts-divider {
            display: none;
        }

        /* Mobile Finance Sub-tabs Menu */
        .finance-sub-tabs-btns {
            width: 100%;
            justify-content: space-between;
        }

        .finance-sub-tabs-btns .sub-tab {
            flex: 1;
            text-align: center;
            justify-content: center;
            padding: 8px 4px;
            font-size: 0.78rem;
        }

        /* Mobile Date Range Filter Input Optimization */
        .flatpickr-wrapper {
            width: 100%;
            max-width: 100%;
            min-width: 0;
            box-sizing: border-box;
        }

        .flatpickr-wrapper input.filter-select {
            font-size: 0.72rem;
            padding-left: 24px;
            padding-right: 20px;
            min-width: 0;
            width: 100%;
            max-width: 100%;
            letter-spacing: -0.3px;
            height: 32px;
            box-sizing: border-box;
        }

        .flatpickr-wrapper .fa-calendar-alt {
            left: 8px;
            font-size: 0.75rem;
        }

        .flatpickr-wrapper .fa-times-circle {
            right: 6px;
            font-size: 0.75rem;
        }

        /* Mobile Modal Footer Alignment */
        .modal-footer {
            padding: 10px 14px;
        }

        .modal-footer-content {
            flex-direction: column;
            align-items: stretch;
            gap: 8px;
            width: 100%;
        }

        .modal-footer-group {
            display: flex;
            width: 100%;
            gap: 8px;
        }

        .modal-footer-group .btn {
            flex: 1;
            justify-content: center;
            margin: 0;
            font-size: 0.78rem;
            padding: 7px 6px;
            white-space: nowrap;
        }

        /* Mobile Stat Cards Font Size & Layout */
        .stat-card {
            padding: 10px 10px;
            gap: 10px;
        }

        .stat-icon {
            width: 36px;
            height: 36px;
            font-size: 0.95rem;
            border-radius: 8px;
        }

        .stat-info h3 {
            font-size: 1.05rem;
        }

        .stat-info p {
            font-size: 0.68rem;
            line-height: 1.2;
            margin-top: 2px;
            letter-spacing: -0.2px;
        }

        .fin-badge {
            font-size: 0.68rem;
            padding: 2px 5px;
        }

        /* Mobile Sub-tabs Font Size & Single Line Layout */
        .sub-tab,
        .tab-item,
        .tab-menu .tab-item,
        .sub-tabs .sub-tab,
        .user-tab {
            font-size: 0.68rem;
            padding: 5px 6px;
            gap: 3px;
            line-height: 1.2;
            letter-spacing: -0.3px;
            white-space: nowrap;
        }

        .sub-tab i,
        .tab-item i,
        .tab-menu .tab-item i,
        .sub-tabs .sub-tab i {
            font-size: 0.72rem;
        }

        .tab-menu,
        .sub-tabs,
        .sub-tabs-bar {
            gap: 4px;
            flex-wrap: nowrap;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
        }

        .card-header h3 {
            font-size: 0.82rem;
        }

        .flatpickr-calendar {
            left: 50% !important;
            transform: translateX(-50%) !important;
        }

        .charts-row-3,
        .charts-row-2 {
            grid-template-columns: 1fr !important;
        }
    }

    /* Dashboard Chart Row Grids */
    .charts-row-3 {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
        margin-bottom: 16px;
    }

    .charts-row-2 {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        margin-bottom: 16px;
    }

    @media (max-width: 1024px) {
        .charts-row-3 {
            grid-template-columns: repeat(2, 1fr);
        }
    }

    /* ============ PRINT STYLES ============ */
    @media print {
        body {
            background: #fff !important;
            color: #000 !important;
            padding: 0 !important;
            margin: 0 !important;
            -webkit-print-color-adjust: exact !important;
            print-color-adjust: exact !important;
        }

        #sidebar,
        .top-header,
        .dashboard-tabs-wrapper,
        .flatpickr-calendar,
        .toast,
        .btn,
        .modal,
        .modal-overlay:not(.show) {
            display: none !important;
        }

        /* 1. Dashboard Print Mode */
        body.printing-dashboard #mainContent,
        body.printing-dashboard #pageDashboard {
            display: block !important;
            position: static !important;
            width: 100% !important;
            margin: 0 !important;
            padding: 0 !important;
            background: transparent !important;
        }

        body.printing-dashboard #dashTabGeneral.active,
        body.printing-dashboard #dashTabAttendance.active {
            display: block !important;
        }

        body.printing-dashboard #dashTabGeneral:not(.active),
        body.printing-dashboard #dashTabAttendance:not(.active) {
            display: none !important;
        }

        body.printing-dashboard #dashPrintHeader {
            display: block !important;
            text-align: center;
            margin-bottom: 15px;
        }

        body.printing-dashboard .stats-grid {
            display: grid !important;
            grid-template-columns: repeat(4, 1fr) !important;
            gap: 10px !important;
            margin-bottom: 12px !important;
        }

        body.printing-dashboard .charts-row-3 {
            display: grid !important;
            grid-template-columns: repeat(3, 1fr) !important;
            gap: 10px !important;
            margin-bottom: 12px !important;
        }

        body.printing-dashboard .charts-row-2,
        body.printing-dashboard #dashTabAttendance .charts-container {
            display: grid !important;
            grid-template-columns: repeat(2, 1fr) !important;
            gap: 10px !important;
            margin-bottom: 12px !important;
        }

        body.printing-dashboard .card {
            border: 1px solid #cbd5e1 !important;
            box-shadow: none !important;
            page-break-inside: avoid !important;
            margin-bottom: 0 !important;
            background: #fff !important;
        }

        body.printing-dashboard .card-header {
            padding: 6px 12px !important;
            background: #f8fafc !important;
            border-bottom: 1px solid #e2e8f0 !important;
        }

        body.printing-dashboard .card-body {
            padding: 4px !important;
            overflow: visible !important;
        }

        body.printing-dashboard .card-body .apexcharts-canvas {
            transform: scale(0.91) !important;
            transform-origin: top left !important;
            width: 109.8% !important;
        }

        body.printing-dashboard .apexcharts-canvas svg {
            width: 100% !important;
            height: 100% !important;
            max-width: 100% !important;
        }

        body.printing-dashboard .apexcharts-legend {
            max-width: 100% !important;
            box-sizing: border-box !important;
        }

        /* 2. Invoice Modal Print Mode */
        body:not(.printing-dashboard) #app {
            display: none !important;
        }

        body:not(.printing-dashboard) #invoiceModal,
        body:not(.printing-dashboard) #invoiceModal.show {
            display: block !important;
            position: absolute !important;
            top: 0 !important;
            left: 0 !important;
            width: 100% !important;
            height: auto !important;
            background: #fff !important;
            padding: 0 !important;
            margin: 0 !important;
            box-shadow: none !important;
            border: none !important;
            z-index: 99999 !important;
        }

        body:not(.printing-dashboard) #invoiceModal .modal-box {
            position: static !important;
            width: 100% !important;
            max-width: 100% !important;
            box-shadow: none !important;
            border: none !important;
            padding: 0 !important;
            margin: 0 !important;
            background: #fff !important;
        }

        body:not(.printing-dashboard) #invoiceModal .modal-header,
        body:not(.printing-dashboard) #invoiceModal .modal-footer {
            display: none !important;
        }

        body:not(.printing-dashboard) #invoiceModal .modal-body {
            padding: 0 !important;
            margin: 0 !important;
        }

        @page {
            size: portrait;
            margin: 0.8cm;
        }
    }
 
/* ============================================================
   VIỆC 13: MÀN HÌNH "SẢN PHẨM HỌC SINH"
   ============================================================ */
.sp-list { display: flex; flex-direction: column; }
.sp-row { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.sp-row:last-child { border-bottom: none; }
.sp-row:hover { background: var(--bg); }
.sp-idx { width: 28px; flex-shrink: 0; text-align: center; font-size: .85rem; color: var(--text-light); }
.sp-name { flex: 0 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sp-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-code { font-size: .72rem; color: var(--text-light); }
.sp-status { flex: 1; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: .85rem; }
.sp-empty { color: var(--text-light); font-style: italic; }
.sp-title-text { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-link { color: var(--primary); text-decoration: none; }
.sp-actions { flex-shrink: 0; }
.sp-form-grid { display: grid; grid-template-columns: 1fr 220px; gap: 16px; }
.sp-form-grid.sp-form-grid-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 768px) {
  .sp-row { flex-wrap: wrap; padding: 12px 14px; gap: 8px 10px; }
  .sp-name { flex: 1 1 calc(100% - 48px); }
  .sp-status { order: 3; flex: 1 1 100%; }
  .sp-actions { order: 4; flex: 1 1 100%; }
  .sp-actions .btn { width: 100%; }
  .sp-items { order: 3; flex: 1 1 100%; }
  .sp-summary { padding: 10px 14px; }
  .sp-form-grid { grid-template-columns: 1fr; gap: 0; }
}
/* VIỆC 14: TRANG SẢN PHẨM - lọc theo tháng / khoảng ngày */
.sp-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 22px; padding: 10px 20px; border-bottom: 1px solid var(--border); background: var(--bg); font-size: .85rem; }
.sp-summary i { color: var(--primary); margin-right: 4px; }
.sp-hint { color: var(--text-light); font-style: italic; }
.sp-row-multi { align-items: flex-start; }
.sp-items { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; font-size: .85rem; }
.sp-item { display: flex; align-items: center; gap: 10px; }
.sp-item-main { flex: 1; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.sp-date { flex-shrink: 0; width: 46px; font-size: .78rem; font-weight: 600; color: var(--text-light); }
