/* mrphu v3 "Sổ ô": phần mới của khung văn phòng và lưới ô có thể gõ.
   Nền tảng (token, nút, bảng, tag...) là tenant.css và excel.css chép nguyên từ app. File này chỉ thêm phần mới;
   lớp nào có tiền tố .xl- sẽ đi vào _components/excel/excel.css khi làm thật. Phần .mockbar chỉ có trong mockup. */

html, body { height: 100%; }
body.v3 { display: flex; flex-direction: column; height: 100vh; overflow: hidden; background: #fff; }
body.v3.v3-page { background: var(--paper); }
body.v3.v3-page .v3-main { flex: 1; min-height: 0; overflow: auto; }

/* ------------------------------------------------------------------ thanh mockup (không có trong sản phẩm) */
.mockbar { flex: none; display: flex; align-items: center; gap: 14px; min-height: 30px; padding: 3px 12px; background: #23262a; color: #d9dde2; font: 12.5px/1.3 'Segoe UI', Arial, sans-serif; z-index: 200; }
.mockbar b { color: #fff; letter-spacing: .02em; }
.mockbar a { color: #9fd3b4; }
.mockbar label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.mockbar select { font: inherit; background: #33373c; color: #fff; border: 1px solid #50555c; border-radius: 3px; padding: 1px 4px; }
.mockbar .mockbar__grow { flex: 1; }
.mockbar .mockbar__hint { color: #9aa1a9; }

/* ------------------------------------------------------------------ thanh tiêu đề xanh + chọn sổ năm học */
.xl-titlebar { position: relative; flex: none; }
.xl-book { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px 0 8px; margin-left: -8px; border: 1px solid transparent; border-radius: 3px; background: transparent; color: #fff; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }
.xl-book:hover, .xl-book[aria-expanded="true"] { background: #1a5c38; border-color: #14502f; }
.xl-book .i { width: 16px; height: 16px; }
.xl-book small { font-weight: 400; opacity: .85; font-size: 14px; }
.xl-titlebar__who b { font-weight: 700; }
.xl-titlebar__who span { opacity: .8; }

/* ------------------------------------------------------------------ hàng menu một dòng chữ */
.xl-menu { flex: none; display: flex; align-items: center; gap: 2px; min-height: 36px; padding: 0 8px; background: #fff; border-bottom: 1px solid #d4d4d4; font-size: 15px; position: relative; z-index: 40; }
.xl-menu__item { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 0 12px; border: 1px solid transparent; border-radius: 3px; background: none; color: #1f2a25; text-decoration: none; font: inherit; cursor: pointer; white-space: nowrap; }
.xl-menu__item:hover, .xl-menu__item[aria-expanded="true"] { background: #e8f3ec; border-color: #b7d6c4; color: #1f2a25; }
.xl-menu__item.is-active { color: #217346; font-weight: 700; box-shadow: inset 0 -3px 0 #217346; border-radius: 3px 3px 0 0; }
.xl-menu__item .i { width: 14px; height: 14px; }
.xl-menu__sep { width: 1px; height: 18px; background: #d4d4d4; margin: 0 4px; }
.xl-menu__grow { flex: 1; }
.xl-menu__badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--debtBg); color: var(--debt); border: 1px solid var(--debtLine); font-size: 12px; font-weight: 700; line-height: 18px; text-align: center; }
.xl-find-inline { position: relative; display: flex; align-items: center; }
.xl-find-inline .i { position: absolute; left: 9px; color: #6b7570; pointer-events: none; }
.xl-find-inline input { width: 220px; min-height: 30px; padding: 2px 52px 2px 30px; border: 1px solid #a6a6a6; border-radius: 3px; font: inherit; font-size: 14px; }
.xl-find-inline input:focus { outline: none; border-color: #217346; box-shadow: 0 0 0 2px #cfe6d8; }
.xl-find-inline .kbd { position: absolute; right: 8px; }

/* menu thả xuống dùng chung (sổ năm học, Quản trị ▾, Tháng khác ▾, menu chuột phải) */
.xl-drop { position: absolute; z-index: 300; min-width: 220px; padding: 4px; background: #fff; border: 1px solid #8c8c8c; box-shadow: 2px 4px 14px rgb(0 0 0 / 22%); font-size: 15px; color: #1f2a25; }
.xl-drop[hidden] { display: none; }
.xl-drop__item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 32px; padding: 0 12px 0 10px; border: 0; background: none; font: inherit; text-align: left; color: inherit; text-decoration: none; cursor: pointer; white-space: nowrap; }
.xl-drop__item:hover, .xl-drop__item:focus-visible { background: #e2f0d9; color: inherit; box-shadow: none; border-radius: 0; }
.xl-drop__item.is-current { font-weight: 700; }
.xl-drop__item.is-danger { color: var(--debt); }
.xl-drop__item[aria-disabled="true"] { color: #9aa29e; cursor: default; background: none; }
.xl-drop__item .i { width: 16px; height: 16px; color: #217346; }
.xl-drop__item.is-danger .i { color: var(--debt); }
.xl-drop__item .xl-drop__meta { margin-left: auto; padding-left: 18px; font-size: 13px; color: #6b7570; }
.xl-drop__item .xl-drop__key { margin-left: auto; padding-left: 24px; font-size: 12.5px; color: #6b7570; }
.xl-drop__sep { height: 1px; margin: 4px 2px; background: #e1e1e1; }
.xl-drop__cap { padding: 6px 10px 4px; font-size: 12px; font-weight: 700; color: #6b7570; text-transform: uppercase; letter-spacing: .04em; }

/* ------------------------------------------------------------------ thanh công thức */
.xl-fbar { flex: none; }
.xl-fbar__name { width: 110px; font-variant-numeric: tabular-nums; }
.xl-fbar__content { cursor: text; }
.xl-fbar__content.is-edit { box-shadow: inset 0 0 0 2px #217346; }
.xl-fbar__content input { width: 100%; height: 26px; border: 0; padding: 0; font: inherit; outline: none; background: transparent; }
.xl-fbar__hint { color: #6b7570; font-style: italic; }
.xl-fbar__lock { display: inline-flex; align-items: center; gap: 5px; margin-left: 10px; padding: 0 8px; border-radius: 999px; background: #eceef0; color: #4a4f57; font-size: 12.5px; font-style: normal; line-height: 20px; vertical-align: 1px; }
.xl-fbar__lock .i { width: 12px; height: 12px; }

/* ------------------------------------------------------------------ vùng lưới (cuộn liên tục, chỉ vẽ dòng đang thấy) */
body.v3:has(.xl-sheettabs) { padding-bottom: 0; }
.xl-area { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.xl-banner { flex: none; display: flex; align-items: center; gap: 8px; padding: 5px 12px; background: #fff8e1; border-bottom: 1px solid #e6d48a; color: #5c4700; font-size: 14px; }
.xl-banner[hidden] { display: none; }
.xl-banner .i { width: 15px; height: 15px; }
.xl-scroll { flex: 1; height: auto; min-height: 0; position: relative; }
.xl-grid { --rowh: 24px; }
.xl-grid th, .xl-grid td { height: var(--rowh); }
/* hàng tiêu đề của file giữ đúng chiều cao trong file (tr có height) */
.xl-grid thead tr[data-fr] > * { height: auto; padding-top: 0; padding-bottom: 0; line-height: 1.15; }
.xl-grid .xl-letters th { position: sticky; top: 0; z-index: 8; height: 20px; }
.xl-grid .xl-letters th.is-fz { z-index: 11; }
.xl-grid .xl-letters th.xl-corner { z-index: 12; }
.xl-grid .xl-letters th.is-colsel { background: #d3f0e0; color: #217346; font-weight: 700; box-shadow: inset 0 -2px 0 #217346; }
.xl-grid .xl-corner { position: sticky; left: 0; top: 0; z-index: 12; }
.xl-grid .xl-gutter { position: sticky; left: 0; width: 52px; min-width: 52px; font-variant-numeric: tabular-nums; cursor: pointer; }
.xl-grid .xl-gutter:hover { background: #d9d9d9; }
.xl-grid tr.is-selrow .xl-gutter, .xl-grid .xl-gutter.is-selrow { background: #d3f0e0; color: #217346; font-weight: 700; box-shadow: inset -2px 0 0 #217346; }
.xl-grid.is-filtered tbody .xl-gutter { color: #0047ab; }
.xl-grid .is-fz { position: sticky; z-index: 3; }
.xl-grid .is-fz-last { box-shadow: inset -1px 0 0 #9e9e9e; border-right-color: #9e9e9e; }
.xl-grid .xl-sticky { position: sticky; z-index: 7; }
.xl-grid .xl-sticky.is-fz { z-index: 9; }
.xl-grid .xl-sticky.xl-gutter { z-index: 10; }

/* hàng tiêu đề (cuộn đi), hàng tiêu đề cột và TỔNG CỘNG (đứng yên) */
.xl-grid .xl-t { font-size: 15px; white-space: nowrap; overflow: visible; background: #fff; }
.xl-grid .xl-t.is-big { font-size: 20px; font-weight: 700; }
.xl-grid .xl-t.is-bold { font-weight: 700; }
.xl-grid .xl-t.is-free { color: #000; }
.xl-grid .xl-h { background: #f2f2f2; font-weight: 700; font-size: 13.5px; line-height: 1.2; text-align: center; vertical-align: middle; white-space: normal; border-color: #bfbfbf; padding: 2px 4px; }
.xl-grid .xl-h.is-day { font-weight: 400; font-size: 13px; padding: 0; }
.xl-grid .xl-h.is-day.is-cn { background: #e3e3e3; }
.xl-grid .xl-h.is-today { background: #fbf2c8; color: #5c4700; font-weight: 700; }
.xl-grid .xl-h.is-dead { color: #9a9a9a; }
.xl-grid .xl-h .xl-af { position: absolute; right: 2px; bottom: 2px; margin: 0; }
.xl-grid .xl-h.has-af { padding-right: 22px; }
.xl-grid .xl-tot { background: #e2f0d9; font-weight: 700; text-align: right; white-space: nowrap; overflow: hidden; font-variant-numeric: tabular-nums; }
.xl-grid .xl-tot.is-label { text-align: center; }
.xl-grid .xl-tot.is-sub { color: #1a5c38; }

/* ô dữ liệu */
.xl-grid td.c { white-space: nowrap; overflow: hidden; text-overflow: clip; font-size: 15px; position: relative; cursor: cell; }
/* ô cột cố định: sticky (cũng là khung cho ::before/::after và ô sửa) */
.xl-grid td.c.is-fz { position: sticky; }
.xl-grid td.c.al-r { text-align: right; font-variant-numeric: tabular-nums; }
.xl-grid td.c.al-c { text-align: center; }
.xl-grid td.c.is-f { background: #f5f6f5; }
.xl-grid td.c.is-free { background: #fff; }
.xl-grid td.c.is-day { text-align: center; padding: 0; }
.xl-grid td.c.is-day.is-cn { background: #ececec; }
.xl-grid td.c.is-day.is-dead { background: repeating-linear-gradient(135deg, #fafafa 0 4px, #efefef 4px 5px); cursor: not-allowed; }
.xl-grid td.c.mk-p { color: #c00000; }
.xl-grid td.c.mk-b { color: #0047ab; }
.xl-grid td.c.is-locked { color: #555; }
.xl-grid td.c.is-err-val { color: #c00000; }
.xl-grid td.c.is-sel { outline: 2px solid #217346; outline-offset: -2px; z-index: 4; }
.xl-grid td.c.is-in-range { background-color: #e6f2ea; }
.xl-grid td.c.is-in-range.is-f { background-color: #dde9e1; }
.xl-grid td.c.is-found { background: #fff2a8; }
.xl-grid td.c.is-pending { color: #6b7570; font-style: italic; }
.xl-grid td.c.is-just-saved { animation: xlSaved 1.2s ease; }
@keyframes xlSaved { from { background-color: #d3f0e0; } }
/* cột cố định luôn nằm trên ô cuộn qua bên dưới nó (kể cả ô đang chọn) */
.xl-grid td.c.is-fz, .xl-grid td.c.is-fz.is-sel, .xl-grid td.c.is-fz.is-loi { z-index: 6; }
.xl-grid tbody .xl-gutter { z-index: 7; }
/* ô gõ đè / để trống thay công thức trong file gốc: tam giác đỏ góc trái trên */
.xl-grid td.c.is-ov::before { content: ''; position: absolute; top: 0; left: 0; border-top: 7px solid #d00000; border-right: 7px solid transparent; }
/* ô công thức gõ tay (=a+b) trong ô nhập: chấm xanh nhỏ góc phải dưới */
.xl-grid td.c.has-fx::after { content: ''; position: absolute; right: 2px; bottom: 2px; width: 4px; height: 4px; border-radius: 50%; background: #217346; opacity: .7; }
/* lưu lỗi: viền đỏ + nút Thử lại */
.xl-grid td.c.is-loi { outline: 2px solid #d00000; outline-offset: -2px; z-index: 4; }
.xl-grid td.c .xl-ed { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0 4px; border: 0; outline: 2px solid #217346; outline-offset: -2px; font: inherit; font-size: 15px; background: #fff; text-align: inherit; z-index: 5; }
/* dòng trống dưới cùng: gõ vào là thêm dòng */
.xl-grid tr.is-addrow td.c { background: #fbfdfb; }
.xl-grid tr.is-addrow td.c.is-hint { color: #8a948f; font-style: italic; overflow: visible; }
.xl-grid tr.is-addrow .xl-gutter { color: #8a948f; }

/* bong bóng nhắc ngay dưới ô (lỗi gõ, ô công thức, ô gõ đè) */
.xl-bubble { position: absolute; z-index: 400; max-width: 360px; padding: 6px 10px; background: #fffbd0; border: 1px solid #8a7a00; color: #000; font-size: 13.5px; line-height: 1.35; box-shadow: 1px 2px 6px rgb(0 0 0 / 18%); }
.xl-bubble.is-err { background: #fdecea; border-color: #b42318; color: #7c1810; }
.xl-bubble.is-info { background: #fff; border-color: #8c8c8c; }
.xl-bubble b { font-weight: 700; }
.xl-bubble .xl-bubble__act { display: flex; gap: 8px; margin-top: 6px; }
.xl-bubble .btn { min-height: 28px; padding: 0 10px; font-size: 13px; }

/* tìm (Ctrl+F) */
.xl-findbox { position: absolute; top: 6px; right: 22px; z-index: 50; display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: #fff; border: 1px solid #8c8c8c; box-shadow: 2px 4px 14px rgb(0 0 0 / 18%); font-size: 14px; }
.xl-findbox input { width: 230px; min-height: 30px; padding: 2px 8px; border: 1px solid #a6a6a6; font: inherit; }
.xl-findbox input:focus { outline: none; border-color: #217346; }
.xl-findbox button { min-width: 30px; min-height: 30px; border: 1px solid #c6c6c6; background: #fff; cursor: pointer; font: inherit; }
.xl-findbox button:hover { background: #e2f0d9; }
.xl-findbox output { min-width: 64px; color: #555; text-align: center; font-variant-numeric: tabular-nums; }

/* lọc như Excel */
.xl-af__btn { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 2px; }
.xl-af__btn svg { width: 11px; height: 11px; }
.xl-af__menu { width: 280px; padding: 8px; font-size: 14px; }
.xl-af__title { font-size: 12.5px; color: #6b7570; margin: 0 2px 6px; }
.xl-af__item { min-height: 26px; }
.xl-af__item input { accent-color: #217346; }
.xl-af__item .n { margin-left: auto; color: #8a948f; font-size: 12.5px; }
.xl-af__foot { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.xl-af__foot .btn { min-height: 30px; padding: 0 14px; font-size: 14px; }
.xl-af__clear { margin-right: auto; }

/* ------------------------------------------------------------------ chân: sheet tab + thanh trạng thái (như Excel) */
.xl-foot { flex: none; display: flex; flex-direction: column; background: #f3f3f3; border-top: 1px solid #c6c6c6; position: relative; z-index: 45; }
.xl-foot .xl-sheettabs { position: static; height: 34px; border-top: 0; }
.xl-sheettabs a, .xl-sheettabs button.xl-tab { flex: none; display: flex; align-items: center; gap: 6px; padding: 0 16px; font: inherit; font-size: 14px; color: var(--ink2); text-decoration: none; white-space: nowrap; border: 0; border-right: 1px solid #d4d4d4; border-bottom: 3px solid transparent; background: transparent; cursor: pointer; }
.xl-sheettabs button.xl-tab:hover { background: #e3e3e3; }
.xl-sheettabs .is-active { background: #fff !important; color: #217346 !important; font-weight: 700; border-bottom-color: #217346 !important; }
.xl-sheettabs .xl-tab .i { width: 13px; height: 13px; }
.xl-status { display: flex; align-items: center; gap: 18px; min-height: 26px; padding: 0 10px 0 12px; border-top: 1px solid #d9d9d9; background: #217346; color: #fff; font-size: 13px; }
.xl-status__save { display: inline-flex; align-items: center; gap: 6px; min-width: 150px; }
.xl-status__save .dot { width: 8px; height: 8px; border-radius: 50%; background: #9fd3b4; }
.xl-status__save.is-saving .dot { background: #f1cf4b; animation: xlPulse 1s infinite; }
.xl-status__save.is-error .dot { background: #ff8a80; }
.xl-status__save.is-error { font-weight: 700; }
@keyframes xlPulse { 50% { opacity: .35; } }
.xl-status__msg { font-weight: 700; color: #fff3b0; }
.xl-status__grow { flex: 1; }
.xl-status__sum { font-variant-numeric: tabular-nums; }
.xl-status .xl-zoom { border-left: 1px solid rgb(255 255 255 / 25%); padding: 0 0 0 12px; color: #fff; }
.xl-status .xl-zoom button { width: 22px; height: 20px; border: 1px solid rgb(255 255 255 / 45%); background: transparent; color: #fff; border-radius: 2px; line-height: 1; font-size: 14px; }
.xl-status .xl-zoom input[type="range"] { width: 110px; accent-color: #fff; }
.xl-status .xl-zoom output { min-width: 40px; }
.xl-status a { color: #fff; }

/* ------------------------------------------------------------------ hộp thoại (lịch sử ô, xóa dòng) */
.xl-modal { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; background: rgba(21, 32, 27, .38); }
.xl-modal[hidden] { display: none; }
.xl-modal__box { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 64px); display: flex; flex-direction: column; background: #fff; border: 1px solid #8c8c8c; box-shadow: var(--shadow-2); }
.xl-modal__head { display: flex; align-items: center; gap: 10px; padding: 0 6px 0 14px; min-height: 36px; background: #217346; color: #fff; font-weight: 700; }
.xl-modal__head .grow { flex: 1; }
.xl-modal__close { width: 32px; height: 28px; border: 0; background: transparent; color: #fff; font-size: 18px; cursor: pointer; }
.xl-modal__close:hover { background: #c42b1c; }
.xl-modal__body { padding: 16px 18px; overflow: auto; font-size: 15px; }
.xl-modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid #e1e1e1; background: #f7f7f7; }
.xl-hist { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.xl-hist th { text-align: left; font-size: 12.5px; color: #6b7570; font-weight: 700; padding: 6px 8px; border-bottom: 1px solid #bfbfbf; background: #f7f7f7; }
.xl-hist td { padding: 7px 8px; border-bottom: 1px solid #e6e6e6; vertical-align: top; }
.xl-hist .arrow { color: #8a948f; padding: 0 6px; }
.xl-hist .old { color: #6b7570; text-decoration: line-through; }
.xl-hist .new { font-weight: 700; }
.xl-hist code { font-family: Consolas, 'Courier New', monospace; font-size: 13px; background: #f2f2f2; padding: 0 4px; }

/* ------------------------------------------------------------------ toast */
.xl-toasts { position: fixed; left: 50%; bottom: 84px; z-index: 600; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.xl-toast { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #15201b; color: #fff; border-radius: 3px; box-shadow: var(--shadow-2); font-size: 14.5px; animation: toastIn .2s ease; pointer-events: auto; }
.xl-toast .i { color: #f1cf4b; }

/* ------------------------------------------------------------------ trang ngoài sổ (Tổng quan, Nhắc đóng tiền...) */
.v3-main { min-height: 0; }
.v3-page .page { margin: 0 auto; }
.v3-page .page { max-width: 1240px; }
.v3-page .page-head h1 { font-size: var(--fs-xl); }
.v3-page .tabs { margin-bottom: var(--s4); }
.v3-more { display: flex; justify-content: center; margin-top: var(--s4); }

/* Nhắc đóng tiền: thẻ gia đình */
.fam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); gap: var(--s4); }
.fam { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-1); }
.fam__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.fam__who b { font-size: var(--fs-lg); }
.fam__who .sdt { display: block; color: var(--ink3); font-size: var(--fs-md); font-variant-numeric: tabular-nums; margin-top: 2px; }
.fam__head .tien-big { font-size: var(--fs-xl); }
.fam__kids { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.fam__kids td { padding: 7px var(--s4); border-bottom: 1px solid var(--line); vertical-align: middle; }
.fam__kids tr:last-child td { border-bottom: 0; }
.fam__kids td.num { text-align: right; white-space: nowrap; }
.fam__kids td.gv { color: var(--ink3); font-size: var(--fs-sm); }
.fam__kids a { white-space: nowrap; font-size: var(--fs-sm); }
.fam__foot { display: flex; gap: var(--s2); justify-content: flex-end; padding: var(--s2) var(--s4) var(--s3); margin-top: auto; border-top: 1px solid var(--line); background: var(--surface2); border-radius: 0 0 var(--r-md) var(--r-md); }

/* ô số lớn (Tổng quan, Đối chiếu lương) */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--s4); margin-bottom: var(--s5); }
.kpi { display: block; padding: var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-1); color: inherit; text-decoration: none; }
a.kpi:hover { border-color: var(--board); }
.kpi .lbl { font-size: var(--fs-sm); color: var(--ink3); font-weight: 600; }
.kpi .val { font-size: var(--fs-2xl); font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; line-height: 1.15; }
.kpi .val.is-no { color: var(--debt); }
.kpi .sub { font-size: var(--fs-sm); color: var(--ink3); margin-top: 4px; }

/* bảng mở rộng được (Đối chiếu lương) */
.tbl tr.is-open > td { background: var(--board100); }
.tbl tr.sub > td { background: var(--surface2); font-size: var(--fs-md); }
.tbl tr.sub > td:first-child { padding-left: 44px; }
.tbl .xbtn { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: 6px; border: 1px solid var(--lineStrong); border-radius: var(--r-xs); background: var(--surface); cursor: pointer; font-weight: 700; line-height: 1; vertical-align: middle; }
.tbl td.num, .tbl th.num { font-variant-numeric: tabular-nums; }

/* phiếu thu A5 */
.phieu { width: 148mm; min-height: 200mm; margin: 0 auto; padding: 10mm 11mm; background: #fff; color: #000; box-shadow: var(--shadow-2); font-family: 'Times New Roman', Times, serif; font-size: 13.5pt; line-height: 1.4; }
.phieu__tt { display: flex; justify-content: space-between; gap: 8mm; font-size: 11pt; }
.phieu__tt b { font-size: 12pt; }
.phieu h1 { text-align: center; font-size: 20pt; margin: 7mm 0 1mm; letter-spacing: .04em; font-family: inherit; }
.phieu .sub { text-align: center; font-style: italic; font-size: 11.5pt; }
.phieu table { width: 100%; border-collapse: collapse; margin: 5mm 0 3mm; font-size: 12pt; }
.phieu th, .phieu td { border: 1px solid #000; padding: 1.5mm 2mm; vertical-align: top; }
.phieu th { font-weight: 700; text-align: center; }
.phieu td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.phieu tr.tong td { font-weight: 700; }
.phieu .chu { font-style: italic; }
.phieu .ky { display: grid; grid-template-columns: 1fr 1fr; text-align: center; margin-top: 7mm; font-size: 12pt; }
.phieu .ky i { display: block; font-size: 10.5pt; }
.phieu .ky span { display: block; height: 22mm; }
@media print {
  @page { size: A5 portrait; margin: 0; }
  body.v3 { display: block; height: auto; overflow: visible; background: #fff; }
  .no-print, #khung-tren, #khung-duoi { display: none !important; }
  .v3-main { overflow: visible !important; }
  .v3-page .page { padding: 0; max-width: none; }
  .phieu { box-shadow: none; margin: 0; width: auto; min-height: 0; }
}

/* giáo viên: khung điện thoại trong mockup */
.phone-stage { display: flex; justify-content: center; padding: var(--s5) var(--s4) var(--s10); }
.phone { width: 390px; height: min(800px, calc(100vh - 90px)); min-height: 560px; border: 10px solid #1d2320; border-radius: 38px; overflow: hidden; box-shadow: var(--shadow-2); background: var(--paper); }
.phone .t-app { height: 100%; min-height: 0; overflow: auto; box-shadow: none; }
.phone .t-nav { grid-template-columns: repeat(3, 1fr); }
.dd-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.dd-row .grow b { display: block; font-weight: 600; }
.dd-row .grow small { color: var(--ink3); font-size: 13px; }
.dd-row button.dau { border: 0; cursor: pointer; width: 44px; height: 44px; }
.dd-row button.dau.dau-n { border: 2px dashed var(--markN); }
.dd-bar { position: sticky; bottom: 0; display: flex; gap: 10px; align-items: center; padding: 10px 14px; background: var(--surface); border-top: 1px solid var(--lineStrong); }

/* trong lúc đọc sổ (vài trăm ms với file thật), trang không trống trơn */
#khung-tren:empty::before { content: 'Đang mở sổ DỮ LIỆU 2026-2027…'; display: block; padding: 10px 16px; background: #217346; color: #fff; font-weight: 700; }
/* ô vừa nhận từ điện thoại giáo viên / máy khác: viền xanh dương nháy */
.xl-grid td.c.is-remote { animation: xlRemote 1.4s ease 3; box-shadow: inset 0 0 0 2px #2f6fd0; font-weight: 700; }
@keyframes xlRemote { 50% { background-color: #dbe8fb; } }
.xl-toast .btn { min-height: 26px; padding: 0 10px; margin-left: 6px; background: #fff; color: #15201b; }

/* ------------------------------------------------------------------ ứng dụng giáo viên (gv.js) trong khung điện thoại */
.phone { position: relative; }
.phone .t-head .days { display: flex; gap: 8px; margin-top: 12px; }
.phone .t-head .day { flex: 1; min-height: 52px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 10px; background: transparent; color: #fff; font: inherit; font-size: 13px; cursor: pointer; line-height: 1.2; }
.phone .t-head .day b { display: block; font-size: 16px; }
.phone .t-head .day[aria-pressed="true"] { background: #fff; color: var(--board); font-weight: 700; }
.phone .t-head .hello { color: #cfe2d9; font-size: 15px; }
.phone .t-section { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 2px 10px; }
.phone .t-section h2 { font-size: 17px; }
.phone .t-section .sub { font-size: 14px; color: var(--ink3); }
.phone .t-card .top { display: flex; justify-content: space-between; gap: 12px; }
.phone .t-card .meta { font-size: 14px; color: var(--ink3); margin-top: 6px; }
.phone .t-card .cta { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-weight: 700; color: var(--board); }
.phone .t-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--lineStrong); border-radius: 14px; overflow: hidden; }
.phone .t-item { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 8px 14px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.phone .t-list li:last-child .t-item { border-bottom: 0; }
.phone .t-item small { display: block; color: var(--ink3); font-size: 13px; margin-top: 3px; }
.phone .t-item.is-on { background: var(--board100); }
.phone .gv-grid-wrap { overflow: auto; max-height: 520px; background: var(--surface); border: 1px solid var(--lineStrong); border-radius: 10px; }
.phone .mgrid { border-collapse: separate; border-spacing: 0; font-size: 13px; }
.phone .mgrid .name { min-width: 140px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.phone .luong-row { display: flex; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.phone .luong-row small { display: block; color: var(--ink3); font-size: 13px; margin-top: 2px; }
.phone .luong-row .tien { font-size: 16px; }
.phone .luong-tong { display: flex; justify-content: space-between; padding: 14px; background: var(--board100); font-weight: 700; font-size: 17px; }
.gv-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; background: var(--creditBg); color: var(--credit); border: 1px solid var(--creditLine); font-size: 13px; font-weight: 700; }
.gv-chip .i { width: 15px; height: 15px; }
.gv-chip.is-off { background: var(--warnBg); color: var(--warn); border-color: var(--warnLine); }
.gv-dem { display: flex; gap: 6px; margin-top: 10px; }
.gv-dem span { flex: 1; padding: 4px 0; border-radius: 8px; background: rgba(255, 255, 255, .12); text-align: center; font-size: 12.5px; color: #dcebe3; }
.gv-dem b { display: block; font-size: 18px; color: #fff; }
.gv-tool { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; font-size: 14px; }
.gv-hs { color: inherit; text-decoration: none; min-width: 0; }
.gv-hs b { display: block; font-weight: 600; }
.gv-hs small { color: var(--ink3); font-size: 12.5px; }
.dd-row button.dau.is-cho { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--chalk); }
.dd-row button.dau:disabled { cursor: default; opacity: .85; }
.dd-bar { min-height: 56px; }
.gv-sync { display: flex; align-items: center; gap: 8px; font-size: 13.5px; line-height: 1.35; color: var(--ink2); }
.gv-sync .i { flex: none; color: var(--board); }
.gv-sync.is-ok .i { color: var(--credit); }
.gv-sync.is-off { color: var(--warn); }
.gv-sync.is-off .i { color: var(--warn); }
.gv-ngay { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.gv-ngay__o { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.gv-ngay__o small { color: var(--ink3); font-size: 11px; }
.gv-ngay__o .dau { width: 28px; height: 28px; font-size: 15px; }
.gv-login { display: flex; flex-direction: column; justify-content: center; gap: 14px; min-height: 100%; padding: 28px 22px; background: var(--paper); }
.gv-login__logo { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 16px; background: var(--board); color: #fff; font-weight: 700; font-size: 15px; text-align: center; line-height: 1.1; }
.gv-login h1 { font-size: 26px; }
.gv-toast { position: absolute; left: 12px; right: 12px; bottom: 80px; z-index: 40; font-size: 14px; }

/* trang nhiều khung điện thoại + trang đồng bộ */
.gv-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 28px 20px; padding: 20px 16px 48px; max-width: 1640px; margin: 0 auto; }
.gv-gallery figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.gv-gallery figcaption { max-width: 360px; font-size: 14px; color: var(--ink2); text-align: center; }
.gv-gallery figcaption b { display: block; color: var(--ink); font-size: 15px; }
.gv-gallery .phone { width: 340px; height: 690px; min-height: 0; border-width: 9px; }
.tag-de-xuat { background: var(--infoBg); color: var(--info); border-color: var(--infoLine); }
body.v3.is-nhung .mockbar { display: none; }
body.v3.is-nhung .xl-toasts { bottom: auto; top: 96px; }
.mockbar--warn { background: #5c4700; color: #fff3b0; }
