/* Patient identity stays in the header; management opens only on demand. */
.patient-records{display:inline-flex;align-items:center;position:relative;min-width:0;flex:0 1 auto;color:#172033}
.patient-records .pr-header-controls{display:flex;gap:5px;align-items:center;min-width:0}
.patient-records .pr-chart-field{position:relative;display:block;min-width:0;margin:0}
.patient-records #prChart{box-sizing:border-box;width:145px;max-width:100%;height:32px;min-height:32px;padding:5px 23px 5px 9px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;font-size:12px;color:#172033}
.patient-records #prChart:focus{outline:2px solid #9ec5ff;outline-offset:1px;border-color:#397ad1}
.patient-records #prFind{width:auto;min-height:32px;height:32px;padding:4px 10px;border-radius:8px;font-size:12px;white-space:nowrap}
.pr-save-indicator{position:absolute;right:9px;top:50%;width:6px;height:6px;border-radius:50%;background:#cbd5e1;transform:translateY(-50%);pointer-events:none}
.patient-records[data-save-state=saved] .pr-save-indicator{background:#2c9775}
.patient-records[data-save-state=saving] .pr-save-indicator{background:#d28b14}
.patient-records[data-save-state=error] .pr-save-indicator{background:#c43737}
.api-status-box .status-pill.connected~.status-retry,.api-status-box .status-pill.checking~.status-retry{display:none}
.pr-sr-only,.patient-records>.pr-status{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.patient-records>.pr-status[data-failed=true]{clip:auto;white-space:normal;width:max-content;max-width:min(340px,85vw);height:auto;overflow:visible;top:calc(100% + 6px);right:0;margin:0;padding:7px 10px;border:1px solid #f0b5b5;border-radius:7px;background:#fff6f6;color:#a52727;font-size:12px;z-index:30;box-shadow:0 3px 12px #17203315}
.pr-dialog{box-sizing:border-box;width:min(780px,calc(100vw - 24px));max-width:calc(100vw - 24px);max-height:85dvh;margin:auto;padding:18px;border:1px solid #cbd5e1;border-radius:14px;background:#fff;color:#172033;overflow:auto;overscroll-behavior:contain;box-shadow:0 12px 50px #0f172a30}
.pr-dialog::backdrop{background:#0f172a38}
.pr-dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}
.pr-dialog-heading h2{margin:0;font-size:18px}.pr-dialog-heading button{flex:none}
.patient-records .pr-dialog p{display:block;font-size:12px;margin:6px 0;color:#475569}
.patient-records .pr-dialog-status{min-height:16px}
.patient-records .pr-dialog button,.patient-records .pr-link{width:auto;min-height:32px;padding:6px 10px;font-size:12px}
.patient-records summary{cursor:pointer;font-size:13px;font-weight:600}
.patient-records .pr-meta,.patient-records .pr-actions{display:flex;gap:8px;align-items:end;flex-wrap:wrap;margin:8px 0}
.patient-records .pr-meta label{display:flex;flex:1;min-width:130px;flex-direction:column;gap:3px;font-size:12px}
.patient-records .pr-meta input,.patient-records .pr-dialog select,.patient-records .pr-dialog input:not([type=checkbox]){box-sizing:border-box;min-width:0;max-width:100%;padding:6px 8px;border:1px solid #cbd5e1;border-radius:6px;background:#fff;color:#172033;font-size:13px}
.patient-records .pr-meta input{width:100%}.pr-tools{margin-top:12px;padding-top:10px;border-top:1px solid #e2e8f0}
.pr-panel{padding:10px 0}.pr-panel textarea{box-sizing:border-box;min-height:130px;width:100%;padding:8px}
.pr-panel table{border-collapse:collapse;width:100%;font-size:12px;table-layout:fixed}.pr-panel td,.pr-panel th{text-align:left;vertical-align:top;padding:6px;border-bottom:1px solid #cbd5e1;overflow-wrap:anywhere;white-space:pre-wrap}.pr-panel th{background:#f1f5f9}
.pr-item{padding:8px 0;border-bottom:1px solid #e2e8f0}.pr-item button{margin:3px}
.pr-raw{white-space:pre-wrap;overflow-wrap:anywhere;font-size:12px;max-height:160px;overflow:auto;background:#f8fafc;padding:8px}
.pr-change{background:#fff5d6}.pr-pending{border-left:3px solid #d99500;padding-left:8px}.pr-panel input[type=checkbox]{width:18px;height:18px}.pr-help{color:#475569}.pr-dialog [hidden]{display:none!important}
@media(max-width:600px){
.app-header{position:relative;display:grid;grid-template-columns:minmax(0,1fr);align-items:start;gap:6px}.app-header h1{white-space:nowrap}.app-header .blank-exam-sheet-link{position:absolute;right:12px;top:8px}
.app-header .api-status-box{width:100%;min-width:0;gap:6px;flex-wrap:wrap}.patient-records{flex:1;max-width:240px}.patient-records .pr-header-controls{width:100%}.patient-records .pr-chart-field{flex:1}.patient-records #prChart{width:100%}
.pr-dialog{padding:12px;max-height:90dvh}.patient-records .pr-meta label{flex-basis:100%}.pr-panel td,.pr-panel th{padding:4px}
}
@media print{.patient-records,.pr-dialog{display:none!important}}
