/* Shared shell contract; scoped to BML roots. No document scroll locks or form relocation. */
html body [data-bml-layout]{box-sizing:border-box;max-width:var(--bml-layout-width,100%)!important;min-width:0!important;margin-inline:auto!important;gap:var(--bml-layout-gap,10px);font-size:var(--bml-layout-text,13px)}
html body [data-bml-layout] :is(input,select,textarea,button,table){font-size:inherit}
html body [data-bml-layout] :is(.bmlbo-work,.bmluc-main,.bml-work-content){font-size:var(--bml-layout-text,13px);scroll-padding:16px 12px 64px;scrollbar-gutter:stable}
html body [data-bml-layout] :is(td,th){padding-block:var(--bml-layout-pad,6px)!important;min-height:var(--bml-layout-row,36px);height:var(--bml-layout-row,36px);font-size:var(--bml-layout-text,13px)!important}
html body [data-bml-layout] :is(.bmlbo-card,.bmluc-panel,.bmlwp-card,.bml-panel,.bml-dash-panel){min-width:0;overflow-wrap:anywhere}
html body [data-bml-layout-table]{max-height:var(--bml-layout-table-height,500px)!important;overflow:auto!important;scrollbar-gutter:stable;min-width:0}
html body [data-bml-sticky="yes"] [data-bml-layout-table] thead th{position:sticky!important;top:0;z-index:2;background:#f3f8fa}
html body [data-bml-sticky="no"] [data-bml-layout-table] thead th{position:static!important}
html body [data-bml-actions="yes"] :is(.bmlbo-form-actions,.bml-form-actions,.bmlwp-actions){position:sticky;bottom:0;background:#fff;z-index:3;padding-block:8px}
html body [data-bml-actions="no"] :is(.bmlbo-form-actions,.bml-form-actions,.bmlwp-actions){position:static}
html body [data-bml-header="compact"] :is(.bmlbo-topbar,.bml-work-top){padding-block:6px!important;min-height:48px}
html body [data-bml-layout] :is(.cc-sms-textarea,.cc-composer textarea){min-height:min(var(--bml-layout-composer,150px),28dvh);max-height:45dvh}
html body [data-bml-layout] :is(.cc-email-editor,.cc-composer .mce-edit-area iframe){min-height:min(var(--bml-layout-email,300px),40dvh)}
html body [data-bml-layout] dialog:not(#bml-layout-editor){max-width:min(var(--bml-layout-dialog,900px),calc(100vw - 24px));max-height:calc(100dvh - 32px);overflow:auto}
@media(min-width:901px){
 html body #bml-admin-app[data-bml-fit="1"],html body #bmluc-app[data-bml-fit="1"],html body .bml-workspace[data-bml-fit="1"]{height:var(--bml-layout-height)!important;min-height:0!important;overflow:hidden!important;margin-top:var(--bml-layout-gutter)!important;margin-bottom:0!important;position:relative}
 html body #bml-admin-app[data-bml-fit="1"]{display:grid!important;grid-template-columns:var(--bml-layout-sidebar) minmax(0,1fr)!important}
 html body #bml-admin-app[data-bml-fit="1"]>.bmlbo-main,html body .bml-workspace[data-bml-fit="1"]>.bml-work-main{display:flex!important;flex-direction:column;height:100%;min-height:0!important;min-width:0!important;overflow:hidden!important}
 html body #bml-admin-app[data-bml-fit="1"] .bmlbo-topbar,html body .bml-workspace[data-bml-fit="1"] .bml-work-top{flex:none}
 html body #bml-admin-app[data-bml-fit="1"] .bmlbo-work,html body .bml-workspace[data-bml-fit="1"] .bml-work-content{flex:1;min-height:0!important;overflow:auto!important;padding-bottom:56px!important}
 html body [data-bml-fit="1"] [data-bml-layout-side]{position:static!important;width:auto!important;height:100%!important;min-height:0!important;overflow-y:auto!important}
 html body #lcos-page-root #bmluc-app[data-bml-fit="1"],html body #bmluc-app[data-bml-fit="1"]{display:grid!important;grid-template-rows:auto minmax(0,1fr)!important;margin-top:var(--bml-layout-gutter)!important}
 html body #bmluc-app[data-bml-fit="1"] .bmluc-shell{display:grid!important;grid-template-columns:var(--bml-layout-sidebar) minmax(0,1fr)!important;min-height:0!important;height:auto!important;grid-template-rows:minmax(0,1fr)!important;min-width:0;overflow:hidden}
 html body #bmluc-app[data-bml-fit="1"] .bmluc-main{min-height:0!important;height:auto!important;min-width:0;overflow:auto!important}
 html body #bmluc-app.cc-nav-collapsed[data-bml-fit="1"]:has(#bml-communication-center):not([data-bml-navigation="collapsed"]) .bmluc-shell{grid-template-columns:64px minmax(0,1fr)!important}
 html body .bml-workspace[data-bml-fit="1"]{display:grid!important;grid-template-columns:var(--bml-layout-sidebar) minmax(0,1fr)!important}
 html body [data-bml-layout="public"][data-bml-fit="1"]{display:flex!important;flex-direction:column;height:var(--bml-layout-height)!important;min-height:0!important;overflow:hidden}
 html body [data-bml-layout="public"][data-bml-fit="1"]>#bml-main{flex:1;min-height:0!important;overflow:auto}
 html body [data-bml-layout="public"][data-bml-fit="1"]>:not(#bml-main){flex:none}
 html body [data-bml-layout][data-bml-fit="1"][data-bml-navigation="collapsed"]{--bml-layout-sidebar:0px!important}
 html body [data-bml-layout][data-bml-fit="1"][data-bml-navigation="collapsed"] [data-bml-layout-side]{display:none!important}
 html body [data-bml-layout][data-bml-fit="1"][data-bml-navigation="collapsed"][data-bml-nav-open="1"] [data-bml-layout-side]{display:block!important;position:absolute!important;inset:0 auto 0 0;width:min(320px,80vw)!important;z-index:50;background:#f5faf8;box-shadow:5px 0 20px #183b3326}
}
@media(max-width:900px){html body [data-bml-layout]{max-width:100%!important;height:auto!important;min-height:0!important;overflow:visible!important}html body [data-bml-layout] :is(.cc-composer textarea,.cc-sms-textarea){min-height:100px;max-height:35dvh}html body [data-bml-layout-table]{max-width:100%;overscroll-behavior-x:contain}}
#bml-layout-tools{position:fixed;bottom:max(8px,env(safe-area-inset-bottom));right:12px;display:flex;gap:5px;z-index:99980;font:13px/1.4 system-ui,sans-serif}
#bml-layout-tools button,.bml-layout-welcome button{border:1px solid #b9d5ca;border-radius:8px;background:#fff;color:#176348;padding:7px 12px;min-height:36px;cursor:pointer;box-shadow:0 2px 9px #12372a15}
#bml-layout-editor{box-sizing:border-box;width:min(640px,calc(100vw - 24px));max-height:calc(100dvh - 24px);padding:18px;border:1px solid #c6dcd2;border-radius:14px;background:#f7faf9;color:#193a30;font:14px/1.45 system-ui,sans-serif;overflow:auto;overscroll-behavior:contain;z-index:100000}
#bml-layout-editor::backdrop{background:#112e2855}
#bml-layout-editor header,#bml-layout-editor footer{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}#bml-layout-editor h2{margin:0;font-size:20px}#bml-layout-editor button{min-height:36px;border:1px solid #bdd5cb;border-radius:7px;background:#fff;color:#176348;padding:7px 10px;cursor:pointer}#bml-layout-editor button:disabled{opacity:.5;cursor:wait}#bml-layout-editor select,#bml-layout-editor input[type=text]{box-sizing:border-box;min-height:36px;border:1px solid #bdd5cb;border-radius:7px;padding:5px;max-width:100%;background:white;color:#193a30}#bml-layout-editor>select{width:100%;margin-bottom:8px}#bml-layout-editor fieldset{border:1px solid #d6e3dd;border-radius:8px;padding:10px;margin:12px 0;background:#fff}#bml-layout-editor legend{font-weight:700}#bml-layout-editor label{display:grid;grid-template-columns:minmax(0,1fr) minmax(100px,45%) 30px;align-items:center;gap:8px;margin:8px 0}#bml-layout-editor input[type=range]{width:100%;accent-color:#087c59}#bml-layout-editor output{font-size:12px;text-align:right}#bml-layout-editor footer{position:sticky;bottom:-18px;padding:12px 0;background:#f7faf9;border-top:1px solid #d6e3dd}#bml-layout-editor button:focus-visible,#bml-layout-tools button:focus-visible{outline:3px solid #087c59;outline-offset:2px}
.bml-layout-welcome{padding:16px;border:1px solid #d6e3dd;border-radius:12px;background:#fff;max-width:1000px}.bml-layout-example{display:grid;grid-template-columns:90px 1fr;border:1px solid #c6dcd2;border-radius:8px;overflow:hidden;margin-top:20px;min-height:220px}.bml-layout-example aside{background:#e6f2ec;padding:12px}.bml-layout-example section{display:flex;flex-direction:column;min-width:0}.bml-layout-example :is(header,footer){padding:10px;background:#f3f8f5}.bml-layout-example section>div{display:grid;grid-template-columns:1fr 2fr 1fr;gap:8px;flex:1;padding:10px}.bml-layout-example article{border:1px solid #d6e3dd;border-radius:5px;padding:10px;min-width:0;overflow-wrap:anywhere}
@media(max-width:480px){#bml-layout-editor label{grid-template-columns:1fr 100px 24px}.bml-layout-example{grid-template-columns:50px 1fr}}
@media print{#bml-layout-tools,#bml-layout-editor{display:none!important}html body [data-bml-layout],html body [data-bml-layout] :is(.bmlbo-main,.bmlbo-work,.bmluc-shell,.bmluc-main,.bml-work-main,.bml-work-content,[data-bml-layout-table]){height:auto!important;max-height:none!important;overflow:visible!important}html body [data-bml-layout] [data-bml-layout-side]{display:none!important}}

@media(min-width:1181px){html body [data-bml-columns="two"] .bml-conversation-details{display:none!important}html body [data-bml-columns="two"] .bml-conversation-split{grid-template-columns:minmax(0,1fr)!important}}
html body [data-bml-layout] #bml-communication-center:not([data-cc-mode]) .cc-layout[data-channel] .cc-composer #cc-message-body{min-height:min(var(--bml-layout-composer,150px),28dvh)!important}
html body [data-bml-layout] #bml-communication-center .cc-composer .mce-edit-area iframe{min-height:min(var(--bml-layout-email,300px),40dvh)!important}

@media(min-width:901px){html body #bml-admin-app[data-bml-fit="1"]>.bmlbo-main,html body .bml-workspace[data-bml-fit="1"]>.bml-work-main{margin:0!important;width:auto!important}html body [data-bml-fit="1"] :is(.bmlbo-topbar,.bml-work-top,.bmluc-top){position:relative!important;top:auto!important}}

[data-bml-layout] #bml-layout-tools{position:relative;inset:auto;z-index:30;margin-left:auto;flex:none;align-self:center}[data-bml-layout] #bml-layout-tools [hidden]{display:none!important}

html body.bml-layout-active dialog[open]:not(#bml-layout-editor):not([data-cc-dialog="preview"]){max-width:min(var(--bml-layout-current-dialog,900px),calc(100vw - 24px))!important;max-height:calc(100dvh - 32px)!important;overflow:auto}
html body [data-bml-layout] :is(.bmlbo-panel,.bml-panel,.bml-dash-panel,.bmluc-panel,.bmlwp-card){padding:calc(var(--bml-layout-pad,6px) + 6px)}
html body [data-bml-layout] :is(p,label,li){font-size:var(--bml-layout-text,13px)}
html body [data-bml-header="compact"] :is(.bmlbo-topbar,.bml-work-top,.bmluc-top){height:auto!important;min-height:48px!important;padding-block:6px!important}
html body [data-bml-header="comfortable"] :is(.bmlbo-topbar,.bml-work-top,.bmluc-top){height:auto!important;min-height:64px!important;padding-block:12px!important}

/* Touch/short-screen page flow must not inherit a desktop row cap inside another scroll area. */
@media(max-width:900px),(max-height:560px){
 html body #bml-admin-app[data-bml-layout=admin] [data-bml-layout-table]:not([data-billing-viewport-table]){max-height:none!important;height:auto!important;overflow-x:auto!important;overflow-y:visible!important}
}
html body #bml-admin-app[data-bml-fit="1"]>.bmlbo-main>.bmlbo-work{overscroll-behavior-y:auto;scrollbar-width:auto;scroll-padding-bottom:64px}

html body #bml-admin-app[data-bml-layout=admin][data-bml-table-scroll=page] [data-bml-layout-table]:not([data-billing-viewport-table]){height:auto!important;max-height:none!important}
html body #bml-admin-app [data-bml-layout-table]:focus-visible{outline:2px solid #087f59;outline-offset:-2px}
