/* Care forms remain mounted; operation forms confirm discarding unsaved input. */
.list-filters{display:flex;flex-wrap:wrap;gap:12px;align-items:end;margin:12px 0 18px}
.list-filters>label{flex:1 1 160px;min-width:0}
.list-filters input[type=checkbox]{width:auto;display:block;margin:12px 0}
.pagination{display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap;margin:16px 0}
.pagination span{font-size:13px;color:#45645c}
.overdue-row{background:#fff0e9}
.overdue-row td{border-bottom-color:#d9a48c}
select[multiple]{min-height:110px}
html[data-telegram-theme=dark] .overdue-row{background:#49332e}
html[data-telegram-theme=dark] .pagination span{color:#c4dbd4}
.header-actions{display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.browser-link{color:var(--accent);font-size:13px;white-space:nowrap}
.section-help{position:relative;display:inline-flex;align-items:center;justify-content:center;width:1.2em;height:1.2em;min-height:0;margin-left:6px;padding:0;border:1px solid #9ab3ac;border-radius:50%;background:transparent;color:inherit;font-size:.5em;font-weight:400;line-height:1;vertical-align:super}
.section-help::before{content:'';position:absolute;inset:-7px}
.ops-columns:not(:has(aside)){display:block!important}
#ops-dialog{width:min(620px,calc(100vw - 32px));max-height:calc(100dvh - 32px);padding:20px;border:1px solid #c5d6cf;border-radius:14px;background:white;color:#173b40;overflow-y:auto;overscroll-behavior:contain}
#ops-dialog::backdrop{background:rgb(18 40 36 / 40%)}
.ops-dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:12px;color:#57706c;font-size:13px}
#ops-dialog-close{padding:0;width:36px;height:36px;font-size:24px;line-height:1}
#ops-dialog-status:empty{display:none}
#ops-dialog-status{color:#a12d25;white-space:pre-wrap}
#ops-dialog #ops-editor{padding:0;background:transparent}
#ops-dialog .reference-search{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:12px}
#ops-dialog .reference-search input{flex:1 1 100%;min-width:0}
#ops-dialog .reference-search span{flex-basis:100%;font-size:12px;color:#57706c}
#ops-dialog #ops-dialog-cancel{margin-top:12px}
html[data-telegram-theme=dark] #ops-dialog{background:#202d3a;color:#d9e8e2;border-color:#506170}
html[data-telegram-theme=dark] .ops-dialog-heading,html[data-telegram-theme=dark] #ops-dialog .reference-search span{color:#b3dcd3}
html[data-telegram-theme=dark] #ops-dialog-status{color:#ffb4a8}
.refresh-control{display:flex;flex-direction:column;align-items:center;gap:4px}
#refresh-status{min-height:16px;color:#57706c;font-size:12px;line-height:16px}
html[data-telegram-theme=dark] #refresh-status{color:#b3dcd3}
#refresh{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-width:190px}
#refresh[aria-busy=true]{cursor:wait}
#refresh[aria-busy=true]::before{content:'';width:14px;height:14px;flex:none;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:refresh-spin .75s linear infinite}
@keyframes refresh-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){#refresh[aria-busy=true]::before{animation:none}}
#care-nav{justify-content:flex-start;gap:6px;overflow-x:auto;margin-bottom:18px}
#care-nav button{white-space:nowrap;min-height:42px}
#care-nav button.active{background:var(--accent);color:white}
.care-columns{display:block}
.care-columns>div{display:contents}
body[data-care-view=appointments] :is(#patient-registry,#booking,#import-section,#registry-editor,#registry-history),
body[data-care-view=patients] :is(#visit-queue,#encounter,#booking,#import-section),
body[data-care-view=booking] :is(#patient-registry,#visit-queue,#encounter,#import-section,#registry-editor,#registry-history),
body[data-care-view=import] :is(#patient-registry,#visit-queue,#encounter,#booking,#registry-editor,#registry-history){display:none!important}
#booking{max-width:720px}
#module-picker{margin:0 0 16px;font-size:12px;color:#57706c}
#module-select{font-weight:650}
body:has(#workspace:not([hidden])) .intro{margin-bottom:18px}
body:has(#workspace:not([hidden])) .intro>p{display:none}
body:has(#workspace:not([hidden])) #mini-status{display:none}
body:has(#workspace:not([hidden])) h1{font-size:25px;margin:0}
#workspace>nav:first-child{justify-content:flex-end;align-items:flex-start;flex-wrap:wrap}
#workspace #module-nav{display:none}
html[data-telegram-theme=dark] :is(#module-picker,.browser-link){color:#b3dcd3}
@media(min-width:1000px){
 body:has(#workspace:not([hidden])) main{max-width:none;padding:24px 32px}
 body:has(#workspace:not([hidden])) header{position:sticky;top:var(--mini-safe-top,0px);z-index:20;padding:16px 32px}
 #workspace{display:grid;grid-template-columns:224px minmax(0,1fr);grid-template-rows:0 max-content 1fr;grid-template-areas:'modules tools' 'modules recovery' 'modules content';column-gap:28px;align-items:start}
 #workspace>nav:first-child{grid-area:tools;margin-top:-48px;margin-bottom:20px;min-height:42px}
 #workspace #module-nav{grid-area:modules;display:flex;flex-direction:column;flex-wrap:nowrap;overflow:auto;position:sticky;top:94px;max-height:calc(100dvh - 120px);padding:10px;border:1px solid #d9e5e1;border-radius:12px;background:white;margin:0;gap:4px;scroll-snap-type:none}
 #workspace #module-nav button{width:100%;text-align:left;font-size:13px;line-height:1.4;min-height:44px;border:0;padding:11px 12px;background:transparent;color:#33564e;flex:none;white-space:normal}
 #workspace #module-nav button.active{background:#116b62;color:white}
 #workspace #module-nav button:hover{background:#eaf4ef;filter:none}
 #workspace #module-nav button.active:hover{background:#0c5c54}
 #module-picker{display:none}
 #recovery{grid-area:recovery}
 #care-workspace,#operations{grid-area:content;min-width:0}
 #care-workspace #care-nav{padding-bottom:12px;border-bottom:1px solid #d9e5e1}
 #care-workspace #care-nav button{font-size:14px;padding:9px 16px}
 body[data-care-view=appointments] .care-columns:has(#encounter:not([hidden])){display:grid;grid-template-columns:minmax(260px,.75fr) minmax(350px,1.25fr);gap:20px;align-items:start}
 #patients{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:16px}
 #patients>.patient-card{border:1px solid #d9e5e1;border-radius:10px;padding:18px;align-self:start}
 #appointments{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:16px}
 #appointments>.card{padding:18px;border:1px solid #d9e5e1;border-radius:10px}
 #workspace section{padding:24px}
 #workspace .ops-columns{grid-template-columns:minmax(250px,300px) minmax(0,1fr);gap:24px}
 #workspace .ops-columns:has(aside[hidden]){display:block}
 #workspace input,#workspace select,#workspace textarea{font-size:14px}
 html[data-telegram-theme=dark] #workspace #module-nav{background:#202d3a;border-color:#506170}
 html[data-telegram-theme=dark] #workspace #module-nav button{color:#d9e8e2}
 html[data-telegram-theme=dark] #workspace #module-nav button:hover{background:#304838}
}
@media(max-width:999px){
 #workspace>nav:first-child{margin-bottom:12px}
 #workspace #care-nav button{padding:8px 11px;font-size:13px}
 .header-actions{gap:10px;font-size:12px}
 .header-actions button{font-size:12px;padding:6px 10px}
 #workspace .ops-columns{grid-template-columns:minmax(0,1fr)}
 #workspace section{padding:16px}
}
