/* Phase 5 confidential HIV screen chrome. No clinical PDF styles modified. */
@media screen {
.p5-confidential{display:flex;justify-content:flex-end;color:#884c7f;font-size:12px;font-weight:650;margin:0 0 8px}.p5-hiv-title{text-align:center;margin:0 0 8px;padding:4px 6px}.p5-hiv-title h2{font-size:25px;margin:0 0 3px}.p5-hiv-title p{margin:3px 0;font-size:13px}.r12-layout .main .p5-hiv-editor{margin:0;padding:0;border:0;min-width:0;overflow:visible}.r12-layout .main:has(.p5-hiv-editor){overflow:visible}.r12-layout .main .p5-hiv-tracker{grid-template-columns:repeat(4,minmax(0,1fr))!important;position:sticky;top:var(--p5-top,90px);z-index:35;min-height:48px;padding:3px 5px!important;margin:0 0 8px!important}.r12-layout .main .p5-hiv-tracker .stage-icon{width:23px;height:23px;flex-basis:23px;font-size:12px}.r12-layout .main .p5-hiv-tracker li b{font-size:12px}.r12-layout .main .p5-hiv-tracker li::after{top:11px}.p5-hiv-module .hiv-report-editor{min-width:0}.p5-hiv-module .hiv-entry-column{min-width:0}.p5-hiv-module .hiv-entry-column fieldset{min-inline-size:0}.p5-hiv-module .hiv-entry-column :is(input,select){max-width:100%;min-width:0}.p5-hiv-module .hiv-entry-column .table-wrap{max-width:100%;overflow:auto}.p5-hiv-module .hiv-entry-column .hiv-pid-input{flex-wrap:wrap}.p5-hiv-module .hiv-preview:not(.hiv-preview-fullscreen){top:calc(var(--p5-top,90px) + var(--p5-track,48px) + 9px);max-height:calc(100dvh - var(--p5-top,90px) - var(--p5-track,48px) - var(--p5-bottom,68px) - 20px);display:flex;flex-direction:column;min-height:180px}.p5-hiv-module .hiv-preview-scroll{min-height:0;flex:1;max-height:none;overflow:auto}.p5-hiv-module #hiv-pdf-frame{margin:0 auto;border-radius:0;background:white}.p5-hiv-module .hiv-preview.hiv-preview-fullscreen{inset:0!important;border-radius:0!important;padding:10px!important}.p5-hiv-module .hiv-preview-fullscreen .hiv-preview-scroll{flex:1}.p5-hiv-module .p5-hiv-readonly:not(.p5-hiv-show-sheet) .hiv-report-editor{display:block!important}.p5-hiv-module .p5-hiv-readonly:not(.p5-hiv-show-sheet) .hiv-entry-column,.p5-hiv-module .p5-hiv-readonly:not(.p5-hiv-show-sheet) .editor-resize-handle{display:none!important}.p5-hiv-module .p5-hiv-readonly:not(.p5-hiv-show-sheet) .hiv-preview:not(.hiv-preview-fullscreen){position:relative;top:auto;max-height:none;height:clamp(300px,calc(100dvh - 265px),900px)}.p5-hiv-action-bar,.p5-hiv-output{position:sticky;bottom:0;z-index:40}.p5-hiv-action-bar #p5-hiv-save-state{margin-right:auto;align-self:center;font-size:14px;font-weight:600}.p5-hiv-output button{flex:1;min-width:145px}.p5-hiv-output .muted{flex-basis:100%;text-align:center;font-size:12px}.p5-hiv-module :is(input,select,button){scroll-margin-top:calc(var(--p5-top,90px) + var(--p5-track,48px) + 10px);scroll-margin-bottom:calc(var(--p5-bottom,68px) + 12px)}.p5-hiv-archive td{white-space:normal;overflow-wrap:anywhere}.p5-hiv-archive .r12-toolbar{align-items:end}.p5-hiv-archive .r12-toolbar label{flex:1}.p5-hiv-archive .r12-toolbar input{width:100%}#p5-hiv-laboratory[hidden],#p5-hiv-historical[hidden]{display:none!important}
@media(max-width:900px){.p5-hiv-module .hiv-report-editor{grid-template-columns:minmax(0,1fr)!important}.p5-hiv-module .hiv-preview:not(.hiv-preview-fullscreen){position:relative;top:auto;max-height:75vh}.p5-hiv-module .hiv-report-editor>.editor-resize-handle{display:none}.p5-hiv-title h2{font-size:22px}.p5-hiv-tracker li b{font-size:11px!important}}
@media(max-width:500px){.p5-hiv-module .hiv-entry-column .grid3,.p5-hiv-module .hiv-name-row{grid-template-columns:minmax(0,1fr)!important}.p5-hiv-action-bar,.p5-hiv-output{gap:6px;padding:8px}.p5-hiv-action-bar #p5-hiv-save-state{flex-basis:100%}.p5-hiv-module .hiv-pid-input{display:flex;flex-wrap:wrap}.p5-hiv-module .hiv-pid-input select{max-width:100%}}
}
/* Supersede legacy HIV-only single-column lock in Phase 5, not in legacy tools. */
@media screen {
.p5-hiv-module #hiv-report-editor.hiv-report-editor{display:grid!important;grid-template-columns:minmax(0,var(--hiv-form-share,44%)) 8px minmax(0,1fr)!important;gap:9px!important;align-items:start!important}
.p5-hiv-module #hiv-report-editor > #hiv-resize-handle{display:flex!important;order:0;position:sticky;top:calc(var(--p5-top,90px) + var(--p5-track,48px) + 9px);height:calc(100dvh - var(--p5-top,90px) - var(--p5-track,48px) - var(--p5-bottom,68px) - 20px);min-height:180px;align-self:start}
.p5-hiv-module #hiv-report-editor [data-hiv-action="expand"],.p5-hiv-module #hiv-report-editor [data-hiv-action="reset-layout"]{display:inline-flex!important}
.p5-hiv-module #hiv-report-editor > #hiv-preview-panel.hiv-preview:not(.hiv-preview-fullscreen){display:flex!important;flex-direction:column;position:sticky!important;inset:auto!important;top:calc(var(--p5-top,90px) + var(--p5-track,48px) + 9px)!important;z-index:1!important;height:calc(100dvh - var(--p5-top,90px) - var(--p5-track,48px) - var(--p5-bottom,68px) - 20px)!important;min-height:180px!important;max-height:none!important;order:0!important}
.p5-hiv-module #hiv-report-editor > #hiv-preview-panel.hiv-preview.hiv-preview-fullscreen{display:flex!important;flex-direction:column;position:fixed!important;inset:0!important;z-index:1260!important;height:100dvh!important;max-height:none!important;width:100vw!important;max-width:none!important}
.p5-hiv-module #hiv-report-editor > #hiv-preview-panel .hiv-preview-scroll{flex:1;min-height:0;max-height:none!important;overflow:auto}
.p5-hiv-module .p5-hiv-readonly:not(.p5-hiv-show-sheet) #hiv-report-editor.hiv-report-editor,.p5-hiv-module #hiv-report-editor.hiv-expanded{display:block!important}
.p5-hiv-module .p5-hiv-readonly:not(.p5-hiv-show-sheet) #hiv-report-editor > .hiv-entry-column,.p5-hiv-module .p5-hiv-readonly:not(.p5-hiv-show-sheet) #hiv-report-editor > #hiv-resize-handle,.p5-hiv-module #hiv-report-editor.hiv-expanded > .hiv-entry-column,.p5-hiv-module #hiv-report-editor.hiv-expanded > #hiv-resize-handle{display:none!important}
.p5-hiv-module .p5-hiv-readonly:not(.p5-hiv-show-sheet) #hiv-report-editor > #hiv-preview-panel.hiv-preview:not(.hiv-preview-fullscreen){position:relative!important;top:auto!important;height:clamp(300px,calc(100dvh - 260px),900px)!important}
@media(max-width:900px){.p5-hiv-module #hiv-report-editor.hiv-report-editor{display:block!important;grid-template-columns:minmax(0,1fr)!important}.p5-hiv-module #hiv-report-editor > #hiv-resize-handle{display:none!important}.p5-hiv-module #hiv-report-editor > #hiv-preview-panel.hiv-preview:not(.hiv-preview-fullscreen){position:relative!important;top:auto!important;height:70vh!important}}
}

@media screen{.r12-layout .main .p5-hiv-module{display:block;gap:0}.p5-hiv-module #hiv-notice:empty,.p5-hiv-module #hiv-lab-recovery-top:empty{display:none!important}.r12-layout .main .p5-hiv-module .p5-hiv-editor{display:block;margin:0!important;padding:0!important}.r12-layout .main .p5-hiv-title h2{font-size:24px!important;line-height:1.25}.r12-layout .main ol.rms-connected-tracker.p5-hiv-tracker{grid-template-columns:repeat(4,minmax(0,1fr))!important;position:sticky!important;top:var(--p5-top,90px);margin:0 0 8px!important;padding:3px 5px!important}.r12-layout .main .p5-hiv-readonly .p5-hiv-title{padding:4px;margin:0 0 8px}.p5-hiv-module #hiv-report-editor.hiv-report-editor{overflow:visible!important}.p5-hiv-module .hiv-preview-scroll{scrollbar-gutter:stable}.p5-hiv-module #hiv-report-editor > #hiv-preview-panel.hiv-preview.hiv-preview-fullscreen{box-shadow:none!important;overflow:hidden!important}}

/* Phase 5 approved visual refinements: isolated to confidential HIV editor. */
@media screen {
.hiv-module .hiv-entry-column .p5r-patient-grid{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;gap:12px 10px;align-items:start;container-type:inline-size}
.hiv-module .p5r-wide,.hiv-module .p5r-lab-id,.hiv-module .p5r-patient-grid .hiv-pid-field,.hiv-module .p5r-patient-grid .hiv-strategy-field{grid-column:1/-1;min-width:0}
.hiv-module .p5r-lab-id{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:8px}.hiv-module .p5r-lab-id .hiv-lab-lookup-tools{margin:0;padding:0;display:flex;align-items:end}.hiv-module .p5r-lab-id button{background:#f5ebf3;color:#884c7f;border:1px solid #884c7f;min-height:42px;white-space:normal}.hiv-module .p5r-patient-grid .field{margin:0;min-width:0}.hiv-module .p5r-patient-grid .hiv-age-row{grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr)}
.hiv-module .p5r-time .rms-12hour-controls{display:grid;grid-template-columns:minmax(110px,2.3fr) minmax(48px,.8fr) minmax(48px,.8fr) minmax(58px,1fr);gap:5px;align-items:stretch}.hiv-module .p5r-time .rms-12hour-controls>*{width:100%!important;min-width:0!important;max-width:100%!important;margin:0!important;padding:5px 4px!important;min-height:42px}.hiv-module .p5r-time .rms-12hour-help{margin:3px 0 0}
.hiv-module .p5r-test-sequence{display:grid;gap:12px;min-width:0;container-type:inline-size}.hiv-module .p5r-test-card{min-width:0;border:1px solid #cdb5c8;border-radius:12px;overflow:hidden;background:var(--surface,#fff)}.hiv-module .p5r-test-card header{display:flex;align-items:center;gap:9px;padding:10px 12px;background:#f5ebf3;color:#884c7f;font-size:16px}.hiv-module .p5r-test-number{display:grid;place-items:center;flex:0 0 28px;height:28px;border-radius:50%;background:#884c7f;color:white;font-weight:700;font-size:13px}.hiv-module .p5r-test-fields{display:grid;gap:10px;padding:12px;min-width:0}.hiv-module .p5r-test-fields label{margin:0;min-width:0;overflow-wrap:anywhere}.hiv-module .p5r-test-fields select{width:100%;min-width:0!important;min-height:42px}.hiv-module .p5r-results{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;min-width:0}.hiv-module .p5r-results .p5r-result-field:has([data-hiv-key="hiv2_other"]),.hiv-module .p5r-combined-note,.hiv-module .p5r-na-fields{grid-column:1/-1}.hiv-module .p5r-na-fields[hidden]{display:none!important}.hiv-module .p5r-na-fields:not([hidden]){display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.hiv-module .p5r-interpretation{border:1px solid #b0d4c9;background:#e4f4f0;color:#164c44;border-radius:10px;padding:12px;margin-top:12px}.hiv-module .p5r-interpretation p{margin:6px 0}.hiv-module .hiv-row-tools{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:12px}.hiv-module .hiv-next-test-help{flex-basis:100%;white-space:normal}
/* A4 iframe dimensions are actual CSS pixels, never CSS zoom. Let oversized manual zoom scroll horizontally. */
.hiv-module #hiv-pdf-frame{display:block;box-sizing:border-box;min-width:0!important;max-width:none!important;max-height:none!important;flex:none!important;transform:none!important;zoom:1!important;border:0!important;background:#fff!important;margin:0 auto!important}.hiv-module .hiv-preview-scroll{display:block!important;overflow:auto!important;box-sizing:border-box;min-width:0;padding:5px 3px!important;scrollbar-gutter:stable}.hiv-module #hiv-pdf-frame{position:relative!important;inset:auto!important}
@container(max-width:370px){.hiv-module .p5r-time .rms-12hour-controls{grid-template-columns:repeat(3,minmax(0,1fr))}.hiv-module .p5r-time .rms-12date{grid-column:1/-1}.hiv-module .p5r-lab-id{grid-template-columns:minmax(0,1fr)}.hiv-module .p5r-lab-id .hiv-lab-lookup-tools button{width:100%}}
@container(max-width:300px){.hiv-module .p5r-results,.hiv-module .p5r-na-fields:not([hidden]){grid-template-columns:minmax(0,1fr)}}
@media(max-width:500px){.hiv-module .hiv-entry-column .p5r-patient-grid{grid-template-columns:minmax(0,1fr)!important}}
}

/* Local HIV vector page: scale the white sheet itself, never an embedded browser viewport. */
@media screen {
.hiv-module .hiv-preview-scroll{background:#e1e6eb!important;overflow:auto!important;padding:10px!important;}
.hiv-module #hiv-pdf-frame{display:block!important;box-sizing:content-box!important;min-width:0!important;max-width:none!important;max-height:none!important;min-height:0!important;flex:none!important;border:0!important;border-radius:0!important;background:#fff!important;box-shadow:0 2px 9px #0002;margin:0 auto!important;overflow:visible!important;}
.hiv-module #hiv-pdf-frame>svg{display:block!important;width:100%!important;height:100%!important;max-width:none!important;max-height:none!important;background:#fff!important;overflow:hidden!important;}
.hiv-module #hiv-pdf-frame>svg text{font-family:RMSHIVPage!important;letter-spacing:normal!important;text-transform:none!important;}
}

/* Step 18: screen-only preview space; retain all report content and action guards. */
@media screen {
.p5-hiv-module .p5-confidential{align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;margin:0 0 4px;padding:0;font-size:12px}
.p5-hiv-module .p5-confidential .rms-issue-status{display:inline-block;padding:5px 9px;border-radius:6px;background:#e7efff;color:#245bb8;font-weight:650}
.p5-hiv-module .p5-hiv-readonly:not(.p5-hiv-show-sheet) #hiv-preview-panel:not(.hiv-preview-fullscreen){height:var(--rms-hiv-available,calc(100dvh - 240px))!important;min-height:260px;max-height:none!important;padding:8px!important}
.p5-hiv-module .p5-hiv-readonly:not(.p5-hiv-show-sheet) #hiv-preview-panel .preview-tools{position:static;justify-content:center;gap:6px;padding:3px 0;flex-wrap:wrap}
.p5-hiv-module .p5-hiv-readonly:not(.p5-hiv-show-sheet) #hiv-preview-panel .preview-toolbar-actions{justify-content:center;flex-wrap:wrap}
.p5-hiv-module .p5-hiv-readonly:not(.p5-hiv-show-sheet) #hiv-preview-panel #hiv-pdf-alert{font-size:12px;margin:2px 0;padding:0}
.r12-layout .main .p5-hiv-output{gap:6px;padding:6px;margin:6px 0 0!important;box-shadow:none}
.p5-hiv-output button{min-width:120px;min-height:42px}
.p5-hiv-output .muted{margin:0;font-size:12px}
@media(max-width:650px){.p5-hiv-output button{flex:1 1 42%;min-width:0}.p5-hiv-module .p5-confidential{justify-content:flex-start}}
}

/* Step 19: compact screen chrome only. No rules apply to printed/saved A4 documents. */
@media screen {
 .r12-layout .main:has(.p19-hiv-head,.rms-issue-view,.p4-review,.p4-archive .p3-document){padding-top:6px!important;padding-bottom:6px!important}
 .r12-layout .main>.page-header.p19-hiv-head,.r12-layout .main:has(.rms-issue-view,.p4-review,.p4-archive .p3-document)>.page-header{min-height:0!important;padding:0 0 4px!important;margin:0 0 4px!important;gap:8px!important;align-items:center!important}
 .r12-layout .main>.page-header.p19-hiv-head .page-heading h1,.r12-layout .main:has(.rms-issue-view,.p4-review,.p4-archive .p3-document)>.page-header h1{font-size:clamp(19px,1.6vw,24px)!important;margin:0 0 2px!important;line-height:1.15!important}
 .r12-layout .main>.page-header.p19-hiv-head .page-heading p{margin:0!important;font-size:13px!important}
 .r12-layout .main>.page-header.p19-hiv-head>.action-bar:empty{display:none!important}
 .r12-layout .main>.page-header.p19-hiv-head .p19-hiv-meta{margin:0!important;display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap;color:#884c7f;font-weight:650;font-size:12px}
 .p19-hiv-head:has(.p19-archive-back) .r12-back,.p5-hiv-output [hidden]{display:none!important}
 .p5-hiv-module .p19-preview-label{display:none!important}
 .p5-hiv-module #hiv-pdf-alert.p19-preview-ready{position:absolute!important;width:1px!important;height:1px!important;clip-path:inset(50%);overflow:hidden!important;margin:0!important;padding:0!important;white-space:nowrap}
 .r12-layout .main .p5-hiv-module .p5-hiv-readonly:not(.p5-hiv-show-sheet) #hiv-report-editor > #hiv-preview-panel.hiv-preview:not(.hiv-preview-fullscreen){height:var(--rms-hiv-available,calc(100dvh - 215px))!important;min-height:180px!important;max-height:none!important;padding:5px!important;box-sizing:border-box!important;overflow:hidden!important;position:relative!important;top:auto!important}
 .p5-hiv-module #hiv-preview-panel .preview-tools,.r12-layout .main .rms-issue-view .p3-document-tools{min-height:0!important;padding:3px 5px!important;margin:0!important;gap:5px!important;justify-content:center!important;flex-wrap:wrap}
 .p5-hiv-module #hiv-preview-panel .preview-toolbar-actions,.r12-layout .main .p3-document-tools .preview-toolbar-actions{justify-content:center!important;gap:5px!important;flex-wrap:wrap}
 .p5-hiv-module #hiv-preview-panel .preview-toolbar-actions button,.r12-layout .main .p3-document-tools .preview-toolbar-actions button{min-height:32px!important;padding:5px 9px!important;font-size:13px!important;white-space:nowrap}
 .p5-hiv-module .hiv-preview-scroll{padding:6px!important}
 .r12-layout .main .p5-hiv-output{display:flex;position:sticky!important;bottom:0!important;z-index:40;gap:6px!important;margin:4px 0 0!important;padding:5px!important;box-shadow:none!important;align-items:center;box-sizing:border-box}
 .r12-layout .main .p5-hiv-output button{flex:1 1 0;min-width:0;min-height:38px!important;padding:7px 8px!important;border:1px solid currentColor;font-weight:650;font-size:14px}
 .r12-layout .main .p5-hiv-output [data-hiv-action=print]{background:#e4f4f0;color:#087f72}
 .r12-layout .main .p5-hiv-output [data-hiv-action=pdf]{background:#e8f0ff;color:#245bb8}
 .r12-layout .main .p5-hiv-output :is([data-hiv-action=print-confirm-row],[data-hiv-action=issue-print-confirm]){background:#fff1d9;color:#8d611e}
 .r12-layout .main .p5-hiv-output :is([data-hiv-action=archive-issue-confirm],[data-hiv-action=issue-confirm]){background:#dff3e8;color:#18734c}
 .r12-layout .main .p5-hiv-output button:disabled{opacity:.55;cursor:not-allowed}
 .r12-layout .main .p5-hiv-output .muted{flex-basis:100%;font-size:11px;line-height:1.2;margin:0!important}
 .r12-layout .main .p3-document:not(.rms-full-preview-open):not(.rms-viewer-tall)>.p3-paper-scroll{height:var(--p19-paper-height,calc(100dvh - 260px))!important;min-height:180px!important;max-height:none!important;box-sizing:border-box!important;overflow:auto!important;padding:8px!important}
 .r12-layout .main .rms-issue-actions{margin-top:4px!important;gap:7px!important}
 .r12-layout .main .rms-issue-actions button{min-height:38px!important;padding:7px 10px!important}
 @media(max-width:700px){.r12-layout .main .p5-hiv-output button{flex:1 1 45%;min-width:0}.r12-layout .main>.page-header.p19-hiv-head .p19-hiv-meta{justify-content:flex-start}.r12-layout .main>.page-header.p19-hiv-head{flex-wrap:wrap}}
}
@media screen {
 .r12-layout .main :is(#resizable-editor,#tb-resizable-editor) .preview-tools>b{display:none!important}
 .r12-layout .main :is(#resizable-editor,#tb-resizable-editor) .preview-toolbar-actions{justify-content:center;flex-wrap:wrap;gap:5px}
 .r12-layout .main .p19-tb-archive-actions{position:sticky;bottom:0;z-index:10;background:var(--r12-panel,#fff);padding:4px 0}
}
