@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@300;400;500;600;700&family=Lexend:wght@400;500;600;700&display=swap');

:root {
    --navy: #0f2744;
    --navy2: #1a3a5c;
    --blue: #1d6fbd;
    --blue-light: #e8f2fb;
    --gold: #e6a817;
    --gold-light: #fef6e4;
    --green: #0e8a5f;
    --green-light: #e4f5ee;
    --red: #c0392b;
    --red-light: #fdecea;
    --gray50: #f8fafc;
    --gray100: #f1f5f9;
    --gray200: #e2e8f0;
    --gray400: #94a3b8;
    --gray600: #475569;
    --gray800: #1e293b;
    --white: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --radius: 10px;
    --radius-sm: 6px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Be Vietnam Pro', sans-serif;
    background: var(--gray100);
    color: var(--gray800);
    font-size: 14px;
    line-height: 1.6;
}

/* ===== LAYOUT CHÍNH ===== */
.app-shell {
    display: flex;
    width: 100%;
    min-height: 100vh;
    background: var(--gray100);
}

.sidebar {
    width: 230px;
    background: var(--navy);
    color: white;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 200;
    flex-shrink: 0;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    overflow: hidden;
}

.topbar {
    background: white;
    border-bottom: 1px solid var(--gray200);
    padding: 0 28px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    z-index: 99;
    box-shadow: var(--shadow-sm);
}

.page-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
}

/* LAYOUT DASHBOARD 2 CỘT (1 trái to, 2 phải nhỏ) */
.dashboard-2col {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    align-items: start;
}

.dashboard-2col .card-nganh {
    grid-row: 1 / span 3;
    /* Kéo dài qua 3 hàng của cột bên phải */
}

/* ========================================== */
/* MOBILE SIDEBAR (Sửa triệt để lỗi xám/đè)   */
/* ========================================== */
@media (max-width: 768px) {

    /* 1. ÉP APP SHELL THÀNH BLOCK ĐỂ KHÔNG CÒN KHOẢNG TRỐNG */
    .app-shell {
        display: block !important;
        width: 100% !important;
    }

    /* 2. ĐƯA SIDEBAR LÊN TRỤC TỌA ĐỘ (NỔI BAY TRÊN MÀN HÌNH) */
    .sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 260px;
        /* Rộng 1 chút cho mobile */
        height: 100vh;
        transform: translateX(-100%);
        /* Ẩn hẳn sang trái */
        transition: transform 0.25s ease;
        z-index: 1050 !important;
        /* Z-index cao nhất, nằm trên lớp mờ */
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        /* Trượt vào khi bấm menu */
    }

    /* 3. ÉP MAIN-CONTENT CHIẾM TRỌN 100% MÀN HÌNH */
    .main-content {
        width: 100% !important;
        margin-left: 0 !important;
        flex: none !important;
        /* Hủy bỏ flex của desktop */
        display: block !important;
        height: auto !important;
        /* THÊM DÒNG NÀY */
        overflow: visible !important;
        /* THÊM DÒNG NÀY */
    }

    /* 4. LỚP MỜ (OVERLAY) NẰM DƯỚI SIDEBAR */
    .sidebar-overlay {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(15, 39, 68, 0.5);
        z-index: 1040 !important;
        /* Thấp hơn Sidebar (1050) */
        backdrop-filter: blur(2px);
        display: none;
    }

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

    /* 5. HIỆN NÚT MENU */
    #hamburger-btn {
        display: inline-flex !important;
        align-items: center;
    }

    /* 6. ĐỔI LAYOUT DASHBOARD VỀ 1 CỘT DỌC */
    .dashboard-2col {
        grid-template-columns: 1fr !important;
    }

    .dashboard-2col .card-nganh {
        grid-row: auto !important;
    }

    .topbar {
        padding: 0 16px;
    }

    .page-area {
        padding: 16px;
        overflow: visible !important;
        /* THÊM DÒNG NÀY */
        height: auto !important;
        /* THÊM DÒNG NÀY */
    }

    /* 7. THU NHỎ TIÊU ĐỀ VÀ ẨN TEXT NÚT BẤM TRÊN MOBILE */
    .topbar-title {
        font-size: 14px !important;
        max-width: 100px !important;
        /* Giới hạn chiều rộng để không tràn */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        /* Cắt chữ dài bằng dấu ... */
    }

    /* Ẩn chữ bên trong nút bấm, chỉ giữ lại icon */
    .topbar-right .btn-text {
        display: none !important;
    }

    /* Giảm padding của nút cho gọn trên mobile */
    .topbar-right .btn,
    .topbar-right button {
        padding: 5px 8px !important;
        font-size: 14px !important;
    }
}

/* ===== SIDEBAR ===== */
.sidebar-logo {
    padding: 20px 18px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-title {
    font-family: 'Lexend', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: white;
    line-height: 1.3;
}

.logo-sub {
    font-size: 11px;
    color: var(--gold);
    margin-top: 2px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-section {
    padding: 10px 18px 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.35);
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13.5px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: white;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    border-left-color: var(--gold);
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-mini {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.stat-mini-card {
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}

.stat-mini-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 2px;
}

.stat-mini-value {
    font-size: 18px;
    font-weight: 700;
    color: white;
    font-family: 'Lexend', sans-serif;
}

/* ===== TOPBAR ===== */
.page-title {
    font-family: 'Lexend', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--navy);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.save-indicator {
    font-size: 12px;
    color: var(--green);
}

/* ===== BAR CHART ===== */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bar-label {
    width: 150px;
    font-size: 12px;
    color: var(--gray600);
    text-align: right;
    flex-shrink: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bar-track {
    flex: 1;
    background: var(--gray200);
    border-radius: 4px;
    height: 24px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 700;
    color: white;
    transition: width 1s ease;
    min-width: 2px;
}

.bar-num {
    width: 90px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--navy);
    white-space: nowrap;
}

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray200);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-family: 'Lexend', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--navy);
}

.card-body {
    padding: 20px;
}

/* ===== FORMS ===== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group.span2 {
    grid-column: span 2;
}

.form-group.span3 {
    grid-column: span 3;
}

label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray600);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

input[type=text],
input[type=number],
input[type=email],
input[type=password],
select,
textarea {
    padding: 8px 11px;
    border: 1.5px solid var(--gray200);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: 'Be Vietnam Pro', sans-serif;
    color: var(--gray800);
    background: white;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}

input:focus,
select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(29, 111, 189, 0.12);
}

input[type=number] {
    appearance: textfield;
    -moz-appearance: textfield;
}

input[type=number]::-webkit-inner-spin-button {
    opacity: 1;
}

/* ===== PASSWORD INPUT WRAP (NÚT CON MẮT) ===== */
.pw-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.pw-input-wrap input {
    width: 100%;
    padding-right: 36px;
}

.pw-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--gray400);
    font-size: 15px;
    padding: 4px;
    line-height: 1;
    transition: color 0.15s;
    z-index: 2;
}

.pw-toggle:hover {
    color: var(--navy);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Be Vietnam Pro', sans-serif;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--navy);
    color: white;
}

.btn-primary:hover {
    background: var(--navy2);
}

.btn-blue {
    background: var(--blue);
    color: white;
}

.btn-blue:hover {
    background: #1660a8;
}

.btn-success {
    background: var(--green);
    color: white;
}

.btn-success:hover {
    background: #0a7350;
}

.btn-gold {
    background: var(--gold);
    color: white;
}

.btn-gold:hover {
    background: #d09710;
}

.btn-danger {
    background: var(--red);
    color: white;
}

.btn-danger:hover {
    background: #a93226;
}

.btn-ghost {
    background: transparent;
    color: var(--gray600);
    border: 1.5px solid var(--gray200);
}

.btn-ghost:hover {
    background: var(--gray100);
    border-color: var(--gray400);
}

.btn-sm {
    padding: 5px 11px;
    font-size: 12px;
}

.btn-xs {
    padding: 3px 9px;
    font-size: 11px;
}

.btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 16px;
}

/* ===== TABLE ===== */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--navy);
    background: white;
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

/* Tiêu đề bảng (th) - Nền Navy, chữ trắng */
thead tr {
    background: var(--navy);
}

th {
    padding: 12px 12px;
    text-align: left;
    font-size: 11.5px;
    font-weight: 700;
    color: white;
    /* Chữ trắng tương phản nền Navy */
    letter-spacing: 0.4px;
    text-transform: uppercase;
    white-space: nowrap;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    /* Viền phân cách cột */
}

th:last-child {
    border-right: none;
}

/* Nội dung bảng (td) */
td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray200);
    border-right: 1px solid var(--gray200);
    /* Thêm viền phải cho dễ nhìn cột */
    color: var(--gray800);
    vertical-align: middle;
}

td:last-child {
    border-right: none;
}

tr:last-child td {
    border-bottom: none;
}

/* Hiệu ứng Hover (Chuột qua) */
tbody tr:hover td {
    background: var(--blue-light);
}

/* Số căn lề phải */
.tnum {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--navy);
    text-align: right;
}

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: var(--green-light);
    color: var(--green);
}

.badge-danger {
    background: var(--red-light);
    color: var(--red);
}

.badge-warning {
    background: var(--gold-light);
    color: #9a6e00;
}

.badge-info {
    background: var(--blue-light);
    color: var(--blue);
}

.badge-gray {
    background: var(--gray100);
    color: var(--gray600);
}

.badge-navy {
    background: #e8edf5;
    color: var(--navy);
}

/* ===== ALERT ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 16px;
}

.alert-success {
    background: var(--green-light);
    color: var(--green);
    border-left: 4px solid var(--green);
}

.alert-warning {
    background: var(--gold-light);
    color: #8a6000;
    border-left: 4px solid var(--gold);
}

.alert-info {
    background: var(--blue-light);
    color: var(--blue);
    border-left: 4px solid var(--blue);
}

.alert-danger {
    background: var(--red-light);
    color: var(--red);
    border-left: 4px solid var(--red);
}

/* ===== TABS ===== */
.subtabs {
    display: flex;
    border-bottom: 2px solid var(--gray200);
    margin-bottom: 20px;
    gap: 0;
}

.subtab {
    padding: 9px 18px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--gray600);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

.subtab:hover {
    color: var(--navy);
}

.subtab.active {
    color: var(--navy);
    border-bottom-color: var(--blue);
    font-weight: 600;
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray200);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray400);
    font-weight: 600;
    margin-bottom: 6px;
}

.stat-value {
    font-family: 'Lexend', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--navy);
    line-height: 1;
}

.stat-sub {
    font-size: 11.5px;
    color: var(--gray400);
    margin-top: 4px;
}

/* ===== UPLOAD ZONE ===== */
.upload-zone {
    border: 2px dashed var(--gray200);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--gray50);
}

.upload-zone:hover {
    border-color: var(--blue);
    background: var(--blue-light);
}

.upload-zone.dragover {
    border-color: var(--blue);
    background: var(--blue-light);
}

.upload-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.upload-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 5px;
}

.upload-sub {
    font-size: 13px;
    color: var(--gray400);
}

/* ===== SCORE SECTION ===== */
.score-section {
    background: var(--gray50);
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray200);
    padding: 14px 16px;
    margin-bottom: 12px;
}

.score-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray600);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.score-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray200);
}

/* ===== KET QUA BOX ===== */
.kq-box {
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 16px;
}

.kq-box.pass {
    background: linear-gradient(135deg, #e4f5ee 0%, #f0faf5 100%);
    border: 1.5px solid #a3d9c0;
}

.kq-box.fail {
    background: linear-gradient(135deg, #fdecea 0%, #fef5f5 100%);
    border: 1.5px solid #f0b8b2;
}

.kq-box.pending {
    background: var(--gray100);
    border: 1.5px solid var(--gray200);
}



/* ===== MISC ===== */
.flex {
    display: flex;
    align-items: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-16 {
    margin-top: 16px;
}

.text-muted {
    color: var(--gray400);
    font-size: 12.5px;
}

.section-gap {
    margin-bottom: 20px;
}

.page-section {
    display: none;
}

.page-section.active {
    display: block;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.three-col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.highlight {
    background: #fff9e6;
}

.monospace {
    font-family: monospace;
}

input[type=file] {
    display: none;
}

.tohop-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: var(--blue-light);
    color: var(--blue);
    margin: 2px;
}

.nv-rank-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--navy);
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    background: var(--gray100);
    color: var(--gray600);
}

.diem-box {
    background: white;
    border: 1px solid var(--gray200);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    min-width: 64px;
}

.diem-box-label {
    font-size: 10px;
    color: var(--gray400);
}

.diem-box-val {
    font-size: 17px;
    font-weight: 700;
    color: var(--navy);
    font-family: 'Lexend', sans-serif;
}

.import-template-link {
    color: var(--blue);
    text-decoration: underline;
    cursor: pointer;
    font-size: 13px;
}

/* SCROLLBAR */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray200);
    border-radius: 3px;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    border-top: 1px solid var(--gray200);
    flex-wrap: wrap;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--gray200);
    background: white;
    color: var(--gray600);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.12s;
    font-family: 'Be Vietnam Pro', sans-serif;
}

.page-btn:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.page-btn.active {
    background: var(--navy);
    border-color: var(--navy);
    color: white;
    font-weight: 700;
}

.page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.page-info {
    font-size: 12.5px;
    color: var(--gray400);
    margin-left: 8px;
}

.page-size-sel {
    padding: 4px 8px;
    border: 1.5px solid var(--gray200);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--gray600);
}

/* ===== WORKER SPINNER ===== */
.worker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 39, 68, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.worker-box {
    background: white;
    border-radius: var(--radius);
    padding: 32px 40px;
    text-align: center;
    box-shadow: var(--shadow-md);
    min-width: 280px;
}

.worker-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--gray200);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.worker-title {
    font-family: 'Lexend', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 6px;
}

.worker-sub {
    font-size: 13px;
    color: var(--gray400);
}

.worker-progress {
    margin-top: 14px;
    background: var(--gray200);
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
}

.worker-progress-bar {
    height: 100%;
    background: var(--blue);
    border-radius: 4px;
    transition: width 0.3s;
}

/* ===== IDB STATUS ===== */
.idb-status {
    font-size: 11px;
    color: var(--gray400);
    display: flex;
    align-items: center;
    gap: 4px;
}

.idb-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
}

.idb-dot.error {
    background: var(--red);
}

.idb-dot.loading {
    background: var(--gold);
    animation: pulse 1s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: 0.4
    }
}

/* ===== SESSION (DOT XET TUYEN) ===== */
.session-bar {
    background: rgba(255, 255, 255, 0.07);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 14px;
}

.session-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 5px;
    font-weight: 600;
}

.session-current {
    display: flex;
    align-items: center;
    gap: 6px;
}

.session-name {
    font-size: 13px;
    font-weight: 600;
    color: white;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.session-badge {
    font-size: 10px;
    background: var(--gold);
    color: white;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

.session-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.8);
    border-radius: 5px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    font-family: 'Be Vietnam Pro', sans-serif;
    transition: all 0.15s;
    white-space: nowrap;
}

.session-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 39, 68, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 8000;
    backdrop-filter: blur(3px);
}

.modal-box {
    background: white;
    border-radius: var(--radius);
    width: 580px;
    max-width: 95vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--gray200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-title {
    font-family: 'Lexend', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--navy);
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--gray400);
    padding: 0 4px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--red);
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--gray200);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-shrink: 0;
}

.sess-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.sess-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border: 1.5px solid var(--gray200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    background: white;
}

.sess-item:hover {
    border-color: var(--blue);
    background: var(--blue-light);
}

.sess-item.active-sess {
    border-color: var(--blue);
    background: var(--blue-light);
}

.sess-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.sess-info {
    flex: 1;
    min-width: 0;
}

.sess-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--navy);
}

.sess-meta {
    font-size: 11.5px;
    color: var(--gray400);
    margin-top: 2px;
}

.sess-stats {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.sess-stat {
    text-align: center;
}

.sess-stat-v {
    font-size: 14px;
    font-weight: 700;
    color: var(--navy);
    font-family: 'Lexend', sans-serif;
}

.sess-stat-l {
    font-size: 10px;
    color: var(--gray400);
}

.sess-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.new-sess-form {
    background: var(--gray50);
    border: 1.5px dashed var(--gray200);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-top: 4px;
}

.new-sess-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* ===== TIÊU CHÍ PHỤ ===== */
.tcp-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.tcp-gv {
    background: #fef3f2;
    color: #c0392b;
    border: 1px solid #f5c6c2;
}

.tcp-gvtc {
    background: #fff8e6;
    color: #9a6e00;
    border: 1px solid #f5dfa0;
}

.tcp-nk {
    background: #f0f0ff;
    color: #5b4fcc;
    border: 1px solid #c7c3f0;
}

.tcp-none {
    background: var(--gray100);
    color: var(--gray400);
    border: 1px solid var(--gray200);
}

.tcp-form-section {
    background: var(--gray50);
    border: 1.5px solid var(--gray200);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-top: 14px;
}

.tcp-form-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tcp-form-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray200);
}

.tcp-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray200);
    flex-wrap: wrap;
}

.tcp-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.nd-subtab {
    display: none;
}

.nv-subtab {
    display: none;
}

/* ====== ROLE SYSTEM ====== */
.role-locked {
    position: relative;
    pointer-events: none;
    user-select: none;
}

.role-locked::after {
    content: '🔒';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    border-radius: inherit;
    z-index: 10;
    backdrop-filter: blur(1px);
}

.role-btn-locked {
    opacity: 0.35 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
}

.nav-item.role-view-only {
    opacity: 0.6;
}

.nav-item.role-view-only::after {
    content: ' 👁';
    font-size: 10px;
}

#role-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.07);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.15s;
}

#role-badge:hover {
    background: rgba(255, 255, 255, 0.14);
    color: white;
}

#role-badge .role-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

#role-badge .role-dot.guest {
    background: #94a3b8;
}

#role-badge .role-dot.nhaplieu {
    background: #f59e0b;
}

#role-badge .role-dot.xettuyen {
    background: #3b82f6;
}

#role-badge .role-dot.admin {
    background: #10b981;
}

#role-modal .role-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    border: 2px solid var(--gray200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.18s;
}

#role-modal .role-card:hover {
    border-color: var(--blue);
    background: var(--blue-light);
}

#role-modal .role-card.selected {
    border-color: var(--blue);
    background: var(--blue-light);
}

#role-modal .role-card-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 8px;
}

#role-modal .role-card-desc {
    font-size: 12.5px;
    color: var(--gray400);
    line-height: 1.5;
}

#role-modal .role-card-perms {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}

#role-modal .perm-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

#role-modal .perm-full {
    background: #d1fae5;
    color: #065f46;
}

#role-modal .perm-view {
    background: #e2e8f0;
    color: #475569;
}

#role-modal .perm-none {
    background: #fee2e2;
    color: #991b1b;
}

.view-only-banner {
    display: none;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    gap: 7px;
    align-items: center;
}

/* Converter scoped styles */
.cvt-card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray200);
    box-shadow: var(--shadow-sm);
    margin-bottom: 18px;
}

.cvt-card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--gray200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.cvt-card-title {
    font-family: 'Lexend', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--navy);
}

.cvt-card-body {
    padding: 18px;
}

.cvt-steps {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin-bottom: 22px;
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray200);
    overflow: hidden;
}

.cvt-step {
    flex: 1;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    position: relative;
    transition: background 0.15s;
}

.cvt-step:not(:last-child)::after {
    content: '›';
    position: absolute;
    right: -7px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray400);
    font-size: 17px;
    z-index: 1;
    pointer-events: none;
}

.cvt-step.active {
    background: var(--blue-light);
}

.cvt-step.done {
    background: var(--green-light);
}

.cvt-step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gray200);
    color: var(--gray600);
    font-size: 11.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cvt-step.active .cvt-step-num {
    background: var(--blue);
    color: white;
}

.cvt-step.done .cvt-step-num {
    background: var(--green);
    color: white;
}

.cvt-step-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--gray600);
}

.cvt-step.active .cvt-step-label {
    color: var(--navy);
}

.cvt-step.done .cvt-step-label {
    color: var(--green);
}

.cvt-upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width:700px) {
    .cvt-upload-grid {
        grid-template-columns: 1fr;
    }
}

.cvt-uz {
    border: 2px dashed var(--gray200);
    border-radius: var(--radius);
    padding: 22px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--gray50);
    position: relative;
}

.cvt-uz:hover,
.cvt-uz.dragover {
    border-color: var(--blue);
    background: var(--blue-light);
}

.cvt-uz.loaded {
    border-color: var(--green);
    background: var(--green-light);
    border-style: solid;
}

.cvt-uz.err {
    border-color: var(--red);
    background: var(--red-light);
    border-style: solid;
}

.cvt-uz-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.cvt-uz-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 3px;
}

.cvt-uz-sub {
    font-size: 11.5px;
    color: var(--gray400);
    line-height: 1.5;
}

.cvt-uz-clear {
    position: absolute;
    top: 7px;
    right: 7px;
    background: var(--red);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    line-height: 1;
}

.cvt-uz.loaded .cvt-uz-clear {
    display: flex;
}

/* Converter Mapper Grid (4 môn 1 hàng) */
.cvt-mapper-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.cvt-mapper-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cvt-mapper-label {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--gray600);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cvt-mapper-sel {
    padding: 6px 8px;
    border: 1.5px solid var(--gray200);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: 'Be Vietnam Pro', sans-serif;
    color: var(--gray800);
    background: white;
    width: 100%;
    cursor: pointer;
}

.cvt-mapper-sel:focus {
    border-color: var(--blue);
    outline: none;
}

.cvt-mapper-sel.mapped {
    border-color: var(--green);
    background: #f0faf5;
}

.cvt-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray600);
    margin: 14px 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cvt-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray200);
}

.cvt-lop-tabs {
    display: flex;
    border-bottom: 2px solid var(--gray200);
    margin-bottom: 14px;
}

.cvt-lop-tab {
    padding: 7px 16px;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--gray600);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.cvt-lop-tab.active {
    color: var(--navy);
    border-bottom-color: var(--blue);
    font-weight: 700;
}

.cvt-preview-wrap {
    overflow-x: auto;
    border: 1px solid var(--gray200);
    border-radius: var(--radius-sm);
    max-height: 200px;
    overflow-y: auto;
}

.cvt-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 11.5px;
}

.cvt-tbl thead tr {
    background: var(--navy);
    position: sticky;
    top: 0;
    z-index: 2;
}

.cvt-tbl th {
    padding: 7px 9px;
    text-align: left;
    color: rgba(255, 255, 255, .85);
    font-size: 10.5px;
    font-weight: 600;
    white-space: nowrap;
}

.cvt-tbl td {
    padding: 6px 9px;
    border-bottom: 1px solid var(--gray200);
    white-space: nowrap;
}

.cvt-tbl tr:last-child td {
    border-bottom: none;
}

.cvt-tbl tbody tr:hover td {
    background: var(--gray50);
}

.cvt-stat-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.cvt-stat {
    background: var(--gray50);
    border: 1px solid var(--gray200);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    text-align: center;
    flex: 1;
    min-width: 90px;
}

.cvt-stat-val {
    font-family: 'Lexend', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--navy);
}

.cvt-stat-lbl {
    font-size: 10.5px;
    color: var(--gray400);
    margin-top: 2px;
}

.cvt-log {
    background: var(--gray800);
    color: #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-family: monospace;
    font-size: 11.5px;
    max-height: 160px;
    overflow-y: auto;
    line-height: 1.8;
    margin-top: 10px;
}

.cvt-log-ok {
    color: #6ee7b7;
}

.cvt-log-warn {
    color: #fcd34d;
}

.cvt-log-err {
    color: #fca5a5;
}

.cvt-page-sec {
    display: none;
}

.cvt-page-sec.active {
    display: block;
}

.cvt-btn-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 16px;
}

.tk-subtab {
    display: none;
}

.tk-subtab:first-of-type {
    display: block;
}

/* ===== APP FOOTER ===== */
.app-footer {
    text-align: center;
    padding: 14px;
    font-size: 10px;
    font-style: italic;
    color: var(--gray400);
    border-top: 1px solid var(--gray200);
    margin-top: 20px;
    background: white;
}

.app-footer a {
    color: var(--blue);
    text-decoration: none;
    font-weight: 600;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* UI TỔ HỢP MÔN (CHIP GRID) */
#tohop-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    padding: 14px;
    border: 1.5px solid var(--gray200);
    border-radius: var(--radius-sm);
    background: var(--gray50);
}

.tohop-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1.5px solid var(--gray200);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 12.5px;
    user-select: none;
}

.tohop-chip:hover {
    border-color: var(--blue);
    background: var(--blue-light);
}

.tohop-chip input[type=checkbox] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--navy);
}

.tohop-chip input:checked+span {
    color: var(--navy);
    font-weight: 700;
}

/* Multi-select Dropdown */
.ms-container {
    position: relative;
    width: 100%;
}

.ms-box {
    min-height: 42px;
    border: 1.5px solid var(--gray200);
    border-radius: var(--radius-sm);
    padding: 6px 30px 6px 8px;
    cursor: pointer;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    background: white;
    transition: border-color 0.15s;
}

.ms-box:hover {
    border-color: var(--blue);
}

.ms-placeholder {
    color: var(--gray400);
    font-size: 13.5px;
}

.ms-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
}

.ms-tag {
    background: var(--blue-light);
    color: var(--blue);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
}

.ms-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray400);
    font-size: 10px;
    pointer-events: none;
}

.ms-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10;
    background: white;
    border: 1.5px solid var(--blue);
    border-radius: var(--radius-sm);
    margin-top: 4px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.ms-search {
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-bottom: 1px solid var(--gray200);
    outline: none;
    font-size: 13px;
    font-family: 'Be Vietnam Pro', sans-serif;
}

.ms-list {
    max-height: 250px;
    overflow-y: auto;
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

/* Fix Flatpickr Header Layout Override */
.flatpickr-current-month {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 4px 0 !important;
}

.flatpickr-monthDropdown-months {
    width: auto !important;
    margin: 0 !important;
    font-size: 16px !important;
    appearance: menulist !important; /* Force dropdown arrow */
    padding: 2px 6px !important;
    border: 1px solid var(--gray200) !important;
    border-radius: 4px !important;
    background: white !important;
    height: 30px !important;
}

.flatpickr-current-month .numInputWrapper {
    width: 75px !important;
}

.flatpickr-current-month .numInputWrapper input.cur-year {
    font-size: 16px !important;
    padding: 2px 6px !important;
    border: 1px solid var(--gray200) !important;
    border-radius: 4px !important;
    background: white !important;
    height: 30px !important;
    margin: 0 !important;
}