/* EduMate – giao diện bản 2: gọn, chuyên nghiệp.
   Xanh bảng (#0F5A4C) là màu thương hiệu và mọi nút chính; vàng phấn chỉ dùng để đánh dấu mục đang chọn và nút trong vùng xanh;
   đỏ chỉ dành cho cảnh báo và điểm dưới trung bình. Mỗi khối nội dung là một mặt trắng trên nền xám nhạt. */
:root {
  --xanh: #0f5a4c;
  --xanh-dam: #0a4338;
  --xanh-nhat: #e4f1ed;
  --vang: #f2b632;
  --vang-nhat: #fff5d9;
  --nen: #f1f4f3;
  --mat: #fff;
  --chu: #15201d;
  --mo: #5b6966;
  --vien: #dce3e0;
  --do: #c2362e;
  --do-nhat: #fbeae8;
  --bong: 0 1px 2px rgba(15, 40, 34, .06), 0 0 0 1px rgba(15, 40, 34, .05);
  --chinh: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --day-cao: 62px;
  /* tên cũ còn dùng trong vài chỗ của app.js / cong.css */
  --muc: var(--xanh); --muc-dam: var(--xanh-dam); --muc-nhat: var(--xanh-nhat); --tay: var(--chinh); --bang: #1f4d42; --bang-dam: #173a32; --phan: #f4f1e4;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--chu); font: 400 15.5px/1.55 var(--chinh); background: var(--nen); min-height: 100dvh; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: var(--xanh); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--vang); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
svg.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dang-mo { padding: 40vh 0 0; text-align: center; color: var(--mo); }

/* ---------- Khung ứng dụng ---------- */
.so { padding-bottom: calc(var(--day-cao) + 20px + env(safe-area-inset-bottom)); }
.gay { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; padding: 0 16px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--vien); }
.ten-so { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 18px; letter-spacing: -.01em; color: var(--xanh-dam); text-decoration: none; }
.ten-so i { width: 30px; height: 30px; border-radius: 9px; background: var(--xanh); display: grid; place-items: center; }
.ten-so i::after { content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--vang); box-shadow: 0 0 0 3px rgba(255, 255, 255, .22); }
.toi { width: 38px; height: 38px; border-radius: 50%; background: var(--xanh-nhat); color: var(--xanh-dam); font-weight: 700; font-size: 14px; display: grid; place-items: center; text-decoration: none; }
.trang { max-width: 880px; margin: 0 auto; padding: 18px 16px 24px; }

.the { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: flex; background: var(--mat); border-top: 1px solid var(--vien); padding: 0 4px env(safe-area-inset-bottom); height: calc(var(--day-cao) + env(safe-area-inset-bottom)); }
.the .the-ten { display: none; }
.the a { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--mo); font-size: 11.5px; font-weight: 600; }
.the a span { display: grid; place-items: center; width: 52px; height: 28px; border-radius: 999px; }
.the a[aria-current="page"] { color: var(--xanh-dam); font-weight: 700; }
.the a[aria-current="page"] span { background: var(--xanh-nhat); color: var(--xanh); }

/* ---------- Chữ và tiêu đề ---------- */
.tua { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; margin: 4px 0 16px; }
.tua small { display: block; font-size: 14.5px; font-weight: 400; letter-spacing: 0; line-height: 1.5; color: var(--mo); margin-top: 6px; max-width: 62ch; }
.de { font-size: 16px; font-weight: 700; margin: 26px 2px 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.de a, .de button.chu { font-weight: 600; font-size: 13.5px; text-decoration: none; padding: 0; }
.mo { color: var(--mo); }
.nho { font-size: 13.5px; }
.do { color: var(--do); }
.lui { display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 600; color: var(--mo); text-decoration: none; padding: 6px 0; }
.lui::before { content: "‹"; font-size: 18px; line-height: 1; }
.but-do { background: var(--vang-nhat); color: #5a4200; border-radius: 10px; padding: 11px 14px; margin: 12px 0; font-size: 14.5px; }
.but-do b { font-weight: 700; }
.but-do a, .but-do .chu { color: inherit; font-weight: 600; }
.trong { padding: 16px; color: var(--mo); background: var(--mat); border-radius: 12px; box-shadow: var(--bong); }

/* ---------- Danh sách mục ---------- */
.muc { list-style: none; margin: 0 0 4px; padding: 0; background: var(--mat); border-radius: 12px; box-shadow: var(--bong); overflow: hidden; }
.muc + .muc { margin-top: 10px; }
.muc li + li { border-top: 1px solid var(--vien); }
.muc a, .muc button:not(.chu) { width: 100%; display: grid; grid-template-columns: 1fr 18px; column-gap: 10px; align-items: center; padding: 13px 14px 13px 16px; min-height: 56px; text-decoration: none; color: inherit; background: none; border: 0; text-align: left; cursor: pointer; }
.muc a:hover { background: #f7faf9; }
.muc a::after { content: ""; grid-column: 2; grid-row: 1 / span 2; width: 8px; height: 8px; border-right: 2px solid #9aa8a4; border-top: 2px solid #9aa8a4; transform: rotate(45deg); }
.muc .ten { grid-column: 1; font-weight: 600; overflow-wrap: anywhere; }
.muc .phu { grid-column: 1; font-size: 13.5px; color: var(--mo); overflow-wrap: anywhere; }
.muc .cham { display: none; }
.muc .xep { display: block; padding: 13px 16px; }
.muc .xep .phu { display: block; margin-top: 2px; }
.muc details > summary { list-style: none; cursor: pointer; padding: 13px 16px; min-height: 56px; }
.muc details > summary::-webkit-details-marker { display: none; }
.muc details[open] > summary { background: #f7faf9; }
.muc details > .dien { box-shadow: none; border-radius: 0; border-top: 1px solid var(--vien); margin: 0; }

/* ---------- Biểu mẫu và nút ---------- */
.dien { display: grid; gap: 14px; margin: 0 0 16px; background: var(--mat); border-radius: 12px; box-shadow: var(--bong); padding: 16px; }
.o { display: grid; gap: 5px; min-width: 0; }
.o > span { font-size: 13px; font-weight: 600; color: #34423f; }
.o input, .o select, .o textarea { width: 100%; background: var(--mat); border: 1.5px solid var(--vien); border-radius: 9px; padding: 10px 12px; min-height: 46px; transition: border-color .12s; }
.o input:hover, .o select:hover, .o textarea:hover { border-color: #b8c4c0; }
.o input:focus, .o select:focus, .o textarea:focus { outline: none; border-color: var(--xanh); box-shadow: 0 0 0 3px var(--xanh-nhat); }
.o textarea { min-height: 104px; resize: vertical; line-height: 1.55; }
.o input::placeholder, .o textarea::placeholder { color: #9aa8a4; }
.o input[type="file"] { padding: 9px; }
.hai { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kiem { display: flex; gap: 10px; align-items: center; min-height: 40px; font-size: 14.5px; }
.kiem input { width: 20px; height: 20px; accent-color: var(--xanh); flex: none; }
.nut { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 9px 18px; background: var(--xanh); color: #fff; border: 1.5px solid var(--xanh); border-radius: 10px; font-weight: 700; cursor: pointer; text-decoration: none; }
.nut:hover { background: var(--xanh-dam); border-color: var(--xanh-dam); }
.nut:disabled { opacity: .55; cursor: progress; }
.nut.phu { background: var(--mat); color: var(--xanh-dam); border-color: var(--vien); }
.nut.phu:hover { background: var(--xanh-nhat); border-color: var(--xanh-nhat); }
.nut.be { min-height: 38px; padding: 6px 13px; font-size: 14px; border-radius: 9px; }
.hang { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
button.chu { background: none; border: 0; padding: 6px 0; color: var(--xanh); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
button.chu.do { color: var(--do); }
details > summary.chu { cursor: pointer; color: var(--xanh); font-weight: 600; padding: 8px 2px; }

/* ---------- Trang đầu ---------- */
.chao { background: var(--xanh); color: #fff; border-radius: 16px; padding: 20px 16px 16px; margin: 0 0 14px; background-image: radial-gradient(circle at 100% 0, rgba(242, 182, 50, .22), transparent 46%); }
.chao h1 { font-size: 23px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; }
.chao p { color: rgba(255, 255, 255, .78); font-size: 14px; margin: 4px 0 16px; }
.hoi { display: flex; background: var(--mat); border-radius: 12px; padding: 5px; }
.hoi input { flex: 1; min-width: 0; border: 0; padding: 10px 10px; min-height: 44px; background: transparent; color: var(--chu); }
.hoi input:focus { outline: none; }
.hoi button { border: 0; background: var(--vang); color: #3a2a00; font-weight: 700; padding: 0 16px; border-radius: 9px; cursor: pointer; }
.goi-y { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 2px; scrollbar-width: none; }
.goi-y::-webkit-scrollbar { display: none; }
.goi-y button { flex: none; background: rgba(255, 255, 255, .13); border: 0; border-radius: 999px; padding: 8px 13px; font-size: 13px; color: #fff; cursor: pointer; min-height: 36px; }
.goi-y button:hover { background: rgba(255, 255, 255, .22); }
.so-lieu { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--mat); border-radius: 12px; box-shadow: var(--bong); margin: 0 0 6px; }
.so-lieu > * { padding: 12px 6px; text-align: center; text-decoration: none; color: inherit; }
.so-lieu > * + * { border-left: 1px solid var(--vien); }
.so-lieu b { display: block; font-size: 20px; font-weight: 800; color: var(--xanh-dam); font-variant-numeric: tabular-nums; }
.so-lieu b.do { color: var(--do); }
.so-lieu span { font-size: 12px; color: var(--mo); }
.so-lieu.ba { grid-template-columns: repeat(3, 1fr); }
.tiet { flex: none; width: 46px; height: 46px; border-radius: 12px; background: var(--xanh-nhat); color: var(--xanh-dam); display: grid; place-content: center; text-align: center; font-weight: 800; font-size: 17px; line-height: 1.05; }
.tiet small { display: block; font-size: 10px; font-weight: 600; }
.viec { list-style: none; margin: 0; padding: 0; background: var(--mat); border-radius: 12px; box-shadow: var(--bong); }
.viec li { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 14px; min-height: 52px; border-bottom: 1px solid var(--vien); }
.viec input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--xanh); flex: none; }
.viec .ten { flex: 1; font-weight: 500; overflow-wrap: anywhere; }
.viec li.xong .ten { text-decoration: line-through; color: var(--mo); }
.viec .han { font-size: 12.5px; color: var(--mo); white-space: nowrap; }
.viec .han.tre { color: var(--do); font-weight: 600; }
.viec .xoa { background: none; border: 0; color: #9aa8a4; font-size: 20px; line-height: 1; width: 32px; height: 32px; cursor: pointer; border-radius: 8px; }
.viec .xoa:hover { color: var(--do); background: var(--do-nhat); }
.them-viec { display: flex; gap: 8px; padding: 10px 12px; }
.them-viec input { min-width: 0; border: 1.5px solid var(--vien); border-radius: 9px; padding: 8px 10px; min-height: 42px; background: var(--mat); }
.them-viec input:focus { outline: none; border-color: var(--xanh); }
.them-viec input[name="text"] { flex: 1; }
.them-viec input[type="date"] { width: 138px; flex: none; }
.them-viec button { flex: none; min-height: 42px; }

/* ---------- Tài liệu ---------- */
.giay { background: var(--mat); border-radius: 12px; box-shadow: var(--bong); padding: 22px 18px; margin: 12px 0; overflow-x: auto; line-height: 1.65; }
.giay h1 { font-size: 20px; text-align: center; margin: 0 0 14px; line-height: 1.35; }
.giay h2 { font-size: 17px; margin: 22px 0 8px; color: var(--xanh-dam); }
.giay h3 { font-size: 15.5px; margin: 16px 0 6px; }
.giay p { margin: 8px 0; }
.giay ul, .giay ol { padding-left: 22px; margin: 6px 0; }
.giay hr { border: 0; border-top: 2px dashed var(--vien); margin: 26px 0; }
.giay blockquote { margin: 10px 0; padding: 8px 12px; border-radius: 8px; background: var(--vang-nhat); color: #5a4200; font-size: 14.5px; }
.giay table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 14.5px; }
.giay th, .giay td { border: 1px solid #b8c4c0; padding: 6px 8px; vertical-align: top; text-align: left; }
.giay th { background: var(--xanh-nhat); }
.soan-o { width: 100%; min-height: 60vh; border: 1.5px solid var(--vien); border-radius: 12px; padding: 14px; background: var(--mat); line-height: 1.6; font-size: 15px; margin: 12px 0; }
.soan-o:focus { outline: none; border-color: var(--xanh); }
.tieu-de-o { width: 100%; font-weight: 800; font-size: 20px; letter-spacing: -.01em; border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 6px 0; }
.tieu-de-o:hover, .tieu-de-o:focus { outline: none; border-bottom-color: var(--xanh); }
.dang-viet { color: var(--xanh-dam); font-weight: 600; padding: 18px 2px; }
.dang-viet::after { content: ""; display: inline-block; width: 1.4em; text-align: left; animation: cham 1.2s steps(4) infinite; }
@keyframes cham { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* ---------- Lớp học ---------- */
.tab { display: flex; gap: 2px; background: #e3e9e7; border-radius: 11px; padding: 3px; margin: 4px 0 16px; overflow-x: auto; scrollbar-width: none; }
.tab::-webkit-scrollbar { display: none; }
.tab a { flex: 1 0 auto; text-align: center; padding: 9px 12px; text-decoration: none; color: var(--mo); font-weight: 600; font-size: 14px; border-radius: 9px; white-space: nowrap; }
.tab a[aria-current="page"] { color: var(--xanh-dam); background: var(--mat); box-shadow: 0 1px 2px rgba(15, 40, 34, .12); font-weight: 700; }
.hs { list-style: none; margin: 0; padding: 0; background: var(--mat); border-radius: 12px; box-shadow: var(--bong); }
.hs li { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 6px 12px 6px 14px; }
.hs li + li { border-top: 1px solid var(--vien); }
.hs .stt { width: 22px; flex: none; color: var(--mo); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.hs .ten { flex: 1; min-width: 0; font-weight: 500; color: inherit; text-decoration: none; }
.hs a.ten:hover { color: var(--xanh); }
.hs .ten small { display: block; color: var(--mo); font-weight: 400; font-size: 12.5px; }
.tt { flex: none; min-width: 98px; min-height: 40px; border: 1.5px solid var(--vien); background: var(--mat); color: var(--mo); font-weight: 700; font-size: 13.5px; border-radius: 999px; cursor: pointer; }
.tt[data-v="co-mat"] { background: var(--xanh-nhat); color: var(--xanh-dam); border-color: var(--xanh-nhat); }
.tt[data-v="vang-khong-phep"] { background: var(--do); color: #fff; border-color: var(--do); }
.tt[data-v="vang-phep"] { background: var(--do-nhat); color: var(--do); border-color: var(--do-nhat); }
.tt[data-v="muon"] { background: var(--vang-nhat); color: #6b4e00; border-color: var(--vang-nhat); }
.tt[data-v=""] { border-style: dashed; }
.dem { font-weight: 800; font-variant-numeric: tabular-nums; }
.cong-tru { display: flex; align-items: center; gap: 6px; flex: none; }
.cong-tru button { width: 40px; height: 40px; border: 1.5px solid var(--vien); background: var(--mat); color: var(--xanh-dam); font-size: 20px; font-weight: 700; border-radius: 50%; cursor: pointer; }
.cong-tru output { min-width: 34px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.luoi { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.luoi button { min-height: 104px; background: var(--mat); color: var(--chu); border: 0; border-radius: 12px; box-shadow: var(--bong); padding: 14px; text-align: left; cursor: pointer; font-weight: 700; font-size: 15.5px; display: flex; flex-direction: column; gap: 4px; }
.luoi button:hover { background: #f7faf9; }
.luoi button svg { color: var(--xanh); margin-bottom: 4px; width: 26px; height: 26px; }
.luoi button small { font-weight: 400; font-size: 13px; color: var(--mo); }

/* Bảng số liệu cuộn ngang: sổ điểm, chuyên cần */
.cuon { overflow-x: auto; margin: 0 -16px 10px; padding: 2px 16px 8px; }
.so-diem { border-collapse: separate; border-spacing: 0; background: var(--mat); font-size: 14.5px; border-radius: 12px; box-shadow: var(--bong); }
.so-diem th, .so-diem td { border-bottom: 1px solid var(--vien); border-right: 1px solid var(--vien); padding: 0; }
.so-diem tr > :last-child { border-right: 0; }
.so-diem tbody tr:last-child > * { border-bottom: 0; }
.so-diem thead th { background: #f7faf9; padding: 9px 8px; font-size: 12.5px; min-width: 78px; max-width: 124px; vertical-align: bottom; font-weight: 700; }
.so-diem thead th:first-child { border-top-left-radius: 12px; position: sticky; left: 0; z-index: 2; text-align: left; padding-left: 14px; }
.so-diem thead th:last-child { border-top-right-radius: 12px; }
.so-diem thead th small { display: block; font-weight: 400; color: var(--mo); }
.so-diem tbody th { position: sticky; left: 0; background: var(--mat); text-align: left; padding: 8px 12px 8px 14px; white-space: nowrap; font-weight: 500; min-width: 136px; z-index: 1; }
.so-diem tbody tr:last-child th { border-bottom-left-radius: 12px; }
.so-diem tbody th a { color: inherit; text-decoration: none; }
.so-diem input { width: 100%; min-width: 64px; height: 44px; border: 0; text-align: center; background: transparent; font-variant-numeric: tabular-nums; }
.so-diem input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--xanh); }
.so-diem input.thap { color: var(--do); font-weight: 700; }
.so-diem td.tb { text-align: center; font-weight: 800; padding: 0 12px; background: #f7faf9; font-variant-numeric: tabular-nums; min-width: 44px; }
.so-diem td.cc { text-align: center; min-width: 38px; height: 40px; font-size: 12.5px; font-weight: 700; }
.so-diem td.cc.k { background: var(--do); color: #fff; } .so-diem td.cc.p { background: var(--do-nhat); color: var(--do); } .so-diem td.cc.m { background: var(--vang-nhat); color: #6b4e00; } .so-diem td.cc.c { color: #9aa8a4; font-weight: 400; }
.so-diem.hep thead th { min-width: 38px; padding: 8px 4px; text-align: center; }
.so-diem.hep thead th:first-child { text-align: left; padding-left: 14px; }

.khoi { background: var(--mat); border-radius: 12px; box-shadow: var(--bong); padding: 14px 16px; }
.bd { width: 100%; height: auto; display: block; }
.tia { width: 84px; height: 28px; flex: none; }
.canh-bao { list-style: none; margin: 0; padding: 0; background: var(--mat); border-radius: 12px; box-shadow: var(--bong); overflow: hidden; }
.canh-bao li { padding: 12px 14px 12px 16px; border-left: 4px solid var(--do); }
.canh-bao li + li { border-top: 1px solid var(--vien); }
.canh-bao a { text-decoration: none; color: inherit; }
.canh-bao b { font-weight: 700; }
.canh-bao span { display: block; font-size: 13.5px; color: var(--do); }

/* Hồ sơ học sinh */
.ho-so { display: flex; gap: 14px; align-items: center; margin: 4px 0 14px; }
.ho-so .anh { width: 60px; height: 60px; border-radius: 50%; background: var(--xanh); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 22px; flex: none; }
.ho-so h1 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; }
.ho-so p { color: var(--mo); font-size: 14px; }
.nhat-ky { list-style: none; margin: 0 0 10px; padding: 0; background: var(--mat); border-radius: 12px; box-shadow: var(--bong); }
.nhat-ky li { padding: 12px 16px; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; }
.nhat-ky li + li { border-top: 1px solid var(--vien); }
.nhat-ky time { font-size: 12.5px; color: var(--mo); font-variant-numeric: tabular-nums; }
.nhat-ky p { grid-column: 1 / -1; }
.nhat-ky button.chu { padding: 0; font-size: 13px; }

/* Lịch dạy */
.tuan { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 12px; }
.tuan b { font-size: 15px; text-align: center; }
.ngay { background: var(--mat); border-radius: 12px; box-shadow: var(--bong); margin: 0 0 10px; overflow: hidden; }
.ngay h3 { font-size: 14px; font-weight: 700; padding: 10px 16px; background: #f7faf9; border-bottom: 1px solid var(--vien); display: flex; justify-content: space-between; }
.ngay h3 span { font-weight: 400; color: var(--mo); }
.ngay.hom-nay h3 { background: var(--xanh); color: #fff; border-color: var(--xanh); }
.ngay.hom-nay h3 span { color: rgba(255, 255, 255, .8); }
.ngay .dong { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 14px; min-height: 58px; }
.ngay .dong + .dong { border-top: 1px solid var(--vien); }
.ngay .dong .lop { flex: none; width: 74px; font-weight: 700; font-size: 14px; line-height: 1.25; }
.ngay .dong .lop small { display: block; font-weight: 400; color: var(--mo); font-size: 12px; }
.ngay .dong input, .ngay .dong select { flex: 1; min-width: 0; border: 1.5px solid transparent; border-radius: 8px; padding: 8px 10px; min-height: 42px; background: #f3f6f5; }
.ngay .dong input:focus, .ngay .dong select:focus { outline: none; border-color: var(--xanh); background: var(--mat); }
.ngay .rong { padding: 14px 16px; color: var(--mo); font-size: 14px; }

/* Trò chuyện */
.chat { display: grid; gap: 12px; margin: 12px 0; }
.chat .toi-noi { justify-self: end; max-width: 86%; background: var(--xanh); color: #fff; padding: 10px 14px; border-radius: 16px 16px 4px 16px; white-space: pre-wrap; }
.chat .may-noi { justify-self: start; max-width: 94%; background: var(--mat); box-shadow: var(--bong); padding: 4px 14px; border-radius: 4px 16px 16px 16px; }
.chat .may-noi.giay { margin: 0; }
.gui { position: sticky; bottom: calc(var(--day-cao) + 10px + env(safe-area-inset-bottom)); display: flex; gap: 6px; background: var(--mat); border-radius: 14px; box-shadow: var(--bong), 0 6px 20px rgba(15, 40, 34, .1); padding: 5px; }
.gui textarea { flex: 1; border: 0; padding: 10px; min-height: 46px; max-height: 160px; resize: none; background: transparent; }
.gui textarea:focus { outline: none; }
.gui button { border: 0; background: var(--xanh); color: #fff; font-weight: 700; padding: 0 16px; border-radius: 10px; cursor: pointer; }

.qr { background: #fff; padding: 10px; width: min(240px, 66vw); margin: 10px 0; border-radius: 12px; box-shadow: var(--bong); }
.qr svg { display: block; width: 100%; height: auto; }
.lien-ket { word-break: break-all; font-size: 14px; background: var(--mat); border: 1.5px dashed #b8c4c0; border-radius: 10px; padding: 10px 12px; }
.nhan { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--xanh-nhat); color: var(--xanh-dam); white-space: nowrap; vertical-align: 1px; }
.nhan.do { background: var(--do-nhat); color: var(--do); }
.nhan.vang { background: var(--vang-nhat); color: #6b4e00; }
.cau { background: var(--mat); border-radius: 12px; box-shadow: var(--bong); padding: 13px 16px; margin: 0 0 10px; }
.cau ol { margin: 6px 0 0; padding-left: 24px; list-style: upper-alpha; }
.cau li.dung { font-weight: 700; color: var(--xanh); }

/* ---------- Bảng lớp: công cụ chiếu trong giờ học ---------- */
#bang { position: fixed; inset: 0; z-index: 50; background: #173f36; color: var(--phan); display: flex; flex-direction: column; overflow: auto; background-image: radial-gradient(ellipse at 30% 10%, rgba(255, 255, 255, .07), transparent 60%); }
#bang header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; gap: 10px; }
#bang header b { font-size: 16px; font-weight: 600; opacity: .9; }
#bang .dong { background: rgba(255, 255, 255, .12); border: 0; color: #fff; border-radius: 10px; min-height: 42px; padding: 0 16px; font-weight: 700; cursor: pointer; }
#bang .giua { flex: 1; display: grid; place-content: center; justify-items: center; text-align: center; padding: 16px; gap: 18px; }
#bang .to { font-size: clamp(40px, 12vw, 120px); font-weight: 800; letter-spacing: -.03em; line-height: 1.15; text-wrap: balance; }
#bang .so-to { font: 800 clamp(72px, 26vw, 220px)/1 var(--chinh); font-variant-numeric: tabular-nums; letter-spacing: -.03em; color: var(--vang); }
#bang .so-to.het { color: #ff9d8f; }
#bang .phan-nut { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
#bang .phan-nut button { background: var(--vang); color: #3a2a00; border: 0; border-radius: 10px; min-height: 48px; padding: 0 18px; font-weight: 800; cursor: pointer; font-size: 15.5px; }
#bang .phan-nut button.vien { background: rgba(255, 255, 255, .12); color: #fff; }
#bang .kiem input { accent-color: var(--vang); }
#bang .nhom { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 6px 16px 20px; text-align: left; }
#bang .nhom section { background: rgba(255, 255, 255, .08); padding: 12px 14px; border-radius: 12px; }
#bang .nhom h3 { font-size: 14px; font-weight: 700; color: var(--vang); margin-bottom: 6px; }
#bang .nhom ul { margin: 0; padding: 0; }
#bang .nhom li { list-style: none; padding: 3px 0; }
#bang .hs { background: rgba(255, 255, 255, .06); box-shadow: none; margin: 0 16px 20px; }
#bang .hs li + li { border-color: rgba(255, 255, 255, .12); }
#bang .hs .stt { color: var(--vang); font-weight: 800; }
#bang .cong-tru button { background: rgba(255, 255, 255, .12); border: 0; color: #fff; }
#bang .qr { margin: 0 auto; box-shadow: none; }
#bang .nho { opacity: .8; }

#toast { position: fixed; z-index: 60; left: 50%; bottom: calc(var(--day-cao) + 14px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(92vw, 440px); display: grid; gap: 8px; pointer-events: none; }
#toast div { background: #15201d; color: #fff; padding: 11px 15px; border-radius: 11px; font-size: 14px; box-shadow: 0 8px 24px rgba(15, 40, 34, .25); }
#toast div.loi { background: var(--do); }

/* ---------- Đăng nhập và trang công khai ---------- */
.cua { max-width: 420px; margin: 0 auto; padding: 7vh 18px 40px; min-height: 100dvh; }
.cua .dau { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.cua h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; color: var(--chu); }
.cua .loi-chao { color: var(--mo); margin: 6px 0 20px; }
.cua .doi { margin-top: 8px; font-size: 14.5px; text-align: center; }
.cua .ba-dieu { list-style: none; padding: 0; margin: 22px 2px 0; display: grid; gap: 10px; font-size: 14px; color: var(--mo); }
.cua .ba-dieu li { display: flex; gap: 10px; align-items: flex-start; }
.cua .ba-dieu svg { color: var(--xanh); width: 20px; height: 20px; margin-top: 1px; }

/* ---------- Máy tính ---------- */
@media (min-width: 960px) {
  .so { padding: 0 0 60px 240px; }
  .gay { background: transparent; border: 0; backdrop-filter: none; position: static; justify-content: flex-end; padding: 0 36px; height: 64px; }
  .gay .ten-so { display: none; }
  .trang { padding: 0 36px 24px; max-width: 980px; margin: 0; }
  .the { top: 0; bottom: 0; right: auto; width: 240px; height: auto; flex-direction: column; gap: 4px; padding: 20px 14px; background: var(--xanh-dam); border: 0; }
  .the .the-ten { display: flex; color: #fff; margin: 0 6px 22px; }
  .the .the-ten i { background: rgba(255, 255, 255, .12); }
  .the a { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 12px; height: 46px; border-radius: 10px; color: rgba(255, 255, 255, .72); font-size: 14.5px; }
  .the a span { width: auto; height: auto; }
  .the a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
  .the a[aria-current="page"] { background: rgba(255, 255, 255, .13); color: #fff; box-shadow: inset 3px 0 0 var(--vang); }
  .the a[aria-current="page"] span { background: none; color: var(--vang); }
  .tua { font-size: 28px; }
  .chao { padding: 28px 28px 22px; }
  .chao h1 { font-size: 28px; }
  .giay { padding: 36px 44px; }
  .gui { bottom: 16px; }
  #toast { bottom: 24px; left: calc(50% + 120px); }
  .luoi { grid-template-columns: repeat(4, 1fr); }
  .hai-cot { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; align-items: start; }
  .lich-luoi { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; align-items: start; }
  .cuon { margin: 0 0 10px; padding: 2px 2px 8px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- In / lưu PDF: chỉ còn tài liệu ---------- */
@media print {
  body { background: #fff; }
  .gay, .the, .khong-in, #toast { display: none !important; }
  .so { padding: 0; }
  .trang { padding: 0; max-width: none; }
  .giay { box-shadow: none; margin: 0; padding: 0; font-size: 13pt; border-radius: 0; }
  .giay hr { border: 0; break-after: page; margin: 0; }
}
.viec li.them { padding: 0; border: 0; }
.viec li.them form { flex: 1; min-width: 0; }
.viec li:last-child { border-bottom: 0; }
