/* =========================================================
   Sách giáo khoa màu – lớp giao diện đè lên lms.css (19/11/2026)
   Ý tưởng: sách giáo khoa và vở ô li của học sinh THCS.
   - Mỗi khối một màu như bìa sách: 6 xanh dương, 7 xanh lá, 8 cam, 9 tím.
     Trang thuộc một khóa học nhận màu của khối qua <body data-grade="…">.
   - Điểm nhấn duy nhất: đầu trang là một "trang vở" (dòng kẻ xanh, lề đỏ).
   - Tiêu đề Baloo 2 (bo tròn, thân thiện), nội dung Be Vietnam Pro.
   - Nền lạnh và sáng; không dùng chữ có chân, không viết hoa giãn chữ.
   Muốn quay lại giao diện gốc của thầy Hiệp: bỏ dòng <link> sgk.css ở layouts/.
   ========================================================= */
:root {
    --ink: #1b2a41;
    --ink-2: #3a4a63;
    --muted: #63728a;
    --bg: #f3f6fb;
    --surface: #ffffff;
    --surface-2: #f6f8fc;
    --line: #dfe6f0;
    --line-2: #c9d4e3;

    /* Màu các khối */
    --g6: #2d7ff9;
    --g6-deep: #1a5fc9;
    --g6-soft: #e6f0ff;
    --g7: #1c9a66;
    --g7-deep: #127650;
    --g7-soft: #e2f5ec;
    --g8: #e8760b;
    --g8-deep: #b85a04;
    --g8-soft: #fdeedd;
    --g9: #8a4fd0;
    --g9-deep: #6a35a8;
    --g9-soft: #f1e8fb;

    /* Màu chủ đạo = màu khối đang xem (mặc định khối 6) */
    --brand: var(--g6);
    --brand-deep: var(--g6-deep);
    --brand-soft: var(--g6-soft);
    --accent: var(--ink);
    --accent-soft: #e8edf5;

    /* Vở ô li, bút dạ quang */
    --rule: #d6e4f5;
    --margin-red: #e35d5d;
    --marker: #ffd43b;

    --ok: #18794e;
    --ok-soft: #dcf3e7;
    --warn: #8a5800;
    --warn-soft: #fff1c7;
    --danger: #c0352b;
    --danger-soft: #fde6e3;
    --info: #1f5f99;
    --info-soft: #e5eff9;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow: none;
    --shadow-md: 0 10px 30px rgba(27, 42, 65, 0.12);
    --display: "Baloo 2", "Be Vietnam Pro", "Segoe UI", sans-serif;
}

body[data-grade="7"] { --brand: var(--g7); --brand-deep: var(--g7-deep); --brand-soft: var(--g7-soft); }
body[data-grade="8"] { --brand: var(--g8); --brand-deep: var(--g8-deep); --brand-soft: var(--g8-soft); }
body[data-grade="9"] { --brand: var(--g9); --brand-deep: var(--g9-deep); --brand-soft: var(--g9-soft); }

/* ---------- Chữ ---------- */
body { font-size: 15.5px; }
h1, h2, h3, h4 {
    font-family: var(--display);
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.2;
}
.panel h2 { font-size: 1.3rem; }
.panel h3 { font-size: 1.1rem; }
.stat .value { font-family: var(--display); font-size: 1.9rem; line-height: 1.1; }
a { color: var(--brand-deep); }
a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--marker); outline-offset: 2px; }

/* Nhãn nhỏ: chữ thường, không giãn chữ */
.side-title,
.hero-kicker,
.kicker {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.82rem;
    font-weight: 600;
}

/* ---------- Thương hiệu, thanh bên ---------- */
.brand-mark {
    border-radius: 50%;
    font-family: var(--display);
    font-size: 1rem;
    background: var(--brand);
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}
.brand-text strong { font-family: var(--display); font-size: 1.12rem; }

.sidebar { border-right: 0; box-shadow: 1px 0 0 var(--line); }
.side-title { color: var(--muted); padding: 8px 12px 4px; }
.side-link {
    position: relative;
    border-radius: 0 999px 999px 0;
    margin-left: -10px;
    padding: 9px 12px 9px 20px;
    font-weight: 500;
}
.side-link:hover { background: var(--surface-2); }
/* Mục đang mở: như tab đánh dấu trang của sách */
.side-link.is-active { background: var(--brand-soft); color: var(--brand-deep); }
.side-link.is-active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 5px;
    border-radius: 0 4px 4px 0;
    background: var(--brand);
}
.avatar { background: var(--brand); color: #fff; font-family: var(--display); }

.app-header { background: rgba(255, 255, 255, 0.97); border-bottom: 1px solid var(--line); }
.app-header-title { font-family: var(--display); font-size: 1.08rem; color: var(--ink); }
.app-header-meta { background: var(--surface-2); }

/* ---------- Đầu trang: trang vở ô li ---------- */
.app .hero {
    position: relative;
    margin-bottom: 20px;
    padding: 18px 22px 20px 64px;
    border-radius: var(--radius);
    color: var(--ink);
    background-color: var(--surface);
    background-image:
        linear-gradient(90deg, transparent 43px, var(--margin-red) 43px, var(--margin-red) 45px, transparent 45px),
        repeating-linear-gradient(180deg, transparent 0, transparent 27px, var(--rule) 27px, var(--rule) 28px);
    background-position: 0 0, 0 12px;
    border: 1px solid var(--line);
    border-top: 6px solid var(--brand);
}
.app .hero-kicker { color: var(--brand-deep); }
.app .hero-kicker a { color: inherit; }
.app .hero h1 { font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.15; margin: 2px 0 6px; }
.app .hero p { color: var(--ink-2); font-size: 0.98rem; line-height: 28px; margin: 0; }
.app .hero-actions { margin-top: 14px; }

/* ---------- Khối nội dung ---------- */
.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.stat {
    border: 2px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px 12px;
}
.stat .label { font-size: 0.85rem; }
a.stat:hover { border-color: var(--brand); box-shadow: none; }

/* Ô bài học, khóa học: viền dày phía dưới như nhãn dán */
.course-tile {
    border: 2px solid var(--line);
    border-bottom-width: 4px;
    border-radius: var(--radius);
    padding: 14px 16px;
}
.course-tile:hover { border-color: var(--line-2); }

/* Mã bài (B01…) trong ô tròn màu khối */
.lesson-badge {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand-deep);
    font-family: var(--display);
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
}
.lesson-badge.is-done { background: var(--brand); color: #fff; }
.tile-main { display: flex; align-items: center; gap: 14px; min-width: 0; }

/* ---------- Nút ---------- */
.btn {
    border-radius: 999px;
    padding: 8px 18px;
    border-width: 2px;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.16);
    transition: background .15s ease, border-color .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); box-shadow: none; }
.btn-secondary:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-deep); }
.btn-accent { background: var(--ink); border-color: var(--ink); }
.btn-accent:hover { background: #0f1b2d; border-color: #0f1b2d; }
.btn-sm { padding: 4px 12px; }
table.data .btn, table.data .btn-accent { border-width: 1px; box-shadow: none; }

/* ---------- Nhãn, thông báo, bảng, ô nhập ---------- */
.chip, .pill { font-weight: 600; padding: 2px 10px; }
.flash { border-radius: var(--radius-sm); border-left: 5px solid var(--ok); }
.flash-error { border-left-color: var(--danger); }
table.data th { background: var(--surface-2); color: var(--ink-2); font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 0.85rem; }
table.data tbody tr:hover td { background: var(--brand-soft); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url],
input[type=date], input[type=datetime-local], input[type=file], input[type=search], select, textarea {
    border-radius: var(--radius-sm);
    border-width: 1.5px;
}

/* Nhãn "Mới": nét bút dạ quang */
.chip-new { background: var(--marker); color: var(--ink); }

/* ---------- Làm bài ---------- */
.quiz-gate { background: rgba(27, 42, 65, 0.9); }
.quiz-gate-card { border-radius: var(--radius); border-top: 6px solid var(--brand); }
.quiz-gate-warning { background: var(--warn-soft); color: var(--warn); border-radius: var(--radius-sm); }
.qz-option { border-radius: var(--radius-sm); }
.qz-qlink.is-answered { background: var(--brand-soft); color: var(--brand-deep); }

/* ---------- Trang công khai ---------- */
body.site { background: var(--bg); }
.masthead {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 0 18px;
    margin-bottom: 28px;
}
.masthead-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ink);
}
.masthead-brand::before {
    content: attr(data-mark);
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: 0.95rem;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}
.masthead-brand:hover { text-decoration: none; }
.masthead-meta { flex: 1; color: var(--muted); font-size: 0.9rem; }
.masthead-nav { display: flex; gap: 16px; align-items: center; }
.masthead-nav a:not(.btn) { color: var(--ink); font-weight: 500; }
.masthead-nav a.is-active { color: var(--brand-deep); }

/* Trang chủ: trang vở mở đầu, bên cạnh là bốn bìa sách Tin học 6–9 */
.edition {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 28px;
    align-items: stretch;
}
.edition-main {
    padding: 30px 30px 32px 78px;
    border-radius: 18px;
    border: 1px solid var(--line);
    border-top: 8px solid var(--brand);
    background-color: var(--surface);
    background-image:
        linear-gradient(90deg, transparent 52px, var(--margin-red) 52px, var(--margin-red) 54px, transparent 54px),
        repeating-linear-gradient(180deg, transparent 0, transparent 31px, var(--rule) 31px, var(--rule) 32px);
    background-position: 0 0, 0 18px;
}
.edition h1 { margin: 0 0 12px; font-size: clamp(2rem, 4.6vw, 3rem); line-height: 1.08; }
.lede { margin: 0; max-width: 44ch; font-size: 1.1rem; line-height: 32px; color: var(--ink-2); }
.edition-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

.shelf { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.book-cover {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 132px;
    padding: 14px 14px 14px 22px;
    border-radius: 6px 14px 14px 6px;
    color: #fff;
    background: var(--cover);
    box-shadow: inset 8px 0 0 rgba(0, 0, 0, 0.16);
}
.book-cover .grade-num { font-family: var(--display); font-size: clamp(1.6rem, 3.4vw, 2.4rem); font-weight: 700; line-height: 1.05; }
.book-cover .grade-name { font-weight: 600; font-size: 0.95rem; }
.book-cover small { opacity: 0.9; font-size: 0.8rem; }
.cover-6 { --cover: var(--g6); }
.cover-7 { --cover: var(--g7); }
.cover-8 { --cover: var(--g8); }
.cover-9 { --cover: var(--g9); }

.facts { display: flex; flex-wrap: wrap; gap: 10px 26px; margin: 22px 0 0; padding: 0; }
.facts div { display: flex; align-items: baseline; gap: 6px; }
.facts dt { order: 2; margin: 0; color: var(--muted); font-size: 0.92rem; }
.facts dd { order: 1; margin: 0; font-family: var(--display); font-size: 1.6rem; font-weight: 700; color: var(--ink); }

.features { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 28px; }
.features article {
    padding: 18px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 2px solid var(--line);
}
.features h3 { margin: 12px 0 6px; font-size: 1.12rem; }
.features p { margin: 0; color: var(--ink-2); font-size: 0.95rem; line-height: 1.6; }
.round-icon {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--tint, var(--g6-soft));
    color: var(--tone, var(--g6-deep));
}
.round-icon .ico { width: 22px; height: 22px; }
.tone-6 { --tint: var(--g6-soft); --tone: var(--g6-deep); }
.tone-7 { --tint: var(--g7-soft); --tone: var(--g7-deep); }
.tone-8 { --tint: var(--g8-soft); --tone: var(--g8-deep); }
.tone-9 { --tint: var(--g9-soft); --tone: var(--g9-deep); }

/* ---------- Đăng nhập, đổi mật khẩu ---------- */
.auth-wrap { padding: 8px 0; }
.auth-card {
    width: min(440px, 100%);
    border-radius: 18px;
    border: 1px solid var(--line);
    border-top: 8px solid var(--brand);
    background: var(--surface);
    padding: 26px 28px 24px;
}
.auth-card h1 { margin: 4px 0 6px; font-size: 2rem; }
.kicker { color: var(--brand-deep); }
.footer-note { border-top: 1px solid var(--line); padding-top: 14px; }

/* ---------- Tổng quan lớp (thanh tiến độ, phân bố điểm) ---------- */
.dash-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr) auto;
    gap: 14px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dashed var(--line-2);
}
.dash-row:last-child { border-bottom: 0; }
.dash-bar { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.dash-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.dash-num { min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; }

.dist { display: flex; height: 12px; min-width: 150px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.dist i, .dist-legend i { display: block; }
.dist i { height: 100%; }
.d-low { background: var(--danger); }
.d-mid { background: #f0a020; }
.d-good { background: #5dbb63; }
.d-high { background: var(--ok); }
.dist-count { margin-top: 3px; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.dist-legend { display: flex; flex-wrap: wrap; gap: 16px; margin: 4px 0 8px; font-size: 0.82rem; color: var(--muted); }
.dist-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dist-legend i { width: 10px; height: 10px; border-radius: 50%; }

/* ---------- Tiến độ học ---------- */
.lesson-progress {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    border: 2px dashed var(--brand);
    background: var(--brand-soft);
}
.lesson-progress form { margin: 0; }
.progress-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Bài tập nộp tệp ---------- */
.submission-row {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.2fr) minmax(0, 1.4fr);
    gap: 10px 18px;
    align-items: start;
    padding: 14px 0;
    border-bottom: 1px dashed var(--line-2);
}
.submission-row:last-child { border-bottom: 0; }
.submission-row:target { background: var(--brand-soft); border-radius: var(--radius-sm); }
.submission-row .chip { margin-top: 6px; margin-right: 4px; }
.submission-text { white-space: pre-wrap; margin-top: 6px; max-height: 12em; overflow: auto; }
.submission-grade label { display: block; margin: 0 0 6px; font-weight: 500; }
.submission-grade input, .submission-grade textarea { margin-top: 4px; }
.submission-row > form:last-child:not(.submission-grade) { grid-column: 3; margin: 0; }
.assignment-card { border-top: 1px dashed var(--line-2); padding-top: 14px; margin-top: 14px; }
.assignment-card:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.assignment-instructions { white-space: pre-wrap; margin: 8px 0; }

/* ---------- Câu tự luận ---------- */
.qz-essay {
    display: block;
    width: 100%;
    min-height: 10em;
    margin-top: 8px;
    padding: 6px 12px;
    font: inherit;
    line-height: 28px;
    resize: vertical;
    /* Ô trả lời kẻ dòng như vở */
    background-color: #fff;
    background-image: repeating-linear-gradient(180deg, transparent 0, transparent 27px, var(--rule) 27px, var(--rule) 28px);
    background-position: 0 5px;
    background-attachment: local;
}
.essay-answer {
    white-space: pre-wrap;
    line-height: 28px;
    padding: 4px 12px 4px 20px;
    margin: 8px 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background-color: #fff;
    background-image:
        linear-gradient(90deg, transparent 9px, var(--margin-red) 9px, var(--margin-red) 10px, transparent 10px),
        repeating-linear-gradient(180deg, transparent 0, transparent 27px, var(--rule) 27px, var(--rule) 28px);
    background-position: 0 0, 0 3px;
}
.essay-guide { white-space: pre-wrap; font-size: 0.9rem; }
.essay-grade { display: grid; grid-template-columns: 9em minmax(0, 1fr); gap: 8px 12px; align-items: start; }

/* ---------- Màn hình hẹp ---------- */
@media (max-width: 900px) {
    .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .submission-row { grid-template-columns: minmax(0, 1fr); }
    .submission-row > form:last-child:not(.submission-grade) { grid-column: auto; }
    .edition { grid-template-columns: minmax(0, 1fr); }
    .masthead-meta { display: none; }
    .masthead { justify-content: space-between; }
}
@media (max-width: 640px) {
    .essay-grade { grid-template-columns: minmax(0, 1fr); }
    .app .hero { padding: 16px 16px 18px 52px; background-image:
        linear-gradient(90deg, transparent 33px, var(--margin-red) 33px, var(--margin-red) 35px, transparent 35px),
        repeating-linear-gradient(180deg, transparent 0, transparent 27px, var(--rule) 27px, var(--rule) 28px); }
    .edition-main { padding: 24px 18px 26px 54px; background-image:
        linear-gradient(90deg, transparent 36px, var(--margin-red) 36px, var(--margin-red) 38px, transparent 38px),
        repeating-linear-gradient(180deg, transparent 0, transparent 31px, var(--rule) 31px, var(--rule) 32px); }
    .course-tile { flex-direction: column; align-items: stretch; }
}
@media (max-width: 520px) {
    .features { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
    .btn, .sidebar { transition: none; }
}

/* Ô tròn mang màu một khối cụ thể (trang chủ học sinh, giáo viên) */
.lesson-badge.tone-6, .lesson-badge.tone-7, .lesson-badge.tone-8, .lesson-badge.tone-9 { background: var(--tone); color: #fff; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.grade-card { border-top: 6px solid var(--tone); }
/* Thẻ lớp: nút và đường kẻ trong thẻ mang màu khối của lớp */
.grade-card.tone-6 { --brand: var(--g6); --brand-deep: var(--g6-deep); --brand-soft: var(--g6-soft); }
.grade-card.tone-7 { --brand: var(--g7); --brand-deep: var(--g7-deep); --brand-soft: var(--g7-soft); }
.grade-card.tone-8 { --brand: var(--g8); --brand-deep: var(--g8-deep); --brand-soft: var(--g8-soft); }
.grade-card.tone-9 { --brand: var(--g9); --brand-deep: var(--g9-deep); --brand-soft: var(--g9-soft); }

/* ---------- Môn học ---------- */
.subject-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--brand-deep);
    margin-bottom: 2px;
}
.subject-heading { margin: 26px 0 12px; font-family: var(--display); }
.subject-heading:first-of-type { margin-top: 6px; }

/* ---------- Danh sách lớp, nhóm (M2) ---------- */
.roster-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 12px; }
.roster-tools input[type=search] { max-width: 320px; }
.roster-tools form { display: flex; gap: 8px; align-items: center; }
.roster-tools form label { margin: 0; white-space: nowrap; }
table.sortable th[data-sort] { cursor: pointer; user-select: none; }
table.sortable th[aria-sort="ascending"]::after { content: " ▲"; font-size: .7em; }
table.sortable th[aria-sort="descending"]::after { content: " ▼"; font-size: .7em; }
td.is-low { color: var(--danger); font-weight: 700; }
.print-only { display: none; }

.group-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 18px; }
.group-col { margin: 0; display: flex; flex-direction: column; gap: 8px; min-height: 160px; transition: box-shadow .15s, border-color .15s; }
.group-col.is-over { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.group-col.is-unassigned { background: var(--bg); border-style: dashed; }
.group-head { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.group-head select { grid-column: 1 / -1; }
.group-head button { grid-row: 1; grid-column: 2; }
.group-title { margin: 0; }
.group-count { font-size: .85rem; }
.group-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 40px; }
.group-card { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: grab; }
.group-card.is-dragging { opacity: .45; }
.group-card .group-name { font-weight: 600; }
.group-move { grid-column: 1 / -1; margin: 0; }
.group-move select { padding: 2px 6px; font-size: .8rem; min-height: 0; }
.member-list { columns: 2; padding-left: 18px; }

@media print {
    .sidebar, .app-header, .nav-toggle, .no-print, .flash, .masthead { display: none !important; }
    .app-shell, .app-main, main { margin: 0 !important; padding: 0 !important; }
    .hero { box-shadow: none; border: 0; padding: 0; }
    .panel { box-shadow: none; border: 0; padding: 0; }
    .print-only { display: block; }
    table.data { font-size: 11pt; }
    table.data th, table.data td { border: 1px solid #999; padding: 3px 6px; }
}
#roster-table td:nth-child(3), #homeroom-table td:first-child { white-space: nowrap; }

/* ---------- Nội dung giáo viên tự tạo ---------- */
.item-list { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 8px; }
.item-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.item-row.is-heading { background: var(--brand-soft); border-color: transparent; }
.item-row.is-dragging { opacity: .45; }
.drag-handle { cursor: grab; color: var(--muted); font-size: 1.2rem; line-height: 1.6; user-select: none; }
.item-main details { margin-top: 6px; }
.item-main details > :not(summary) { margin-top: 8px; padding: 10px; border-left: 3px solid var(--brand-soft); }
.item-kind { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--brand-deep); background: var(--brand-soft); border-radius: 999px; padding: 1px 8px; margin-right: 4px; vertical-align: 2px; }
.add-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding-top: 12px; border-top: 1px dashed var(--line); }
.lesson-items .lesson-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.lesson-items .lesson-item:last-child { border-bottom: 0; }
.lesson-items .item-heading { margin: 18px 0 4px; font-family: var(--display); color: var(--brand-deep); }
.lesson-items .item-heading:first-child { margin-top: 0; }
.rich-content img { max-width: 100%; height: auto; border-radius: 8px; }
.rich-content table { border-collapse: collapse; margin: 8px 0; }
.rich-content th, .rich-content td { border: 1px solid var(--line); padding: 4px 8px; min-width: 40px; }
.rich-content blockquote { border-left: 4px solid var(--brand-soft); margin: 8px 0; padding: 4px 12px; color: var(--muted); }
.pre-wrap { white-space: pre-wrap; }
.discussion { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.discussion-post { padding: 8px 12px; border-radius: 10px; background: var(--bg); }
.link-btn { background: none; border: 0; padding: 0; color: var(--danger); text-decoration: underline; cursor: pointer; font: inherit; }
.rich-editor { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.rich-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 2; }
.rich-toolbar button { min-width: 32px; height: 30px; border: 1px solid transparent; border-radius: 6px; background: transparent; font: inherit; font-weight: 700; font-size: .85rem; cursor: pointer; color: var(--ink); }
.rich-toolbar button:hover, .rich-toolbar button:focus-visible { background: var(--surface); border-color: var(--line); }
.rich-sep { width: 1px; background: var(--line); margin: 4px 4px; }
.rich-area { min-height: 260px; max-height: 70vh; overflow: auto; padding: 12px 14px; outline: none; }
.rich-area:focus { box-shadow: inset 0 0 0 2px var(--brand-soft); }
.rich-editor.is-html textarea { display: block; width: 100%; min-height: 260px; border: 0; border-radius: 0; font-family: ui-monospace, monospace; font-size: .85rem; }
.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; }

/* ---------- Hoạt động (M3) ---------- */
.live-counts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.live-counts .stat { padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.access-code { font-family: ui-monospace, monospace; font-size: 1.6rem; font-weight: 800; letter-spacing: .2em; color: var(--brand-deep); background: var(--marker); padding: 0 10px; border-radius: 6px; }
.activity-chip { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-deep); }
.todo-group { margin-top: 18px; }
.todo-group h2 { font-size: 1.05rem; }
.todo-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.todo-item:last-child { border-bottom: 0; }
.nav-badge { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; text-align: center; line-height: 20px; }
.inline-checks { border: 0; padding: 0; margin: 10px 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.inline-checks legend { font-weight: 600; margin-bottom: 4px; }
.assignee-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 12px; max-height: 300px; overflow: auto; margin: 6px 0 10px; }
.assignee-grid .check { margin: 2px 0; font-weight: 400; }
.peer-box { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--bg); }
.peer-box h4 { margin: 0 0 6px; }
.peer-item { padding: 8px 0; border-top: 1px dashed var(--line); }
.peer-item:first-of-type { border-top: 0; }

/* ---------- Học liệu (M4) ---------- */
.embed-frame, .pdf-view iframe { position: relative; width: 100%; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg); }
.embed-frame { aspect-ratio: 16 / 10; margin: 8px 0; }
.embed-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.pdf-view { margin: 8px 0; }
.pdf-view iframe { height: 75vh; min-height: 420px; margin-top: 8px; }
.media-video { width: 100%; max-height: 70vh; border-radius: 12px; background: #000; margin: 8px 0; }
.media-image { max-width: 100%; max-height: 70vh; border-radius: 10px; cursor: zoom-in; margin: 8px 0; display: block; }
.quota { margin-top: 10px; max-width: 520px; }
.quota-bar { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.quota-bar span { display: block; height: 100%; background: var(--brand); }
.quota-bar span.is-full { background: var(--danger); }
.copy-box { display: inline-block; position: relative; }
.copy-box > summary { list-style: none; }
.copy-box > summary::-webkit-details-marker { display: none; }
.copy-box form { position: absolute; right: 0; z-index: 5; min-width: 220px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.12); }

/* ---------- Tin nhắn (M5) ---------- */
.chat { display: grid; grid-template-columns: 320px 1fr; gap: 14px; height: calc(100vh - 120px); min-height: 480px; }
.chat .panel { margin: 0; display: flex; flex-direction: column; min-height: 0; }
.chat-list-head { margin-bottom: 8px; }
.chat-new { display: flex; gap: 6px; margin-bottom: 10px; }
.chat-new select { flex: 1; min-width: 0; }
.chat-items { overflow: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -8px; }
.chat-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 10px; border-radius: 10px; color: inherit; text-decoration: none; }
.chat-item:hover { background: var(--bg); }
.chat-item.is-active { background: var(--brand-soft); }
.chat-item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item-last { grid-column: 1 / -1; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-thread { padding-bottom: 12px; }
.chat-empty { margin: auto; }
.chat-head { display: flex; gap: 10px; align-items: center; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.chat-back { display: none; text-decoration: none; font-size: 1.3rem; }
.chat-messages { flex: 1; overflow: auto; padding: 12px 4px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 75%; align-self: flex-start; }
.msg.is-mine { align-self: flex-end; text-align: right; }
.msg-meta { font-size: .72rem; color: var(--muted); margin: 0 6px 2px; }
.msg-body { display: inline-block; text-align: left; padding: 8px 12px; border-radius: 14px; background: var(--bg); white-space: pre-wrap; word-break: break-word; }
.msg.is-mine .msg-body { background: var(--brand); color: #fff; }
.msg-body.is-deleted { font-style: italic; color: var(--muted); background: transparent; border: 1px dashed var(--line); }
.msg.is-mine .msg-body.is-deleted { color: var(--muted); background: transparent; }
.msg.is-reported .msg-body { outline: 3px solid var(--danger); }
.msg-actions { font-size: .72rem; margin: 2px 6px 0; display: flex; gap: 8px; }
.msg.is-mine .msg-actions { justify-content: flex-end; }
.msg-actions .link-btn { color: var(--muted); }
.chat-compose { display: flex; gap: 8px; align-items: flex-end; padding-top: 8px; border-top: 1px solid var(--line); }
.chat-compose textarea { flex: 1; resize: vertical; min-height: 44px; max-height: 160px; }
@media (max-width: 760px) {
    .chat { grid-template-columns: 1fr; height: auto; }
    .chat.has-thread .chat-list { display: none; }
    .chat:not(.has-thread) .chat-thread { display: none; }
    .chat-thread { height: calc(100vh - 110px); }
    .chat-back { display: inline; }
    .msg { max-width: 88%; }
}

/* ---------- Đề định kỳ (M6) ---------- */
#cells-table select { min-width: 0; max-width: 260px; }
tr.is-short td { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.stat.is-bad strong { color: var(--danger); }
.paper > summary { cursor: pointer; }
.paper-items { padding-left: 22px; }
.paper-items > li { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.paper-opts { list-style: none; padding-left: 8px; margin: 4px 0; }
.paper-opts li.is-correct { color: var(--ok); font-weight: 600; }
.paper-opts li.is-correct::after { content: " ✓"; }
.review-item { padding: 10px 0; border-top: 1px solid var(--line); }
.warn-box { margin: 10px 0; padding: 8px 12px; border-radius: 10px; background: var(--warn-soft, #fff4e0); color: var(--ink); }
.warn-box summary { cursor: pointer; font-weight: 600; }
.warn-box ul { margin: 6px 0 0; padding-left: 20px; font-size: .9rem; }
.qz-short { width: 100%; max-width: 420px; font-size: 1.05rem; padding: 10px 12px; }

/* ---------- Phụ huynh (M7) ---------- */
.parent-course > summary { cursor: pointer; }
.progress-line { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-line span { display: block; height: 100%; background: var(--brand); }
.link-card { border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; break-inside: avoid; }
.link-card .code { font: 800 1.5rem/1.2 ui-monospace, monospace; letter-spacing: .18em; }
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
@media print { .link-grid { grid-template-columns: 1fr 1fr; } }
