/* =========================================
   MODERN LOGIN THEME (CTVCTT V2)
   ========================================= */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-gradient-start: #eff6ff;
    --bg-gradient-end: #dbeafe;
    --text-main: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --input-focus: #3b82f6;
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}
/* LOGIN PAGE STYLES */
/* 1. Cấu trúc trang toàn màn hình */
body.ctvctt-login-page {
    font-family: 'Inter', -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, #bfdbfe 100%);
    color: var(--text-main);
}

.ctvctt-login-wrapper {
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
}

/* 2. Thẻ Card chứa Form */
.ctvctt-login-card {
    background: #ffffff;
    width: 100%;
    max-width: 450px;
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease;
    border: 1px solid rgba(255,255,255,0.8);
    animation: slideUpFade 0.6s ease-out forwards;
    box-sizing: border-box;
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 3. Logo & Header */
.ctvctt-logo-area {
    text-align: center;
    margin-bottom: 20px;
}

.ctvctt-school-logo {
    height: 80px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.ctvctt-header-text {
    text-align: center;
    margin-bottom: 30px;
}

.ctvctt-header-text h2 {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
}

.ctvctt-header-text p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
}

/* 4. Input Fields */
.ctvctt-input-group {
    margin-bottom: 20px;
}

.ctvctt-input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #334155;
}

.ctvctt-input-group input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: #f8fafc;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.ctvctt-input-group input:focus {
    outline: none;
    background-color: #fff;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 5. Actions (Checkbox & Forgot Pass) */
.ctvctt-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    font-size: 13px;
}

.ctvctt-checkbox {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    cursor: pointer;
}

.ctvctt-checkbox input {
    margin-right: 8px;
    width: 16px; 
    height: 16px;
    cursor: pointer;
}

.forgot-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}
.forgot-link:hover {
    text-decoration: underline;
}

/* 6. Nút Đăng nhập Hiện đại */
.ctvctt-btn-modern {
    width: 100%;
    padding: 14px;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.ctvctt-btn-modern:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.ctvctt-btn-modern:active {
    transform: translateY(0);
}

.ctvctt-btn-modern:disabled {
    background-color: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

/* 7. Thông báo & Footer */
.ctvctt-msg {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
    border: 1px solid transparent;
}
.ctvctt-msg.error { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.ctvctt-msg.success { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }

.ctvctt-footer-text {
    margin-top: 30px;
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.5;
}

/* 8. Spinner Loading */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #fff;
    border-bottom-color: transparent;
    border-radius: 50%;
    display: none;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 3. Logo & Header (Cập nhật giao diện Tối giản) */
.ctvctt-logo-area {
    text-align: center;
    margin-bottom: 25px;
}

.ctvctt-school-logo {
    height: 90px;
    width: 90px;
    object-fit: contain;
    
    /* Nền trắng làm nổi bật logo */
    background-color: #ffffff;
    
    /* Viền mỏng tinh tế */
    border: 1px solid rgba(0, 0, 0, 0.08);
    
    /* Bo tròn 4 góc mềm mại */
    border-radius: 16px;
    
    /* Padding để logo không dính sát viền */
    padding: 12px;
    
    /* Hiệu ứng bóng đổ (Drop Shadow) tạo chiều sâu */
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15); /* Bóng màu xanh nhẹ theo tông chủ đạo */
    
    /* Hiệu ứng chuyển động nhẹ khi di chuột vào */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Thêm chút tương tác khi di chuột */
.ctvctt-school-logo:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}
/* KẾT THÚC LOGIN PAGE STYLES */
/* DASHBOARD STYLES */
/* =========================================
   DASHBOARD LAYOUT STYLES
   ========================================= */

/* Reset body dashboard */
body.ctvctt-dashboard-body {
    background-color: #f1f5f9; /* Xám xanh nhạt hiện đại */
    overflow: hidden; /* Ẩn thanh cuộn body chính */
}

.ctvctt-wrapper {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* --- SIDEBAR (CỘT TRÁI) --- */
.ctvctt-sidebar {
    width: 260px;
    background-color: #1e293b; /* Màu xanh đen Slate 800 */
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid #334155;
    transition: width 0.3s;
}

/* Brand Logo */
.ctvctt-brand {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    background-color: #0f172a; /* Slate 900 */
    border-bottom: 1px solid #334155;
    gap: 15px;
}
.ctvctt-brand .brand-logo img {
    height: 35px;
    width: 35px;
    border-radius: 8px;
    background: #fff;
    padding: 2px;
}
.ctvctt-brand span {
    font-size: 14px;
    letter-spacing: 0.5px;
    color: #fff;
}

/* Menu Scroll Area */
.ctvctt-menu-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 15px 0;
}
.ctvctt-menu-scroll::-webkit-scrollbar { width: 5px; }
.ctvctt-menu-scroll::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }

/* Menu Header */
.ctvctt_sidebar_menu_header {
    padding: 20px 25px 10px 25px;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    color: #94a3b8; /* Slate 400 */
    letter-spacing: 0.5px;
}
.ctvctt_sidebar_menu_header i {
    margin-right: 5px;
    opacity: 0.7;
}

/* Menu Links */
.ctvctt-sidebar a {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.ctvctt-sidebar a i {
    width: 25px; /* Cố định width icon để text thẳng hàng */
    font-size: 16px;
    text-align: center;
    margin-right: 10px;
    opacity: 0.8;
}
.ctvctt-sidebar a:hover {
    background-color: #334155;
    color: #fff;
}
/* Active State (Khi đang chọn) */
.ctvctt-sidebar a.active {
    background-color: #2563eb; /* Primary Blue */
    color: #fff;
    border-left-color: #60a5fa;
}

/* Divider */
.ctvctt-divider {
    height: 1px;
    background-color: #334155;
    margin: 10px 25px;
}

/* Footer Logout */
.ctvctt-sidebar-footer {
    padding: 15px;
    background-color: #0f172a;
    border-top: 1px solid #334155;
}
.logout-btn {
    justify-content: center;
    background: #334155;
    border-radius: 6px;
    color: #f87171 !important; /* Đỏ nhạt */
    font-weight: 500;
}
.logout-btn:hover {
    background: #ef4444 !important;
    color: #fff !important;
}

/* --- MAIN CONTENT (CỘT PHẢI) --- */
.ctvctt-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Topbar */
.ctvctt-topbar {
    height: 70px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.topbar-title h2 { margin: 0; font-size: 20px; color: #1e293b; }
.topbar-title span { font-size: 13px; color: #64748b; }

.user-info { display: flex; align-items: center; gap: 15px; }
.user-details { text-align: right; line-height: 1.2; }
.user-details strong { display: block; font-size: 14px; color: #334155; }
.user-details small { font-size: 12px; color: #94a3b8; }
.user-avatar {
    width: 40px; height: 40px;
    background: #eff6ff;
    color: #2563eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border: 1px solid #bfdbfe;
}

/* Body Content Area */
.ctvctt-body {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* Card Container */
.ctvctt-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 10px 15px -5px rgba(0,0,0,0.04);
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid #e2e8f0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

/* Form Area Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 15px;
    margin-bottom: 20px;
}
.card-header h3 { margin: 0; color: #2563eb; }
.btn-close-form {
    background: transparent;
    border: 1px solid #cbd5e1;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    color: #64748b;
    font-size: 13px;
    transition: 0.2s;
}
.btn-close-form:hover { background: #f1f5f9; color: #333; }

/* Animation */
.fade-in { animation: fadeIn 0.3s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   MODERN TABLE STYLES (DATA GRID)
   ========================================= */

/* Container bao quanh bảng để xử lý scroll ngang */
.ctvctt-table-responsive {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e2e8f0; /* Viền mỏng bao quanh */
}

/* Bảng chính */
.ctvctt-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 14px;
    white-space: nowrap; /* Giữ nội dung trên 1 dòng */
}

/* Header (Tiêu đề cột) */
.ctvctt-table thead th {
    background-color: #f8fafc; /* Xám rất nhạt */
    color: #64748b; /* Màu chữ xám đậm */
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    padding: 16px 24px;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    letter-spacing: 0.5px;
}

/* Dòng dữ liệu */
.ctvctt-table tbody td {
    padding: 16px 24px;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

/* Hiệu ứng khi di chuột vào dòng */
.ctvctt-table tbody tr:hover {
    background-color: #f1f5f9;
}

/* Cột hành động (Nút bấm) */
.ctvctt-actions-cell {
    display: flex;
    gap: 8px; /* Khoảng cách giữa các nút */
    justify-content: flex-end; /* Căn phải */
}

/* Nút Sửa */
.btn-edit {
    background-color: #eff6ff;
    color: #2563eb; /* Xanh dương */
    border: 1px solid #dbeafe;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.btn-edit:hover {
    background-color: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

/* Nút Xóa */
.btn-delete {
    background-color: #fef2f2;
    color: #ef4444; /* Đỏ */
    border: 1px solid #fee2e2;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.btn-delete:hover {
    background-color: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

/* Badges (Nhãn hiển thị quyền hạn/trạng thái) */
.ctvctt-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}
.badge-admin { background: #dbeafe; color: #1e40af; } /* Xanh đậm */
.badge-user { background: #f1f5f9; color: #475569; } /* Xám */
.badge-success { background: #dcfce7; color: #166534; } /* Xanh lá */
/* =========================================
   MODERN FORM STYLES
   ========================================= */

/* Lưới Form: Chia 2 cột trên màn hình lớn */
.ctvctt-modern-form .form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .ctvctt-modern-form .form-grid {
        grid-template-columns: 1fr 1fr; /* 2 Cột */
    }
}

.form-control-group {
    display: flex;
    flex-direction: column;
}

.form-control-group label {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 13px;
    color: #475569;
}

.ctvctt-input {
    padding: 10px 15px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    background-color: #f8fafc;
    width: 100%;
    box-sizing: border-box; /* Quan trọng để không bị vỡ layout */
}

.ctvctt-input:focus {
    border-color: #2563eb;
    background-color: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Khu vực nút bấm cuối form */
.form-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 15px;
    justify-content: flex-end; /* Căn phải */
}

/* Nút phụ (Hủy bỏ) */
.ctvctt-btn-secondary {
    padding: 10px 20px;
    background-color: #fff;
    border: 1px solid #cbd5e1;
    color: #64748b;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s;
}
.ctvctt-btn-secondary:hover {
    background-color: #f1f5f9;
    color: #334155;
}
/* Hiệu ứng hiện ra nhẹ nhàng */
.ctvctt-card {
    /* Mặc định cho hiện */
    animation: simpleFadeIn 0.3s ease-out;
}

@keyframes simpleFadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
/* =========================================
   CUSTOM MODAL STYLES
   ========================================= */

.ctvctt-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.5); /* Nền tối mờ */
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px); /* Làm mờ nền web phía sau */
}

.ctvctt-modal {
    background: #fff;
    width: 90%;
    max-width: 400px;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    text-align: center;
    animation: modalPopUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPopUp {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.ctvctt-modal-icon {
    font-size: 40px;
    margin-bottom: 15px;
}
.ctvctt-modal-icon.success { color: #10b981; }
.ctvctt-modal-icon.error { color: #ef4444; }
.ctvctt-modal-icon.warning { color: #f59e0b; }

#ctvctt-modal-title {
    margin: 0 0 10px;
    font-size: 18px;
    color: #1e293b;
}

#ctvctt-modal-message {
    color: #64748b;
    margin-bottom: 25px;
    line-height: 1.5;
}

.ctvctt-modal-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}
/* Button nhỏ trong bảng (Quick Action) */
.btn-tiny {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: 0.2s;
}

.btn-approve {
    background-color: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}
.btn-approve:hover { background-color: #22c55e; color: white; }

.btn-lock {
    background-color: #f1f5f9;
    color: #475569;
    border-color: #e2e8f0;
}
.btn-lock:hover { background-color: #64748b; color: white; }

.btn-open {
    background-color: #eff6ff;
    color: #1e40af;
    border-color: #dbeafe;
}
.btn-open:hover { background-color: #3b82f6; color: white; }
/* Button bị vô hiệu hóa */
.btn-disabled {
    background-color: #f1f5f9;
    color: #cbd5e1; /* Màu chữ nhạt */
    border: 1px solid #e2e8f0;
    cursor: not-allowed; /* Con trỏ chuột báo cấm */
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.a4-paper {
    width: 277mm; /* Tối ưu cho in ngang */
    margin: 0 auto;
    padding: 10mm;
    background: white;
    font-family: "Times New Roman", Times, serif;
}
.table-print {
    width: 100%;
    border-collapse: collapse;
    border: 1.5pt solid black; /* Viền ngoài đậm */
}
.table-print th, .table-print td {
    border: 0.5pt solid black; /* Viền trong mảnh sắc nét */
    padding: 4px;
    text-align: center;
    vertical-align: middle;
}
.vertical-text {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-weight: bold;
    padding: 5px !important;
}
.print-subject { font-weight: bold; text-transform: uppercase; font-size: 13px; }
.print-room { font-size: 12px; }
.print-gv { font-size: 11px; font-style: italic; }
@media print {
    @page { size: landscape; margin: 0; }
    .no-print { display: none !important; }
    .a4-paper { border: none; box-shadow: none; width: 100%; }
}
/* ================================================================= */
/* CSS CHUYÊN DỤNG CHO TRANG IN TKB (A4 LANDSCAPE) - CHUẨN EXCEL     */
/* ================================================================= */

/* Giả lập tờ giấy A4 trên màn hình để xem trước */
.a4-paper {
    width: 297mm;
    min-height: 210mm;
    padding: 10mm 15mm;
    margin: 20px auto; /* Canh giữa tờ giấy trên màn hình */
    background: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    font-family: 'Times New Roman', Times, serif;
    color: #000;
    box-sizing: border-box;
    display: block;
}

/* Header Quốc hiệu - Căn lề 2 bên */
.print-header-flex { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start; 
    margin-bottom: 15px; 
}
.header-left, .header-right { 
    text-align: center; 
    width: 45%; 
}
.header-bold { 
    font-weight: bold; 
    text-transform: uppercase; 
    font-size: 13px; 
    line-height: 1.3; 
}

/* Tiêu đề chính */
.tkb-title-main { 
    text-align: center; 
    font-size: 20px; 
    font-weight: bold; 
    margin: 15px 0 5px 0; 
    text-transform: uppercase; 
}
.tkb-meta-info { 
    text-align: center; 
    font-size: 14px; 
    margin-bottom: 5px; 
}

/* Bảng TKB - Kẻ khung nét liền đen kiểu Excel */
.table-print { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: 12px; 
    margin: 10px auto; /* Canh giữa bảng */
    border: 1.5pt solid black;
}
.table-print th, .table-print td { 
    border: 1px solid black; 
    padding: 4px; 
    text-align: center;      /* Căn giữa ngang */
    vertical-align: middle;  /* Căn giữa dọc */
}

.table-print th { 
    background-color: #f0f0f0; 
    font-weight: bold; 
    height: 35px; 
    text-transform: uppercase;
}

/* Text xoay dọc cho cột Buổi */
.vertical-text {
    writing-mode: vertical-rl; 
    transform: rotate(180deg); 
    font-weight: bold; 
    text-transform: uppercase;
    width: 30px;
    text-align: center;
}

/* Footer Ký tên - Canh đều */
.print-footer { 
    display: flex; 
    justify-content: space-around; 
    margin-top: 30px; 
    text-align: center; 
    font-size: 13px; 
}
.footer-col { width: 30%; }
.footer-title { font-weight: bold; text-transform: uppercase; margin-bottom: 60px; }

/* Ẩn các thành phần không cần thiết khi in */
@media print {
    @page { 
        size: landscape; 
        margin: 10mm; 
    }
    body { background: white !important; }
    body * { visibility: hidden; } 
    
    #tkb-print-section, #tkb-print-section * { visibility: visible; }
    
    #tkb-print-section { 
        position: absolute; 
        left: 0; top: 0; 
        width: 100%; 
        margin: 0; padding: 0; 
        box-shadow: none; 
        border: none;
    }
    
    .no-print, .ctvctt-sidebar, .ctvctt-header, #wpadminbar { display: none !important; }
}
/* Container phía dưới Sidebar */
.ctvctt-sidebar-user-light {
    padding-top: 11px;
    background: #ffffff; /* Nền trắng hoàn toàn */
    border-top: 1px solid #f1f5f9;
    margin-bottom: 11px;
}

/* Khối User dạng Pill trắng */
.user-pill-light {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    background: #f8fafc; /* Màu nền xám cực nhẹ */
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    gap: 10px;
}

/* Avatar xanh dịu */
.u-avatar-blue {
    width: 36px;
    height: 36px;
    background: #eff6ff;
    color: #3b82f6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

/* Thông tin chữ tối trên nền sáng */
.u-info-light {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.u-name-dark {
    color: #1e293b; /* Chữ xanh đen đậm */
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.u-role-gray {
    color: #64748b; /* Chữ xám */
    font-size: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: #22c55e; /* Chấm xanh lá cây */
    border-radius: 50%;
}

/* Nhóm nút bấm tinh tế */
.u-btns {
    display: flex;
    gap: 2px;
}
.u-btnsx {
    display: flex;
    gap: 4px;
    margin-top: 11px;
}   

.u-btns button {
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 28px;
    height: 28px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 11px;
}

.u-btns button:hover {
    background: #f1f5f9;
    color: #334155;
}

.u-btns button.u-logout:hover {
    background: #fef2f2;
    color: #ef4444;
}/* Style cho số nhóm ghép */
.badge-merge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background-color: #fef3c7; /* Vàng nhạt */
    color: #d97706;           /* Cam đậm */
    border: 1px solid #fcd34d;
    border-radius: 12px;      
    padding: 1px 6px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 5px;
    vertical-align: middle;
    cursor: help;
}
.badge-merge i { font-size: 10px; }
.batch-page {
    page-break-after: always; /* Quan trọng: Ngắt trang sau mỗi lớp */
    break-after: page;
    display: block;
    width: 100%;
    height: 100vh; /* Chiếm trọn 1 trang */
}
    
/* Ẩn trang trắng cuối cùng nếu có */
.batch-page:last-child {
    page-break-after: auto;
}
/* --- STYLE CHO HEADER SIDEBAR (NẰM NGANG) --- */
/* --- STYLE CHO HEADER SIDEBAR (LINK CHUNG) --- */
.ctvctt-brand {
    display: flex;
    flex-direction: row;       /* Xếp ngang */
    align-items: center;       /* Căn giữa dọc */
    justify-content: flex-start;   /* Căn giữa cụm này trong sidebar */
    gap: 8px;                  /* Khoảng cách giữa hình và chữ (đã thu nhỏ) */
    padding: 20px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    
    /* [QUAN TRỌNG] Reset style cho thẻ a */
    text-decoration: none !important; 
    color: #fff !important;           
    cursor: pointer;
    transition: background 0.2s;
}

/* Hiệu ứng khi di chuột vào cả cụm */
.ctvctt-brand:hover {
    background: rgba(255, 255, 255, 0.05); /* Sáng nền lên 1 chút */
}

/* Logo */
.ctvctt-brand .brand-logo img {
    width: 38px;       /* Kích thước logo nhỏ gọn */
    height: auto;
    display: block;
}

/* Chữ tiêu đề */
.ctvctt-brand span {
    display: block;
    font-size: 14px;               
    text-transform: uppercase;
    text-align: left;         /* Canh lề trái để dính vào logo */
    line-height: 1.2;         
    letter-spacing: 0.5px;
}
/* --- SIDEBAR HEADER (NẰM NGANG + LINK CHUNG) --- */
.ctvctt-brand {
    display: flex !important;
    flex-direction: row !important; /* Xếp ngang */
    align-items: center !important; /* Căn giữa dọc */
    justify-content: center;
    gap: 10px;                      /* Khoảng cách giữa Logo và Chữ */
    padding: 15px 10px;
    background: rgba(0,0,0,0.1);    /* Nền tối nhẹ để tách biệt */
    text-decoration: none !important; /* Bỏ gạch chân link */
    color: #fff !important;           /* Màu chữ trắng */
    transition: background 0.3s;
}

.ctvctt-brand:hover {
    background: rgba(255,255,255,0.1); /* Hiệu ứng hover */
}

/* Logo */
.ctvctt-brand .brand-logo img {
    width: 40px;  /* Kích thước logo vừa vặn */
    height: auto;
    display: block;
}

/* Chữ tiêu đề */
.ctvctt-brand span {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    text-align: left; /* Canh trái để dính vào logo */
    line-height: 1.2; /* Khoảng cách dòng hẹp lại */
    color: #fff;
}
/* ==========================================================================
   STYLE KHÓA LỊCH SỬ (BẢO VỆ TUẦN QUÁ KHỨ) - "BÀN TAY SẮT"
   ========================================================================== */

/* 1. O CHECKBOX TUẦN QUÁ KHỨ (Cấm chạm) */
.week-label.week-past-locked {
    background-color: #e2e8f0 !important; /* Màu xám chết */
    color: #94a3b8 !important;            /* Chữ mờ */
    border: 1px solid #cbd5e1 !important;
    cursor: not-allowed !important;
    opacity: 1 !important; /* Giữ độ rõ để người dùng đọc được số tuần */
    pointer-events: none !important; /* CHẶN CLICK TUYỆT ĐỐI TỪ CSS */
    position: relative;
}

/* Ẩn checkbox thật nhưng giữ lại để form lấy value */
.week-label.week-past-locked input[type="checkbox"] {
    opacity: 0.5;
}

/* Icon khóa khi hover */
.week-label.week-past-locked::after {
    content: "\f023"; /* Icon khóa FontAwesome */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 10px;
    margin-left: 4px;
    color: #ef4444; 
    display: inline-block;
}

/* 2. CARD CẤU HÌNH BỊ KHÓA (Khi có chứa lịch sử) */
.config-card.locked-history {
    background-color: #fff1f2 !important; /* Nền hồng rất nhạt cảnh báo */
    border-left: 4px solid #be123c !important; /* Viền trái đỏ đậm */
    opacity: 1 !important; 
    pointer-events: auto !important; /* Vẫn cho phép thao tác phần tương lai nếu có */
}

/* Ẩn nút Xóa (Dấu X) trên Card khóa */
.config-card.locked-history .btn-remove-card {
    display: none !important;
}

/* Khóa Dropdown chọn phòng của Card khóa */
/* (Chỉ cho xem, không cho đổi phòng nếu đã chốt lịch sử) */
.config-card.locked-history select.select-phong-card {
    background-color: #f1f5f9 !important;
    color: #64748b !important;
    pointer-events: none !important; /* Chặn click */
    border-color: #e2e8f0 !important;
    cursor: not-allowed !important;
}

/* Ẩn nút tự động điền trong Card khóa */
.config-card.locked-history .auto-fill-box,
.config-card.locked-history .week-chk-group a {
    display: none !important;
}

/* Thêm dòng chữ thông báo vào Header của Card */
.config-card.locked-history h6::after {
    content: " (🔒 Đã có lịch sử)";
    font-size: 11px;
    color: #be123c;
    font-weight: normal;
    font-style: italic;
    margin-left: 5px;
    display: inline-block;
}

/* ==========================================================================
   1. RESPONSIVE & MOBILE OPTIMIZATION
   ========================================================================== */

/* Reset cỡ chữ cơ bản cho toàn bộ ứng dụng */
body {
    font-size: 14px; /* Chuẩn web, không dùng biến text large */
    line-height: 1.5;
    color: #334155;
}

/* Container chính linh hoạt */
.ctvctt-wrapper {
    display: flex;
    flex-direction: row; /* Mặc định ngang */
    width: 100%;
    overflow-x: hidden;
}

/* Trên Mobile (< 768px) */
@media (max-width: 768px) {
    .ctvctt-wrapper {
        flex-direction: column; /* Chuyển thành dọc */
    }

    .ctvctt-sidebar {
        width: 100% !important;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #334155;
    }

    .ctvctt-main-content {
        width: 100%;
        height: auto;
        overflow-y: visible;
    }

    /* Các lưới (Grid) chuyển thành 1 cột */
    .ctvctt-flex-row, .form-grid, .dash-filter-grid, .stats-grid {
        display: block !important;
    }

    .ctvctt-col-left, .ctvctt-col-right {
        width: 100% !important;
        padding: 0 !important;
        margin-bottom: 20px;
    }

    /* Bảng dữ liệu có thanh cuộn ngang */
    .ctvctt-table-responsive, .table-responsive-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        display: block;
    }

    /* Giảm padding card */
    .ctvctt-card {
        padding: 15px !important;
    }
}

/* ==========================================================================
   2. FIX FONT SIZE LỚN
   ========================================================================== */
.ctvctt-input, .ctvctt-btn-modern, .ctvctt-table th, .ctvctt-table td {
    font-size: 13px !important; /* Ép cỡ chữ nhỏ gọn */
}

h3 { font-size: 18px !important; }
h4 { font-size: 16px !important; }
h5 { font-size: 15px !important; }
h6 { font-size: 14px !important; }

/* ==========================================================================
   3. STYLE NÚT IN MỚI (NHÓM NÚT)
   ========================================================================== */
.print-toolbar {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
    background: #f1f5f9;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.btn-print-group {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    text-align: center;
}

.btn-print-group:hover:not(:disabled) {
    border-color: #2563eb;
    background: #eff6ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.btn-print-group i {
    font-size: 24px;
    margin-bottom: 8px;
    color: #475569;
}

.btn-print-group.active i { color: #2563eb; }
.btn-print-group strong { display: block; font-size: 14px; color: #1e293b; }
.btn-print-group span { font-size: 11px; color: #64748b; }
/* ==========================================================================
   GIAO DIỆN IN ẤN & EXCEL (MODERN UI V2)
   ========================================================================== */

/* 1. KHUNG LƯỚI CHỨA NÚT */
.print-toolbar-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Chia cột tự động, tối thiểu 250px */
    gap: 20px; /* Khoảng cách giữa các ô */
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed #cbd5e1;
}

/* 2. STYLE CHO NÚT IN DẠNG THẺ (CARD BUTTON) */
.btn-print-large {
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    padding: 20px !important;
    background-color: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-left: 4px solid #cbd5e1 !important; /* Viền trái làm điểm nhấn */
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    min-height: 90px; /* Chiều cao cố định cho đều */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    text-align: left;
    position: relative;
    overflow: hidden;
}

/* Icon trong nút */
.btn-print-large i {
    font-size: 32px !important;
    margin-right: 18px;
    width: 40px;
    text-align: center;
    transition: transform 0.3s ease;
}

/* Phần nội dung chữ */
.btn-print-large div {
    display: flex;
    flex-direction: column;
}

.btn-print-large strong {
    font-size: 14px !important;
    color: #334155;
    font-weight: 700;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-print-large small {
    font-size: 12px !important;
    color: #94a3b8;
    font-weight: 500;
}

/* --- TRẠNG THÁI ACTIVE (HOVER & ENABLED) --- */
.btn-print-large:not(:disabled):hover {
    transform: translateY(-5px); /* Nổi lên */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Màu sắc riêng cho từng loại nút khi Active */
/* Nút Lớp */
.btn-print-large.btn-lop:not(:disabled) { border-left-color: #2563eb !important; }
.btn-print-large.btn-lop:not(:disabled) i { color: #2563eb; }

/* Nút Giảng viên */
.btn-print-large.btn-gv:not(:disabled) { border-left-color: #059669 !important; }
.btn-print-large.btn-gv:not(:disabled) i { color: #059669; }

/* Nút Excel */
.btn-print-large.btn-excel:not(:disabled) { border-left-color: #16a34a !important; }
.btn-print-large.btn-excel:not(:disabled) i { color: #16a34a; }

/* --- TRẠNG THÁI DISABLED (KHÓA) --- */
.btn-print-large:disabled {
    background-color: #f8fafc !important; /* Xám rất nhạt */
    border-color: #f1f5f9 !important;
    border-left-color: #e2e8f0 !important;
    opacity: 0.6; /* Mờ đi thôi chứ không xám xịt */
    cursor: not-allowed;
    filter: grayscale(100%); /* Chuyển icon sang đen trắng */
}

/* 3. STYLE CHO KHU VỰC IN LẺ (GRID) */
.single-print-area {
    display: grid;
    grid-template-columns: 2fr 2fr 1.5fr; /* Chia tỉ lệ: Tuần - Lớp - Nút */
    gap: 15px;
    align-items: end; /* Căn đáy để input và button bằng nhau */
}
/* Mobile cho khu vực in lẻ */
@media (max-width: 768px) {
    .single-print-area {
        grid-template-columns: 1fr; /* 1 cột dọc */
    }
    .btn-print-large {
        min-height: auto;
        padding: 15px !important;
    }
}

/* Style lại các nút nhỏ (In tuần, In HK) */
.ctvctt-btn-modern {
    height: 42px; /* Cao bằng input */
    padding: 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    transition: all 0.2s;
}
.ctvctt-btn-modern i { font-size: 16px; }
/* ==========================================================================
   STYLE MỞ RỘNG CHO NÚT IN (CARD STYLE)
   ========================================================================== */

/* Nút In PDF Tuần (Màu Xám Đậm/Xanh Đen) */
.btn-print-large.btn-pdf {
    border-left-color: #475569 !important;
}
.btn-print-large.btn-pdf i {
    color: #475569;
}
.btn-print-large.btn-pdf:not(:disabled):hover {
    background-color: #f8fafc !important;
    border-color: #475569 !important;
}

/* Nút Excel Học Kỳ (Màu Cam Đậm hoặc Xanh khác để phân biệt) */
.btn-print-large.btn-excel-sem {
    border-left-color: #ea580c !important; /* Màu cam cháy */
}
.btn-print-large.btn-excel-sem i {
    color: #ea580c;
}

/* Tinh chỉnh Grid cho khu vực input (Chọn Tuần/Lớp) */
.single-print-inputs {
    display: grid;
    grid-template-columns: 1fr 2fr; /* Cột lớp rộng gấp đôi cột tuần */
    gap: 20px;
    margin-bottom: 15px;
}

/* Mobile: Chuyển input thành 1 cột */
@media (max-width: 768px) {
    .single-print-inputs {
        grid-template-columns: 1fr;
    }
}
/* ==========================================================================
   MOBILE & RESPONSIVE (OFF-CANVAS MENU)
   ========================================================================== */

/* Nút Menu Mobile (Mặc định ẩn trên Desktop) */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    font-size: 24px;
    color: #334155;
    cursor: pointer;
    margin-right: 15px;
    padding: 5px;
}

/* Lớp phủ mờ khi mở menu (Mặc định ẩn) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9998; /* Nằm dưới Sidebar nhưng trên nội dung */
    backdrop-filter: blur(2px);
    transition: opacity 0.3s;
}

/* --- LOGIC RESPONSIVE CHO MOBILE (< 768px) --- */
@media (max-width: 768px) {
    /* 1. Hiển thị nút Menu */
    .mobile-menu-btn {
        display: block;
    }

    /* 2. Điều chỉnh Topbar */
    .ctvctt-topbar {
        padding: 0 15px; /* Giảm padding */
        justify-content: flex-start; /* Căn trái để chứa nút menu */
    }
    
    /* Đẩy User Info sang phải cùng */
    .ctvctt-topbar .user-info {
        margin-left: auto; 
    }
    
    /* Ẩn bớt text tiêu đề dài nếu cần */
    .topbar-title h2 {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px;
    }
    .topbar-title span { display: none; } /* Ẩn subtitle cho gọn */

    /* 3. SIDEBAR (DẠNG TRƯỢT - OFF CANVAS) */
    .ctvctt-sidebar {
        position: fixed;
        top: 0;
        left: -280px; /* Ẩn sang trái màn hình */
        width: 260px !important;
        height: 100%;
        z-index: 9999; /* Nổi lên trên cùng */
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 5px 0 15px rgba(0,0,0,0.1);
    }

    /* Class kích hoạt mở menu */
    .ctvctt-sidebar.active {
        left: 0;
    }

    /* 4. NỘI DUNG CHÍNH (FULL MÀN HÌNH) */
    .ctvctt-main-content {
        width: 100%;
        margin-left: 0; /* Không bị sidebar đẩy */
    }
    
    /* Fix padding body */
    .ctvctt-body {
        padding: 15px;
    }

    /* 5. CÁC THÀNH PHẦN KHÁC (Grid 1 cột) */
    .ctvctt-flex-row, .form-grid, .dash-filter-grid, .stats-grid, .print-toolbar-group, .single-print-inputs {
        display: grid !important;
        grid-template-columns: 1fr !important; /* Ép về 1 cột dọc */
        gap: 15px;
    }

    /* Fix các nút to */
    .btn-print-large {
        min-height: auto;
        padding: 15px !important;
    }

    /* Bảng có thanh cuộn */
    .ctvctt-table-responsive, .table-responsive-wrapper {
        overflow-x: auto;
        display: block;
        width: 100%;
    }
    
    /* Ẩn các chi tiết thừa trong bảng trên mobile */
    .ctvctt-table th, .ctvctt-table td {
        padding: 10px;
        font-size: 12px !important;
    }
}