/* Release 75. Shared control geometry and containment; semantic colours stay local. */
:root{--bm-control-height:44px;--bm-control-radius:8px;--bm-control-gap:10px}
body :is(main,#main,#p-view,.p-content,.card,.panel,.p-card,fieldset){min-inline-size:0;box-sizing:border-box}
body :is(main,#main,#p-view,.p-content) :is(.row,.p-row,.p-approval,.pc-actions,.actions,.toolbar,.bgov-actions,.service-job-actions,.bm-row-actions,.ext-form-actions){display:flex;flex-wrap:wrap;align-items:center;gap:var(--bm-control-gap);min-width:0;max-width:100%}
body :is(main,#main,#p-view,.p-content,dialog,.pc-dialog,.drawer) :is(button,.btn,.p-btn,a.button):not(.bmd-multi-chips button):not([role=switch]){
 box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;gap:7px;
 min-height:var(--bm-control-height);height:auto;max-height:none;max-width:100%;
 padding:10px 14px;border-radius:var(--bm-control-radius);font-family:inherit;
 font-size:14px;font-weight:650;line-height:1.4;white-space:normal;overflow-wrap:anywhere;
 text-align:center;vertical-align:middle;cursor:pointer;text-decoration:none;
}
body :is(main,#main,#p-view,.p-content,dialog,.pc-dialog,.drawer) :is(button,.btn,.p-btn,a.button)>svg{flex-shrink:0}
body :is(button,.btn,.p-btn,a.button):focus-visible{outline:3px solid #54c4df;outline-offset:3px}
body button:disabled{cursor:not-allowed;opacity:.5}
/* Expanded action labels may wrap; filter rows grow instead of clipping them. */
html body :is(.filters,.ext-filters,.filt,.r-filters,.controls,.p-filters,.pc-filters,.bm-filter-toolbar) >button{
 height:auto!important;max-height:none!important;min-height:44px!important;white-space:normal!important;align-self:end;
}
html body :is(.p-approval,.pc-actions,.actions,.bm-row-actions,.service-job-actions,.bgov-actions) >:is(button,.btn,.p-btn,a.button){
 flex:0 1 auto!important;min-width:0!important;max-width:100%!important;min-height:44px!important;
 white-space:normal!important;overflow-wrap:anywhere!important;line-height:1.4!important;margin:0!important;
}
/* Label and control widths stay within their grid tracks. */
body :is(.form,.formgrid,.p-form,.pc-form,.bgov-new,.filters,.ext-filters,.filt,.r-filters,.controls,.bm-filter-toolbar) >*{min-width:0;max-width:100%;box-sizing:border-box}
body :is(.form,.formgrid,.p-form,.pc-form,.bgov-new,.filters,.ext-filters,.filt,.r-filters) :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea){min-width:0;max-width:100%;width:100%;box-sizing:border-box}
html body .bgov label.bgov-confirm,html body :is(.form,.formgrid,.p-form,.pc-form) label:has(>input:is([type=checkbox],[type=radio])){
 display:flex!important;flex-direction:row!important;align-items:center!important;justify-content:flex-start;gap:9px;white-space:normal;line-height:1.5;
}
html body :is(.bgov,.form,.formgrid,.p-form,.pc-form,.filters,.ext-filters) input:is([type=checkbox],[type=radio]){
 width:18px!important;min-width:18px!important;max-width:18px!important;height:18px!important;min-height:18px!important;max-height:18px!important;flex:0 0 18px;padding:0!important;margin:0!important;
}
/* Wide data tables scroll in their own container. Do not hide page overflow. */
body :is(.tablewrap,.table-wrap,.table-responsive,.p-table-wrap,.pc-table){box-sizing:border-box;min-width:0;max-width:100%;overscroll-behavior-x:contain}
body :is(.bm-disclosure-content,.ext-detail-grid,.portal-detail-grid,.crm-detail-sheet){min-width:0;overflow-wrap:anywhere}
body :is(.tablewrap,.table-wrap,.p-table-wrap,.pc-table) td :is(button,.btn,.p-btn){vertical-align:middle}
body :is(.tablewrap,.table-wrap,.p-table-wrap,.pc-table) td >:is(button,.btn,.p-btn)+:is(button,.btn,.p-btn){margin-inline-start:6px;margin-block:4px}
body :is(dialog,.pc-dialog){max-width:calc(100vw - 24px);max-height:calc(100dvh - 32px);box-sizing:border-box;overflow-y:auto;overscroll-behavior:contain}
body dialog::backdrop{background:rgba(6,28,44,.62)}
body :is(dialog,.pc-dialog) :is(form,fieldset,.card,.panel){min-width:0;max-width:100%;box-sizing:border-box}
/* Filters in narrow content panes must not retain desktop minimum tracks. */
@media(max-width:1100px){
 html body :is(.ext-filters,.filt,.r-filters,.bm-filter-toolbar){grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
@media(max-width:680px){
 html body :is(.ext-filters,.filt,.r-filters,.bm-filter-toolbar,.formgrid,.lineform){grid-template-columns:minmax(0,1fr)!important}
 body :is(.controls,.toolbar,.bgov-actions,.p-approval,.ext-form-actions){row-gap:10px}
 body :is(.bgov-actions,.ext-form-actions)>:is(button,a){flex:1 1 160px!important}
 body :is(main,#main,#p-view,.p-content) :is(input:not([type=checkbox]):not([type=radio]),select,textarea){font-size:16px}
 html body :is(.service-details-cell,.service-job-actions){white-space:normal!important}
 html body .service-job-actions{min-width:0;max-width:100%}
 html body button.service-details-button{white-space:normal!important;min-width:0!important}
 body :is(dialog,.pc-dialog){padding:16px;scroll-padding-block:16px}
}
@media print{
 body :is(main,#main,#p-view,.p-content) :is(button,.btn,.p-btn){min-height:0}
}
/* Author-level display rules must never override an explicit hidden state. */
html body [hidden]{display:none!important}
/* Shared action palette: primary, secondary and destructive retain distinct meanings. */
body :is(main,#main,#p-view,.p-content,dialog,.pc-dialog) :is(.p-btn:not(.secondary):not(.alt):not(.warn):not(.danger),.btn.primary,button[data-save],button[data-submit],button[data-save-actual],button[data-submit-month],button[data-decision="approve"]){background:#00669a;color:#fff;border:1px solid #00669a}
body :is(main,#main,#p-view,.p-content,dialog,.pc-dialog) :is(.btn.alt,.btn.secondary,.p-btn.secondary){background:#eaf3f7;color:#125072;border:1px solid #bfd4e0}
body :is(main,#main,#p-view,.p-content,dialog,.pc-dialog) :is(.btn.danger,.p-btn.danger){background:#fceeed;color:#a63838;border:1px solid #ebc3bf}
/* v81: one navigation row, predictable wrapping and spacing for financial actions. */
.bgov>nav.bgov-actions{display:flex!important;flex-wrap:wrap!important;gap:12px!important;align-items:stretch;margin:0 0 22px!important;padding:0!important}
.bgov>nav.bgov-actions>button{flex:0 1 auto!important;min-height:44px!important;height:auto!important;margin:0!important;padding:11px 16px!important;white-space:normal!important;line-height:1.4!important}
.bgov .bgov-new{gap:18px!important}.bgov .bgov-new>.bgov-actions{display:flex!important;flex-wrap:wrap!important;gap:12px!important;margin-top:8px!important}
.bgov .panel .bgov-actions>button{position:static!important;transform:none!important;min-width:0!important;max-width:100%!important}
.bgov #targets td details{min-width:200px}.bgov #targets td details :is(select,textarea,input){display:block;margin-top:10px;max-width:100%}
@media(max-width:600px){.bgov>nav.bgov-actions>button{flex:1 1 145px!important}.bgov .bgov-new>.bgov-actions>button{width:100%}}

/* v84: persistent, high-contrast state for actual view controls, not action buttons. */
html body #portal :is(.p-tabs,.pc-views,.pc-statusbar) >button,
html body #portal .visit-view-tabs >button{
 background:#fff!important;color:#355c70!important;border:1px solid #c6dce7!important;box-shadow:none!important;
}
html body #portal :is(.p-tabs,.pc-views,.pc-statusbar) >button:is(.selected,[aria-selected="true"],[aria-pressed="true"]),
html body #portal .visit-view-tabs >button[aria-selected="true"]{
 background:#087b80!important;color:#fff!important;border-color:#087b80!important;box-shadow:0 1px 3px #063b3e25!important;font-weight:750!important;
}
html body #portal :is(.p-tabs,.pc-views,.pc-statusbar) >button:hover{border-color:#087b80!important}
html body #portal :is(.p-tabs,.pc-views){display:flex;flex-wrap:wrap;gap:10px;align-items:center}
#portal .deep-analysis-panel{scroll-margin-top:100px}
