:root {
            --primary: #1E40AF;
            --primary-light: #2563EB;
            --accent: #059669;
            --warning: #D97706;
            --danger: #DC2626;
            --bg-body: #F1F5F9;
            --border: #CBD5E1;
            --text-dark: #0F172A;
            --text-muted: #475569;
        }
        * { box-sizing: border-box; }
        body {
            font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
            background: var(--bg-body);
            color: var(--text-dark);
            margin: 0;
            padding: 0;
            line-height: 1.5;
        }
        .main-wrapper {
            max-width: 1420px;
            margin: 20px auto;
            padding: 0 18px 40px 18px;
        }
        .top-banner {
            background: linear-gradient(135deg, #1E3A8A 0%, #0F172A 100%);
            color: #FFFFFF;
            padding: 22px 26px;
            border-radius: 14px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 16px;
            margin-bottom: 20px;
            box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
        }
        .top-banner h1 {
            margin: 0 0 4px 0;
            font-size: 1.45rem;
            text-transform: uppercase;
        }
        .top-banner p {
            margin: 0;
            color: #DBEAFE;
            font-size: 0.92rem;
        }
        .nav-tabs {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            margin-bottom: 20px;
        }
        .nav-tab-btn {
            padding: 11px 18px;
            border-radius: 10px;
            border: 1.5px solid var(--border);
            background: #FFFFFF;
            color: var(--text-dark);
            font-weight: 700;
            font-size: 0.95rem;
            cursor: pointer;
            transition: all 0.2s;
        }
        .nav-tab-btn.active {
            background: var(--primary);
            color: #FFFFFF;
            border-color: var(--primary);
            box-shadow: 0 4px 12px rgba(30, 64, 175, 0.25);
        }

        /* Thẻ thống kê nhanh */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
            gap: 14px;
            margin-bottom: 20px;
        }
        .stat-card {
            background: #FFFFFF;
            border-radius: 12px;
            padding: 16px 18px;
            border: 1px solid #E2E8F0;
            border-left: 5px solid var(--primary);
            box-shadow: 0 2px 8px rgba(0,0,0,0.04);
        }
        .stat-card .stat-title {
            font-size: 0.85rem;
            color: var(--text-muted);
            font-weight: 600;
            text-transform: uppercase;
        }
        .stat-card .stat-value {
            font-size: 1.7rem;
            font-weight: 800;
            color: var(--text-dark);
            margin-top: 4px;
        }

        /* BỐ CỤC CHIA ĐÔI MÀN HÌNH CHẤM BÀI THỰC HÀNH (SPLIT-SCREEN GRADER) */
        .split-grader {
            display: grid;
            grid-template-columns: 1.15fr 1fr;
            gap: 18px;
            align-items: start;
        }
        @media (max-width: 1024px) {
            .split-grader { grid-template-columns: 1fr; }
        }
        .panel-card {
            background: #FFFFFF;
            border-radius: 14px;
            padding: 20px;
            border: 1px solid #E2E8F0;
            box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
        }
        .panel-card h2 {
            margin: 0 0 14px 0;
            font-size: 1.15rem;
            color: var(--primary);
            border-bottom: 2px solid #EFF6FF;
            padding-bottom: 8px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .filter-bar {
            display: grid;
            grid-template-columns: 1fr 1.4fr auto auto;
            gap: 10px;
            margin-bottom: 14px;
        }
        @media (max-width: 680px) {
            .filter-bar { grid-template-columns: 1fr; }
        }
        .filter-bar select,
        .filter-bar input {
            padding: 9px 12px;
            border: 1.5px solid var(--border);
            border-radius: 8px;
            font-size: 0.92rem;
        }
        .btn-action {
            padding: 9px 14px;
            border-radius: 8px;
            border: none;
            font-weight: 700;
            font-size: 0.9rem;
            cursor: pointer;
            background: var(--primary-light);
            color: #FFFFFF;
        }
        .submission-table-wrap {
            max-height: 540px;
            overflow-y: auto;
            border: 1px solid #E2E8F0;
            border-radius: 8px;
        }
        table.sub-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.89rem;
        }
        table.sub-table th,
        table.sub-table td {
            padding: 10px 10px;
            border-bottom: 1px solid #E2E8F0;
            text-align: left;
        }
        table.sub-table th {
            background: #F8FAFC;
            position: sticky;
            top: 0;
            z-index: 2;
            color: #334155;
            font-weight: 700;
        }
        table.sub-table tr:hover {
            background: #EFF6FF;
            cursor: pointer;
        }
        table.sub-table tr.selected-row {
            background: #DBEAFE !important;
        }
        .badge-graded {
            background: #ECFDF5;
            color: #065F46;
            padding: 3px 8px;
            border-radius: 6px;
            font-weight: 700;
            font-size: 0.82rem;
            border: 1px solid #A7F3D0;
        }
        .badge-pending {
            background: #FEF3C7;
            color: #B45309;
            padding: 3px 8px;
            border-radius: 6px;
            font-weight: 700;
            font-size: 0.82rem;
            border: 1px solid #FDE68A;
        }
        .preview-iframe-box {
            width: 100%;
            height: 330px;
            border: 1.5px solid #CBD5E1;
            border-radius: 10px;
            background: #0F172A;
            margin-bottom: 14px;
            overflow: hidden;
            position: relative;
        }
        .preview-iframe-box iframe {
            width: 100%;
            height: 100%;
            border: none;
            background: #FFFFFF;
        }
        .quick-score-chips {
            display: flex;
            gap: 6px;
            flex-wrap: wrap;
            margin: 6px 0 12px 0;
        }
        .score-chip {
            padding: 5px 10px;
            background: #F1F5F9;
            border: 1px solid #CBD5E1;
            border-radius: 6px;
            font-weight: 700;
            font-size: 0.85rem;
            cursor: pointer;
        }
        .score-chip:hover {
            background: #DBEAFE;
            border-color: #2563EB;
            color: #1E40AF;
        }

        /* NÂNG CẤP: Cố định khung chấm điểm bên phải khi cuộn & Cho phép kéo giãn chiều cao khung xem trước */
        @media (min-width: 1025px) {
            .split-grader > .panel-card:last-child {
                position: sticky;
                top: 58px;
            }
        }
        .preview-iframe-box {
            height: 420px;
            min-height: 260px;
            max-height: 78vh;
            resize: vertical;
        }
        @media (max-width: 640px) {
            .main-wrapper { padding: 0 10px 28px 10px; }
            .top-banner { padding: 16px; }
            .top-banner h1 { font-size: 1.2rem; }
            .panel-card { padding: 14px; }
        }

/* Co giãn tự động cỡ chữ tiêu đề trên mọi màn hình */
h1, .school-info h1, .top-banner h1 { font-size: clamp(1.12rem, 3.5vw, 1.55rem) !important; line-height: 1.35 !important; }
h2 { font-size: clamp(1rem, 2.8vw, 1.25rem) !important; }

/* ==========================================================================
   11. HỆ THỐNG NÚT LỆNH CO GIÃN THÔNG MINH THEO MÀN HÌNH THIẾT BỊ (FLUID BUTTONS)
   Tự động điều chỉnh kích thước từ Điện thoại nhỏ (320px) -> Tablet -> PC lớn
   ========================================================================== */
button,
.btn-start,
.btn-submit,
.btn-clear,
.btn-action,
.btn-login,
.btn-submit-practice,
.btn-paste,
.nav-tab-btn,
.topic-tab-btn,
.lab-tab-btn,
.tf-btn,
.option-btn,
.options-list label {
    font-size: clamp(0.78rem, 2.2vw, 0.96rem) !important;
    padding: clamp(7px, 1.5vw, 11px) clamp(11px, 2.4vw, 20px) !important;
    border-radius: clamp(6px, 1.2vw, 10px) !important;
    line-height: 1.3 !important;
}

.btn-start, .btn-submit, .btn-clear {
    min-width: clamp(140px, 42vw, 220px) !important;
    margin: clamp(12px, 2.5vw, 20px) auto !important;
}

.btn-mini, .score-chip, .tf-btn {
    font-size: clamp(0.72rem, 1.9vw, 0.84rem) !important;
    padding: clamp(4px, 1vw, 6px) clamp(8px, 1.8vw, 13px) !important;
}

.input-group input,
.input-group select,
.form-group input,
.form-group select,
.filter-bar input,
.filter-bar select,
.search-box input {
    height: clamp(36px, 8.5vw, 42px) !important;
    padding: 0 clamp(9px, 2vw, 13px) !important;
    font-size: clamp(0.8rem, 2.2vw, 0.94rem) !important;
}

/* Thu gọn Cụm nút điều hướng nổi (.ltk-floating-nav) tự động theo màn hình */
.ltk-floating-nav {
    bottom: clamp(8px, 2vw, 16px) !important;
    right: clamp(8px, 2vw, 16px) !important;
    padding: clamp(4px, 1vw, 6px) clamp(6px, 1.4vw, 10px) !important;
    gap: clamp(4px, 1vw, 7px) !important;
}

.ltk-float-btn {
    padding: clamp(5px, 1.1vw, 7px) clamp(8px, 1.8vw, 12px) !important;
    font-size: clamp(0.7rem, 1.9vw, 0.82rem) !important;
    gap: 4px !important;
}

@media screen and (max-width: 640px) {
    .btn-start, .btn-submit, .btn-clear {
        width: 100% !important;
    }
    .ltk-floating-nav {
        left: 8px !important;
        right: 8px !important;
        bottom: 8px !important;
        justify-content: space-between !important;
    }
    .ltk-float-btn {
        flex: 1 1 0 !important;
        padding: 6px 4px !important;
        font-size: clamp(0.68rem, 2.6vw, 0.75rem) !important;
    }
}


/* ==========================================================================
   V22: GIAO DIỆN BẢNG CHẤM BÀI & QUẢN TRỊ 3D MẠNH MẼ
   ========================================================================== */
body {
    background: radial-gradient(circle at 15% 10%, #1E293B 0%, #0F172A 55%, #070C16 100%) !important;
}
.admin-container, .container {
    background: linear-gradient(180deg, #F8FAFC 0%, #EFF4FA 100%) !important;
    border: 1.5px solid rgba(56, 189, 248, 0.35) !important;
    border-radius: 16px !important;
    box-shadow: 0 24px 50px rgba(2, 6, 23, 0.55), inset 0 1px 0 #FFFFFF !important;
}
.nav-tab-btn, .btn-action {
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    border-bottom: 3px solid rgba(15, 23, 42, 0.35) !important;
    border-radius: 9px !important;
    box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.35), 0 4px 10px rgba(15, 23, 42, 0.2) !important;
    transition: transform 0.1s ease, box-shadow 0.14s ease, filter 0.14s ease !important;
}
.nav-tab-btn.active {
    background: linear-gradient(180deg, #3B82F6 0%, #1D4ED8 100%) !important;
    color: #FFFFFF !important;
    box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.45), 0 4px 0 #1E3A8A, 0 8px 16px rgba(29, 78, 216, 0.38) !important;
}
.nav-tab-btn:hover, .btn-action:hover {
    transform: translateY(-1.5px) !important;
    filter: brightness(1.08) !important;
}
.nav-tab-btn:active, .btn-action:active {
    transform: translateY(2px) !important;
    border-bottom-width: 1px !important;
}

/* ==========================================================================
   V29.5: GIẢM TỈ LỆ CÁC NÚT BẤM CÒN ~68% — CÂN ĐỐI, GỌN GÀNG TRÊN MỌI MÀN HÌNH
   ========================================================================== */
.nav-tab-btn {
    padding: 6px 12px !important;
    font-size: 0.76rem !important;
    border-radius: 7px !important;
    border-bottom-width: 2px !important;
}
.btn-action {
    padding: 5px 10px !important;
    font-size: 0.75rem !important;
    border-radius: 6px !important;
    border-bottom-width: 2px !important;
    line-height: 1.25 !important;
}
.top-banner a {
    padding: 5px 10px !important;
    font-size: 0.76rem !important;
    border-radius: 6px !important;
}
table.sub-table {
    font-size: 0.82rem !important;
}
table.sub-table th,
table.sub-table td {
    padding: 6px 8px !important;
}
/* Nút thao tác trong bảng (Sửa / Reset MK / Xóa): thu gọn 68%, không bị !important toàn cục phóng to */
table.sub-table td button,
#accountTableBody button {
    padding: 3px 8px !important;
    font-size: 0.72rem !important;
    border-radius: 5px !important;
    line-height: 1.2 !important;
    min-height: 24px !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08) !important;
    white-space: nowrap !important;
}
/* Nhãn vai trò (ADMIN / TEACHER / STUDENT) nằm gọn 1 dòng */
#accountTableBody span {
    white-space: nowrap !important;
    font-size: 0.72rem !important;
}
.score-chip {
    padding: 3px 7px !important;
    font-size: 0.72rem !important;
    border-radius: 5px !important;
}

/* V35.3: 1/2/3 nav tabs on 1 row & hide redundant floating nav */
.nav-tabs {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    width: 100% !important;
}
.nav-tabs .nav-tab-btn {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    text-align: center !important;
}
.ltk-floating-nav,
#ltk-floating-nav-css,
#ltk-floating-nav-inline-style {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
@media (max-width: 680px) {
    .nav-tabs { flex-wrap: wrap !important; }
    .nav-tabs .nav-tab-btn { flex: 1 1 calc(33.33% - 6px) !important; padding: 8px 6px !important; font-size: 0.72rem !important; }
}

/* ==========================================================================
   V55: ĐỒNG BỘ TƯƠNG PHẢN CAO, CHỐNG TRÀN CODE & ẨN NÚT TRANG CHỦ NỔI
   ========================================================================== */
code:not(pre code) {
    color: #C2410C !important;
    background: #FFEDD5 !important;
    border: 1px solid #FDBA74 !important;
    padding: 1px 5px !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
}

pre code {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

.ltk-floating-nav .home-btn,
.ltk-floating-nav a[href="index.html"] {
    display: none !important;
}


/* ==========================================================================
   V58.2: ĐỔI MÀU MÃ LỆNH INLINE `code` SANG XANH NAVY IN ĐẬM (#1E3A8A)
   - Thay thế nền đỏ/chữ đỏ gây rối mắt bằng Xanh Navy đậm trên nền xanh dịu nhẹ
   ========================================================================== */
code:not(pre code) {
    background: #EFF6FF !important;
    color: #1E3A8A !important;
    border: 1px solid #DBEAFE !important;
    padding: 1px 6px !important;
    border-radius: 4px !important;
    font-weight: 700 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    display: inline !important;
}


/* ==========================================================================
   V62.1: TỰ ĐỘNG ĐIỀU CHỈNH PHÔNG CHỮ, CỠ CHỮ ĐỘNG (FLUID TYPOGRAPHY)
          & CHỐNG RỚT DÒNG CHO NHÃN TRẠNG THÁI, NÚT LỆNH, TIÊU ĐỀ / Ô NGẮN
   ========================================================================== */
body {
    font-family: 'Plus Jakarta Sans', 'Be Vietnam Pro', 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: clamp(0.88rem, 1.1vw + 0.65rem, 1rem);
    text-rendering: optimizeLegibility;
}

h1, .top-banner h1 {
    font-size: clamp(1.15rem, 2.6vw, 1.7rem) !important;
    line-height: 1.3 !important;
    text-wrap: balance;
}

h2, .card-title, .panel-card h2 {
    font-size: clamp(0.96rem, 2vw, 1.24rem) !important;
    line-height: 1.35 !important;
    text-wrap: balance;
}

h3 {
    font-size: clamp(0.9rem, 1.7vw, 1.08rem) !important;
    line-height: 1.38 !important;
}

/* Giữ các nhãn trạng thái, huy hiệu, thẻ định hướng, nút điều hướng luôn gọn trên 1 dòng */
.badge,
.ltk-track-pill,
.ltk-track-tag,
.ltk-status-badge,
.status-badge,
.nav-tab-btn,
.ltk-ts-btn,
.ltk-tb-zoom-btn,
.ltk-float-btn,
.score-chip {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    white-space: nowrap !important;
    word-break: keep-all !important;
    line-height: 1.25 !important;
    font-size: clamp(0.72rem, 1.6vw, 0.84rem) !important;
}

/* Chống rớt dòng cho tiêu đề cột ngắn & ô dữ liệu ngắn trong bảng */
table th {
    font-size: clamp(0.76rem, 1.4vw, 0.9rem) !important;
    white-space: nowrap;
}

table td.ltk-nowrap,
table th.ltk-nowrap,
.ltk-nowrap {
    white-space: nowrap !important;
    word-break: keep-all !important;
}

/* Tự động co cỡ chữ nút bấm để không bị rớt chữ trên màn hình nhỏ */
button:not(.ltk-mm-toggle-btn):not(.btn-start):not(.btn-submit):not(.btn-clear),
.btn-action,
.btn-mini {
    white-space: nowrap;
    font-size: clamp(0.74rem, 1.7vw, 0.88rem) !important;
}


/* ==========================================================================
   V64.3: CHỐNG TRÀN LỀ TOÀN HỆ THỐNG (ĐẶC BIỆT THẺ NĂNG LỰC AI, KHUNG BÀI HỌC)
   ========================================================================== */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

.container,
.main-wrapper,
.card,
.panel-card,
.note-box,
.question-card,
.ltk-khbd-box,
.ltk-khbd-item,
.ltk-ai-activity {
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.ltk-khbd-grid > *,
.ltk-ai-steps > *,
.card > * {
    min-width: 0;
}

/* Cho phép mã Năng lực số / Năng lực AI tự động xuống dòng gọn trong khung thẻ */
.ltk-comp-code,
.ltk-comp-code.ltk-ai-code {
    display: inline-block !important;
    max-width: 100% !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    box-sizing: border-box !important;
    line-height: 1.4 !important;
    vertical-align: top !important;
}

pre,
.quiz-code-block,
.code-block {
    max-width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
}

.table-responsive {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

img, svg, iframe {
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .ltk-khbd-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ==========================================================================
   V66.1: PHÂN BIỆT RÕ RÀNG GIAO DIỆN PHÒNG ÔN TẬP (XANH NGỌC) vs PHÒNG KIỂM TRA (XANH NAVY)
          & SỬA LỖI CẮT CHỮ .hero-badge TRÊN ĐIỆN THOẠI
   ========================================================================== */
.hero-badge {
    display: inline-block !important;
    max-width: 100% !important;
    white-space: normal !important;
    word-break: break-word !important;
    text-align: center !important;
    line-height: 1.38 !important;
    padding: 5px 14px !important;
    box-sizing: border-box !important;
}

/* --- CHẾ ĐỘ 1: PHÒNG ÔN TẬP TRỰC TUYẾN (XANH NGỌC LỤC BẢO - EMERALD) --- */
body.ltk-mode-practice .hero {
    background: linear-gradient(135deg, #ECFDF5 0%, #F0FDF4 65%, #E6FFFA 100%) !important;
    border: 1.5px solid #A7F3D0 !important;
    border-top: 5px solid #059669 !important;
    border-bottom: 2.5px solid #10B981 !important;
}
body.ltk-mode-practice .hero-badge {
    background: #047857 !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 8px rgba(4, 120, 87, 0.25);
}
body.ltk-mode-practice .hero h1,
body.ltk-mode-practice #exam-header-title {
    color: #065F46 !important;
}
body.ltk-mode-practice .hero p {
    color: #047857 !important;
    font-weight: 600;
}
body.ltk-mode-practice .card-title {
    background: linear-gradient(90deg, #DCFCE7 0%, #F0FDF4 100%) !important;
    border-left: 5px solid #059669 !important;
    color: #065F46 !important;
}
body.ltk-mode-practice .note-box {
    border-left-color: #059669 !important;
}
body.ltk-mode-practice .btn-start {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.32) !important;
}
body.ltk-mode-practice .btn-start:hover {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%) !important;
}
body.ltk-mode-practice #exam-status-bar {
    background: #064E3B !important;
    border-bottom: 2.5px solid #10B981 !important;
}

/* --- CHẾ ĐỘ 2: PHÒNG KIỂM TRA CHÍNH THỨC (XANH NAVY - OFFICIAL EXAM) --- */
body.ltk-mode-exam .hero {
    background: linear-gradient(135deg, #EFF6FF 0%, #F8FAFC 65%, #DBEAFE 100%) !important;
    border: 1.5px solid #93C5FD !important;
    border-top: 5px solid #1E3A8A !important;
    border-bottom: 2.5px solid #1E40AF !important;
}
body.ltk-mode-exam .hero-badge {
    background: #1E3A8A !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.28);
}
body.ltk-mode-exam .hero h1,
body.ltk-mode-exam #exam-header-title {
    color: #1E3A8A !important;
}
body.ltk-mode-exam .hero p {
    color: #1E40AF !important;
    font-weight: 600;
}
body.ltk-mode-exam .card-title {
    background: linear-gradient(90deg, #DBEAFE 0%, #EFF6FF 100%) !important;
    border-left: 5px solid #1E3A8A !important;
    color: #1E3A8A !important;
}
body.ltk-mode-exam .note-box {
    border-left-color: #1E3A8A !important;
}
body.ltk-mode-exam .btn-start {
    background: linear-gradient(135deg, #1E3A8A 0%, #172554 100%) !important;
    box-shadow: 0 4px 14px rgba(30, 58, 138, 0.34) !important;
}
body.ltk-mode-exam .btn-start:hover {
    background: linear-gradient(135deg, #1D4ED8 0%, #1E3A8A 100%) !important;
}
body.ltk-mode-exam #exam-status-bar {
    background: #0F172A !important;
    border-bottom: 2.5px solid #3B82F6 !important;
}


/* ==========================================================================
   V67.3: KHẮC PHỤC TRIỆT ĐỂ LỖI HIỂN THỊ TRÊN DI ĐỘNG TOÀN HỆ THỐNG
   1. Danh mục Ôn tập / Kiểm tra (.lesson-item) chuyển Thẻ 2 tầng gọn đẹp (<= 720px)
      -> Không bao giờ bị bóp tên bài thành từng chữ xếp dọc!
   2. Thanh điều hướng nổi (.ltk-floating-nav) căn giữa khi ít nút & vuốt ngang mượt khi nhiều nút
      -> Không bao giờ bị cắt nút ở 2 mép trái/phải!
   3. Lưới biểu mẫu nhiều cột (.ltk-mob-stack) tự xếp 1 cột trên điện thoại (<= 680px)
   ========================================================================== */
.ltk-floating-nav {
    max-width: calc(100vw - 16px) !important;
    box-sizing: border-box !important;
}

@media (max-width: 720px) {
    /* 1. Thẻ Ôn tập & Kiểm tra trên Mục lục 10/11/12: Bố cục 2 tầng (Tầng 1: Tiêu đề 100%, Tầng 2: Kỳ + Trạng thái + Thời lượng + Mũi tên) */
    #ltk-review-list-core .lesson-item,
    #ltk-exam-list-core .lesson-item,
    #ltk-dynamic-exams-list .lesson-item,
    .lesson-item:has(.ltk-exam-state-slot) {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        row-gap: 8px !important;
        column-gap: 8px !important;
        padding: 12px 12px !important;
    }

    #ltk-review-list-core .lesson-item .lesson-name,
    #ltk-exam-list-core .lesson-item .lesson-name,
    #ltk-dynamic-exams-list .lesson-item .lesson-name,
    .lesson-item:has(.ltk-exam-state-slot) .lesson-name {
        order: 1 !important;
        flex: 1 0 100% !important;
        width: 100% !important;
        min-width: 0 !important;
        font-size: 0.94rem !important;
        font-weight: 700 !important;
        line-height: 1.45 !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
    }

    #ltk-review-list-core .lesson-item .lesson-num,
    #ltk-exam-list-core .lesson-item .lesson-num,
    #ltk-dynamic-exams-list .lesson-item .lesson-num,
    .lesson-item:has(.ltk-exam-state-slot) .lesson-num {
        order: 2 !important;
        min-width: auto !important;
        flex-shrink: 0 !important;
        font-size: 0.78rem !important;
        padding: 3px 8px !important;
        border-radius: 6px !important;
        background: #EFF6FF !important;
        border: 1px solid #BFDBFE !important;
        color: #1E3A8A !important;
    }

    #ltk-review-list-core .lesson-item .ltk-exam-state-slot,
    #ltk-exam-list-core .lesson-item .ltk-exam-state-slot,
    #ltk-dynamic-exams-list .lesson-item .ltk-exam-state-slot,
    .lesson-item:has(.ltk-exam-state-slot) .ltk-exam-state-slot {
        order: 3 !important;
        flex-shrink: 0 !important;
        max-width: 100% !important;
    }

    #ltk-review-list-core .lesson-item .ltk-exam-state-slot .ltk-status-badge,
    #ltk-exam-list-core .lesson-item .ltk-exam-state-slot .ltk-status-badge,
    #ltk-dynamic-exams-list .lesson-item .ltk-exam-state-slot .ltk-status-badge {
        font-size: 0.73rem !important;
        padding: 3px 8px !important;
        white-space: nowrap !important;
    }

    #ltk-review-list-core .lesson-item .page-num,
    #ltk-exam-list-core .lesson-item .page-num,
    #ltk-dynamic-exams-list .lesson-item .page-num,
    .lesson-item:has(.ltk-exam-state-slot) .page-num {
        order: 4 !important;
        margin-right: 0 !important;
        font-size: 0.78rem !important;
        color: #475569 !important;
        white-space: nowrap !important;
    }

    #ltk-review-list-core .lesson-item .icon-link,
    #ltk-exam-list-core .lesson-item .icon-link,
    #ltk-dynamic-exams-list .lesson-item .icon-link,
    .lesson-item:has(.ltk-exam-state-slot) .icon-link {
        order: 5 !important;
        margin-left: auto !important;
        flex-shrink: 0 !important;
    }

    /* Bảo vệ các dòng bài học thông thường (Bài 1–34) trên màn hình nhỏ không bao giờ bị bóp chữ */
    .lesson-item {
        flex-wrap: wrap !important;
        row-gap: 4px !important;
    }
    .lesson-item .lesson-name {
        flex: 1 1 160px !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
    }

    /* 2. Thanh điều hướng nổi (.ltk-floating-nav): căn giữa khi ít nút, vuốt ngang mượt từ nút đầu tiên khi nhiều nút */
    .ltk-floating-nav {
        left: 8px !important;
        right: 8px !important;
        bottom: 8px !important;
        width: auto !important;
        max-width: calc(100vw - 16px) !important;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        padding: 6px 8px !important;
        gap: 6px !important;
    }
    .ltk-floating-nav::-webkit-scrollbar {
        display: none !important;
    }
    .ltk-floating-nav::before,
    .ltk-floating-nav::after {
        content: "";
        margin: auto;
        flex: 0 0 0px;
    }
    .ltk-floating-nav .ltk-float-btn {
        flex: 0 0 auto !important;
        white-space: nowrap !important;
        padding: 6px 10px !important;
        font-size: 0.75rem !important;
    }
}

/* 3. Lưới biểu mẫu nhiều cột trên các trang Quản trị & Đăng nhập tự động xếp 1 cột gọn trên điện thoại */
@media (max-width: 680px) {
    .ltk-mob-stack {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
    .ltk-mob-stack > * {
        min-width: 0 !important;
    }
}


/* ==========================================================================
   V68.2: THANH CHIA TAB QUẢN LÝ KỲ KIỂM TRA & NGÂN HÀNG ĐỀ (tin-quan-tri-de-thi.html)
   ========================================================================== */
.ltk-de-thi-subtabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    max-width: 1120px;
    margin: 0 auto 16px auto;
    background: #FFFFFF;
    padding: 8px;
    border-radius: 14px;
    border: 1.5px solid #CBD5E1;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    box-sizing: border-box;
}

.ltk-subtab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 10px;
    border-radius: 10px;
    border: 1.5px solid #E2E8F0;
    background: #F8FAFC;
    color: #334155;
    font-weight: 700;
    font-size: 0.86rem;
    line-height: 1.3;
    cursor: pointer;
    text-align: center;
    transition: all 0.18s ease;
}

.ltk-subtab-btn:hover {
    background: #EFF6FF;
    border-color: #93C5FD;
    color: #1E3A8A;
}

.ltk-subtab-btn.active {
    background: linear-gradient(135deg, #1E3A8A 0%, #0284C7 100%);
    color: #FFFFFF;
    border-color: #1E3A8A;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.28);
}

.ltk-de-thi-tab-panel {
    display: none;
    animation: ltkTabFadeIn 0.18s ease;
}

.ltk-de-thi-tab-panel.active {
    display: block;
}

@keyframes ltkTabFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
    .ltk-de-thi-subtabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        padding: 6px;
    }
    .ltk-subtab-btn {
        padding: 9px 8px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .ltk-de-thi-subtabs {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================================
   V69.0: SỬA CẮT CHỮ .nav-tabs TRÊN DI ĐỘNG & GIAO DIỆN QUẢN LÝ TRƯỜNG/LỚP/HS
   ========================================================================== */
@media (max-width: 680px) {
    .nav-tabs {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 6px !important;
    }
    .nav-tabs .nav-tab-btn {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        line-height: 1.25 !important;
        padding: 8px 5px !important;
        font-size: 0.72rem !important;
        text-align: center !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: 44px !important;
    }
}

.ltk-acc-subtabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-width: 1180px;
    margin: 0 auto 16px auto;
    background: #FFFFFF;
    padding: 8px;
    border-radius: 14px;
    border: 1.5px solid #CBD5E1;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    box-sizing: border-box;
}

@media (max-width: 560px) {
    .ltk-acc-subtabs {
        grid-template-columns: 1fr;
    }
}

.roster-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1.05fr 1.65fr;
    gap: 14px;
    align-items: start;
}

.roster-col {
    background: #F8FAFC;
    border: 1.5px solid #CBD5E1;
    border-radius: 12px;
    padding: 12px;
    box-sizing: border-box;
    min-width: 0;
}

.roster-col-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1.5px solid #E2E8F0;
}

.roster-col-head h3 {
    margin: 0;
    font-size: 0.94rem;
    color: #1E3A8A;
}

.roster-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 430px;
    overflow-y: auto;
    padding-right: 2px;
}

.roster-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 9px;
    border: 1.5px solid #E2E8F0;
    background: #FFFFFF;
    cursor: pointer;
    transition: all 0.15s ease;
}

.roster-item:hover {
    border-color: #93C5FD;
    background: #EFF6FF;
}

.roster-item.active {
    border-color: #1E3A8A;
    background: #DBEAFE;
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.14);
}

.roster-item-main {
    flex: 1 1 auto;
    min-width: 0;
}

.roster-item-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: #0F172A;
    word-break: break-word;
}

.roster-item-meta {
    font-size: 0.74rem;
    color: #64748B;
    margin-top: 2px;
}

.roster-mini-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.roster-mini-btn {
    padding: 3px 7px;
    border-radius: 6px;
    border: 1px solid #CBD5E1;
    background: #FFFFFF;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    color: #334155;
}

.roster-mini-btn.edit { border-color: #3B82F6; color: #1D4ED8; background: #EFF6FF; }
.roster-mini-btn.del  { border-color: #EF4444; color: #DC2626; background: #FEF2F2; }

@media (max-width: 960px) {
    .roster-grid-3 {
        grid-template-columns: 1fr;
    }
    .roster-list {
        max-height: 260px;
    }
}


/* ==========================================================================
   V70.1: THANH 5 TAB QUẢN LÝ KỲ KIỂM TRA & NGÂN HÀNG ĐỀ (.ltk-de-thi-subtabs-5)
   ========================================================================== */
.ltk-de-thi-subtabs.ltk-de-thi-subtabs-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
}

@media (max-width: 980px) {
    .ltk-de-thi-subtabs.ltk-de-thi-subtabs-5 {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 600px) {
    .ltk-de-thi-subtabs.ltk-de-thi-subtabs-5 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 6px !important;
        padding: 6px !important;
    }
    .ltk-de-thi-subtabs.ltk-de-thi-subtabs-5 .ltk-subtab-btn:last-child {
        grid-column: 1 / -1 !important;
    }
}
