/* =====================================================================
   public/css/app.css — Hệ thống giao diện EduPlatform v3
   Nhận diện: xanh lục bảo Trường THPT Hoàng Hoa Thám, chữ Plus Jakarta Sans,
   code JetBrains Mono trên nền Dracula (khung cửa sổ macOS).
   Nạp SAU custom.css: ghi đè token cũ cho đồng bộ.
   ===================================================================== */

:root {
    --c-primary: #006841;
    --c-primary-600: #00593a;
    --c-primary-700: #004a30;
    --c-primary-50: #ecf7f1;
    --c-primary-100: #d3eee0;
    --c-accent: #f5a623;
    --c-accent-50: #fff6e5;
    --c-ink: #14231c;
    --c-text: #24332c;
    --c-muted: #5d6b64;
    --c-line: #e3e8e5;
    --c-line-soft: #eef2f0;
    --c-bg: #f6f8f7;
    --c-surface: #ffffff;
    --c-danger: #c62828;
    --c-warning: #b86e00;
    --c-info: #1d5fa8;

    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --shadow-1: 0 1px 2px rgba(20, 35, 28, .06), 0 1px 3px rgba(20, 35, 28, .05);
    --shadow-2: 0 4px 16px rgba(20, 35, 28, .08);
    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;

    /* Dracula (màu chú thích làm sáng để đạt tương phản WCAG AA 4.7:1) */
    --dr-bg: #282a36;
    --dr-bar: #21222c;
    --dr-line: #44475a;
    --dr-fg: #f8f8f2;
    --dr-comment: #8592c9;
    --dr-cyan: #8be9fd;
    --dr-green: #50fa7b;
    --dr-orange: #ffb86c;
    --dr-pink: #ff79c6;
    --dr-purple: #bd93f9;
    --dr-red: #ff6e6e;
    --dr-yellow: #f1fa8c;

    --bs-primary: var(--c-primary);
    --bs-primary-rgb: 0, 104, 65;
    --bs-link-color: var(--c-primary);
    --bs-link-color-rgb: 0, 104, 65;
    --bs-link-hover-color: var(--c-primary-700);
    --bs-body-font-family: var(--font-sans);
}

html { font-size: 15.5px; }
body {
    font-family: var(--font-sans);
    background: var(--c-bg);
    color: var(--c-text);
    letter-spacing: -0.005em;
    line-height: 1.6;
}
h1, h2, h3, h4, h5, h6 { color: var(--c-ink); font-weight: 700; letter-spacing: -0.015em; }
code, kbd, pre, samp { font-family: var(--font-mono); }
a { color: var(--c-primary); }
a:hover { color: var(--c-primary-700); }
:focus-visible { outline: 3px solid rgba(0, 104, 65, .35); outline-offset: 2px; }

/* Bỏ ép khung 90% của giao diện cũ */
.container, .container-sm, .container-md, .container-lg, .container-xl, .container-xxl { max-width: 1320px !important; width: 100% !important; }
.app-container { max-width: 1360px; margin: 0 auto; padding-left: 1.25rem; padding-right: 1.25rem; }

/* ---------- Bootstrap tinh chỉnh ---------- */
.btn { font-weight: 600; border-radius: var(--r-sm); }
.btn-primary, .btn-success { --bs-btn-bg: var(--c-primary); --bs-btn-border-color: var(--c-primary); --bs-btn-hover-bg: var(--c-primary-600);
    --bs-btn-hover-border-color: var(--c-primary-600); --bs-btn-active-bg: var(--c-primary-700); --bs-btn-disabled-bg: var(--c-primary); --bs-btn-disabled-border-color: var(--c-primary); }
.btn-outline-primary { --bs-btn-color: var(--c-primary); --bs-btn-border-color: var(--c-primary); --bs-btn-hover-bg: var(--c-primary);
    --bs-btn-hover-border-color: var(--c-primary); --bs-btn-active-bg: var(--c-primary-700); }
.btn-accent { background: var(--c-accent); border-color: var(--c-accent); color: #2b1a00; }
.btn-accent:hover { background: #e39512; border-color: #e39512; color: #2b1a00; }
.text-primary { color: var(--c-primary) !important; }
.bg-primary { background-color: var(--c-primary) !important; }
.form-control, .form-select { border-radius: var(--r-sm); border-color: #d5ddd9; }
.form-control:focus, .form-select:focus { border-color: var(--c-primary); box-shadow: 0 0 0 .2rem rgba(0, 104, 65, .15); }
.form-label { font-weight: 600; font-size: .86rem; color: var(--c-ink); margin-bottom: .3rem; }
.form-text { color: var(--c-muted); }
.table { --bs-table-color: var(--c-text); }
.table > :not(caption) > * > * { padding: .65rem .75rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--c-muted); font-weight: 700; background: #f3f6f4; border-bottom-width: 1px; }
.badge { font-weight: 600; }
.dropdown-menu { border-radius: var(--r-md); padding: .4rem; }
.dropdown-item { border-radius: 6px; padding: .5rem .75rem; display: flex; gap: .6rem; align-items: center; }
.dropdown-item i { color: var(--c-muted); width: 1rem; }
.dropdown-header { font-size: .8rem; }
.nav-tabs .nav-link { font-weight: 600; color: var(--c-muted); }
.nav-tabs .nav-link.active { color: var(--c-primary); }

/* ---------- Thanh trên cùng & thanh điều hướng ---------- */
.app-topbar { background: #0d2b1e; color: #c9d8d0; font-size: .8rem; padding: .35rem 0; }
.app-topbar strong { color: #fff; }
.app-topbar a { color: #c9d8d0; text-decoration: none; }
.app-navbar { background: var(--c-primary); box-shadow: 0 2px 12px rgba(0, 0, 0, .12); padding: .55rem 0; }
.app-brand { display: flex; align-items: center; gap: .65rem; color: #fff !important; }
.app-brand-logo { width: 42px; height: 42px; border-radius: 10px; background: #fff; display: grid; place-items: center; padding: 3px; flex-shrink: 0; }
.app-brand-logo.sm { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--c-line); }
.app-brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.app-brand-name { display: block; font-weight: 800; font-size: 1.05rem; line-height: 1.1; letter-spacing: .01em; }
.app-brand-sub { display: block; font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: #ffd98a; font-weight: 700; }
.app-navbar .nav-link { color: rgba(255, 255, 255, .86); font-weight: 600; border-radius: 8px; padding: .5rem .85rem !important; display: flex; gap: .45rem; align-items: center; }
.app-navbar .nav-link:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.app-navbar .nav-link.active { color: #fff; background: rgba(255, 255, 255, .18); }
.app-btn-ghost { color: #fff; border: 1px solid rgba(255, 255, 255, .45); }
.app-btn-ghost:hover { color: var(--c-primary); background: #fff; }
.app-btn-accent { background: var(--c-accent); color: #2b1a00; border: 1px solid var(--c-accent); }
.app-btn-accent:hover { background: #ffc04d; color: #2b1a00; }
.app-user-btn { color: #fff; border: 1px solid rgba(255, 255, 255, .45); display: flex; align-items: center; gap: .5rem; padding: .25rem .65rem .25rem .3rem; }
.app-user-btn:hover, .app-user-btn.show { color: #fff; background: rgba(255, 255, 255, .12); }
.app-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--c-accent); color: #2b1a00; display: grid; place-items: center; font-weight: 800; font-size: .85rem; }

/* ---------- Khung quản trị: thanh bên + nội dung ---------- */
.app-shell { display: flex; min-height: calc(100vh - 100px); }
.app-sidenav { width: 240px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--c-line); padding: 1rem .75rem 2rem; position: sticky; top: 58px; height: calc(100vh - 58px); overflow-y: auto; }
.app-sidenav-group { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: #8a9790; margin: 1rem .6rem .35rem; }
.app-sidenav-group:first-child { margin-top: 0; }
.app-sidenav-link { display: flex; align-items: center; gap: .65rem; padding: .5rem .65rem; border-radius: 8px; color: var(--c-text); text-decoration: none; font-weight: 600; font-size: .9rem; }
.app-sidenav-link i { font-size: 1.05rem; color: var(--c-muted); }
.app-sidenav-link:hover { background: var(--c-line-soft); color: var(--c-ink); }
.app-sidenav-link.active { background: var(--c-primary-50); color: var(--c-primary); }
.app-sidenav-link.active i { color: var(--c-primary); }
.app-main { flex: 1; min-width: 0; padding: 1.75rem 2rem 3rem; }
@media (max-width: 991.98px) {
    .app-shell { display: block; }
    .app-sidenav { width: auto; height: auto; position: static; display: flex; gap: .25rem; overflow-x: auto; padding: .5rem; border-right: 0; border-bottom: 1px solid var(--c-line); }
    .app-sidenav-group { display: none; }
    .app-sidenav-link { white-space: nowrap; }
    .app-main { padding: 1.25rem 1rem 2.5rem; }
}

/* ---------- Thành phần trang ---------- */
.page-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.55rem; margin: 0; }
.page-header p { color: var(--c-muted); margin: .25rem 0 0; }
.page-header .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.app-breadcrumb { font-size: .84rem; margin-bottom: .5rem; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; color: var(--c-muted); }
.app-breadcrumb a { color: var(--c-muted); text-decoration: none; }
.app-breadcrumb a:hover { color: var(--c-primary); }
.app-breadcrumb .sep { opacity: .5; }

.app-card { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.app-card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--c-line); display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.app-card-header h2, .app-card-header h3 { font-size: 1.05rem; margin: 0; }
.app-card-body { padding: 1.25rem; }
.app-card + .app-card { margin-top: 1.25rem; }

.stat-tile { background: #fff; border: 1px solid var(--c-line); border-radius: var(--r-md); padding: 1rem 1.15rem; height: 100%; }
.stat-tile .label { font-size: .78rem; font-weight: 700; color: var(--c-muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-tile .value { font-size: 1.75rem; font-weight: 800; color: var(--c-ink); line-height: 1.2; }
.stat-tile .hint { font-size: .82rem; color: var(--c-muted); }
.stat-tile .icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--c-primary-50); color: var(--c-primary); font-size: 1.15rem; float: right; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--c-muted); }
.empty-state i { font-size: 2.2rem; display: block; margin-bottom: .5rem; color: #b5c2bb; }

.pill { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 700; padding: .2rem .55rem; border-radius: 999px; background: var(--c-line-soft); color: var(--c-muted); }
.pill-primary { background: var(--c-primary-50); color: var(--c-primary); }
.pill-accent { background: var(--c-accent-50); color: #8a5300; }
.pill-danger { background: #fdecec; color: var(--c-danger); }
.pill-info { background: #e8f1fb; color: var(--c-info); }

/* ---------- Cây thư mục: Môn – Khối – Chủ đề – Bài học ---------- */
.subject-switch { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.subject-chip { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem .9rem; border-radius: 999px; border: 1px solid var(--c-line); background: #fff; color: var(--c-text); text-decoration: none; font-weight: 600; }
.subject-chip:hover { border-color: var(--c-primary); color: var(--c-primary); }
.subject-chip.active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.subject-chip .count { font-size: .72rem; background: rgba(0, 0, 0, .08); border-radius: 999px; padding: 0 .45rem; }
.subject-chip.active .count { background: rgba(255, 255, 255, .25); }
.grade-block { margin-bottom: 1.75rem; }
.grade-title { display: flex; align-items: center; gap: .6rem; font-size: 1.1rem; margin-bottom: .75rem; }
.grade-title .grade-badge { background: var(--c-ink); color: #fff; border-radius: 8px; padding: .15rem .55rem; font-size: .85rem; }
.topic-panel { background: #fff; border: 1px solid var(--c-line); border-radius: var(--r-md); margin-bottom: .75rem; overflow: hidden; }
.topic-panel > summary { list-style: none; cursor: pointer; padding: .85rem 1.1rem; display: flex; align-items: center; gap: .75rem; font-weight: 700; color: var(--c-ink); }
.topic-panel > summary::-webkit-details-marker { display: none; }
.topic-panel > summary .chev { transition: transform .2s; color: var(--c-muted); }
.topic-panel[open] > summary .chev { transform: rotate(90deg); }
.topic-panel > summary .topic-no { font-size: .72rem; font-weight: 800; color: var(--c-primary); background: var(--c-primary-50); border-radius: 6px; padding: .15rem .45rem; white-space: nowrap; }
.lesson-list { border-top: 1px solid var(--c-line-soft); }
.lesson-item { display: flex; align-items: center; gap: .85rem; padding: .7rem 1.1rem .7rem 2.6rem; border-bottom: 1px solid var(--c-line-soft); text-decoration: none; color: var(--c-text); }
.lesson-item:last-child { border-bottom: 0; }
.lesson-item:hover { background: #f8fbf9; color: var(--c-ink); }
.lesson-item .num { width: 32px; height: 32px; flex-shrink: 0; border-radius: 8px; display: grid; place-items: center; background: var(--c-line-soft); font-weight: 800; font-size: .85rem; color: var(--c-ink); }
.lesson-item.done .num { background: var(--c-primary); color: #fff; }
.lesson-item .meta { font-size: .8rem; color: var(--c-muted); }
.lesson-item .title { font-weight: 600; }

/* Cây quản trị (kéo thả sắp xếp) */
.tree-admin .topic-panel > summary { padding-right: .6rem; }
.tree-actions { margin-left: auto; display: flex; gap: .25rem; }
.tree-actions .btn { padding: .2rem .45rem; font-size: .8rem; }
.drag-handle { cursor: grab; color: #a3b0a9; }
.sortable-ghost { opacity: .4; background: var(--c-primary-50); }

/* ---------- Trang bài học ---------- */
.lesson-hero { background: linear-gradient(135deg, #00452b 0%, #006841 60%, #0a7d52 100%); color: #fff; border-radius: var(--r-lg); padding: 1.75rem 2rem; position: relative; overflow: hidden; }
.lesson-hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: rgba(255, 255, 255, .05); }
.lesson-hero .app-breadcrumb, .lesson-hero .app-breadcrumb a { color: rgba(255, 255, 255, .75); }
.lesson-hero h1 { color: #fff; font-size: 1.9rem; margin: .35rem 0 .4rem; }
.lesson-hero .summary { color: rgba(255, 255, 255, .85); max-width: 760px; }
.lesson-hero .lesson-no { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; border-radius: 12px; background: var(--c-accent); color: #2b1a00; font-weight: 800; font-size: 1.1rem; margin-right: .75rem; }
.lesson-facts { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-top: 1rem; font-size: .88rem; color: rgba(255, 255, 255, .85); }
.lesson-facts i { color: #ffd98a; margin-right: .35rem; }
.lesson-hero .btn-complete { border: 1px solid rgba(255, 255, 255, .6); color: #fff; }
.lesson-hero .btn-complete.done { background: #fff; color: var(--c-primary); }

.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.5rem; margin-top: 1.5rem; align-items: start; }
@media (max-width: 1199.98px) and (min-width: 992px) { .lesson-layout { grid-template-columns: minmax(0, 1fr) 260px; gap: 1rem; } }

.lesson-tabs { display: flex; gap: .4rem; overflow-x: auto; padding: .35rem; background: #fff; border: 1px solid var(--c-line); border-radius: var(--r-md); margin-bottom: 1rem; scrollbar-width: thin; }
.lesson-tab { flex: 1 0 auto; display: flex; align-items: center; gap: .6rem; padding: .55rem .9rem; border-radius: 9px; border: 0; background: transparent; color: var(--c-muted); text-align: left; white-space: nowrap; }
.lesson-tab .step { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 800; background: var(--c-line-soft); color: var(--c-muted); flex-shrink: 0; }
.lesson-tab .t { display: block; font-weight: 700; color: var(--c-ink); font-size: .92rem; line-height: 1.2; }
.lesson-tab .p { display: block; font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--c-muted); }
.lesson-tab:hover { background: var(--c-line-soft); }
.lesson-tab.active { background: var(--c-primary); }
.lesson-tab.active .t, .lesson-tab.active .p { color: #fff; }
.lesson-tab.active .step { background: #fff; color: var(--c-primary); }
.lesson-pane { display: none; }
.lesson-pane.active { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.pane-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.pane-head .icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--c-primary-50); color: var(--c-primary); font-size: 1.2rem; }
.pane-head h2 { font-size: 1.3rem; margin: 0; }
.pane-head .phase { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--c-accent); }
.pane-nav { display: flex; justify-content: space-between; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--c-line); }

.lesson-main { min-width: 0; max-width: 100%; }
.lesson-pane pre, .lesson-pane .code-window pre { max-width: 100%; overflow-x: auto; }
.lesson-aside { position: sticky; top: 76px; }
body.dashboard-page .lesson-aside { top: 16px; }
.lesson-aside .app-card { max-height: calc(100vh - 96px); overflow-y: auto; scrollbar-width: thin; }
body.dashboard-page .lesson-aside .app-card { max-height: calc(100vh - 108px); }
.lesson-aside-fab, .lesson-aside-backdrop, .lesson-aside-close { display: none; }
@media (max-width: 991.98px) {
    .lesson-layout { grid-template-columns: minmax(0, 1fr); gap: .85rem; margin-top: .85rem; }
    .lesson-aside-fab { display: inline-flex; align-items: center; justify-content: center; position: fixed; right: 16px; bottom: 18px; z-index: 1045; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--c-primary); color: #fff; font-size: 1.3rem; box-shadow: 0 6px 20px rgba(0, 106, 78, .35); }
    .lesson-aside-close { display: inline-block; }
    .lesson-aside { position: fixed; top: 0; right: 0; bottom: 0; width: min(320px, 86vw); z-index: 1055; transform: translateX(100%); transition: transform .22s ease; pointer-events: none; }
    .lesson-aside .app-card { height: 100%; max-height: 100vh; border-radius: 16px 0 0 16px; }
    body.lesson-aside-open .lesson-aside { transform: translateX(0); pointer-events: auto; }
    body.lesson-aside-open .lesson-aside-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1050; }
    body.lesson-aside-open { overflow: hidden; }
    .lesson-tabs { padding: .25rem; gap: .25rem; margin-bottom: .75rem; }
    .lesson-tab { padding: .42rem .65rem; gap: .45rem; }
    .lesson-tab .p { display: none; }
    .lesson-pane.app-card { border-radius: 12px; }
    .lesson-pane > .app-card-body { padding: .85rem !important; }
    .lesson-pane .pane-head { gap: .55rem; margin-bottom: .75rem; }
    .lesson-pane .pane-head .icon { width: 34px; height: 34px; font-size: 1rem; }
    .lesson-pane .pane-head h2 { font-size: 1.12rem; }
    .lesson-main .block-card-head { padding: .6rem .8rem; }
    .lesson-main .block-card-body, .lesson-main .q-card { padding: .75rem .8rem; }
}
.toc-link { display: flex; gap: .6rem; align-items: center; padding: .45rem .6rem; border-radius: 8px; color: var(--c-text); text-decoration: none; font-size: .9rem; }
.toc-link:hover { background: var(--c-line-soft); }
.toc-link.current { background: var(--c-primary-50); color: var(--c-primary); font-weight: 700; }
.cog-bars .row-bar { display: flex; align-items: center; gap: .5rem; font-size: .8rem; margin-bottom: .35rem; }
.cog-bars .row-bar .bar { flex: 1; height: 8px; background: var(--c-line-soft); border-radius: 99px; overflow: hidden; }
.cog-bars .row-bar .bar span { display: block; height: 100%; background: var(--c-primary); }

/* ---------- Nội dung soạn thảo (dùng chung cho mọi tab) ---------- */
.rich-content { font-size: 1.02rem; line-height: 1.75; color: var(--c-text); overflow-wrap: anywhere; }
.rich-content > *:first-child { margin-top: 0; }
.rich-content h2 { font-size: 1.35rem; margin: 1.6rem 0 .7rem; }
.rich-content h3 { font-size: 1.15rem; margin: 1.4rem 0 .6rem; padding-bottom: .35rem; border-bottom: 2px solid var(--c-primary-100); }
.rich-content h4 { font-size: 1.05rem; margin: 1.2rem 0 .5rem; color: var(--c-primary); }
.rich-content p { margin: 0 0 .9rem; }
.rich-content ul, .rich-content ol { padding-left: 1.4rem; margin-bottom: 1rem; }
.rich-content li { margin-bottom: .3rem; }
.rich-content img { max-width: 100%; height: auto; border-radius: var(--r-sm); }
.rich-content iframe, .rich-content video { max-width: 100%; border-radius: var(--r-md); border: 0; }
.rich-content iframe { aspect-ratio: 16 / 9; width: 100%; height: auto; }
.rich-content table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .95rem; }
.rich-content th, .rich-content td { border: 1px solid var(--c-line); padding: .55rem .7rem; vertical-align: top; }
.rich-content th { background: #f1f6f3; color: var(--c-ink); font-weight: 700; }
.rich-content blockquote { border-left: 4px solid var(--c-primary); background: var(--c-primary-50); padding: .75rem 1rem; border-radius: 0 var(--r-sm) var(--r-sm) 0; margin: 1rem 0; }
.rich-content :not(pre) > code { background: #f2eefc; color: #6b2fbf; padding: .1rem .35rem; border-radius: 5px; font-size: .9em; }
.rich-content .list-group-item { border: 0; padding-left: 0; }
/* Hộp chú thích */
.callout { border-radius: var(--r-md); padding: .9rem 1.1rem .9rem 3rem; margin: 1rem 0; position: relative; border: 1px solid; }
.callout::before { font-family: bootstrap-icons; position: absolute; left: 1rem; top: .85rem; font-size: 1.15rem; }
.callout > *:last-child { margin-bottom: 0; }
.callout-note { background: #edf5ff; border-color: #c7dcf5; }
.callout-note::before { content: "\F431"; color: #1d5fa8; }
.callout-tip { background: var(--c-primary-50); border-color: var(--c-primary-100); }
.callout-tip::before { content: "\F46C"; color: var(--c-primary); }
.callout-warn { background: #fff7e6; border-color: #f6dca6; }
.callout-warn::before { content: "\F33A"; color: #b86e00; }
.callout-key { background: #f6f0ff; border-color: #ddd0f7; }
.callout-key::before { content: "\F2EA"; color: #6b2fbf; }
.callout-title { font-weight: 800; display: block; margin-bottom: .25rem; color: var(--c-ink); }
/* Tương thích nội dung cũ */
.rich-content .alert { border-radius: var(--r-md); }
.rich-content .note-box { background: var(--c-primary-50); border-left: 4px solid var(--c-primary); padding: .75rem 1rem; border-radius: var(--r-sm); }

/* ---------- Khung code Dracula – cửa sổ macOS ---------- */
.code-window { background: var(--dr-bg); border-radius: 12px; margin: 1rem 0; overflow: hidden; box-shadow: 0 10px 30px rgba(15, 17, 26, .25); border: 1px solid #1b1c24; }
.code-window-bar { display: flex; align-items: center; gap: .75rem; background: var(--dr-bar); padding: .55rem .9rem; border-bottom: 1px solid #191a21; }
.code-window-bar .dots { display: flex; gap: 7px; }
.code-window-bar .dots i { width: 12px; height: 12px; border-radius: 50%; display: block; }
.code-window-bar .dots i:nth-child(1) { background: #ff5f57; }
.code-window-bar .dots i:nth-child(2) { background: #febc2e; }
.code-window-bar .dots i:nth-child(3) { background: #28c840; }
.code-window-title { flex: 1; text-align: center; color: #c5c8d6; font-family: var(--font-mono); font-size: .8rem; letter-spacing: .02em; }
.code-window-copy { background: transparent; border: 1px solid var(--dr-line); color: #e3e4ea; border-radius: 6px; font-size: .75rem; padding: .15rem .55rem; }
.code-window-copy:hover { background: var(--dr-line); }
.code-window pre { margin: 0; padding: 1rem 1.1rem; background: var(--dr-bg); color: var(--dr-fg); font-family: var(--font-mono); font-size: .92rem; line-height: 1.65; overflow-x: auto; tab-size: 4; }
.code-window pre code { background: transparent !important; color: inherit; padding: 0; font-size: inherit; white-space: pre; }
.code-window.with-lines pre code { counter-reset: line; }
.code-output { background: #1d1f27; border-top: 1px solid var(--dr-line); color: #e9eaf0; font-family: var(--font-mono); font-size: .88rem; padding: .75rem 1.1rem; white-space: pre-wrap; }
.code-output-label { display: block; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--dr-green); margin-bottom: .3rem; font-weight: 700; }
/* Màu cú pháp Dracula cho highlight.js */
.code-window .hljs, pre.hljs { color: var(--dr-fg); background: var(--dr-bg); }
.code-window .hljs-comment, .code-window .hljs-quote { color: var(--dr-comment); font-style: italic; }
.code-window .hljs-keyword, .code-window .hljs-selector-tag, .code-window .hljs-literal, .code-window .hljs-meta .hljs-keyword { color: var(--dr-pink); }
.code-window .hljs-string, .code-window .hljs-regexp, .code-window .hljs-meta .hljs-string { color: var(--dr-yellow); }
.code-window .hljs-number, .code-window .hljs-symbol { color: var(--dr-purple); }
.code-window .hljs-built_in, .code-window .hljs-type, .code-window .hljs-class .hljs-title, .code-window .hljs-title.class_ { color: var(--dr-cyan); }
.code-window .hljs-title, .code-window .hljs-title.function_, .code-window .hljs-section { color: var(--dr-green); }
.code-window .hljs-params, .code-window .hljs-variable, .code-window .hljs-template-variable { color: var(--dr-orange); }
.code-window .hljs-attr, .code-window .hljs-attribute, .code-window .hljs-name, .code-window .hljs-tag { color: var(--dr-green); }
.code-window .hljs-meta, .code-window .hljs-doctag { color: var(--dr-pink); }
.code-window .hljs-subst, .code-window .hljs-operator, .code-window .hljs-punctuation { color: var(--dr-fg); }
.code-window .hljs-deletion { color: var(--dr-red); }
.code-window .hljs-addition { color: var(--dr-green); }
.code-window .hljs-emphasis { font-style: italic; }
.code-window .hljs-strong { font-weight: 700; }

/* Thẻ ví dụ, bài tập, câu hỏi */
.block-card { border: 1px solid var(--c-line); border-radius: var(--r-md); background: #fff; margin-bottom: 1.25rem; }
.block-card-head { display: flex; align-items: center; gap: .65rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--c-line-soft); flex-wrap: wrap; }
.block-card-head .no { background: var(--c-ink); color: #fff; font-weight: 800; border-radius: 7px; padding: .1rem .55rem; font-size: .85rem; }
.block-card-head h3 { font-size: 1.05rem; margin: 0; }
.block-card-body { padding: 1rem 1.1rem; }
.diff-easy { background: #e8f6ee; color: #0d6b3d; }
.diff-medium { background: #fff4dd; color: #8a5300; }
.diff-hard { background: #fdecec; color: #a32020; }
.diff-challenge { background: #f1eafd; color: #5b23a8; }
.quiz-q { border: 1px solid var(--c-line); border-radius: var(--r-md); padding: 1rem 1.1rem; margin-bottom: 1rem; background: #fff; }
.quiz-q .q-head { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.quiz-opt { display: flex; gap: .6rem; align-items: flex-start; border: 1px solid var(--c-line); border-radius: 9px; padding: .55rem .75rem; margin-bottom: .45rem; cursor: pointer; }
.quiz-opt:hover { border-color: var(--c-primary); }
.quiz-opt.correct { background: #e8f6ee; border-color: #77c79c; }
.quiz-opt.wrong { background: #fdecec; border-color: #e7a3a3; }
.quiz-explain { display: none; margin-top: .6rem; background: #f6f8f7; border-radius: 9px; padding: .6rem .8rem; font-size: .92rem; }
.quiz-q.answered .quiz-explain { display: block; }

/* ---------- Trình soạn tab (giáo viên) ---------- */
.tab-editor-list .tab-row { display: flex; align-items: center; gap: .6rem; padding: .55rem .65rem; border-radius: 9px; border: 1px solid transparent; text-decoration: none; color: var(--c-text); }
.tab-editor-list .tab-row:hover { background: var(--c-line-soft); }
.tab-editor-list .tab-row.active { background: var(--c-primary-50); border-color: var(--c-primary-100); color: var(--c-primary); font-weight: 700; }
.tab-editor-list .tab-row.hidden-tab { opacity: .55; }
.tab-editor-list .tab-row .type { font-size: .68rem; margin-left: auto; }
.editor-shell .tox-tinymce { border-radius: var(--r-md) !important; border-color: var(--c-line) !important; }
.icon-pick { display: flex; flex-wrap: wrap; gap: .35rem; }
.icon-pick label { width: 38px; height: 38px; border: 1px solid var(--c-line); border-radius: 8px; display: grid; place-items: center; cursor: pointer; font-size: 1.1rem; }
.icon-pick input { display: none; }
.icon-pick input:checked + label { border-color: var(--c-primary); background: var(--c-primary-50); color: var(--c-primary); }

/* ---------- Trang chủ ---------- */
.home-hero { border-radius: 20px; background: radial-gradient(1200px 400px at 85% -10%, rgba(255, 217, 138, .22), transparent 60%), linear-gradient(135deg, #003b25, #006841 65%, #0b8657); color: #fff; padding: 3rem 3rem; position: relative; overflow: hidden; }
.home-hero h1 { color: #fff; font-size: clamp(1.8rem, 3.2vw, 2.6rem); font-weight: 800; line-height: 1.15; }
.home-hero .lead { color: rgba(255, 255, 255, .86); font-size: 1.08rem; max-width: 620px; }
.home-hero .kicker { display: inline-flex; gap: .45rem; align-items: center; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2); padding: .3rem .8rem; border-radius: 999px; font-size: .8rem; font-weight: 700; color: #ffd98a; }
.home-hero .feature { display: inline-flex; gap: .4rem; align-items: center; font-size: .85rem; color: rgba(255, 255, 255, .9); margin-right: 1rem; }
.home-join { background: #fff; color: var(--c-text); border-radius: var(--r-lg); padding: 1.5rem; box-shadow: 0 20px 40px rgba(0, 0, 0, .18); }
.home-join h2 { font-size: 1.15rem; }
.home-section-title { text-align: center; margin: 3rem 0 1.5rem; }
.home-section-title h2 { font-size: 1.6rem; }
.home-section-title p { color: var(--c-muted); }
.feature-card { background: #fff; border: 1px solid var(--c-line); border-radius: var(--r-lg); padding: 1.4rem; height: 100%; transition: box-shadow .2s, transform .2s; text-decoration: none; color: inherit; display: block; }
.feature-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); color: inherit; }
.feature-card .ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; margin-bottom: .85rem; background: var(--c-primary-50); color: var(--c-primary); }
.feature-card h3 { font-size: 1.08rem; }
.feature-card p { color: var(--c-muted); font-size: .92rem; margin: 0; }
.subject-card { display: flex; gap: 1rem; align-items: center; background: #fff; border: 1px solid var(--c-line); border-radius: var(--r-lg); padding: 1.1rem 1.25rem; text-decoration: none; color: inherit; height: 100%; }
.subject-card:hover { border-color: var(--c-primary); color: inherit; }
.subject-card .ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 1.5rem; color: #fff; flex-shrink: 0; }

/* ---------- Đăng nhập ---------- */
.auth-wrap { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 560px; background: #fff; border-radius: 20px; overflow: hidden; border: 1px solid var(--c-line); box-shadow: var(--shadow-2); max-width: 1040px; margin: 0 auto; }
.auth-side { background: linear-gradient(160deg, #00452b, #006841 60%, #0b8657); color: #fff; padding: 2.5rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h2 { color: #fff; font-size: 1.6rem; }
.auth-side p, .auth-side li { color: rgba(255, 255, 255, .85); }
.auth-side ul { list-style: none; padding: 0; }
.auth-side li { display: flex; gap: .6rem; margin-bottom: .6rem; }
.auth-side li i { color: #ffd98a; }
.auth-form { padding: 2.5rem; }
.auth-form h1 { font-size: 1.5rem; }
.auth-tabs { display: flex; background: var(--c-line-soft); border-radius: 10px; padding: 4px; margin-bottom: 1.5rem; }
.auth-tabs button { flex: 1; border: 0; background: transparent; padding: .5rem; border-radius: 8px; font-weight: 700; color: var(--c-muted); }
.auth-tabs button.active { background: #fff; color: var(--c-primary); box-shadow: var(--shadow-1); }
@media (max-width: 767.98px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } .auth-form { padding: 1.5rem; } }

/* ---------- Sổ điểm ---------- */
.gradebook-wrap { overflow-x: auto; border: 1px solid var(--c-line); border-radius: var(--r-md); background: #fff; }
.gradebook { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.gradebook th, .gradebook td { border-bottom: 1px solid var(--c-line-soft); border-right: 1px solid var(--c-line-soft); padding: .35rem .45rem; text-align: center; white-space: nowrap; }
.gradebook thead th { background: #f1f6f3; position: sticky; top: 0; z-index: 2; font-size: .78rem; color: var(--c-ink); }
.gradebook .sticky-col { position: sticky; left: 0; background: #fff; z-index: 1; text-align: left; min-width: 210px; }
.gradebook thead .sticky-col { z-index: 3; background: #f1f6f3; }
.gradebook input.score { width: 58px; text-align: center; border: 1px solid transparent; border-radius: 6px; padding: .2rem; font-weight: 600; background: transparent; }
.gradebook input.score:hover { border-color: var(--c-line); }
.gradebook input.score:focus { border-color: var(--c-primary); background: #fff; outline: 0; box-shadow: 0 0 0 2px rgba(0, 104, 65, .15); }
.gradebook input.score.dirty { background: #fff8e1; }
.gradebook input.score.invalid { border-color: var(--c-danger); background: #fdecec; }
.gradebook .from-exam { position: relative; }
.gradebook .from-exam::after { content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--c-info); }
.gradebook .avg { font-weight: 800; color: var(--c-primary); }
.gradebook .avg.low { color: var(--c-danger); }

/* ---------- OMR ---------- */
.omr-stage { position: relative; background: #1f2421; border-radius: var(--r-md); overflow: hidden; min-height: 260px; display: grid; place-items: center; }
.omr-stage canvas { max-width: 100%; height: auto; display: block; }
.omr-review-cell.flag { background: #fff4dd !important; }
.omr-grid { font-size: .85rem; }
.omr-grid select, .omr-grid input { font-size: .85rem; padding: .15rem .3rem; }

/* ---------- Thông báo & hộp thoại (ghi đè) ---------- */
.edu-toast-container { position: fixed; top: 80px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: .5rem; }
.edu-toast { display: flex; gap: .6rem; align-items: center; background: #fff; border: 1px solid var(--c-line); border-left: 4px solid var(--c-primary); border-radius: 10px; padding: .7rem 1rem; box-shadow: var(--shadow-2); min-width: 280px; max-width: 420px; opacity: 0; transform: translateX(20px); transition: all .3s; }
.edu-toast.show { opacity: 1; transform: none; }
.edu-toast.toast-success i { color: var(--c-primary); }
.edu-toast.toast-warning { border-left-color: #e0a100; } .edu-toast.toast-warning i { color: #b86e00; }
.edu-toast.toast-danger { border-left-color: var(--c-danger); } .edu-toast.toast-danger i { color: var(--c-danger); }
.edu-toast.toast-info { border-left-color: var(--c-info); } .edu-toast.toast-info i { color: var(--c-info); }
.edu-modal-footer { display: flex; gap: .5rem; justify-content: flex-end; }

/* ---------- Chân trang ---------- */
.app-footer { background: #fff; border-top: 1px solid var(--c-line); padding: 2.25rem 0 1.25rem; margin-top: 2rem; }
.app-footer a { display: block; color: var(--c-muted); text-decoration: none; font-size: .9rem; margin-bottom: .3rem; }
.app-footer a:hover { color: var(--c-primary); }
.app-footer-title { font-weight: 800; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: .6rem; color: var(--c-ink); }
.app-footer-bottom { border-top: 1px solid var(--c-line-soft); margin-top: 1.5rem; padding-top: 1rem; font-size: .82rem; color: var(--c-muted); }

/* ---------- Chế độ máy chiếu ---------- */
body.classroom-projector-mode { font-size: 1.18rem; }
body.classroom-projector-mode .rich-content { font-size: 1.25rem; color: #000; }
body.classroom-projector-mode .code-window pre { font-size: 1.12rem; }

/* ---------- In ấn ---------- */
@media print {
    .app-topbar, .app-navbar, .app-sidenav, .app-footer, .lesson-tabs, .lesson-aside, .no-print { display: none !important; }
    .lesson-pane { display: block !important; }
    .app-main { padding: 0; }
    body { background: #fff; }
}
.form-check-input:checked { background-color: var(--c-primary); border-color: var(--c-primary); }
.form-check-input:focus { border-color: var(--c-primary); box-shadow: 0 0 0 .2rem rgba(0, 104, 65, .15); }
.progress-bar.bg-success { background-color: var(--c-primary) !important; }
.code-window pre code, .code-window pre code.hljs { padding: 0 !important; margin: 0 !important; display: block; background: transparent !important; border: 0 !important; overflow: visible; }
.omr-grid select[data-p2] { min-width: 56px; padding-right: 1.6rem; }
code { color: #6b2fbf; } .code-window code { color: inherit; }

/* =====================================================================
   1.0.3 — Thành phần mới + đồng bộ các trang cũ + tối ưu điện thoại
   ===================================================================== */
.callout-info { background: #edf5ff; border-color: #c7dcf5; }
.callout-info::before { content: "\F431"; color: var(--c-info); }
.section-title { font-size: 1rem; font-weight: 800; color: var(--c-ink); margin: 0 0 .75rem; }
.app-card-footer { padding: .75rem 1.25rem; border-top: 1px solid var(--c-line); }
details.app-card > summary { cursor: pointer; list-style: none; }
details.app-card > summary::-webkit-details-marker { display: none; }
details.app-card > summary h2::after { content: " ▾"; color: var(--c-muted); font-size: .8em; }
.app-sidenav-version { margin: 1.5rem .65rem 0; font-size: .72rem; color: #8a9790; }
@media (max-width: 991.98px) { .app-sidenav-version { display: none; } }

/* Thanh lọc + thống kê nhanh */
.filter-bar { padding: 1rem 1.25rem; }
.filter-bar .form-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--c-muted); margin-bottom: .3rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.stat { background: #fff; border: 1px solid var(--c-line); border-radius: var(--r-md); padding: .8rem 1rem; display: flex; flex-direction: column; text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--c-primary-100); box-shadow: var(--shadow-1); color: inherit; }
.stat-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--c-muted); }
.stat-value { font-size: 1.45rem; font-weight: 800; color: var(--c-ink); line-height: 1.25; }
.stat-value small { font-size: .78rem; font-weight: 600; color: var(--c-muted); }

/* Phân trang */
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; }
.pager-info { font-size: .85rem; color: var(--c-muted); }
.pagination { --bs-pagination-color: var(--c-text); --bs-pagination-active-bg: var(--c-primary); --bs-pagination-active-border-color: var(--c-primary); --bs-pagination-hover-color: var(--c-primary); --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgba(0, 104, 65, .15); }
.pagination .page-link { min-width: 2.1rem; text-align: center; }

/* Điểm */
.score-badge { display: inline-block; min-width: 3.2rem; text-align: center; font-weight: 800; padding: .25rem .55rem; border-radius: 8px; font-variant-numeric: tabular-nums; }
.score-hi { background: var(--c-primary); color: #fff; }
.score-good { background: var(--c-primary-50); color: var(--c-primary-700); }
.score-mid { background: var(--c-accent-50); color: #8a5300; }
.score-low { background: #fdecec; color: var(--c-danger); }
.display-score { font-size: 3rem; font-weight: 800; color: var(--c-primary); line-height: 1.1; }
.display-score span { font-size: 1.1rem; color: var(--c-muted); font-weight: 600; }

/* Ngân hàng câu hỏi */
.q-list { display: flex; flex-direction: column; }
.q-item { padding: 1rem 1.25rem; border-bottom: 1px solid var(--c-line-soft); }
.q-item:last-child { border-bottom: 0; }
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-bottom: .5rem; }
.q-topic { font-size: .8rem; color: var(--c-muted); }
.q-actions { margin-left: auto; display: flex; gap: .25rem; }
.q-content { font-weight: 600; color: var(--c-ink); margin-bottom: .5rem; white-space: normal; }
.q-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
.q-opt { position: relative; padding: .45rem .65rem; border: 1px solid var(--c-line); border-radius: 8px; background: #fafbfa; font-size: .92rem; }
.q-opt.correct { background: var(--c-primary-50); border-color: var(--c-primary-100); color: var(--c-primary-700); font-weight: 600; }
.q-opt-rate { position: absolute; right: .5rem; top: .45rem; font-size: .72rem; color: var(--c-muted); font-weight: 700; }
.q-tf > div { display: flex; justify-content: space-between; gap: .5rem; padding: .3rem 0; border-bottom: 1px dashed var(--c-line); font-size: .92rem; }
.q-answer { font-size: .92rem; margin-top: .25rem; }
.q-explain { font-size: .85rem; color: var(--c-muted); margin-top: .4rem; }
.q-flags { font-size: .82rem; color: var(--c-danger); margin-top: .4rem; }
.level-pill.level-NB { background: #e8f1fb; color: var(--c-info); }
.level-pill.level-TH { background: var(--c-primary-50); color: var(--c-primary); }
.level-pill.level-VD { background: var(--c-accent-50); color: #8a5300; }
.level-pill.level-VDC { background: #fdecec; color: var(--c-danger); }

/* Phân tích câu hỏi */
.ia-table td { vertical-align: top; }
.ia-flag { background: #fffaf3; }
.ia-q { font-weight: 600; color: var(--c-ink); max-width: 420px; }
.ia-bar { height: 6px; border-radius: 3px; background: var(--c-line-soft); margin-bottom: .3rem; overflow: hidden; }
.ia-bar span { display: block; height: 100%; background: var(--c-primary); }
.ia-opts { display: grid; gap: .2rem; }
.ia-opt { display: grid; grid-template-columns: 1.2rem 1fr 2.6rem; align-items: center; gap: .35rem; font-size: .8rem; }
.ia-opt .k { font-weight: 800; color: var(--c-muted); }
.ia-opt .bar { height: 8px; background: var(--c-line-soft); border-radius: 4px; overflow: hidden; }
.ia-opt .bar span { display: block; height: 100%; background: #9fb0a7; }
.ia-opt.correct .k, .ia-opt.correct .v { color: var(--c-primary); }
.ia-opt.correct .bar span { background: var(--c-primary); }
.ia-opt .v { text-align: right; font-variant-numeric: tabular-nums; }

/* Bài tập về nhà */
.hw-list { display: flex; flex-direction: column; }
.hw-row { display: grid; grid-template-columns: 220px 1fr 230px; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--c-line-soft); align-items: start; }
.hw-row[hidden] { display: none; }
.hw-who { display: flex; gap: .6rem; align-items: flex-start; }
.hw-seq { width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--c-line-soft); display: grid; place-items: center; font-weight: 800; font-size: .8rem; color: var(--c-muted); flex-shrink: 0; }
.hw-text { font-size: .92rem; max-height: 180px; overflow: auto; background: #fafbfa; border: 1px solid var(--c-line-soft); border-radius: 8px; padding: .5rem .7rem; margin-bottom: .5rem; }
.hw-files { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; }
.hw-thumb img { width: 88px; height: 88px; object-fit: cover; border-radius: 8px; border: 1px solid var(--c-line); }
.hw-file { font-size: .85rem; padding: .3rem .55rem; border: 1px solid var(--c-line); border-radius: 8px; background: #fff; text-decoration: none; }
.hw-box { margin-top: 1.5rem; padding: 1rem 1.15rem; border: 1px dashed var(--c-primary-100); border-radius: var(--r-md); background: #fbfdfc; }
.hw-box-head { font-weight: 800; color: var(--c-ink); margin-bottom: .5rem; }
.task-list { display: flex; flex-direction: column; gap: .5rem; }
.task-card { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .85rem 1rem; background: #fff; border: 1px solid var(--c-line); border-radius: var(--r-md); text-decoration: none; color: inherit; min-height: 56px; }
.task-card + .task-card { margin-top: 0; }
.hw-box .task-card { margin-top: .5rem; }
.task-card:hover { border-color: var(--c-primary-100); box-shadow: var(--shadow-1); color: inherit; }
.task-title { font-weight: 700; color: var(--c-ink); }
.task-meta { font-size: .82rem; color: var(--c-muted); }
.task-side { flex-shrink: 0; }
@media (max-width: 991.98px) {
    .hw-row { grid-template-columns: 1fr; gap: .6rem; }
}

/* Trạng thái mạng */
.net-status { position: fixed; left: 50%; transform: translateX(-50%); bottom: 1rem; z-index: 100001; background: #7a1c1c; color: #fff; padding: .6rem 1rem; border-radius: 999px; font-weight: 700; font-size: .88rem; box-shadow: var(--shadow-2); max-width: calc(100vw - 2rem); text-align: center; }
.net-status.ok { background: var(--c-primary); }
.exam-lockdown-active .net-status { bottom: 5rem; }

/* ---------- Đồng bộ các trang cũ (kiểu Bootstrap mặc định) với giao diện mới ---------- */
.app-main > .d-flex.flex-wrap.justify-content-between.align-items-center.mb-4:first-child h3,
.app-main > .d-flex.justify-content-between.align-items-center.mb-4:first-child h3 { font-size: 1.55rem; font-weight: 800; color: var(--c-ink) !important; margin-bottom: .2rem !important; }
.app-main > .d-flex.mb-4:first-child h3 > i.bi:first-child { display: none; }
.app-main > .d-flex.mb-4:first-child p.text-muted { font-size: .95rem; }
main .card.border-0, main .card.shadow-sm, main .card.shadow { border: 1px solid var(--c-line) !important; border-radius: var(--r-lg) !important; box-shadow: var(--shadow-1) !important; }
main .card-header.bg-white, main .card-header.bg-light { background: #fff !important; border-bottom: 1px solid var(--c-line) !important; padding: 1rem 1.25rem; }
main .card-header h5.fw-bold, main .card-header h6.fw-bold { font-size: 1.02rem; }
main .card-header.bg-dark, main .card-header.bg-primary, main .card-header.bg-success, main .modal-header.bg-dark, main .modal-header.bg-primary { background: #fff !important; color: var(--c-ink) !important; border-bottom: 1px solid var(--c-line); }
main .card-header.bg-dark .text-white, main .card-header.bg-primary .text-white, main .modal-header.bg-dark .text-white, main .modal-header.bg-dark .modal-title { color: var(--c-ink) !important; }
main .modal-header.bg-dark .btn-close-white { filter: none; }
main .rounded-4 { border-radius: var(--r-lg) !important; }
main .stats-card { background: #fff; border: 1px solid var(--c-line); border-radius: var(--r-md); padding: .9rem 1rem; box-shadow: none; height: 100%; }
main .stats-card .stats-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 1.1rem; }
main .stats-card small.fw-bold { font-size: .7rem; letter-spacing: .05em; color: var(--c-muted) !important; }
main .btn.shadow-sm, main .btn.shadow { box-shadow: none !important; }
main .btn.fw-bold { font-weight: 600 !important; }
main .btn-success:not(.exam-mobile-bar .btn) { --bs-btn-bg: var(--c-primary); --bs-btn-border-color: var(--c-primary); --bs-btn-hover-bg: var(--c-primary-600); --bs-btn-hover-border-color: var(--c-primary-600); }
main .btn-outline-secondary, main .btn-outline-primary, main .btn-outline-success { --bs-btn-color: var(--c-text); --bs-btn-border-color: var(--c-line); --bs-btn-hover-bg: var(--c-line-soft); --bs-btn-hover-color: var(--c-ink); --bs-btn-hover-border-color: var(--c-line); background: #fff; }
main .btn-outline-danger { --bs-btn-border-color: #f2c9c9; background: #fff; }
main .btn-warning { --bs-btn-bg: var(--c-accent-50); --bs-btn-border-color: #f6dca6; --bs-btn-color: #8a5300; --bs-btn-hover-bg: #ffecc7; --bs-btn-hover-border-color: #f6dca6; }
main .btn-danger:not([onclick*="Edu"]) { --bs-btn-bg: #fff; --bs-btn-color: var(--c-danger); --bs-btn-border-color: #f2c9c9; --bs-btn-hover-bg: #fdecec; --bs-btn-hover-color: var(--c-danger); --bs-btn-hover-border-color: #f2c9c9; }
main .badge.bg-primary-subtle, main .badge.bg-success-subtle, main .badge.bg-secondary-subtle, main .badge.bg-warning-subtle, main .badge.bg-danger-subtle, main .badge.bg-info-subtle, main .badge.bg-light { border-radius: 999px; font-weight: 700; }
main .table-light, main thead.table-light th { --bs-table-bg: #f3f6f4; }
main .alert { border-radius: var(--r-md); }
main .form-label.small.fw-bold.text-secondary { font-size: .75rem; letter-spacing: .04em; }

/* ---------- Bảng thành thẻ trên điện thoại ---------- */
@media (max-width: 767.98px) {
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr { border-bottom: 1px solid var(--c-line); padding: .6rem .9rem; }
    .table-stack > :not(caption) > * > * { padding: .2rem 0; border: 0; }
    .table-stack td[data-label] { display: flex; justify-content: space-between; gap: 1rem; text-align: right !important; }
    .table-stack td[data-label]::before { content: attr(data-label); font-size: .75rem; font-weight: 700; color: var(--c-muted); text-transform: uppercase; text-align: left; flex-shrink: 0; }
    .table-stack td:not([data-label]) { text-align: right !important; padding-top: .4rem; }
    .q-options { grid-template-columns: 1fr; }
    .q-actions { margin-left: 0; width: 100%; }
    .page-header .actions { width: 100%; }
    .page-header .actions > .btn, .page-header .actions > a.btn { flex: 1 1 auto; }
    .filter-bar { padding: .85rem; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-value { font-size: 1.2rem; }
    .app-card-header { padding: .85rem 1rem; }
}

/* ---------- Phòng thi trên điện thoại ---------- */
.exam-mobile-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040; display: flex; align-items: center; gap: .5rem; padding: .55rem .75rem calc(.55rem + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--c-line); box-shadow: 0 -4px 16px rgba(20, 35, 28, .08); }
.exam-mobile-bar .btn { min-height: 44px; font-weight: 700; }
.emb-timer { font-family: var(--font-mono); font-weight: 800; font-size: 1.25rem; color: var(--c-ink); min-width: 4.2rem; }
.emb-timer.urgent { color: var(--c-danger); }
.emb-progress { font-size: .85rem; font-weight: 700; color: var(--c-muted); margin-right: auto; }
.exam-sheet-backdrop { display: none; }
@media (max-width: 991.98px) {
    .exam-lockdown-active main { padding-bottom: 5.5rem !important; }
    .exam-lockdown-active .single-question-pane .form-check, .exam-lockdown-active .option-label-box { min-height: 48px; }
    .exam-lockdown-active .option-label-box { padding: .8rem 1rem !important; font-size: 1rem; }
    .exam-lockdown-active .single-question-pane input[type=radio] { width: 1.3em; height: 1.3em; }
    .exam-lockdown-active .single-question-pane input[type=text], .exam-lockdown-active .single-question-pane textarea { font-size: 16px; } /* iOS không tự phóng to */
    #btnPrevQuestion, #btnNextQuestion { flex: 1; min-height: 48px; }
    #navIndicator { display: none; }
    .exam-lockdown-active .card.p-4 { padding: 1rem !important; }
    .exam-side-panel { display: none; position: fixed !important; left: 0; right: 0; bottom: 0; top: auto !important; z-index: 1050; max-height: 75vh; overflow-y: auto; border-radius: 18px 18px 0 0 !important; padding: 1.25rem !important; }
    body.exam-sheet-open .exam-side-panel { display: block; }
    body.exam-sheet-open .exam-sheet-backdrop { display: block; position: fixed; inset: 0; background: rgba(20, 35, 28, .45); z-index: 1045; }
    .exam-side-panel #questionPaletteGrid .palette-btn { width: 48px !important; height: 48px !important; }
}

/* ---------- Bài học & thao tác chung trên điện thoại ---------- */
@media (max-width: 575.98px) {
    html { font-size: 15px; }
    .page-header h1 { font-size: 1.3rem; }
    .lesson-pane .pane-nav { flex-direction: column-reverse; gap: .5rem; }
    .lesson-pane .pane-nav .btn { width: 100%; min-height: 46px; }
    .rich-content table { display: block; overflow-x: auto; }
    .code-window pre { font-size: .82rem; }
    .gradebook .sticky-col { min-width: 150px; }
    .modal-dialog { margin: .5rem; }
}

/* ---------- Quét phiếu OMR liên tục bằng camera ---------- */
.ix-match-board { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; align-items: start; }
.ix-match-col { display: flex; flex-direction: column; gap: .45rem; min-width: 0; }
.ix-match-head { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--c-primary, #006A4E); padding: .25rem .4rem; border-bottom: 2px solid var(--c-primary-100, #d1e7dd); }
.ix-match-list { display: flex; flex-direction: column; gap: .5rem; }
.ix-match-row-a, .ix-match-item { display: flex; align-items: center; gap: .55rem; min-height: 54px; padding: .48rem .7rem; border: 1.5px solid var(--ix-bd, #dee2e6); border-radius: 12px; background: var(--ix-bg, #fff); font-size: .92rem; transition: border-color .18s, background-color .18s, transform .12s; }
.ix-match-row-a { font-weight: 600; }
.ix-match-num, .ix-match-let { min-width: 26px; height: 26px; padding: 0 .35rem; border-radius: 7px; display: inline-grid; place-items: center; font-size: .82rem; font-weight: 800; background: var(--ix-tag, #006A4E); color: #fff; flex-shrink: 0; }
.ix-match-arrow { color: var(--ix-tag, #6c757d); flex-shrink: 0; font-size: .85rem; opacity: .75; }
.ix-match-item { cursor: grab; user-select: none; }
.ix-match-item:active { cursor: grabbing; }
/* Màu đồng bộ theo thứ tự từng hàng ghép (Cột A & Cột B cùng hàng có cùng màu) */
.ix-match-list > :nth-child(6n+1):not(.is-extra) { --ix-bg: #e1eefb; --ix-bd: #5e97d1; --ix-tag: #2b6cb0; }
.ix-match-list > :nth-child(6n+2):not(.is-extra) { --ix-bg: #d9efea; --ix-bd: #4e9a8a; --ix-tag: #2c7a6b; }
.ix-match-list > :nth-child(6n+3):not(.is-extra) { --ix-bg: #f6e7c8; --ix-bd: #c68d2c; --ix-tag: #b7791f; }
.ix-match-list > :nth-child(6n+4):not(.is-extra) { --ix-bg: #e9e0fb; --ix-bd: #8a6cd9; --ix-tag: #6b46c1; }
.ix-match-list > :nth-child(6n+5):not(.is-extra) { --ix-bg: #fce4ec; --ix-bd: #d86b90; --ix-tag: #c2185b; }
.ix-match-list > :nth-child(6n+6):not(.is-extra) { --ix-bg: #dcf2fc; --ix-bd: #3b9ec9; --ix-tag: #0284c7; }
.ix-match-item.is-extra { --ix-bg: #f8f9fa; --ix-bd: #cbd5e1; --ix-tag: #94a3b8; opacity: .82; border-style: dashed; }
.ix-match-item .ix-extra-tag { display: none; font-size: .7rem; font-weight: 700; padding: .12rem .4rem; border-radius: 6px; background: #e2e8f0; color: #475569; flex-shrink: 0; }
.ix-match-item.is-extra .ix-extra-tag { display: inline-block; }
.ix-match-item.is-good { --ix-bg: #d1e7dd; --ix-bd: #198754; --ix-tag: #157347; }
.ix-match-item.is-bad { --ix-bg: #f8d7da; --ix-bd: #dc3545; --ix-tag: #b02a37; }

/* Câu sắp xếp: màu chuyển xanh pastel từ trên xuống dưới + số thứ tự 1, 2, 3, 4... cố định */
.ix-order, .ix-ol { display: flex; flex-direction: column; gap: .5rem; padding-left: 0; }
.ix-order .list-group-item, .ix-ol .list-group-item { border-radius: 12px !important; border: 1.5px solid var(--ix-ord-bd, #7b9d74) !important; background: var(--ix-ord-bg, #e2ecdc); color: #14231c; font-weight: 600; padding: .6rem .8rem; cursor: grab; transition: background-color .18s, border-color .18s; }
.ix-order .list-group-item:active, .ix-ol .list-group-item:active { cursor: grabbing; }
.ix-order .list-group-item::before, .ix-ol .list-group-item::before { content: counter(section); min-width: 28px; height: 28px; border-radius: 7px; background: #fff; border: 1.5px solid #2d4739; display: inline-grid; place-items: center; font-weight: 800; font-size: .85rem; color: #14231c; flex-shrink: 0; margin-right: .25rem; }
.ix-order .list-group-item:nth-child(1), .ix-ol .list-group-item:nth-child(1) { --ix-ord-bg: #e2ecdc; --ix-ord-bd: #84a57c; }
.ix-order .list-group-item:nth-child(2), .ix-ol .list-group-item:nth-child(2) { --ix-ord-bg: #cde0c5; --ix-ord-bd: #6e9468; }
.ix-order .list-group-item:nth-child(3), .ix-ol .list-group-item:nth-child(3) { --ix-ord-bg: #b7d2ad; --ix-ord-bd: #588152; }
.ix-order .list-group-item:nth-child(4), .ix-ol .list-group-item:nth-child(4) { --ix-ord-bg: #9fc295; --ix-ord-bd: #456e3f; }
.ix-order .list-group-item:nth-child(5), .ix-ol .list-group-item:nth-child(5) { --ix-ord-bg: #8db582; --ix-ord-bd: #396034; }
.ix-order .list-group-item:nth-child(n+6), .ix-ol .list-group-item:nth-child(n+6) { --ix-ord-bg: #7ca871; --ix-ord-bd: #2e5329; }
.ix-ol .list-group-item.list-group-item-success { --ix-ord-bg: #d1e7dd; --ix-ord-bd: #198754; }
.ix-ol .list-group-item.list-group-item-danger { --ix-ord-bg: #f8d7da; --ix-ord-bd: #dc3545; }
.ix-order .ix-up, .ix-order .ix-down, .ix-ol .ix-up, .ix-ol .ix-down, .ix-match-item .ix-up, .ix-match-item .ix-down { background: rgba(255,255,255,.72); border: 1px solid rgba(0,0,0,.08); padding: .15rem .45rem; }
@media (max-width: 767.98px) { .ix-match-board { grid-template-columns: 1fr; } .ix-match-arrow { display: none; } }
.omr-live[hidden] { display: none; }
body.omr-live-open { overflow: hidden; }
.omr-live video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.omr-live-frame { position: absolute; inset: 9% 7% 16%; pointer-events: none; }
.omr-live-frame span { position: absolute; width: 38px; height: 38px; border: 4px solid #fff; opacity: .9; }
.omr-live-frame span:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; }
.omr-live-frame span:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; }
.omr-live-frame span:nth-child(3) { right: 0; bottom: 0; border-left: 0; border-top: 0; }
.omr-live-frame span:nth-child(4) { left: 0; bottom: 0; border-right: 0; border-top: 0; }
.omr-live-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: calc(.75rem + env(safe-area-inset-top)) 1rem .75rem; background: linear-gradient(rgba(0,0,0,.55), transparent); color: #fff; }
.omr-live-count { font-weight: 800; font-size: 1.05rem; }
.omr-live-status { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(6.5rem + env(safe-area-inset-bottom)); background: rgba(0,0,0,.7); color: #fff; padding: .55rem 1rem; border-radius: 999px; font-weight: 700; text-align: center; max-width: calc(100% - 2rem); }
.omr-live-status.ok { background: var(--c-primary); }
.omr-live-status.warn { background: #8a5300; }
.omr-live-last { position: absolute; left: 1rem; right: 1rem; bottom: calc(4.6rem + env(safe-area-inset-bottom)); color: #fff; text-align: center; font-size: .85rem; text-shadow: 0 1px 3px #000; }
.omr-live-done { position: absolute; left: 1rem; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); min-height: 52px; }
@media (max-width: 991.98px) { .q-part-head { font-size: .85rem; } .q-part-head > span { flex: 1 1 100%; } }

/* =====================================================================
   1.0.4 — Menu trái thu gọn / cuộn trong khối, chân trang, thông báo
   ===================================================================== */
.app-sidenav { display: flex; flex-direction: column; padding: .6rem .6rem 0; overflow: hidden; transition: width .18s ease; }
.app-sidenav-scroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; overscroll-behavior: contain; padding-bottom: 1rem;
    -webkit-mask-image: linear-gradient(#000 calc(100% - 24px), transparent); mask-image: linear-gradient(#000 calc(100% - 24px), transparent); }
.app-sidenav-scroll::-webkit-scrollbar { display: none; }
.app-sidenav-toggle { display: flex; align-items: center; gap: .6rem; width: 100%; border: 0; background: transparent; color: var(--c-muted); font-size: .8rem; font-weight: 700; padding: .45rem .65rem; border-radius: 8px; margin-bottom: .25rem; }
.app-sidenav-toggle:hover { background: var(--c-line-soft); color: var(--c-ink); }
.app-sidenav-toggle i { transition: transform .18s; font-size: 1rem; }
button.app-sidenav-group { display: flex; width: calc(100% - 1.2rem); justify-content: space-between; align-items: center; border: 0; background: transparent; padding: 0; text-align: left; font: inherit; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: #8a9790; margin: 1rem .6rem .35rem; }
button.app-sidenav-group i { font-size: .75rem; transition: transform .18s; }
button.app-sidenav-group[aria-expanded="false"] i { transform: rotate(-90deg); }
.app-sidenav-items[hidden] { display: none; }
.app-sidenav-scroll > button.app-sidenav-group:first-child { margin-top: .25rem; }
.app-sidenav-version { margin: 0 -.6rem; padding: .6rem 1.25rem; border-top: 1px solid var(--c-line-soft); background: #fff; }
.has-admin-nav .app-main { padding-bottom: 4.5rem; }
/* Thu gọn: chỉ còn biểu tượng */
@media (min-width: 992px) {
    .nav-collapsed .app-sidenav { width: 64px; }
    .nav-collapsed .app-sidenav-link span, .nav-collapsed .app-sidenav-toggle span, .nav-collapsed button.app-sidenav-group, .nav-collapsed .app-sidenav-version { display: none; }
    .nav-collapsed .app-sidenav-items[hidden] { display: block; }
    .nav-collapsed .app-sidenav-link { justify-content: center; padding: .6rem 0; position: relative; }
    .nav-collapsed .app-sidenav-link .badge { position: absolute; top: 2px; right: 2px; font-size: .6rem; }
    .nav-collapsed .app-sidenav-items + button + .app-sidenav-items, .nav-collapsed .app-sidenav-items { border-top: 1px solid var(--c-line-soft); padding-top: .25rem; margin-top: .25rem; }
    .nav-collapsed .app-sidenav-toggle { justify-content: center; }
    .nav-collapsed .app-sidenav-toggle i { transform: rotate(180deg); }
}
@media (max-width: 991.98px) {
    .app-sidenav { flex-direction: row; padding: .5rem; }
    .app-sidenav-toggle, .app-sidenav-version, button.app-sidenav-group { display: none; }
    .app-sidenav-scroll { display: flex; gap: .25rem; overflow-x: auto; overflow-y: hidden; -webkit-mask-image: none; mask-image: none; padding-bottom: 0; }
    .app-sidenav-items, .app-sidenav-items[hidden] { display: contents; }
    .has-admin-nav .app-main { padding-bottom: 5rem; }
}

/* Chân trang quản trị cố định */
.admin-footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1020; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: .45rem 1.25rem; background: var(--c-primary); color: rgba(255, 255, 255, .85); font-size: .78rem; }
.admin-footer a { color: #fff; text-decoration: none; }
.admin-footer a:hover { text-decoration: underline; }

/* Chân trang chung nền xanh như thanh đầu trang */
.app-footer { background: var(--c-primary); color: rgba(255, 255, 255, .85); border-top: 0; }
.app-footer strong, .app-footer .app-footer-title { color: #fff; }
.app-footer .text-muted, .app-footer .small.text-muted { color: rgba(255, 255, 255, .78) !important; }
.app-footer a { color: rgba(255, 255, 255, .82); }
.app-footer a:hover { color: #fff; }
.app-footer-bottom { border-top-color: rgba(255, 255, 255, .18); color: rgba(255, 255, 255, .72); }
.app-footer .app-brand-logo { background: #fff; }

/* Chuông thông báo */
.notif-dot { position: absolute; top: -4px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--c-accent); color: #2b1a00; font-size: .68rem; font-weight: 800; line-height: 18px; text-align: center; }
.notif-menu { width: min(360px, 92vw); }
.notif-head, .notif-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .65rem .9rem; border-bottom: 1px solid var(--c-line-soft); }
.notif-foot { border-bottom: 0; border-top: 1px solid var(--c-line-soft); flex-direction: column; align-items: stretch; text-align: center; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { display: block; padding: .6rem .9rem; border-bottom: 1px solid var(--c-line-soft); text-decoration: none; color: var(--c-text); font-size: .88rem; }
.notif-item:hover { background: var(--c-line-soft); color: var(--c-ink); }
.notif-item.unread { background: #f3faf6; }
.notif-item.unread .notif-title::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c-primary); margin-right: .4rem; vertical-align: middle; }
.notif-title { font-weight: 700; color: var(--c-ink); }
.notif-time { font-size: .74rem; color: var(--c-muted); }
.gradebook th.draft-col { background: #fff8e8 !important; color: #8a5300; font-style: italic; }
.gradebook td.draft-col { background: repeating-linear-gradient(135deg, #fffdf6, #fffdf6 6px, #fff8e8 6px, #fff8e8 12px); }
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .3rem .75rem; }
.member-chip { display: flex; gap: .45rem; align-items: center; padding: .3rem .45rem; border-radius: 8px; cursor: pointer; font-size: .9rem; }
.member-chip:hover { background: var(--c-line-soft); }
.member-chip input:checked + span { font-weight: 700; color: var(--c-primary); }

/* 1.0.4 — Nhập đề */
.qi-drop{display:flex;flex-direction:column;align-items:center;justify-content:center;border:2px dashed var(--bs-border-color);border-radius:14px;padding:34px 16px;cursor:pointer;text-align:center;transition:.15s}
.qi-drop:hover,.qi-drop.drag{border-color:#16a34a;background:rgba(22,163,74,.06)}
.qi-sticky{position:sticky;top:64px;z-index:5}
.qi-card.border-warning{border-left:4px solid #f59e0b!important}
.qi-guide code{font-size:.8em}
/* 1.0.4 — Tạo đề */
.eb-method .btn-check:checked+.btn{background:#166534;color:#fff;border-color:#166534}
.eb-grid td,.eb-grid th{text-align:center;vertical-align:middle}
.eb-grid input{width:64px;margin:auto;text-align:center}
.eb-grid .stock{font-size:.72rem;color:var(--bs-secondary-color)}
.eb-picked{max-height:420px;overflow:auto}
.eb-bank{max-height:520px;overflow:auto}
.eb-bank .item,.eb-picked .item{border-bottom:1px solid var(--bs-border-color-translucent);padding:6px 4px;font-size:.86rem}
/* 1.0.4 — Chấm trên ảnh / PDF */
.an-toolbar{position:sticky;top:64px;z-index:6}
.an-toolbar .btn.active{background:#166534;color:#fff}
.an-color span{display:inline-block;width:14px;height:14px;border-radius:50%;vertical-align:middle}
.an-color.active{outline:2px solid #166534;background:#fff!important}
#anPages{display:flex;flex-direction:column;align-items:center;gap:16px;padding-bottom:40px}
.an-page{position:relative;max-width:100%;box-shadow:0 2px 12px rgba(0,0,0,.15);background:#fff}
.an-page canvas{display:block;max-width:100%;height:auto}
.an-page .an-draw{position:absolute;inset:0;width:100%;height:100%;touch-action:none;cursor:crosshair}
#annot[data-tool=text] .an-draw{cursor:text}
#annot[data-tool=eraser] .an-draw{cursor:cell}
.hw-annot{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}
.hw-annot a{position:relative}
.hw-annot a img{height:84px;border-radius:6px;border:2px solid #16a34a}
.hw-annot .tag{position:absolute;left:4px;top:4px;background:#16a34a;color:#fff;font-size:.65rem;padding:1px 5px;border-radius:4px}
/* 1.0.4 — Thống kê bài học */
.lesson-stats{gap:6px;align-items:center;margin-right:10px;font-size:.78rem}
.lesson-stat{color:var(--bs-secondary-color);white-space:nowrap}
.lesson-stats .badge{font-weight:600}
/* 1.0.4 — Video tương tác */
.ivideo{border:1px solid var(--bs-border-color);border-radius:14px;overflow:hidden;margin:1rem 0;background:#0b1410}
.iv-head{color:#d1fae5;padding:8px 12px;font-weight:600;font-size:.92rem}
.iv-count{font-weight:400;opacity:.8}
.iv-stage{position:relative;aspect-ratio:16/9;background:#000}
.iv-stage iframe,.iv-stage video,.iv-player{position:absolute;inset:0;width:100%;height:100%}
.iv-overlay{position:absolute;inset:0;background:rgba(6,20,14,.78);display:flex;align-items:center;justify-content:center;padding:16px;z-index:2}
.iv-q{background:var(--bs-body-bg);color:var(--bs-body-color);border-radius:12px;padding:16px 18px;max-width:560px;width:100%;max-height:100%;overflow:auto;box-shadow:0 10px 30px rgba(0,0,0,.4)}
.iv-blank{display:inline-block;min-width:60px;border-bottom:2px solid #16a34a}
.iv-track{position:relative;height:8px;background:#1f2d27}
.iv-bar{height:100%;background:#16a34a;width:0}
.iv-mark{position:absolute;top:-3px;width:14px;height:14px;margin-left:-7px;border-radius:50%;background:#facc15;border:2px solid #0b1410}
.iv-mark.ok{background:#22c55e}.iv-mark.bad{background:#ef4444}
.ivideo[contenteditable=false],.mce-content-body .ivideo{background:#ecfdf5;color:#065f46;padding:10px 14px;cursor:pointer}

/* 1.0.5 — Văn bản soạn tay (RichText): thẻ ghi nhớ, lời giải, nhận xét */
.rt{line-height:1.6}
.rt .rt-p{margin:0 0 .4em}
.rt .rt-list{margin:0 0 .5em;padding-left:1.7em;text-align:left}
.rt .rt-list li{padding-left:.25em;margin-bottom:.2em}
.rt .rt-list li::marker{font-weight:600}
.rt .rt-math{margin:.4em 0;overflow-x:auto;text-align:center}
.rt .rt-code{background:#1e1f29;color:#f8f8f2;border-radius:8px;padding:.6em .8em;font-size:.88em;text-align:left;white-space:pre;overflow-x:auto}
.rt code{background:rgba(0,0,0,.06);padding:0 .25em;border-radius:4px}
.fc-rich .rt{text-align:center}
.fc-rich .rt .rt-list{display:inline-block;text-align:left}
#cardBackText .rt{text-align:left}
.flashcard-3d-inner .card-face{overflow-y:auto}

/* 1.0.6 — Giám sát khi thi: khoá chọn chữ, dấu chìm tên thí sinh, huy hiệu webcam */
body.exam-nocopy .single-question-pane, body.exam-nocopy .question-content { -webkit-user-select: none; user-select: none; }
body.exam-nocopy input, body.exam-nocopy textarea { -webkit-user-select: text; user-select: text; }
.exam-watermark { position: fixed; inset: -20vh -20vw; z-index: 50; pointer-events: none; transform: rotate(-24deg); color: rgba(0, 104, 65, .055);
  font: 600 15px/42px system-ui, sans-serif; word-spacing: 18px; overflow: hidden; white-space: normal; user-select: none; }
.exam-cam-badge { position: fixed; left: 12px; bottom: 12px; z-index: 1060; background: rgba(15, 23, 42, .86); color: #fff; font-size: 12px; padding: 5px 10px; border-radius: 999px; }
@media print { .exam-watermark { color: rgba(0, 0, 0, .12); } }

/* 1.0.6 — Hỏi đáp trong bài học */
.lc-list { max-height: 460px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px; scroll-behavior: auto; }
.lc-msg { background: var(--bs-light, #f6f8f7); border-radius: 12px; padding: 8px 12px; max-width: 88%; align-self: flex-start; }
.lc-msg.mine { align-self: flex-end; background: #e7f5ee; }
.lc-msg.teacher { border-left: 3px solid #006841; }
.lc-msg.answer { box-shadow: 0 0 0 2px #0ea5e9 inset; }
.lc-head { font-size: .85rem; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lc-time { color: #8a9590; font-size: .75rem; margin-left: auto; }
.lc-text { white-space: normal; word-break: break-word; margin-top: 2px; }
.lc-quote { font-size: .78rem; color: #6b7a73; border-left: 2px solid #c9d6cf; padding-left: 6px; margin-top: 2px; }
.lc-act { display: flex; gap: 10px; margin-top: 2px; }
.lc-act button { border: 0; background: none; padding: 0; font-size: .75rem; color: #6b7a73; }
.lc-act button:hover { color: #006841; text-decoration: underline; }
.lc-del { font-style: italic; color: #9aa5a0; font-size: .85rem; }
