body{background:#eef1f3}
.bar{max-width:800px;margin:0 auto 10px;display:flex;justify-content:space-between;gap:10px}
.sheet{font-family:"Times New Roman",Times,serif;position:relative;max-width:800px;margin:24px auto;background:#fff;border:1px solid var(--line);border-radius:10px;padding:22px 32px;overflow:hidden}
.wm{position:absolute;left:50%;top:56%;transform:translate(-50%,-50%);width:58%;max-width:400px;z-index:0;pointer-events:none}
.inner{position:relative;z-index:1}
.hdimg{width:100%;height:auto;display:block;margin-bottom:8px}
.title-row{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:10px 4px;margin:6px 0 14px}
.qr-spacer{width:64px;flex-shrink:0}
.title-txt{flex:1;text-align:center;font-size:30px;font-weight:700;color:#006494;letter-spacing:.3px}
.qr-box{width:64px;height:64px;flex-shrink:0;background:#fff}
.qr-box svg{width:100%;height:100%;display:block}
.info{display:grid;grid-template-columns:2.2fr 1fr;gap:3px 16px;font-size:15.5px;margin-bottom:8px}
.info div{padding:1px 0}
.info .lb{font-weight:400;color:#444}
.info b{font-weight:800;color:#111}
.info b.ten-bn{text-transform:uppercase;font-size:17px}
.grp-bp{font-weight:800;font-size:16px;text-transform:uppercase;color:#c0392b;letter-spacing:.3px;margin-top:12px;padding-bottom:2px;border-bottom:1.5px solid #c0392b}
.grp-goi{font-weight:800;font-style:italic;color:#0b6f65;padding-top:8px!important;border-bottom:none!important}
table.kq{width:100%;border-collapse:collapse;font-size:15px;font-family:inherit}
table.kq th{text-align:left;border-bottom:1.5px solid #333;padding:5px 6px;font-size:13.5px;font-weight:700;text-transform:uppercase}
table.kq td{padding:4px 6px;border-bottom:1px dotted #ddd;vertical-align:top }
/* Dòng chỉ định: chữ thường; tên chỉ số: in đậm */
table.kq .cd-row td{font-weight:400;padding-top:9px;border-bottom:none}
table.kq td.ten-cs{font-weight:700;padding-left:14px}
/* Cột kết quả: THẤP -> lệch TRÁI, bình thường -> GIỮA, CAO -> lệch PHẢI (kết quả bất thường in đậm) */
table.kq .kq-cell{width:130px;text-align:center}
table.kq td.kq-L{font-weight:800;text-align:left;padding-left:10px}
table.kq td.kq-H{font-weight:800;text-align:right;padding-right:10px}
/* Cột thiết bị (bên phải khoảng tham chiếu) */
table.kq td.tb{font-size:12.5px;color:#444}
table.kq th.c-ten{width:34%}
table.kq th.c-kq{width:15%;text-align:center}
table.kq th.c-ref{width:27%}
table.kq th.c-tb{width:24%}
/* Đường kẻ dọc giữa các cột: chỉ ở dòng chỉ số xét nghiệm */
table.kq tr.cs-row td{border-left:1px solid #8a8a8a;border-right:1px solid #8a8a8a}
/* Khung bảng: kẻ dọc ở dòng tiêu đề, viền trái/phải + gạch dưới ở dòng chỉ định, đóng khung cuối bảng */
table.kq thead th{border-left:1px solid #8a8a8a;border-right:1px solid #8a8a8a}
table.kq tr.cd-row td, table.kq tr.grp-goi-row td{border-bottom:1px solid #8a8a8a!important}
table.kq tr.cd-row td:first-child, table.kq tr.grp-goi-row td{border-left:1px solid #8a8a8a}
table.kq tr.cd-row td:last-child, table.kq tr.grp-goi-row td{border-right:1px solid #8a8a8a}
table.kq{border-bottom:1px solid #8a8a8a}
table.kq .ref{color:#555;white-space:nowrap}
.sign{display:flex;justify-content:flex-end;margin-top:16px}
.sign .box{width:260px;text-align:center;font-size:15px}
.sign .box b{display:block;margin-bottom:52px}
.ftimg{width:100%;height:auto;display:block;margin-top:14px}
/* Khung trang: thead = header, tfoot = footer (trình duyệt lặp lại thead/tfoot trên mỗi trang in) */
table.pg{width:100%;border-collapse:collapse}
table.pg > thead > tr > td, table.pg > tfoot > tr > td, table.pg > tbody > tr > td{padding:0;border:none;vertical-align:top}
.hd-fixed,.ft-fixed{display:none}
table.kq tr{break-inside:avoid;page-break-inside:avoid}
table.kq .cd-row, table.kq .grp-goi-row{break-after:avoid;page-break-after:avoid}
.grp-bp{break-after:avoid;page-break-after:avoid}
.sign{break-inside:avoid;page-break-inside:avoid}
@media print{
  body{background:#fff}
  .no-print{display:none!important}
  .sheet{margin:0;border:none;border-radius:0;padding:0;max-width:100%;overflow:visible}
  @page{size:A4;margin:8mm 12mm 12mm}
  /* Header/footer thật: cố định ở đầu/cuối MỖI trang in */
  .hd-fixed{display:block;position:fixed;top:0;left:0;width:100%;height:auto;z-index:2}
  .ft-fixed{display:block;position:fixed;bottom:0;left:0;width:100%;height:auto;z-index:2}
  /* Bản trong thead/tfoot chỉ làm khoảng trống giữ chỗ (cùng kích thước) để nội dung không đè lên */
  .hdimg,.ftimg{visibility:hidden}
  .hdimg{margin-bottom:8px}
  .ftimg{margin-top:8px}
  /* Logo mờ cũng lặp lại giữa mỗi trang */
  .wm{position:fixed;top:50%}
}
