/* CliNext · patient management. Limited to the patient workspace.
   Make 100+ records usable without shrinking the font to 10px. */
#dashboard[data-workspace="patients"]{gap:13px;color:#203b4d}
main:has(#dashboard:not([hidden])[data-workspace="patients"]){
 max-width:1840px;width:100%;padding:16px clamp(16px,2vw,36px);
 margin:0 auto
}
#dashboard[data-workspace="patients"]>.layout{
 display:grid;grid-template-columns:clamp(295px,22vw,352px) minmax(0,1fr);
 gap:18px;align-items:start;min-width:0
}
#dashboard[data-workspace="patients"] .clinic-nav{
 padding:10px 12px;gap:8px;border:1px solid #dce5ed;
 border-radius:11px;box-shadow:0 2px 14px #163d5710
}
#dashboard[data-workspace="patients"] .clinic-nav button{
 padding:10px 15px;font-size:13px;min-height:38px;border-radius:8px
}
#dashboard[data-workspace="patients"] .cl-nav-logout{
 border:1px solid #e1e9ee;background:#f5f8fb;color:#315268
}
#dashboard[data-workspace="patients"]>.layout>.card{
 border:1px solid #d9e4ec;border-radius:14px;
 box-shadow:0 5px 28px #1a46560a
}
#dashboard[data-workspace="patients"]>.layout>aside.cl-patient-directory{
 display:flex;flex-direction:column;min-width:0;
 max-height:calc(100dvh - 105px);min-height:480px;
 overflow:hidden;position:sticky;top:14px;
 padding:17px 17px 11px
}
#dashboard[data-workspace="patients"] .cl-directory-heading{
 display:flex;align-items:center;justify-content:space-between;
 flex-wrap:wrap;gap:8px;min-height:37px;margin-bottom:13px
}
#dashboard[data-workspace="patients"] .cl-directory-heading h2{
 font-size:19px;line-height:1.2;margin:0;color:#173e55
}
#dashboard[data-workspace="patients"] .cl-directory-heading #clAddPatient{
 flex:0 0 auto;font-size:12px;min-height:36px;margin:0;
 padding:8px 12px;border-radius:8px
}
#dashboard[data-workspace="patients"]>.layout>aside .cl-patient-create-form{
 flex:1;overflow:auto;min-height:0;padding-right:5px
}
#dashboard[data-workspace="patients"]>.layout>aside>label[for="search"]{
 margin:0 0 6px;font-size:12px;font-weight:700;color:#385d73
}
#dashboard[data-workspace="patients"]>.layout>aside>.cl-mic-field{
 flex:0 0 auto;width:100%;margin:0
}
#dashboard[data-workspace="patients"] #search{
 font-size:14px;height:43px;padding:10px 40px 10px 12px;
 border:1px solid #c6d8e3;border-radius:9px;background:white;
 color:#243f52;min-width:0
}
#dashboard[data-workspace="patients"] #search:focus{
 outline:2px solid #519db0;outline-offset:1px;border-color:#519db0
}
#dashboard[data-workspace="patients"] #patientListTools{
 flex:0 0 auto;border-top:0;padding:0;margin:7px 0 4px
}
#dashboard[data-workspace="patients"] .cl-directory-filters{
 display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);
 gap:10px;align-items:end;margin:0 0 7px
}
#dashboard[data-workspace="patients"] .cl-directory-filter{min-width:0}
#dashboard[data-workspace="patients"] .cl-directory-filter label{
 display:block;margin:0 0 5px;font-size:12px;
 line-height:1.25;font-weight:650;color:#3a5e73
}
#dashboard[data-workspace="patients"] .cl-directory-filter select{
 display:block;min-width:0;width:100%;margin:0;height:37px;
 font-size:12px;padding:7px 23px 7px 9px;
 text-overflow:ellipsis;white-space:nowrap;color:#304e62;
 border:1px solid #cddde7;border-radius:8px;background:#fff
}
#dashboard[data-workspace="patients"] .cl-directory-count{
 display:block;min-height:0;margin:4px 0 6px;font-size:12px;
 line-height:1.4;font-weight:600;color:#4b6c7d
}
#dashboard[data-workspace="patients"] #patientSelectionStatus{
 font-size:12px;line-height:1.35;margin:3px 0 7px;
 color:#506e81;overflow-wrap:anywhere
}
#dashboard[data-workspace="patients"] #patients{
 flex:1 1 auto;overflow-y:auto;overflow-x:hidden;min-height:160px;
 overscroll-behavior:contain;scrollbar-width:thin;
 padding:2px 3px 6px 1px;border-top:1px solid #e2ebf0;
 border-radius:4px
}
#dashboard[data-workspace="patients"] #patients .patient{
 width:100%;min-height:40px;display:block;overflow:hidden;
 padding:10px 11px;font-size:13px;line-height:1.3;
 font-weight:550;text-align:left;text-overflow:ellipsis;
 white-space:nowrap;border:0;border-radius:7px;
 background:transparent;color:#28495d;cursor:pointer
}
#dashboard[data-workspace="patients"] #patients .patient+.patient{
 border-top:1px solid #edf2f5
}
#dashboard[data-workspace="patients"] #patients .patient:hover{
 background:#edf6fa;color:#0d526d
}
#dashboard[data-workspace="patients"] #patients .patient:focus-visible{
 outline:2px solid #146782;outline-offset:-2px
}
#dashboard[data-workspace="patients"] #patients .patient[aria-pressed="true"]{
 border-left:3px solid #11738d;background:#e4f3f8;
 font-weight:750;color:#174d61
}
#dashboard[data-workspace="patients"]>.layout>.cl-patient-detail-panel{
 padding:clamp(16px,1.5vw,27px);min-width:0;
 min-height:420px;background:#fff
}
#dashboard[data-workspace="patients"] .cl-patient-detail-panel>.top{
 margin:0 0 11px;min-height:44px;border-bottom:1px solid #e1eaf0;
 padding-bottom:12px
}
#dashboard[data-workspace="patients"] .cl-patient-detail-panel>.top #patientTitle{
 font-size:20px;line-height:1.3;margin:0;font-weight:750;color:#193f56
}
#dashboard[data-workspace="patients"] .cl-patient-detail-panel>.top #newEncounter{
 font-size:13px;min-height:37px;padding:8px 13px
}
#dashboard[data-workspace="patients"] .cl-patient-detail-panel>#patientSubtitle{
 font-size:13px;color:#708597;margin:4px 0 9px
}
#dashboard[data-workspace="patients"] .cl-patient-detail-panel>.tabs{
 gap:7px;margin:12px 0;padding:0 0 12px
}
#dashboard[data-workspace="patients"] .cl-patient-detail-panel>.tabs button{
 font-size:13px;padding:9px 13px;min-height:38px;border-radius:8px
}
#dashboard[data-workspace="patients"][data-patient-open="false"] .cl-patient-detail-panel>.tabs,
#dashboard[data-workspace="patients"][data-patient-open="false"] .cl-patient-detail-panel>#tabContent{
 display:none!important
}
#dashboard[data-workspace="patients"] .cl-patient-empty{
 text-align:center;margin:50px auto 25px;padding:34px 24px;
 max-width:620px;background:#f6fafc;border:1px dashed #b9d0de;
 border-radius:15px;color:#516f80
}
#dashboard[data-workspace="patients"] .cl-patient-empty[hidden]{display:none!important}
.cl-patient-empty-mark{
 display:flex;justify-content:center;align-items:center;
 width:54px;height:54px;margin:0 auto 15px;border-radius:15px;
 background:#e1f1f7;font:500 33px/1 system-ui,sans-serif;color:#1c708d
}
#dashboard[data-workspace="patients"] .cl-patient-empty h3{
 font-size:19px;color:#183c53;margin:0 0 10px
}
#dashboard[data-workspace="patients"] .cl-patient-empty p{
 font-size:14px;line-height:1.7;margin:0 auto;max-width:450px
}
#dashboard[data-workspace="patients"] .cl-patient-detail-panel .tabs [disabled]{cursor:not-allowed}
#dashboard[data-workspace="patients"] .cl-patient-detail-panel .cl-mini,
#dashboard[data-workspace="patients"] .cl-compact-patient .cl-visit-item button{
 font-size:12px
}
@media(max-width:1100px){
 #dashboard[data-workspace="patients"]>.layout{
  grid-template-columns:minmax(275px,300px) minmax(0,1fr);gap:12px
 }
 #dashboard[data-workspace="patients"]>.layout>aside.cl-patient-directory{padding:13px}
}
@media(max-width:850px){
 main:has(#dashboard:not([hidden])[data-workspace="patients"]){padding:10px 12px}
 #dashboard[data-workspace="patients"]>.layout{grid-template-columns:1fr}
 #dashboard[data-workspace="patients"]>.layout>aside.cl-patient-directory{
  position:static;max-height:none;min-height:0;overflow:visible
 }
 #dashboard[data-workspace="patients"] #patients{max-height:280px;flex:none}
 #dashboard[data-workspace="patients"]>.layout>.cl-patient-detail-panel{min-height:270px}
 #dashboard[data-workspace="patients"] .cl-patient-empty{margin:16px auto}
}
@media(max-width:480px){
 #dashboard[data-workspace="patients"] .cl-directory-heading{flex-wrap:nowrap}
 #dashboard[data-workspace="patients"] .cl-directory-heading h2{font-size:18px}
 #dashboard[data-workspace="patients"] .cl-directory-filters{gap:6px}
 #dashboard[data-workspace="patients"] .cl-directory-filter select{font-size:11px}
}

/* Patient creation is a full working dialog, not an inline sidebar scroller. */
.cl-patient-create-backdrop:not([hidden]){position:fixed;inset:0;z-index:100000;display:flex;align-items:center;justify-content:center;padding:22px;background:rgba(12,34,49,.60)}
.cl-patient-create-backdrop[hidden]{display:none!important}
.cl-patient-create-dialog{width:min(660px,100%);max-height:min(92vh,900px);background:#fff;border-radius:18px;box-shadow:0 24px 80px rgba(0,0,0,.28);overflow:auto;overscroll-behavior:contain}
.cl-patient-create-dialog .cl-patient-create-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px 18px;padding:28px 32px 24px;margin:0;border:none;background:white;border-radius:18px;overflow:visible;max-height:none}
.cl-patient-create-dialog .cl-patient-create-form[hidden]{display:none!important}
.cl-patient-create-dialog h3,.cl-patient-create-dialog .cl-mini,.cl-patient-create-dialog .cl-test-hint,.cl-patient-create-dialog #clPatientCreateStatus,.cl-patient-create-dialog .cl-patient-create-actions{grid-column:1/-1}
.cl-patient-create-dialog h3{font-size:24px;margin:0 0 4px;color:#173e55}
.cl-patient-create-dialog label{margin:0;font-size:14px;color:#21485d}
.cl-patient-create-dialog label input,.cl-patient-create-dialog label select{box-sizing:border-box;width:100%;min-height:46px;font-size:16px;margin-top:7px;border-radius:9px}
.cl-patient-create-dialog .cl-patient-create-actions{position:sticky;bottom:-24px;background:#fff;padding:16px 0 2px;margin:8px 0 0;border-top:1px solid #dae5ec;z-index:1}
.cl-patient-create-dialog .cl-patient-create-actions button{min-height:46px;font-size:15px}
@media(max-width:620px){.cl-patient-create-backdrop:not([hidden]){padding:10px;align-items:flex-start}.cl-patient-create-dialog{max-height:calc(100vh - 20px)}.cl-patient-create-dialog .cl-patient-create-form{display:flex;flex-direction:column;padding:20px;gap:10px}.cl-patient-create-dialog .cl-patient-create-actions{bottom:-20px}}
.cl-patient-create-dialog label:has(input[type="checkbox"]){display:flex;align-items:center;gap:10px;grid-column:1/-1;font-size:14px;font-weight:500}
.cl-patient-create-dialog label input[type="checkbox"]{width:20px!important;height:20px!important;min-height:20px!important;margin:0!important;flex:0 0 20px}
.cl-patient-create-dialog .cl-mini{line-height:1.5}
