/* Bố cục: thanh điều hướng trái cố định + vùng làm việc; màu lấy từ ảnh trường (biển xanh, lan can xanh lá, mặt trời vàng) */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --border: #e1e6ee;
  --text: #141c2b;
  --muted: #5a6476;
  --primary: #0a5bd3;
  --primary-hover: #0849ab;
  --primary-soft: #e8f0fd;
  --navy: #0d2a5c;
  --sun: #f5b301;
  --paper: #f3f4ef;
  --ok: #217a4c;   --ok-soft: #e2f3e9;
  --late: #a15c00; --late-soft: #fdf0db;
  --bad: #b3261e;  --bad-soft: #fbe5e3;
  --exc: #2e5bb8;  --exc-soft: #e7eefb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(13, 42, 92, .05), 0 2px 6px rgba(13, 42, 92, .06);
  --shadow-lift: 0 6px 18px rgba(13, 42, 92, .12);
  --font-display: "Lexend", "Be Vietnam Pro", system-ui, sans-serif;
  --side-w: 248px;
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-family: var(--font-display); text-wrap: balance; }
h1 { font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 14px; }

/* ---------- khung trang: thanh trái + vùng làm việc ---------- */
.layout { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--navy); color: #dbe5f6; display: flex; flex-direction: column; gap: 18px;
  padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; padding: 4px 6px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; font: 700 13px/1 var(--font-display); letter-spacing: .02em; box-shadow: inset 0 -3px 0 var(--sun); flex: none; }
.brand .bt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand .bt b { font: 600 17px/1.2 var(--font-display); }
.brand .bt small { font-size: 11.5px; color: #9fb3d6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); border-radius: var(--radius); padding: 10px; display: grid; gap: 8px; }
.ctx .lb { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #9fb3d6; padding: 0 2px; }
.ctx select { background: #142f62; border-color: rgba(255, 255, 255, .14); color: #fff; font-weight: 600; min-height: 38px; }
.ctx select:focus-visible { outline-color: var(--sun); }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #c7d4ec; font-weight: 550; transition: background .15s, color .15s; }
.nav a svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav a.active { background: var(--primary); color: #fff; box-shadow: inset 3px 0 0 var(--sun); }
.nav a.active svg { opacity: 1; }
.me { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 14px; display: grid; gap: 10px; }
.me .who { display: flex; align-items: center; gap: 10px; padding: 0 4px; min-width: 0; }
.me .av { width: 34px; height: 34px; border-radius: 50%; background: #e8f0fd; color: var(--navy); display: grid; place-items: center; font: 600 13px var(--font-display); flex: none; }
.me .nm { color: #fff; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .rl { font-size: 12px; color: #9fb3d6; }
.me .acts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.me .btn { background: transparent; border-color: rgba(255, 255, 255, .18); color: #dbe5f6; min-height: 36px; font-size: 13px; }
.me .btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.mtop { display: none; }
.side-back { display: none; }
.main-col { min-width: 0; }
main { max-width: 1320px; margin: 0 auto; padding: 28px max(24px, env(safe-area-inset-right, 0px)) 64px max(24px, env(safe-area-inset-left, 0px)); }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub { color: var(--muted); margin-top: 6px; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); margin-bottom: 6px; }

/* thanh bên thu gọn khi đang làm việc trong 1 lớp học phần / 1 lớp; rê chuột vào thì hiện đủ, đè lên nội dung */
.ctx-mini { display: none; }
@media (min-width: 961px) {
  .layout.mini { grid-template-columns: 72px minmax(0, 1fr); }
  .layout.mini .side { width: 72px; z-index: 50; transition: width .2s ease, box-shadow .2s ease; overflow-x: hidden; padding-left: 12px; padding-right: 12px; }
  .layout.mini .side:not(:hover):not(:focus-within) .bt,
  .layout.mini .side:not(:hover):not(:focus-within) .ctx,
  .layout.mini .side:not(:hover):not(:focus-within) .nav span,
  .layout.mini .side:not(:hover):not(:focus-within) .me .nm,
  .layout.mini .side:not(:hover):not(:focus-within) .me .rl,
  .layout.mini .side:not(:hover):not(:focus-within) .me .acts { display: none; }
  .layout.mini .side:not(:hover):not(:focus-within) .ctx-mini { display: block; font: 600 11px/1.35 var(--font-display); color: #c7d4ec; text-align: center; background: rgba(255, 255, 255, .06); border-radius: 8px; padding: 6px 2px; }
  .layout.mini .side:not(:hover):not(:focus-within) .nav a { justify-content: center; padding: 11px 0; }
  .layout.mini .side:not(:hover):not(:focus-within) .brand { justify-content: center; padding: 4px 0; }
  .layout.mini .side:not(:hover):not(:focus-within) .me .who { justify-content: center; padding: 0; }
  .layout.mini .side:hover, .layout.mini .side:focus-within { width: var(--side-w); box-shadow: 12px 0 32px rgba(8, 18, 38, .28); }
  .layout.mini .side .bt, .layout.mini .side .nav span, .layout.mini .side .ctx { white-space: nowrap; }
}

/* lưu ý quy chế */
.notice { background: #fff8e1; border: 1px solid #f3d98b; border-left: 4px solid var(--sun); color: #5c4300; border-radius: var(--radius-sm); padding: 10px 14px; margin: -4px 0 16px; font-size: 14px; line-height: 1.55; }
.notice .nb { display: block; color: #6b5414; }

/* số liệu tóm tắt đầu trang */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 26px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 2px; }
.stat .v { font: 600 26px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.stat .k { font-size: 13px; color: var(--muted); }
.stat.live .v { color: var(--ok); }

/* ---------- nút & form ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: var(--radius-sm); font: inherit; font-weight: 550; cursor: pointer;
  min-height: 38px; white-space: nowrap;
  transition: transform .14s ease, background .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 0 rgba(13, 42, 92, .2); }
.btn.primary:hover { background: var(--primary-hover); box-shadow: 0 4px 12px rgba(10, 91, 211, .28); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn.lg { padding: 12px 20px; font-size: 16px; min-height: 48px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
label.field { display: block; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 550; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid #cdd5dd; border-radius: 8px; padding: 8px 10px; min-height: 38px;
}
textarea { min-height: 70px; resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- thẻ ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.sec-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.sec-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: #cfdaf0; }
.sec-card .top { display: flex; align-items: flex-start; gap: 10px; }
.sec-card .code { font: 600 11.5px/1 var(--font-display); letter-spacing: .04em; color: var(--primary); background: var(--primary-soft); padding: 5px 7px; border-radius: 6px; flex: none; }
.sec-card .t { font: 600 16px/1.3 var(--font-display); }
.sec-card .meta { font-size: 13px; color: var(--muted); }
.sec-card .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; padding-top: 4px; }
.sec-card .actions > :first-child { grid-column: 1 / -1; min-height: 40px; }
.sec-card .actions .btn { min-width: 0; }
.group-title { margin: 30px 0 12px; display: flex; align-items: baseline; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.group-title:first-child { margin-top: 0; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge.live { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.lock { background: var(--exc-soft); color: var(--exc); border-color: transparent; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--surface); padding: 5px 12px; border-radius: 99px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 550; color: var(--muted); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- tab ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- bảng ---------- */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); max-height: calc(100vh - 220px); }
table.data { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; }
table.data th, table.data td { border-bottom: 1px solid var(--border); padding: 6px 8px; text-align: left; white-space: nowrap; }
table.data thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 2; font-size: 12.5px; color: var(--muted); font-weight: 650; }
table.data thead tr:nth-child(2) th { top: 33px; }
table.data td.num, table.data th.num { text-align: center; }
table.data tr.inactive td { color: #9aa5b1; }
table.data tr.inactive td .name { text-decoration: line-through; }
table.data .sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.data thead .sticky-col { z-index: 3; background: var(--surface-2); }
table.data tbody tr:hover td { background: #fafcfd; }
table.data td.calc { background: var(--surface-2); font-weight: 650; text-align: center; }
table.data td.cell-in { padding: 2px; }
table.data input.g {
  width: 58px; text-align: center; border: 1px solid transparent; border-radius: 6px; padding: 5px 2px; min-height: 32px; background: transparent; font: inherit;
}
table.data input.g:hover { border-color: var(--border); }
table.data input.g:focus { border-color: var(--primary); background: #fff; outline: none; box-shadow: 0 0 0 2px var(--primary-soft); }
table.data input.g.err { border-color: var(--bad); background: var(--bad-soft); }
table.data input.note { width: 170px; border: 1px solid transparent; background: transparent; padding: 5px; border-radius: 6px; font: inherit; }
table.data input.note:focus { border-color: var(--primary); background: #fff; outline: none; }
.grade-F { color: var(--bad); }
.att {
  width: 30px; height: 30px; border-radius: 7px; border: 0; font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; display: inline-grid; place-items: center;
}
.att.present { background: var(--ok-soft); color: var(--ok); }
.att.late { background: var(--late-soft); color: var(--late); }
.att.absent { background: var(--bad-soft); color: var(--bad); }
.att.excused { background: var(--exc-soft); color: var(--exc); }
.att.none { background: var(--surface-2); color: #b4bec8; }
.att.open { background: #fff; color: #b4bec8; border: 1px dashed #c8d1da; }
.lesson-h { display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.lesson-h:hover { color: var(--primary); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); align-items: center; }
.legend .att { width: 22px; height: 22px; font-size: 11px; cursor: default; margin-right: 4px; }
.save-state { font-size: 13px; color: var(--muted); }
.save-state.ok { color: var(--ok); }
.save-state.err { color: var(--bad); }

/* ---------- hộp thoại ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15, 23, 32, .45); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 14px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.methods { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.method { border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 6px; text-align: center; cursor: pointer; background: var(--surface); font: inherit; }
.method .ic { font-size: 22px; display: block; }
.method .nm { font-size: 13px; font-weight: 600; }
.method.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #17212b; color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 200; font-weight: 550; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: calc(100% - 32px); }
.toast.err { background: var(--bad); }

/* ---------- trang mở đầu (đăng nhập) ---------- */
.entry { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(380px, 1fr); background: var(--surface); }
.entry-art { background: var(--paper); display: grid; place-items: center; overflow: hidden; padding: 24px; }
.entry-art img { display: block; width: 100%; height: auto; max-height: calc(100vh - 48px); object-fit: contain; animation: art-in .9s cubic-bezier(.2, .7, .2, 1) both; }
.entry-side { display: grid; align-items: center; padding: 40px max(32px, env(safe-area-inset-right, 0px)) 40px 48px; border-left: 1px solid var(--border); }
.entry-in { width: min(420px, 100%); display: grid; gap: 22px; animation: side-in .7s .15s cubic-bezier(.2, .7, .2, 1) both; }
.entry-brand { display: flex; align-items: center; gap: 12px; font-size: 13px; line-height: 1.35; color: var(--muted); font-weight: 550; }
.entry-brand .brand-mark { width: 42px; height: 42px; font-size: 13px; }
.entry h1 { font-size: clamp(28px, 2.6vw, 38px); line-height: 1.15; }
.entry .lead { margin: -8px 0 0; color: var(--muted); font-size: 16px; line-height: 1.55; }
.entry-facts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.entry-facts li { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; display: grid; gap: 2px; }
.entry-facts b { font: 600 15px/1.2 var(--font-display); color: var(--navy); }
.entry-facts span { font-size: 12px; color: var(--muted); line-height: 1.35; }
@keyframes art-in { from { opacity: 0; transform: scale(1.03); } }
@keyframes side-in { from { opacity: 0; transform: translateY(10px); } }
@media (max-width: 960px) {
  .entry { grid-template-columns: minmax(0, 1fr); }
  .entry-art { padding: 0; }
  .entry-art img { max-height: none; }
  .entry-side { border-left: 0; padding: 28px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); justify-items: center; }
}
@media (max-width: 420px) { .entry-facts { grid-template-columns: 1fr; } .entry-facts li { grid-template-columns: auto 1fr; align-items: baseline; gap: 8px; } }

/* ---------- màn chiếu ---------- */
.proj { min-height: 100vh; background: #0b1a36; color: #fff; display: flex; flex-direction: column; }
.live-top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid rgba(255,255,255,.08); flex-wrap: wrap; }
.live-top .title { font-size: 20px; font-weight: 700; }
.live-top .btn { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.15); }
.live-top .btn:hover { background: rgba(255,255,255,.16); }
.live-main { flex: 1; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); gap: 24px; padding: 24px; }
@media (max-width: 900px) { .live-main { grid-template-columns: 1fr; } }
.live-stage { background: #fff; color: var(--text); border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 14px; text-align: center; min-height: 420px; }
.live-stage .qr svg { width: min(52vh, 100%); height: auto; display: block; }
.live-stage .qr.small svg { width: 150px; }
.live-stage .hint { font-size: 18px; color: var(--muted); }
.live-stage .url { font-size: 15px; color: var(--muted); word-break: break-all; }
.bigcode { font-size: clamp(80px, 16vw, 190px); font-weight: 800; letter-spacing: .12em; font-variant-numeric: tabular-nums; line-height: 1; color: var(--primary); }
.question { font-size: clamp(22px, 3vw, 34px); font-weight: 700; }
.q-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.q-opts div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; font-size: clamp(18px, 2.2vw, 26px); font-weight: 600; text-align: left; }
.q-opts b { color: var(--primary); margin-right: 8px; }
.live-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.stat-big { display: flex; align-items: baseline; gap: 10px; }
.stat-big .n { font-size: 72px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-big .of { font-size: 28px; opacity: .6; }
.timer { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer.closed { color: #ff8a80; }
.progress { height: 10px; border-radius: 99px; background: rgba(255,255,255,.12); overflow: hidden; }
.progress > div { height: 100%; background: #4cc38a; transition: width .4s; }
.live-list { background: rgba(255,255,255,.05); border-radius: 14px; padding: 12px; flex: 1; overflow: auto; max-height: 52vh; }
.live-list .it { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 8px; font-size: 18px; animation: pop .4s ease-out; }
.live-list .it:nth-child(odd) { background: rgba(255,255,255,.04); }
.live-list .it .tm { opacity: .6; font-variant-numeric: tabular-nums; }
.live-list .it .lt { color: #ffc46b; font-size: 14px; margin-left: 6px; }
@keyframes pop { from { background: rgba(76,195,138,.45); } }
.pattern-svg { width: min(46vh, 90%); height: auto; }

/* ---------- in ấn ---------- */
.print-bar { position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px; display: flex; gap: 10px; align-items: center; z-index: 10; flex-wrap: wrap; }
.sheet { background: #fff; margin: 20px auto; padding: 12mm 10mm; width: 297mm; min-height: 210mm; box-shadow: var(--shadow); color: #000; font-family: "Times New Roman", Times, serif; font-size: 11pt; }
.sheet.portrait { width: 210mm; min-height: 297mm; }
.sheet .hdr { display: flex; line-height: 1.35; }
.sheet .hdr .l { display: inline-block; text-align: center; font-weight: 700; }
.sheet td.nw { white-space: nowrap; }
.sheet .hdr .l div:first-child { font-weight: 400; }
.print-bar .small { flex: 1 1 260px; }
.sheet .ttl { text-align: center; font-size: 15pt; font-weight: 700; margin: 12px 0 6px; }
.sheet .info { display: flex; gap: 40px; justify-content: center; font-weight: 700; margin-bottom: 2px; }
.sheet table { border-collapse: collapse; width: 100%; margin-top: 10px; }
.sheet th, .sheet td { border: 1px solid #000; padding: 3px 4px; font-size: 10pt; text-align: center; }
.sheet th { font-weight: 700; }
.sheet td.l { text-align: left; }
.sheet td.nb-r { border-right: 0; }
.sheet td.nb-l { border-left: 0; }
.sheet .sign { display: grid; grid-template-columns: 1fr 1fr; text-align: center; margin-top: 14px; }
.sheet .sign .d { font-style: italic; }
.sheet .sign b { display: block; margin-top: 4px; }
.sheet.dense th, .sheet.dense td { font-size: 8.5pt; padding: 2px 2px; }
.pins { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.pin-card { border: 1px dashed #888; padding: 10px 12px; font-family: system-ui, sans-serif; }
.pin-card .n { font-weight: 700; font-size: 14px; }
.pin-card .p { font-size: 26px; font-weight: 800; letter-spacing: .2em; font-variant-numeric: tabular-nums; }
.pin-card .s { font-size: 11px; color: #444; }
@media print {
  @page { size: A4 landscape; margin: 8mm; }
  body { background: #fff; }
  .print-bar, .topbar { display: none !important; }
  .sheet { margin: 0; box-shadow: none; padding: 0; width: auto; min-height: 0; page-break-after: always; }
  .sheet:last-child { page-break-after: auto; }
  main { padding: 0; max-width: none; }
  body.portrait-print { }
}
.page-portrait { }
@media print { .page-portrait { } }

@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 60; transform: translateX(-102%); transition: transform .22s ease; padding-top: calc(18px + env(safe-area-inset-top, 0px)); }
  body.menu-open .side { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  body.menu-open .side-back { display: block; position: fixed; inset: 0; background: rgba(8, 18, 38, .45); z-index: 55; }
  .mtop { display: flex; align-items: center; gap: 10px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40; background: var(--navy); color: #fff;
    padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
  .mtop .ctxline { font-size: 13px; color: #c7d4ec; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mtop .menu-btn { background: transparent; border: 1px solid rgba(255, 255, 255, .2); color: #fff; min-width: 44px; min-height: 44px; border-radius: 10px; font-size: 20px; }
  main { padding: 20px max(16px, env(safe-area-inset-right, 0px)) 64px max(16px, env(safe-area-inset-left, 0px)); }
  h1 { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
/* ô đang thao tác không bị dòng tiêu đề cố định che mất khi cuộn */
table.data tbody :is(button, input) { scroll-margin-top: 96px; scroll-margin-left: 200px; }

/* ---------- Sổ điểm danh (theo mẫu của trường) ---------- */
.sheet.sd { font-size: 10pt; }
.sheet.sd .sd-h1 { font-weight: 700; font-size: 12pt; }
.sheet.sd .sd-h2 { font-weight: 700; font-size: 12pt; width: 46%; text-align: center; }
.sheet.sd .sd-title { text-align: center; font-weight: 700; font-size: 14pt; margin-top: 8px; }
.sheet.sd .sd-lop { text-align: center; font-weight: 700; font-size: 13pt; }
.sheet.sd .sd-mon { font-size: 12pt; margin: 4px 0 6px; }
.sheet.sd .sd-pg { font-size: 10pt; color: #444; }
.sheet.sd table { table-layout: fixed; margin-top: 4px; }
.sheet.sd th, .sheet.sd td { font-size: 9.5pt; padding: 2px 2px; height: 7.2mm; overflow: hidden; }
.sheet.sd th { font-size: 9.5pt; }
.sheet.sd th.sd-d { font-size: 8pt; line-height: 1.1; }
.sheet.sd td.sd-m { font-weight: 700; }
.sheet.sd td.sd-note { font-size: 8pt; white-space: normal; }
.sheet.sd tr.sd-f td { height: 9mm; }
.sheet.sd tr.sd-f3 td { height: 11mm; }
.sheet.sd .sd-legend { font-weight: 700; font-style: italic; margin-top: 6px; font-size: 11pt; }
.sheet.sd-cover { display: flex; flex-direction: column; align-items: center; font-family: "Times New Roman", Times, serif; }
.sheet.sd-cover .c1 { font-size: 16pt; margin-top: 6mm; }
.sheet.sd-cover .c2 { font-size: 16pt; font-weight: 700; }
.sheet.sd-cover .c3 { font-size: 64pt; margin: 36mm 0 10mm; letter-spacing: .02em; }
.sheet.sd-cover .c4 { font-size: 20pt; display: grid; gap: 6mm; align-self: center; margin-left: 30mm; }
.sheet.sd-cover .c4 span { display: inline-block; width: 42mm; }
@media print { .sheet.sd-cover { min-height: 190mm; } }
