/* Operational boards consume available space; no fixed subtraction for title height. */
@media screen and (min-width:801px) and (min-height:600px){
 body:is([data-workspace-page="execution"],[data-workspace-page="followups"],[data-workspace-page="flowboard"]){height:100dvh;overflow:hidden;display:flex;flex-direction:column}
 body:is([data-workspace-page="execution"],[data-workspace-page="followups"],[data-workspace-page="flowboard"])>#sidebar{flex:none}
 body:is([data-workspace-page="execution"],[data-workspace-page="followups"],[data-workspace-page="flowboard"])>.workspace{display:flex;flex-direction:column;flex:1;min-height:0}
 body:is([data-workspace-page="execution"],[data-workspace-page="followups"],[data-workspace-page="flowboard"]) #header{flex:none}
 body:is([data-workspace-page="execution"],[data-workspace-page="followups"],[data-workspace-page="flowboard"]) #main{display:flex;flex-direction:column;flex:1;min-height:0;width:100%;box-sizing:border-box;margin:0 auto;padding-top:12px;padding-bottom:6px}
 body:is([data-workspace-page="execution"],[data-workspace-page="followups"],[data-workspace-page="flowboard"]) #main> :not(.op-board):not(.flow-scroll){flex:none}
 body:is([data-workspace-page="execution"],[data-workspace-page="followups"],[data-workspace-page="flowboard"]) #main>.title-row{margin-bottom:10px}
 body:is([data-workspace-page="execution"],[data-workspace-page="followups"],[data-workspace-page="flowboard"]) .flow-filter{padding:9px 12px;margin-bottom:8px}
 body:is([data-workspace-page="execution"],[data-workspace-page="followups"]) .op-note{margin:3px 0 9px}
 body:is([data-workspace-page="execution"],[data-workspace-page="followups"],[data-workspace-page="flowboard"]) .workspace>footer{flex:none;min-height:20px;padding:3px 28px;font-size:10px;line-height:14px}
 body:is([data-workspace-page="execution"],[data-workspace-page="followups"]) .op-board{flex:1;min-height:0;align-items:stretch;overflow:auto;padding-bottom:0}
 body:is([data-workspace-page="execution"],[data-workspace-page="followups"]) .op-column{display:flex;flex-direction:column;min-height:0;overflow:hidden}
 body:is([data-workspace-page="execution"],[data-workspace-page="followups"]) .op-column>header{flex:none}
 body:is([data-workspace-page="execution"],[data-workspace-page="followups"]) .op-column-content{flex:1;min-height:0;max-height:none;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
 body[data-workspace-page="flowboard"] .flow-scroll{flex:1;min-height:0;max-height:none;overflow:auto;padding-bottom:0}
 body[data-workspace-page="flowboard"] .flow-board{height:100%;min-height:0;align-items:stretch}
 body[data-workspace-page="flowboard"] .flow-column{display:flex;flex-direction:column;min-height:0;overflow:hidden}
 body[data-workspace-page="flowboard"] .flow-column-title{flex:none}
 body[data-workspace-page="flowboard"] .flow-cards{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
}
/* On narrow/short windows, natural document scrolling keeps controls reachable. */
@media screen and (max-width:800px),screen and (max-height:599px){
 body:is([data-workspace-page="execution"],[data-workspace-page="followups"]) .op-column-content{max-height:none}
 body[data-workspace-page="flowboard"] .flow-scroll{max-height:none}
}

.execution-history-filter{padding:8px 12px;display:flex;flex-wrap:wrap;gap:8px;border-bottom:1px solid #e3e9eb;background:#f7faf9;flex-shrink:0}
.execution-history-filter label{flex:1;min-width:95px;font-size:11px;color:#52676b;display:grid;gap:4px}
.execution-history-filter select,.execution-history-filter input{width:100%;min-width:0;padding:6px;font-size:12px}
.execution-history-filter small{width:100%;color:#718386;font-size:11px}
.execution-completed-time{color:#217365;font-weight:600}
dialog.encounter-report-dialog{width:min(1180px,calc(100vw - 40px));max-width:none;height:min(860px,calc(100dvh - 40px));max-height:calc(100dvh - 40px);padding:0;border:1px solid #dce7e5;border-radius:16px;overflow:hidden;box-shadow:0 24px 90px #122d3840}
dialog.encounter-report-dialog[open]{display:flex;flex-direction:column}
.encounter-report-dialog::backdrop{background:#142d3b66}
.encounter-report-head{display:flex;align-items:center;justify-content:space-between;padding:18px 24px;background:#f3f8f7;border-bottom:1px solid #dde8e5;flex-shrink:0}
.encounter-report-head h2{margin:0;font-size:20px}.encounter-report-head p{margin:4px 0 0;color:#637b7b;font-size:12px}
.encounter-report-body{padding:24px;overflow:auto;min-height:0;flex:1}
.encounter-report-body .reference-item-name{font-size:22px;margin:0 0 18px}
.encounter-report-body table{width:100%}.encounter-report-body th,.encounter-report-body td{padding:12px;text-align:left}
.encounter-report-body textarea{min-height:110px}.encounter-report-body .encounter-rail-section{margin-top:24px;padding-top:20px;border-top:1px solid #e1e8e6}
@media(max-width:600px){dialog.encounter-report-dialog{width:calc(100vw - 16px);height:calc(100dvh - 16px);max-height:calc(100dvh - 16px)}.encounter-report-body{padding:16px}.encounter-report-head{padding:14px 16px}}

/* Dense flowboard cards: retain readable names and all clinical alerts. */
.flow-board .flow-cards{gap:8px}
.flow-board .visit-card{padding:9px 10px}
.flow-board .visit-time{margin:0 0 5px;line-height:1.4}
.flow-board .visit-identity{gap:5px}
.flow-board .visit-people{display:flex;flex-wrap:wrap;justify-content:space-between;gap:2px 8px;margin:4px 0;color:#5c737d;font-size:12px;line-height:1.5;overflow-wrap:anywhere}
.flow-board .visit-card p{margin:4px 0}
.flow-board .visit-card h3{margin:5px 0;font-size:13px;line-height:1.45}
.flow-board .visit-note{padding:5px 6px}
.flow-board .visit-actions{margin-top:7px;padding-top:7px;gap:4px}
.flow-board .visit-actions button{padding:4px 7px;min-height:30px}
@media(pointer:coarse){.flow-board .visit-actions button{min-height:40px}}

.flow-board .visit-actions{display:flex;flex-wrap:wrap}
.flow-board .visit-actions button{flex:1 1 auto;width:auto;white-space:nowrap}
.flow-board .visit-identity button{min-height:32px}
.flow-board .visit-card>.badge{padding:2px 6px;min-height:0}

/* Optional natural page scrolling; no inner vertical queues to target. */
body[data-workspace-page="flowboard"]:has(.flow-scroll[data-scroll-mode="page"]){height:auto;min-height:100dvh;overflow:auto;display:block}
body[data-workspace-page="flowboard"]:has(.flow-scroll[data-scroll-mode="page"])>.workspace{display:block;height:auto;min-height:0;overflow:visible}
body[data-workspace-page="flowboard"]:has(.flow-scroll[data-scroll-mode="page"]) #main{display:block;height:auto;overflow:visible}
body[data-workspace-page="flowboard"] .flow-scroll[data-scroll-mode="page"]{height:auto;max-height:none;min-height:0;overflow-x:auto;overflow-y:hidden;flex:none;padding-bottom:12px}
body[data-workspace-page="flowboard"] .flow-scroll[data-scroll-mode="page"] .flow-board{height:auto;min-height:50vh;align-items:stretch}
body[data-workspace-page="flowboard"] .flow-scroll[data-scroll-mode="page"] .flow-column{height:auto;max-height:none;overflow:visible}
body[data-workspace-page="flowboard"] .flow-scroll[data-scroll-mode="page"] .flow-cards{height:auto;max-height:none;overflow:visible;flex:none;overscroll-behavior:auto;scrollbar-gutter:auto}

/* Execution supports the same optional document scrolling as the flowboard. */
body[data-workspace-page="execution"]:has([data-execution-scroll-mode="page"]){height:auto;min-height:100dvh;overflow:auto;display:block}
body[data-workspace-page="execution"]:has([data-execution-scroll-mode="page"])>.workspace{display:block;height:auto;min-height:0;overflow:visible}
body[data-workspace-page="execution"]:has([data-execution-scroll-mode="page"]) #main{display:block;height:auto;overflow:visible}
body[data-workspace-page="execution"] .op-board[data-execution-scroll-mode="page"]{height:auto;max-height:none;min-height:50vh;overflow-x:auto;overflow-y:hidden;flex:none;align-items:stretch}
body[data-workspace-page="execution"] [data-execution-scroll-mode="page"] .op-column{height:auto;max-height:none;overflow:visible}
body[data-workspace-page="execution"] [data-execution-scroll-mode="page"] .op-column-content{height:auto;max-height:none;overflow:visible;flex:none;overscroll-behavior:auto;scrollbar-gutter:auto}

.execution-category{display:inline-flex;align-items:center;gap:6px;font-weight:600}.execution-category .cue-icon{width:20px;height:20px;flex:0 0 20px;margin:0}

/* Category color stays stable as the card moves between execution states. */
.op-card.execution-kind-drug{--exec-wash:#f0f7f2;--exec-line:#7ca88a;--exec-ink:#315f43;--exec-label:#e1efe5}
.op-card.execution-kind-lab{--exec-wash:#eff5fb;--exec-line:#7e9fc2;--exec-ink:#355d85;--exec-label:#e0ebf7}
.op-card.execution-kind-imaging{--exec-wash:#f5f1fa;--exec-line:#a18bb8;--exec-ink:#695183;--exec-label:#eae2f2}
.op-card.execution-kind-service{--exec-wash:#fcf6ec;--exec-line:#c6a267;--exec-ink:#7b5c28;--exec-label:#f4e8d2}
.op-card.execution-kind-supply{--exec-wash:#f3f5f7;--exec-line:#9aa8b5;--exec-ink:#506171;--exec-label:#e6ebef}
.op-card[class*="execution-kind-"]{background:var(--exec-wash,#fff);border-left:3px solid var(--exec-line,#b4c4c9)}
.op-card[class*="execution-kind-"] .execution-category{background:var(--exec-label,#eef2f4);color:var(--exec-ink,#324c58);border:0}
.op-card[class*="execution-kind-"] .execution-category .cue-icon{color:inherit}

/* Compact execution cards: keep patient, project and real instructions visible. */
body[data-workspace-page="execution"] .op-card[class*="execution-kind-"]{padding:10px 11px;margin-bottom:8px;border-radius:8px}
body[data-workspace-page="execution"] .op-card-top{margin-bottom:5px;gap:6px}
body[data-workspace-page="execution"] .execution-category{padding:3px 6px;font-size:12px;gap:4px}
body[data-workspace-page="execution"] .execution-category .cue-icon{width:16px;height:16px;flex-basis:16px}
body[data-workspace-page="execution"] .op-patient{flex-direction:row;align-items:center;flex-wrap:wrap;gap:2px 8px}
body[data-workspace-page="execution"] .op-patient button{font-size:14px;min-height:26px;line-height:24px}
body[data-workspace-page="execution"] .op-patient>.text .pet-avatar{width:24px;height:24px;min-width:24px}
body[data-workspace-page="execution"] .op-patient>span{font-size:12px;line-height:18px}
body[data-workspace-page="execution"] .op-card h3{margin:5px 0;font-size:14px;line-height:20px}
body[data-workspace-page="execution"] .op-card p{margin:3px 0;font-size:12px;line-height:19px}
body[data-workspace-page="execution"] .op-card .execution-instruction,body[data-workspace-page="execution"] .op-card .execution-important-note{font-size:13px;line-height:20px}
body[data-workspace-page="execution"] .execution-card-details{margin-top:3px;font-size:12px;color:#526c76}
body[data-workspace-page="execution"] .execution-card-details summary{cursor:pointer;min-height:24px;line-height:24px;width:fit-content}
body[data-workspace-page="execution"] .op-card-actions{margin-top:5px;padding-top:6px;gap:6px}
body[data-workspace-page="execution"] .op-card-actions button{min-height:30px;padding:4px 9px;font-size:12px;line-height:20px}
@media(pointer:coarse){body[data-workspace-page="execution"] .op-card-actions button{min-height:40px}body[data-workspace-page="execution"] .execution-card-details summary{min-height:36px;line-height:36px}}
