/* Giảng Đường Số — v2 "Academic".
   Ngôn ngữ thiết kế: navy đại học + gold học thuật, tiêu đề serif, thân chữ sans.
   Mobile-first, tối giản, trang trọng. */

/* ===== FONT NHÚNG SẴN (04-08-2026) =====
   Noto Serif (variable, SIL Open Font License 1.1 — xem /static/fonts/OFL.txt).
   Nhúng thẳng vào app để MỌI máy hiển thị tiếng Việt giống nhau: font hệ thống
   Georgia/Times/Palatino THIẾU glyph ộ/ữ/ấ → trình duyệt ghép dấu rời, chữ vỡ
   ("chấ ́t") và tràn khung. Tách 2 subset: máy chỉ tải phần tiếng Việt (14KB)
   khi trang thực sự có ký tự Việt. */
@font-face {
  font-family: "GD Serif";
  font-style: normal;
  font-weight: 100 900;            /* variable font — đủ mọi độ đậm trong 1 file */
  font-display: swap;
  src: url("/static/fonts/noto-serif-vi.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
    U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329,
    U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "GD Serif";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/noto-serif-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Chữ thân bài: Inter (variable, SIL OFL) — thiết kế cho màn hình, dễ đọc cỡ nhỏ. */
@font-face {
  font-family: "GD Sans";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/inter-vi.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
    U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329,
    U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "GD Sans";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  --navy: #0B2E63; --navy-2: #16447E; --navy-dark: #071E42;
  --gold: #F0B429; --gold-soft: #F7D070; --gold-dark: #B88A16;
  --bg: #F4F6FA; --card: #FFFFFF; --line: #E2E8F1;
  --text: #1A2740; --muted: #5D6B82;
  --ok: #15803D; --err: #B91C1C; --info: #1D4ED8;
  --radius: 16px;
  /* "GD Serif" = Noto Serif nhúng sẵn ở trên -> hiển thị GIỐNG NHAU trên mọi máy.
     Dự phòng (nếu font tải lỗi): Cambria có đủ tiếng Việt; TUYỆT ĐỐI không để
     Georgia/Times/Palatino lên đầu vì thiếu glyph gây vỡ dấu. */
  --serif: "GD Serif", Cambria, "Noto Serif", serif;
  /* "GD Sans" = Inter nhúng sẵn; dự phòng là font hệ thống (đều đủ tiếng Việt). */
  --sans: "GD Sans", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 1px 2px rgba(10, 30, 66, .05), 0 4px 14px rgba(10, 30, 66, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 16px/1.6 var(--sans);
  /* Chống vỡ chữ tiếng Việt: không cho trình duyệt tự ghép dấu rời */
  font-variant-ligatures: none;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(1200px 400px at 85% -140px, rgba(240, 180, 41, .07), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100dvh; display: flex; flex-direction: column;
}
a { color: var(--navy-2); text-decoration: none; }
.serif { font-family: var(--serif); letter-spacing: .1px; }

/* ---- topbar ---- */
.topbar {
  background: linear-gradient(135deg, var(--navy-dark) 0%, #0D3468 78%, #12427F 100%);
  color: #fff; padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap; position: sticky; top: 0; z-index: 50;
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 2px 14px rgba(7, 30, 66, .35);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; min-width: 0; }
.brand-badge {
  background: linear-gradient(160deg, var(--gold-soft), var(--gold));
  color: var(--navy-dark); border-radius: 10px;
  padding: 4px 8px; font-size: 14px; font-weight: 800; letter-spacing: .5px;
  font-family: var(--serif);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .14);
}
/* Logo HUB: khiên navy-đỏ nên đặt trong khung TRẮNG để nổi trên nền topbar navy */
.hub-logo-top {
  height: 38px; width: auto; background: #fff; border-radius: 9px; padding: 3px 5px;
  flex: 0 0 auto; box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.brand-2line { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 17px; letter-spacing: .3px; line-height: 1.15; }
.brand-sub { font-size: 10.5px; color: #9DB2D0; letter-spacing: .4px; white-space: nowrap; }
@media (max-width: 480px) { .brand-sub { display: none; } .hub-logo-top { height: 32px; } }
.hub-logo-foot { height: 34px; width: auto; margin-bottom: 4px; }
.prof-hub-logo { height: 60px; width: auto; flex: 0 0 auto; }
@media (max-width: 560px) { .prof-hub-logo { display: none; } }
.att-hub-logo {
  height: 52px; width: auto; background: #fff; border-radius: 10px; padding: 4px 6px;
  flex: 0 0 auto;
}
.topnav { display: flex; gap: 2px; flex-wrap: wrap; }
.topnav a {
  color: #D5E1F3; padding: 6px 10px; border-radius: 9px; font-size: 14px; font-weight: 600;
  position: relative;
}
.topnav a.on { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: inset 0 -2px 0 var(--gold); }
.topnav a.muted { color: #93A9CB; }
.dot {
  display: inline-block; background: #E4483C; color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 800; padding: 1px 6px; margin-left: 4px; vertical-align: 2px;
}

/* ---- layout ---- */
.wrap { width: 100%; max-width: 880px; margin: 0 auto; padding: 18px 14px 46px; flex: 1; }
.foot {
  text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.75;
  padding: 18px 16px 26px; border-top: 1px solid var(--line);
  background: #EDF1F7;
}
.foot b { color: var(--navy); font-family: var(--serif); letter-spacing: 1px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 10px; font-size: 18.5px; overflow-wrap: anywhere; }
.card h3 { margin: 0 0 10px; font-size: 15.5px; letter-spacing: .2px; overflow-wrap: anywhere; }
.card { min-width: 0; }

.hero {
  background:
    radial-gradient(500px 220px at 90% -60px, rgba(240, 180, 41, .22), transparent 65%),
    linear-gradient(150deg, #12427F, var(--navy-dark));
  color: #fff; border: 0; border-radius: var(--radius); padding: 24px 20px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.hero h1 { margin: 0 0 5px; font-size: 23px; font-family: var(--serif); letter-spacing: .2px; overflow-wrap: anywhere; }
.hero p { margin: 0; color: #C3D3EA; font-size: 14px; overflow-wrap: anywhere; }
.hero-academic { border-left: 4px solid var(--gold); }

/* ---- giảng viên ---- */
.prof-card { border-top: 3px solid var(--gold); }
.prof-row { display: flex; gap: 14px; align-items: center; }
.prof-avatar {
  flex: 0 0 auto; width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(150deg, var(--navy-2), var(--navy-dark));
  color: var(--gold-soft); font-family: var(--serif); font-weight: 700; font-size: 19px;
  display: flex; align-items: center; justify-content: center; letter-spacing: 1px;
  box-shadow: inset 0 0 0 2px rgba(240, 180, 41, .55);
}

/* ---- feature grid (hướng dẫn) ---- */
.feature-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .feature-grid { grid-template-columns: 1fr 1fr; } }
.feature {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px;
  display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto;
  column-gap: 10px; align-items: center; background: #FBFCFE;
}
.feature .fi { grid-row: 1 / span 2; font-size: 24px; }
.feature b { font-size: 14.5px; }
.feature .small { grid-column: 2; }

/* ---- steps (hướng dẫn) ---- */
.steps { margin: 4px 0 10px; padding-left: 0; counter-reset: st; list-style: none; }
.steps li {
  counter-increment: st; position: relative; padding: 0 0 14px 44px; font-size: 14.5px;
}
.steps li::before {
  content: counter(st); position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 50%;
  background: #EDF2FB; color: var(--navy-2); font-weight: 800; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid #C9D8F0;
}
.steps li::after {
  content: ""; position: absolute; left: 13.5px; top: 30px; bottom: 2px;
  width: 1.5px; background: var(--line);
}
.steps li:last-child::after { display: none; }

/* ---- form ---- */
label { display: block; font-size: 13.5px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=email], input[type=datetime-local], select, textarea {
  width: 100%; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--navy-2);
  box-shadow: 0 0 0 3px rgba(22, 68, 126, .12);
}
textarea { resize: vertical; }
.btn {
  display: inline-block; border: 0; border-radius: 10px; padding: 11px 18px;
  font: inherit; font-weight: 700; cursor: pointer; text-align: center;
  background: linear-gradient(160deg, #1A4C8C, var(--navy-2)); color: #fff;
  box-shadow: 0 2px 6px rgba(11, 46, 99, .25);
}
.btn:active { transform: translateY(1px); }
.btn-gold {
  background: linear-gradient(160deg, var(--gold-soft), var(--gold));
  color: var(--navy-dark); box-shadow: 0 2px 6px rgba(184, 138, 22, .3);
}
.btn-line { background: #fff; color: var(--navy-2); border: 1.5px solid var(--navy-2); box-shadow: none; }
.btn-danger { background: #fff; color: var(--err); border: 1.5px solid #F3C7C7; box-shadow: none; }
.btn-sm { padding: 7px 12px; font-size: 13.5px; border-radius: 8px; }
.btn-block { display: block; width: 100%; }

/* ---- flash ---- */
.flash { border-radius: 10px; padding: 11px 14px; margin-bottom: 12px; font-size: 14.5px; font-weight: 500; }
.flash-ok { background: #EAF7EF; color: var(--ok); border: 1px solid #BFE5CC; }
.flash-error { background: #FDEDED; color: var(--err); border: 1px solid #F3C7C7; }
.flash-info { background: #EDF2FD; color: var(--info); border: 1px solid #C9D8F5; }

/* ---- lớp học ---- */
.class-list { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .class-list { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.class-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; display: block; color: var(--text);
  box-shadow: var(--shadow); transition: box-shadow .15s, transform .15s;
  min-width: 0; overflow-wrap: anywhere;   /* chữ dài phải xuống dòng, không tràn thẻ */
}
.class-card:hover { box-shadow: 0 6px 20px rgba(10, 30, 66, .14); transform: translateY(-1px); }
.cc-course {
  color: var(--gold-dark); font-size: 12.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; overflow-wrap: anywhere;
}
.cc-name {
  font-size: 16.5px; font-weight: 700; margin: 3px 0 6px; font-family: var(--serif);
  overflow-wrap: anywhere;
}
.cc-meta { color: var(--muted); font-size: 13.5px; display: flex; gap: 12px; flex-wrap: wrap; min-width: 0; }

.join-code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 30px; font-weight: 800; letter-spacing: 6px; color: var(--navy-dark);
  background: linear-gradient(160deg, #FFF9E8, #FFF3CE);
  border: 2px dashed var(--gold); border-radius: 12px;
  text-align: center; padding: 12px 8px; margin: 8px 0;
}
.badge { display: inline-block; border-radius: 999px; padding: 2.5px 11px; font-size: 12.5px; font-weight: 700; }
.badge-open { background: #EAF7EF; color: var(--ok); }
.badge-closed { background: #FDEDED; color: var(--err); }
.badge-navy { background: #EDF2FD; color: var(--navy-2); }
.badge-soon { background: #FFF3CE; color: var(--gold-dark); font-size: 11px; vertical-align: 2px; }

/* ---- bảng ---- */
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
tr:last-child td { border-bottom: 0; }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---- góp ý ---- */
.reply-box {
  background: #F6F8FC; border-left: 3px solid var(--navy-2); border-radius: 8px;
  padding: 9px 12px; margin-top: 10px;
}

/* ---- login ---- */
.auth-wrap { max-width: 430px; margin: 5vh auto 0; }
.auth-logo { text-align: center; margin-bottom: 18px; }
.auth-logo .brand-badge { font-size: 24px; padding: 10px 15px; border-radius: 15px; }
.auth-logo h1 { font-size: 26px; margin: 14px 0 4px; color: var(--navy-dark); }
.auth-logo p { color: var(--muted); margin: 0; font-size: 13.5px; line-height: 1.6; }
.auth-wrap .card { border-top: 3px solid var(--gold); }
.check { display: flex; gap: 8px; align-items: center; margin: 12px 0; font-size: 14.5px; color: var(--muted); }
.check input { width: 17px; height: 17px; }

/* ---- tabs (ghi danh) ---- */
.tabs { display: flex; border: 1.5px solid var(--line); border-radius: 11px; overflow: hidden; margin: 12px 0; }
.tabs button {
  flex: 1; border: 0; background: #fff; padding: 10px 6px; font: inherit; font-weight: 700;
  color: var(--muted); cursor: pointer;
}
.tabs button.on { background: var(--navy-2); color: #fff; }
.qr-box { text-align: center; }
.qr-box img { width: 200px; max-width: 70%; border: 1px solid var(--line); border-radius: 10px; }

/* ---- dashboard lớp (M4) ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 640px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 10px; text-align: center; box-shadow: var(--shadow);
}
.kpi-v { font-size: 26px; font-weight: 800; color: var(--navy-2); font-family: var(--serif); }
.kpi-l { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 1.4fr) 2fr 86px; gap: 10px; align-items: center; padding: 5px 0; }
.hbar-label { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { background: #E9EEF6; border-radius: 99px; height: 12px; overflow: hidden; }
.hbar-fill { background: linear-gradient(90deg, #16447E, #F0B429); height: 100%; border-radius: 99px; }
.hbar-fill.hbar-bad { background: #D64545; }
.hbar-fill.hbar-mid { background: #E8A317; }
.hbar-val { font-size: 13px; font-weight: 700; color: var(--navy-2); text-align: right; }
.hist { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.hist-col { flex: 1; text-align: center; }
.hist-bar-wrap { height: 72px; display: flex; align-items: flex-end; }
.hist-bar { width: 100%; background: linear-gradient(180deg, #F0B429, #16447E); border-radius: 6px 6px 0 0; min-height: 2px; }
.hist-x { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.hist-n { font-size: 12px; font-weight: 700; color: var(--navy-2); }

/* ---- trợ giảng AI (M4) ---- */
.qa-q {
  background: #EDF2FB; border-radius: 12px 12px 3px 12px; padding: 9px 13px;
  margin: 8px 0 4px auto; max-width: 85%; width: fit-content; font-weight: 600; font-size: 14.5px;
}
.qa-a {
  background: #F6F8FC; border-left: 3px solid var(--gold); border-radius: 3px 12px 12px 12px;
  padding: 10px 13px; margin: 0 auto 8px 0; max-width: 92%; width: fit-content;
  font-size: 14.5px; white-space: pre-wrap;
}

/* ---- popup giới thiệu lần đầu (M5) ---- */
.intro-overlay {
  position: fixed; inset: 0; background: rgba(7, 30, 66, .55); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 18px;
  backdrop-filter: blur(3px);
}
.intro-box {
  background: #fff; border-radius: 18px; border-top: 4px solid var(--gold);
  padding: 22px 20px; max-width: 440px; width: 100%; max-height: 86dvh; overflow-y: auto;
  box-shadow: 0 18px 50px rgba(7, 30, 66, .4);
}

/* ---- làm bài trắc nghiệm (M3) ---- */
.opt {
  display: flex; gap: 10px; align-items: flex-start; margin: 0;
  border: 1.5px solid var(--line); border-radius: 11px; padding: 11px 12px;
  font-size: 15px; font-weight: 500; color: var(--text); cursor: pointer;
}
.opt:has(input:checked) { border-color: var(--navy-2); background: #EDF2FB; }
.opt input { width: 18px; height: 18px; margin-top: 2px; flex: 0 0 auto; }

/* ---- lịch giảng theo tháng (v1.6.0) ---- */
table.cal { table-layout: fixed; min-width: 640px; }
.cal-cell { vertical-align: top; height: 66px; padding: 4px 5px; border: 1px solid var(--line); }
.cal-d { font-size: 12px; font-weight: 700; color: var(--muted); }
.cal-today { background: #FFF9E8; }
.cal-today .cal-d { color: var(--gold-dark); }
.cal-ev {
  font-size: 11px; border-radius: 6px; padding: 2px 5px; margin-top: 3px;
  background: #EDF2FB; color: var(--navy-2); overflow: hidden; white-space: nowrap;
  text-overflow: ellipsis; font-weight: 600;
}
.cal-ev.cal-bu { background: #FFF3CE; color: var(--gold-dark); }
.cal-ev.cal-nghi { background: #FDEDED; color: var(--err); }

/* ---- chế độ thi nghiêm ngặt (v1.6.0) ---- */
.no-copy { -webkit-user-select: none; user-select: none; }
.no-copy textarea, .no-copy input { -webkit-user-select: text; user-select: text; }

/* ---- màn chiếu điểm danh (M2) ---- */
.att-screen {
  background:
    radial-gradient(600px 300px at 85% -80px, rgba(240, 180, 41, .18), transparent 65%),
    linear-gradient(150deg, #12427F, var(--navy-dark));
  color: #fff; border-radius: var(--radius); padding: 22px 20px 18px;
  box-shadow: var(--shadow);
}
.att-head { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: center; }
.att-head h1 { font-size: 22px; }
.att-count { text-align: center; font-size: 44px; font-weight: 800; line-height: 1.05; color: var(--gold-soft); }
.att-count .att-total { font-size: 22px; color: #C3D3EA; font-weight: 700; }
.att-body {
  display: flex; gap: 22px; align-items: center; justify-content: center;
  flex-wrap: wrap; margin-top: 18px;
}
.att-qr img {
  width: min(46vh, 420px); max-width: 88vw; display: block;
  background: #fff; padding: 12px; border-radius: 16px; transition: opacity .3s;
}
.att-code-box { text-align: center; min-width: 240px; }
.att-code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: clamp(48px, 9vw, 84px); font-weight: 800; letter-spacing: 8px;
  color: var(--gold-soft); line-height: 1.15; transition: opacity .3s;
  text-shadow: 0 3px 18px rgba(240, 180, 41, .35);
}

/* ---- thành viên lớp & bảo vệ tài liệu (v1.7.0) ---- */
.invite-card { border: 2px solid var(--gold); background: #FFFBEF; }
.invite-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; font-size: 15px; }
.invite-grid dt { color: var(--muted, #5B6B82); }
.invite-grid dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.invite-pw { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 19px; letter-spacing: 2px; color: var(--navy); }
.invite-msg { width: 100%; min-height: 150px; font-size: 13.5px; line-height: 1.5; resize: vertical; }
.badge-wait { background: #FFF3CE; color: var(--gold-dark); font-size: 11px; padding: 1.5px 8px; }
.btn-xs { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
.act-cell { white-space: nowrap; }
.act-cell form { display: inline-block; margin: 0 0 0 4px; }
.member-edit { margin-top: 6px; }
.member-edit summary { cursor: pointer; font-size: 12.5px; color: var(--navy-2); }
.member-edit .mini-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 6px; margin-top: 6px; }
.add-sv > summary::-webkit-details-marker { display: none; }
.add-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 12px; }
.pg-protect img { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-user-drag: none; }

/* ---- đề nhiều đáp án, 2 kiểu làm bài, AI chạy nền (v1.9.0) ---- */
[hidden] { display: none !important; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 0 12px; }
.correct-row { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 2px 0 0; }
.opt-list { margin-top: 10px; display: grid; gap: 8px; }
.multi-hint { color: var(--navy-2); }
.multi-hint.multi-over { color: var(--err); font-weight: 700; }
.quiz-bar { position: sticky; top: calc(54px + env(safe-area-inset-top)); z-index: 40; padding: 11px 15px; }
.timing-box { border: 1.5px solid var(--line); border-radius: 12px; padding: 4px 12px 12px; margin-top: 12px; }
.mode-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 8px; margin-bottom: 4px; }
.mode-opt { font-size: 14.5px; }
.t-sec { margin-top: 4px; }
.budget-bar { height: 10px; border-radius: 6px; background: #E6ECF5; overflow: hidden; }
.budget-bar > span { display: block; height: 100%; background: var(--navy-2); border-radius: 6px; transition: width .4s; }
.budget-bar > span.budget-hot { background: var(--err); }
.job-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line); }
.job-row > span { min-width: 0; overflow-wrap: anywhere; }

/* ---- AI đọc chữ slide ảnh (v1.9.1) ---- */
.ocr-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; padding: 7px 10px;
  border-radius: 9px; background: #FFF9E8; border: 1px solid #F3DDA0; }
.ocr-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.6; margin-top: 4px; }

/* ---- thi trên giấy (v1.10.0) ---- */
.paper-codes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
.paper-codes .badge { text-decoration: none; font-size: 13px; padding: 3px 10px; }
.paper-blank { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; }

/* ---- chấm phiếu giấy bằng ảnh (v1.11.0) ---- */
.file-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.scan-live { margin-top: 10px; max-height: 320px; overflow-y: auto; }
.scan-line { font-size: 13.5px; padding: 5px 0; border-bottom: 1px dashed var(--line); overflow-wrap: anywhere; }
.scan-flag { color: var(--gold-dark); }
.scan-error { color: var(--err); }
.scan-counts { display: flex; flex-wrap: wrap; gap: 6px; }
tr.row-warn td { background: #FFF8EC; }
.missing-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 2px 14px; }
.review-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 0 14px; align-items: start; }
@media (max-width: 760px) { .review-grid { grid-template-columns: minmax(0, 1fr); } }
.sheet-wrap { position: relative; width: 100%; aspect-ratio: 210 / 297; }
.sheet-wrap img { width: 100%; height: 100%; display: block; border: 1px solid var(--line); border-radius: 6px; }
.sheet-wrap span { position: absolute; aspect-ratio: 1 / 1; transform: translate(-50%, -50%); border-radius: 50%;
  border: 2px solid; pointer-events: none; }
.dot-fill { border-color: #1F6FEB !important; background: rgba(31, 111, 235, .16); }
.dot-weak { border-color: #E8590C !important; background: rgba(232, 89, 12, .22); }
.legend { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid; vertical-align: -1px; }
.raw-photo { width: 100%; border-radius: 6px; border: 1px solid var(--line); }
.ans-list { border: 1px solid var(--line); border-radius: 10px; padding: 2px 10px; max-height: 70vh; overflow-y: auto; }
.ans-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.ans-row:last-child { border-bottom: 0; }
.ans-row.unsure { background: #FFF1E0; margin: 0 -10px; padding: 5px 10px; }
.ans-row .check { margin: 0; }
.ans-n { width: 26px; font-weight: 700; }
.ans-key { margin-left: auto; }
.ans-key.ok { color: var(--ok); }
.ans-key.bad { color: var(--err); }
.my-sheet { width: 100%; max-width: 520px; border: 1px solid var(--line); border-radius: 8px; display: block; }

/* ---- đề tự luận + chấm từng bài (v1.12.0) ---- */
.essay-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.essay-row-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.essay-pts { max-width: 180px; }
.quiz-part { margin: 18px 2px 8px; color: var(--navy-2); font-size: 17px; }
.essay-answer { white-space: pre-wrap; overflow-wrap: anywhere; background: #F7F9FC; border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; margin-top: 10px; line-height: 1.65; max-height: 60vh; overflow-y: auto; }
.ai-hint { margin-top: 10px; padding: 8px 12px; border-radius: 8px; background: #EDF2FD; color: var(--info);
  font-size: 14px; overflow-wrap: anywhere; }
.grade-row { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; align-items: flex-start; }
.grade-row > div { flex: 1; min-width: min(100%, 150px); }
.grade-row input { max-width: 140px; }
.just-set { outline: 3px solid var(--gold); transition: outline-color .8s; }
.essay-nav { margin: 0 0 12px; }

/* ---- bài giảng tuỳ chỉnh theo lớp (v1.13.0) ---- */
.lec-item { border-left: 4px solid var(--navy-2); }
.lec-off { border-left-color: #C9CFDA; background: #FAFBFD; }
.lec-off .cc-name { color: var(--muted, #6B7385); }
.lec-head { display: flex; gap: 10px; align-items: flex-start; }
.lec-actions { margin: 10px 0 4px; }
.lec-actions form { display: flex; gap: 6px; flex-wrap: wrap; margin: 0; }
.lec-more { margin-top: 6px; font-size: 14px; }
.lec-more summary { cursor: pointer; color: var(--navy-2); font-weight: 600; }
.lec-more form { margin-top: 6px; }
.lec-danger { margin: 8px 0 0; }
.class-note { color: var(--gold-dark); margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.class-note-card { background: #FFF8E6; border: 1px solid #F5DFA0; overflow-wrap: anywhere; }
.page-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 130px), 1fr)); gap: 10px; margin-bottom: 14px; }
.pp-item { position: relative; display: block; cursor: pointer; background: #fff; border: 2px solid var(--line);
  border-radius: 10px; padding: 6px; margin: 0; }
.pp-item input { position: absolute; top: 10px; left: 10px; width: 20px; height: 20px; z-index: 2; }
.pp-item img { width: 100%; display: block; border-radius: 6px; background: #EEF1F6; }
.pp-no { display: block; font-size: 13px; margin-top: 4px; text-align: center; }
.pp-tag { display: none; color: var(--err); font-weight: 700; }
.pp-off { border-color: var(--err); background: #FDF1F1; }
.pp-off img { opacity: .35; }
.pp-off .pp-tag { display: inline; }
.lec-tip { color: var(--info); background: #EDF2FD; border-radius: 8px; padding: 6px 10px; margin-top: 6px; }
