:root{--navy:#102c43;--blue:#087f8c;--bg:#f2f6f8;--border:#dfe8ee;--text:#243e53;--teal:#0b8994}
body{background:var(--bg);color:var(--text);font-size:16px;line-height:1.55}
.sidebar{width:264px;background:linear-gradient(165deg,#102d45,#092336);padding:24px 14px 18px;display:flex;flex-direction:column;overflow-y:auto;z-index:20}
.brand{padding:0 10px 25px;gap:12px;font-size:16px;line-height:1.65}.brand img{width:45px;height:45px}.brand small{display:block;color:#91b3c7;font-size:14px;font-weight:500;letter-spacing:.5px}.nav-label{font-size:14px;letter-spacing:1.7px;font-weight:700;color:#6f93ab;margin:8px 14px 10px}.sidebar nav{gap:4px}.sidebar nav a{padding:11px 13px;border-radius:9px;font-size:16px;gap:12px;color:#bfd0dc;transition:background .15s,color .15s}.sidebar nav a:hover{color:#fff;background:#ffffff0d}.sidebar nav a.active{background:#127e89;color:#fff;box-shadow:0 5px 15px #021a2638}.sidebar nav i{font-size:18px;width:20px}.sidebar-footer{margin-top:auto;padding:25px 14px 0;color:#7398ae;font-size:12px;letter-spacing:1.5px}.status-dot{display:inline-block;width:6px;height:6px;border-radius:50%;background:#43d1ad;margin-right:7px}
main{margin-left:264px}.topbar{height:76px;padding:0 32px;border-bottom:1px solid var(--border);box-shadow:none;z-index:10;background:#ffffffed;backdrop-filter:blur(10px)}.topbar-left,.topbar-right{display:flex;align-items:center;gap:20px}.menu{border:0;background:none;color:#637e90;padding:6px}.workspace-label{font-size:14px;font-weight:700;letter-spacing:1.8px;color:#72899b}.report-date{padding:7px 12px;border:1px solid #d8e8ed;background:#f4fafa;border-radius:8px;font-size:16px;color:#507180}.report-date b{color:#0a7b83;margin-left:5px}#clock{font-size:16px;color:#718397;font-variant-numeric:tabular-nums}.admin-avatar{display:grid;place-items:center;width:32px;height:32px;background:#e4efef;color:#137880;border-radius:50%;font-weight:700}.content{padding:28px 32px 40px;max-width:1900px;margin:auto}
.page-title,.page-head h2{font-size:30px;letter-spacing:-.7px;color:#15344b}.page-head{margin-bottom:24px}.page-head p{font-size:16px;color:#7e91a1}.btn{border-radius:8px;font-weight:600;font-size:16px;padding:9px 15px}.btn-sm{padding:6px 10px;font-size:16px}.btn-primary{--bs-btn-bg:#087f8c;--bs-btn-border-color:#087f8c;--bs-btn-hover-bg:#066976;--bs-btn-hover-border-color:#066976;--bs-btn-active-bg:#065e6a;--bs-btn-active-border-color:#065e6a}.btn-outline-primary{--bs-btn-color:#087f8c;--bs-btn-border-color:#8cbcc2;--bs-btn-hover-bg:#087f8c;--bs-btn-hover-border-color:#087f8c}.form-control{border-radius:7px;border-color:#dce6ec;font-size:16px;min-height:38px}.form-control:focus{border-color:#4ba5ab;box-shadow:0 0 0 3px #0b899414}.readonly{background:#f0f6f7!important;color:#22636e}
.panel,.table-card,.kpi{border:1px solid #e0e8ed;border-radius:13px;box-shadow:0 3px 15px #15344904}.panel{padding:20px}.table-card{padding:24px}.table{--bs-table-color:#284356;--bs-table-border-color:#e3ebef;font-size:16px;margin-bottom:10px}.table>thead>tr>th{padding:13px 10px;font-size:16px;color:#48697e;background:#f2f7f9;font-weight:800;border-bottom-width:1px}.table>tbody>tr>td{padding:12px 10px}.table>tbody>tr:hover{background:#f8fbfc}.table tfoot th{padding:12px 10px;color:#136a76;background:#edf7f7!important}.input-table td{padding:10px 7px!important}.input-table th{background:#f1f7f9!important}.input-table .form-control{font-size:16px}.issue-table .group-end{border-right-color:#cadde4}.issue-table{border-color:#cadde4}.issue-table thead,.issue-table tfoot{border-color:#cadde4}.report-actions{color:#738c9e;font-size:16px}.section-heading{display:flex;align-items:center;gap:12px;margin-bottom:18px}.section-heading span{width:30px;height:30px;display:grid;place-items:center;background:#e8f5f4;color:#178489;border-radius:9px;font-size:14px;font-weight:800}.section-heading h3{font-size:18px;font-weight:800;margin:0;color:#16394c}.report-notes{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.9;color:#536d7e;min-height:45px}
.admin-tabs{top:75px;border-radius:11px;border-color:#dce8ed;padding:9px;box-shadow:0 4px 15px #17424e06;z-index:9}.admin-tabs a{font-size:16px;font-weight:600;color:#48717e;background:#f1f7f8}.admin-tabs a:hover{color:#087f8c;background:#e2f1f1}.form-panel{padding:22px;margin-bottom:20px}.form-panel h3{font-size:20px;letter-spacing:-.3px;color:#164357;border-bottom-color:#e5edf1;padding-bottom:16px}.subtable-title{background:#ecf6f6;color:#1a6974;border-left:3px solid #25a1a5;font-size:16px;letter-spacing:.4px;padding:11px 13px}.save-status-bar{display:flex;justify-content:space-between;align-items:center;gap:12px;min-height:38px;margin:0 0 10px;color:#197d76;font-size:16px}.save-status-bar .save-error{color:#b83e3e;font-weight:600}[id="chung"],[id="nhanluc"],[id="kcb"],[id="mau"],[id="capphat"],[id="benhnhan"],#bieudo{scroll-margin-top:145px}.edit-target{outline-color:#70b8b9}.empty-state{padding:70px 24px}
body:has(.dashboard-page){overflow:auto!important}.dashboard-page{height:auto!important;overflow:visible!important}.dashboard-page .dashboard-toolbar{height:auto;margin-bottom:20px;gap:16px}.dashboard-toolbar label{white-space:nowrap;font-size:16px;color:#708799}.dashboard-toolbar form{max-width:450px}.dashboard-page .hero{background:linear-gradient(110deg,#102e46,#164b61);border:0;padding:25px 30px;color:#fff;border-radius:16px;position:relative;overflow:hidden}.dashboard-page .hero:after{content:"";position:absolute;width:240px;height:240px;border:45px solid #ffffff05;border-radius:50%;right:-80px;top:-100px;pointer-events:none}.dashboard-page .hero h1{font-size:16px;letter-spacing:3px;color:#8fc3d0;font-weight:600}.dashboard-page .hero h2{font-size:34px;color:#fff;letter-spacing:-1px;margin:8px 0}.dashboard-page .hero .text-secondary{color:#9bbdcd!important;font-size:16px!important}.dashboard-page .hero p{font-size:16px;margin:8px 0;color:#c3d9e1}.dashboard-page .hero b{color:#fff}
.dashboard-page .cards{gap:16px;margin:20px 0}.dashboard-page .kpi{padding:19px 22px;position:relative;overflow:hidden}.dashboard-page .kpi:before{content:"";width:4px;position:absolute;left:0;top:20px;bottom:20px;border-radius:3px;background:#1ba3a5}.dashboard-page .kpi:nth-child(2):before{background:#5789d3}.dashboard-page .kpi:nth-child(3):before{background:#8b82ca}.dashboard-page .kpi:nth-child(4):before{background:#dc8c93}.dashboard-page .kpi b{font-size:16px;font-weight:600;color:#6a8192}.dashboard-page .kpi .value{font-size:34px;line-height:1.4;color:#183e55;letter-spacing:-1px;margin:3px 0}.dashboard-page .kpi small{font-size:14px;color:#8195a4}
.dashboard-page .grid-main{grid-template-columns:minmax(0,1fr) minmax(0,1fr) 260px;gap:16px}.dashboard-page .panel{padding:20px}.dashboard-page .panel h3{font-size:16px;font-weight:800;line-height:1.6;margin-bottom:18px;color:#37596b}.dashboard-page canvas{max-height:none!important;height:225px!important}.dashboard-page .qr{grid-row:span 2;display:flex;flex-direction:column;justify-content:center}.dashboard-page .qr img{width:200px;max-width:100%;padding:10px;margin-top:8px}.dashboard-page .qr .alert{background:#eef7f6;color:#548581;border:0;font-size:14px;border-radius:8px;margin:12px 0 0}.dashboard-page .inventory{gap:10px}.dashboard-page .inv{background:#f2f7f9;border:1px solid #eaf0f3;padding:12px 6px;border-radius:9px}.dashboard-page .inv b{font-size:21px;color:#244c64}.dashboard-page .inv span{font-size:14px;letter-spacing:.2px}.dashboard-page .grid-main>.panel:not(.qr):not(.inventory){font-size:16px}.dashboard-page .grid-main>.panel:not(.qr):not(.inventory) small{font-size:16px}.dashboard-page .report-notes{font-size:16px}.sidebar-collapsed .sidebar{display:none}.sidebar-collapsed main{margin-left:0}
@media(min-width:1200px) and (min-height:850px){body:has(.dashboard-page) .content{padding:28px 32px}body:has(.dashboard-page) .topbar{height:76px}}
@media(max-width:1250px){.sidebar{width:234px}main{margin-left:234px}.content{padding:22px}.topbar{padding:0 22px}.workspace-label{display:none}.dashboard-page .grid-main{grid-template-columns:1fr 1fr}.dashboard-page .qr{grid-column:2;grid-row:2/4}.dashboard-page .inventory{grid-column:1;grid-template-columns:repeat(3,1fr)}}
@media(max-width:900px){.sidebar{width:210px}main{margin-left:210px}.content{padding:18px}.topbar{padding:0 16px}.topbar-right{gap:10px}#clock{display:none}.dashboard-page .cards{grid-template-columns:repeat(2,1fr)}.dashboard-page .grid-main{grid-template-columns:1fr}.dashboard-page .qr,.dashboard-page .inventory{grid-column:auto;grid-row:auto}.dashboard-page .hero h2{font-size:28px}.report-date{font-size:14px}.table-card,.form-panel{padding:16px}}
@media(max-width:650px){.sidebar{width:235px;box-shadow:10px 0 35px #06182755}main{margin-left:0}.topbar-left{margin-left:230px}.sidebar-collapsed .topbar-left{margin-left:0}.workspace-label,.admin-avatar{display:none}.topbar-right{margin-left:auto}.dashboard-page .cards{gap:9px}.dashboard-page .kpi{padding:13px 15px}.dashboard-page .kpi .value{font-size:28px}.dashboard-page .hero{padding:22px}.admin-tabs{position:static}.dashboard-toolbar{flex-wrap:wrap}.topbar{height:65px}.content{padding:14px}.report-date{font-size:14px;padding:5px}}
@media print{.sidebar,.topbar,.admin-tabs,.save-status-bar,.report-actions .btn,.dashboard-toolbar{display:none!important}main{margin-left:0}.content{padding:0}.table-card,.panel{break-inside:avoid;box-shadow:none}.table-responsive{overflow:visible}.issue-table,.exam-table,.inventory-input-table{min-width:0}.report-actions{color:#333}}

@media(max-width:650px){body:not(.sidebar-collapsed) .topbar-right{display:none}.sidebar-collapsed .topbar-right{display:flex}}

/* Readable labels and consistent table headings across report and entry pages. */
.form-panel label,.form-select,.input-table .code{font-size:16px}
.panel h3,.panel h4,.table-card h3,.table-card h4,.subtable-title,.table th{font-weight:800}
.table-card h4{font-size:20px}
.dashboard-page .qr small{font-size:14px}
/* Keep action forms on one baseline; standalone section save buttons retain their spacing. */
.dept-table .actions{display:flex;align-items:center;gap:8px;flex-wrap:nowrap}
.dept-table .actions form{margin:0;display:flex;align-items:center}
.dept-table .actions form>.btn{margin:0;display:inline-flex;align-items:center;justify-content:center;min-height:36px;white-space:nowrap}
/* Match group boundaries to the other tables instead of heavy separators. */
.issue-table,.issue-table .group-end,.issue-table td[rowspan],.issue-table thead,.issue-table tfoot,.issue-table tfoot tr:last-child{border-color:#e3ebef}
.issue-table .group-end,.issue-table td[rowspan]{border-right-width:1px}
.issue-table thead{border-bottom-width:1px}
.issue-table tfoot,.issue-table tfoot tr:last-child{border-top-width:1px}
.form-panel h4{font-size:20px;font-weight:800}
/* v1.7: readable branding, QR projection, free-form patient history. */
.sidebar .brand{flex-direction:column;text-align:center;gap:12px;font-size:16px}
.sidebar .brand img{width:72px;height:72px;object-fit:contain}
.dashboard-page .inventory{grid-template-columns:repeat(auto-fit,minmax(160px,1fr))}
.dashboard-page .inv span{font-size:16px;display:inline-block;overflow-wrap:anywhere}
.qr-enlarge{border:0;background:transparent;color:#087f8c;padding:0;cursor:zoom-in}
.qr-enlarge span{display:block;font-size:14px;margin-top:8px}
#qr-dialog{border:0;border-radius:16px;padding:24px;text-align:center;max-width:95vw;max-height:95vh;overflow:auto}
#qr-dialog::backdrop{background:rgba(9,25,40,.8)}
#qr-dialog img{display:block;width:min(72vh,78vw);height:auto;margin:0 auto 16px;image-rendering:pixelated}
#qr-dialog h3{font-size:20px;font-weight:800}
.patient-notes{white-space:normal;overflow-wrap:anywhere;line-height:1.8}
.notes-toolbar{display:flex;gap:8px;margin:8px 0}
#notes-preview:not(:empty){padding:16px;background:#f2f7f9;border-radius:8px;margin-top:12px}
.patient-summary{max-height:110px;overflow:auto;font-size:14px}
#patient-save-status{color:#087f8c;margin-top:12px}
#tinhhinhkhac{scroll-margin-top:145px}
