.recent-patients{display:flex;align-items:center;gap:7px;overflow:auto;padding:10px 0;border-bottom:1px solid #cce9f1;margin-bottom:12px;white-space:nowrap}
.recent-patients>strong{font-size:12px;color:#008aaa;margin-right:4px}.recent-patients button{flex-shrink:0;padding:6px 10px;border-color:#b6deeb;background:#f2fbff;color:#21637a}.recent-patients button small{display:block;font-size:10px;color:#668393}.recent-patients button.active{background:#00a6c4;color:white;border-color:#00a6c4}.recent-patients button.active small{color:white}
.patient-context-header{position:sticky;top:var(--patient-header-top,60px);z-index:15;background:#fff;border:1px solid #b6e5f0;border-top:3px solid #00a6c4;padding:12px 14px;box-shadow:0 3px 10px #137ea014;border-radius:6px;margin-bottom:12px}
.patient-context-header .pagehead{margin-bottom:8px}.patient-context-header .pagehead h1{font-size:20px;margin:0}.patient-context-header .patient-profile-summary{padding:6px 10px;margin:0}.patient-context-header .warning{margin:6px 0 0;padding:6px 10px;font-size:12px}
.patient-profile .patient-context-header{max-height:35vh;overflow:auto}.patient-profile>.recent-patients{margin-bottom:8px}
.reception-progress{display:flex;gap:5px;flex-wrap:wrap;min-width:170px;max-width:240px}.reception-progress button,.progress-pending{font-size:11px;padding:4px 7px;border-radius:4px}.reception-progress .progress-done{background:#daf7e9;color:#08704c;border-color:#86d7b3}.reception-progress .progress-attention{background:#fff1ce;color:#945900;border-color:#efce75}.progress-pending{background:#f0f4f6;color:#6b7e87}.reception-table table{min-width:1150px}
.followup-batch{display:flex;gap:10px;align-items:center;flex-wrap:wrap;padding:10px;background:#e4f8ff;border:1px solid #b9e6f1;border-radius:6px;margin-bottom:10px}.followup-batch label{display:flex;align-items:center;gap:7px}.followup-batch input,.followup-card-heading .followup-select{width:auto}.followup-card-heading .followup-select{margin-right:10px;accent-color:#00a6c4}
@media(max-width:720px){.patient-context-header{position:static;padding:10px}.patient-context-header .pagehead{flex-wrap:wrap}.patient-context-header .pagehead .actions{gap:4px}.patient-profile .patient-context-header{max-height:none}.recent-patients{padding:8px 0}.recent-patients>strong{position:sticky;left:0;background:white;padding:6px}.followup-batch{font-size:12px}}
@media print{.recent-patients,.patient-context-header{display:none}}
/* Desktop patient frame follows the observed recent-patient rail and thin
   identity strip. Existing controls and their permissions stay in the DOM. */
@media screen and (min-width:721px){
 .shell #view .patient-profile{--patient-rail-width:216px;display:grid;grid-template-columns:var(--patient-rail-width) minmax(0,1fr);grid-template-rows:auto auto auto minmax(0,1fr);column-gap:12px;row-gap:0;align-items:start;min-height:calc(100dvh - 76px);background:#fff}
 .shell #view .patient-profile:not(:has(>.recent-patients)){display:block}
 .shell #view .patient-profile>.recent-patients{grid-column:1;grid-row:1 / 5}
 .shell #view .patient-profile>.patient-context-header{grid-column:2;grid-row:1}
 .shell #view .patient-profile>.tabs{grid-column:2;grid-row:2}
 .shell #view .patient-profile>.workflow-next{grid-column:2;grid-row:3}
 .shell #view .patient-profile>#patient-body{grid-column:2;grid-row:4;min-width:0}
 .shell #view:has(>.visit-editor-layout){--patient-rail-width:216px;display:grid;grid-template-columns:var(--patient-rail-width) minmax(0,1fr);grid-template-rows:auto auto auto auto minmax(0,1fr);column-gap:12px;row-gap:0;align-items:start;min-height:calc(100dvh - 76px);background:#fff}
 .shell #view:has(>.visit-editor-layout):not(:has(>.recent-patients)){display:block}
 .shell #view:has(>.visit-editor-layout)>.recent-patients{grid-column:1;grid-row:1 / 6}
 .shell #view:has(>.visit-editor-layout)>.work-return{grid-column:2;grid-row:1}
 .shell #view:has(>.visit-editor-layout)>.pagehead{grid-column:2;grid-row:2}
 .shell #view:has(>.visit-editor-layout)>.warning{grid-column:2;grid-row:3}
 .shell #view:has(>.visit-editor-layout)>.visit-shortcuts{grid-column:2;grid-row:4;min-width:0}
 .shell #view:has(>.visit-editor-layout)>.visit-editor-layout{grid-column:2;grid-row:5}
 .shell #view .patient-profile>.recent-patients,.shell #view:has(>.visit-editor-layout)>.recent-patients{position:sticky;top:58px;align-self:start;display:block;width:100%;height:calc(100dvh - 74px);min-width:0;overflow:auto;margin:0;padding:0;border:0;border-right:1px solid var(--ui-line,#dedfe2);background:#fff;white-space:normal}
 .shell #view .patient-profile>.recent-patients>strong,.shell #view:has(>.visit-editor-layout)>.recent-patients>strong{display:block;margin:0;padding:10px 12px;border-bottom:1px solid var(--ui-line,#dedfe2);font-size:13px;font-weight:500;color:var(--ui-ink,#303339)}
 .shell #view .patient-profile>.recent-patients>button,.shell #view:has(>.visit-editor-layout)>.recent-patients>button{display:block;width:100%;min-height:56px;margin:0;padding:9px 12px;border:0;border-left:2px solid transparent;border-bottom:1px solid #f1f2f4;border-radius:0;box-shadow:none;background:#fff;color:#60656e;font-size:14px;font-weight:400;text-align:left;line-height:1.5;overflow-wrap:anywhere}
 .shell #view .patient-profile>.recent-patients>button.active,.shell #view:has(>.visit-editor-layout)>.recent-patients>button.active{border-left-color:var(--ui-accent,#00a6c4);background:#f3f4f6;color:var(--ui-ink,#303339)}
 .shell #view .patient-profile>.recent-patients>button small,.shell #view:has(>.visit-editor-layout)>.recent-patients>button small{display:block;margin-top:2px;color:var(--ui-muted,#777c84);font-size:12px;font-weight:400}
 .shell #view .patient-profile>.patient-context-header{position:sticky;top:58px;display:grid;grid-template-columns:200px minmax(0,1fr) auto;grid-template-rows:auto auto;column-gap:16px;row-gap:0;align-items:center;min-height:76px;max-height:none;overflow:visible;padding:8px 12px;margin:0;background:#f8f8f9;border:1px solid var(--ui-line,#dedfe2);border-radius:2px;box-shadow:none}
 .shell #view .patient-context-header .pagehead{display:contents;min-height:0;margin:0;padding:0;border:0;background:transparent}
 .shell #view .patient-context-header .pagehead>div:first-child{grid-column:1;grid-row:1 / 3;align-self:stretch;display:flex;flex-direction:column;justify-content:center;min-width:0;padding-right:12px;border-right:1px solid #e3e4e7;overflow-wrap:anywhere}
 .shell #view .patient-context-header .pagehead>.actions{grid-column:3;grid-row:1 / 3;justify-content:flex-end;max-width:420px;gap:6px}
 .shell #view .patient-context-header .pagehead h1{font-size:15px;font-weight:500;line-height:1.5}
 .shell #view .patient-context-header .pagehead .subtle{font-size:12px;line-height:1.6}
 .shell #view .patient-context-header .pagehead button{min-height:30px;padding:5px 9px;font-size:12px}
 .shell #view .patient-context-header .patient-profile-summary{grid-column:2;grid-row:1;align-self:end;padding:0;margin:0;gap:2px 12px;background:transparent;border:0;border-radius:0;color:#777c84;font-size:12px;line-height:1.6}
 .shell #view .patient-context-header .warning{grid-column:2;padding:2px 0;margin:0;background:transparent;border:0;border-radius:0;color:#9b6336;font-size:12px;line-height:1.5;overflow-wrap:anywhere}
 .shell #view .patient-context-header>.patient-profile-summary+div.warning{grid-row:2;align-self:start}
 .shell #view .patient-context-header>.work-return{grid-column:1 / -1;grid-row:1;margin-bottom:6px}
 .shell #view .patient-context-header:has(>.work-return) .pagehead>div:first-child,.shell #view .patient-context-header:has(>.work-return) .pagehead>.actions{grid-row:2 / 4}
 .shell #view .patient-context-header:has(>.work-return)>.patient-profile-summary{grid-row:2}
 .shell #view .patient-context-header:has(>.work-return)>.patient-profile-summary+div.warning{grid-row:3}
 .shell #view .patient-profile>.tabs{display:flex;flex-wrap:nowrap;overflow:auto;gap:0;margin:8px 0 12px;padding:0;min-width:0;border:0;border-bottom:1px solid var(--ui-accent,#00a6c4);background:#fff}
 .shell #view .patient-profile>.tabs>button{flex:0 0 auto;min-height:32px;margin:0;padding:6px 11px;border-radius:3px 3px 0 0;border:1px solid #e3e4e7;border-bottom:0;background:#fff;color:#60656e;font-size:13px;font-weight:400;white-space:nowrap}
 .shell #view .patient-profile>.tabs>button.active{background:var(--ui-accent,#00a6c4);border-color:var(--ui-accent,#00a6c4);color:#fff}
 .shell #view .patient-profile #patient-body>.grid{grid-template-columns:minmax(0,2.2fr) minmax(220px,1fr);gap:0;border:1px solid var(--ui-line,#dedfe2);background:#fff}
 .shell #view .patient-profile #patient-body>.grid>.card{min-width:0;margin:0;padding:0 14px 16px;border:0;border-radius:0;box-shadow:none;background:#fff}
 .shell #view .patient-profile #patient-body>.grid>.card:first-child{border-right:1px solid var(--ui-line,#dedfe2)}
 .shell #view .patient-profile #patient-body>.grid>.card>h2{min-height:32px;margin:0 -14px 14px;padding:8px 12px;border:0;border-bottom:1px solid var(--ui-line,#dedfe2);background:#f5f5f6;font-size:14px;font-weight:500;line-height:1.4}
 .shell #view .patient-profile #patient-body>.grid>.card>h3{margin:14px 0 8px;padding:0 0 7px;border-bottom:1px solid #eceef0;font-size:13px;font-weight:500}
 .shell #view .patient-profile #patient-body>.grid>.card>p{margin:9px 0;font-size:13px;line-height:1.8}
 .shell #view .patient-profile .record-overview{margin:0;padding:11px 0;border:0;border-bottom:1px solid #eceef0;border-radius:0;box-shadow:none}
 .shell #view .patient-profile .record-overview .overview-heading{padding:0 0 5px;border:0;border-radius:0;background:#fff;color:#60656e;font-size:13px;font-weight:500}
 .shell #view .patient-profile .record-overview .overview-record-link{padding:6px 0;border:0;border-radius:0;background:#fff;color:#777c84;font-size:12px;text-align:left}
 .shell #view:has(>.visit-editor-layout)>.pagehead{min-height:50px;margin:0;padding:8px 12px;border:1px solid var(--ui-line,#dedfe2);border-radius:2px;background:#f8f8f9}
 .shell #view:has(>.visit-editor-layout)>.pagehead h1{font-size:15px;font-weight:500}
 .shell #view:has(>.visit-editor-layout)>.pagehead .subtle{font-size:12px}
 .shell #view:has(>.visit-editor-layout)>.warning{margin:0;padding:5px 12px;border:0;border-radius:0;background:#fff;color:#9b6336;font-size:12px;line-height:1.5}
 .shell #view:has(>.visit-editor-layout) .visit-shortcuts>.patient-shortcuts{display:flex;flex-wrap:wrap;gap:0;margin:0 0 10px;padding:0;border-bottom:1px solid var(--ui-accent,#00a6c4);background:#fff}
 .shell #view:has(>.visit-editor-layout) .visit-shortcuts .patient-shortcuts>button{min-height:32px;padding:6px 12px;border:0;border-radius:0;background:#fff;color:#60656e;font-size:13px;font-weight:400}
 .shell #view:has(>.visit-editor-layout) .visit-shortcuts .patient-shortcuts>button:hover{color:var(--ui-accent,#00a6c4);background:#f5fafb}
}
@media screen and (min-width:721px) and (max-width:1050px){
 .shell #view .patient-profile,.shell #view:has(>.visit-editor-layout){--patient-rail-width:170px;column-gap:8px}
 .shell #view .patient-profile>.patient-context-header{grid-template-columns:170px minmax(0,1fr);column-gap:12px}
 .shell #view .patient-context-header .pagehead>.actions{grid-column:1 / -1;grid-row:3;max-width:none;margin-top:6px}
 .shell #view .patient-context-header:has(>.work-return) .pagehead>.actions{grid-row:4}
 .shell #view .patient-profile #patient-body>.grid{grid-template-columns:minmax(0,1fr)}
 .shell #view .patient-profile #patient-body>.grid>.card:first-child{border-right:0;border-bottom:1px solid var(--ui-line,#dedfe2)}
}
@media screen and (min-width:1051px){
 .shell #view .patient-profile #patient-body>.grid>.card:first-child{column-count:2;column-gap:28px;column-rule:1px solid #f0f1f3}
 .shell #view .patient-profile #patient-body>.grid>.card:first-child>h2,.shell #view .patient-profile #patient-body>.grid>.card:first-child>.actions{column-span:all}
 .shell #view .patient-profile #patient-body>.grid>.card:first-child>h3{break-after:avoid-column}
 .shell #view .patient-profile #patient-body>.grid>.card:first-child>p,.shell #view .patient-profile #patient-body>.grid>.card:first-child>#patient-relations{break-inside:avoid-column}
 .shell #view .patient-profile #patient-body>.grid>.card:first-child>.actions{margin-top:12px;padding-top:10px;border-top:1px solid #eceef0}
}
/* Patient encounter chronology: one date, one appointment, explicit record links. */
.patient-encounters{background:#fff;min-width:0}.encounter-toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:10px 12px;border-bottom:1px solid #e3e7ea;background:#f8f9fa}.encounter-toolbar>strong{margin-right:auto;font-size:14px}.encounter-toolbar small{font-size:12px;font-weight:400;color:#858d96}.encounter-toolbar label{margin:0}.encounter-toolbar input{width:210px}.encounter-toolbar input,.encounter-toolbar select,.encounter-toolbar button{min-height:32px;padding:5px 9px;font-size:13px}.encounter-timeline{padding:4px 16px 20px}.encounter-year{margin:20px 0 12px;color:#00a6c4;font-size:15px;font-weight:500}.encounter-entry{display:grid;grid-template-columns:85px minmax(0,1fr);gap:20px;position:relative;margin:0 0 16px}.encounter-day{display:flex;flex-direction:column;align-items:center;justify-content:center;border-right:1px solid #8ed5e3;color:#278fa3;gap:4px;font-size:12px}.encounter-day strong{font-size:20px;font-weight:500}.encounter-main{border:1px solid #dfe5e9;background:#fff;min-width:0}.encounter-main>header{display:flex;gap:12px;align-items:center;flex-wrap:wrap;padding:9px 12px;background:#f0faff;border-bottom:1px solid #dcebf0;font-size:13px}.encounter-main>header>strong{font-weight:500}.encounter-source{color:#8a6b39;font-size:12px}.encounter-main dl{display:grid;grid-template-columns:65px minmax(0,1fr) 65px minmax(0,1fr);gap:10px 12px;margin:0;padding:14px 16px;font-size:13px;line-height:1.6}.encounter-main dt{color:#858d96}.encounter-main dd{margin:0;overflow-wrap:anywhere}.encounter-main .encounter-wide{grid-column:2 / -1}.encounter-note{white-space:pre-wrap}.encounter-main footer{display:flex;gap:12px;flex-wrap:wrap;border-top:1px solid #edf0f2;padding:6px 12px}.encounter-main footer button{border:0;background:transparent;padding:6px 0;color:#009dbb;border-radius:0;font-size:13px}.encounter-main footer button:hover{text-decoration:underline}
@media(max-width:720px){.encounter-toolbar{gap:7px;padding:10px}.encounter-toolbar>strong{width:100%}.encounter-toolbar label:first-of-type{flex:1;min-width:140px}.encounter-toolbar input{width:100%}.encounter-timeline{padding:0 8px 16px}.encounter-entry{grid-template-columns:48px minmax(0,1fr);gap:8px}.encounter-day strong{font-size:16px}.encounter-main>header{padding:9px;gap:6px}.encounter-main dl{grid-template-columns:54px minmax(0,1fr);padding:10px;gap:8px}.encounter-main .encounter-wide{grid-column:auto}.encounter-main footer{gap:16px;padding:5px 10px}.encounter-main footer button{min-height:40px}}
