/* Scoped to back office; no cashier, receipt or billing selectors. */
#adminView .control-section-nav,#adminView .page-head,#adminView .form-actions,#adminView .card-head,#adminView .report-filter-card{position:relative!important;inset:auto!important;z-index:auto!important;flex-wrap:wrap!important;min-width:0}
#adminView .card,#adminView .two-panel>*,#adminView .form-grid>*,#adminView .control-validation-grid>*,#adminView .release-card>*,#crmView .card{min-width:0;max-width:100%;box-sizing:border-box;overflow-wrap:anywhere}
#adminView .two-panel,#adminView .control-validation-grid{grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}
#adminView .release-card,#adminView .release-actions,#adminView .data-row,#adminView .network-filters{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
#adminView .release-card>div:first-child,#adminView .data-row>div:first-child{flex:1 1 180px;min-width:0}
#franchiseHierarchyCard .two-panel{display:flex;flex-direction:column;gap:12px}
#franchiseHierarchyCard .two-panel>*{width:100%}
#networkEdit{padding:12px;border:1px solid #8ba7bc;border-radius:8px}
#networkEdit summary{cursor:pointer;font-weight:700}
#territoryList,#controlAuditList,#releaseList{max-height:none!important;height:auto!important;overflow:visible!important}
#adminView .network-filters input,#adminView .network-filters select{flex:1 1 180px;min-width:0}
#crmExportPanel[hidden]{display:none!important}
#crmExportPanel{background:#e4f1f5!important;color:#183647!important;-webkit-text-fill-color:#183647!important}
#crmExportPanel label,#crmExportPanel h3,#crmExportPanel p,#crmExportPanel select{color:#183647!important;-webkit-text-fill-color:#183647!important}
#crmExportPanel button{background:#14576c!important;color:white!important;-webkit-text-fill-color:white!important}
@media(max-width:850px){#adminView .two-panel,#adminView .control-validation-grid,#adminView .form-grid,#crmExportPanel .form-grid{grid-template-columns:minmax(0,1fr)!important}#adminView .control-validation-grid>*{grid-column:1/-1}}

#territoryList details{margin-top:8px} #territoryList details summary{cursor:pointer;font-weight:600} #territoryList details small{display:block;padding:4px 0} #crmExportPanel details{margin-top:12px} #crmExportPanel input{min-width:0;color:#183647;background:#fff}

/* RC3: explicit spacing also when legacy rules force block layout. */
#adminView .control-validation-grid.control-visible:not(.hidden){display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:18px!important;align-items:start!important;padding:4px 2px 20px!important;box-sizing:border-box!important}
#adminView .control-validation-grid.control-visible > .card{position:static!important;grid-column:1/-1!important;margin:0!important;min-width:0!important;width:100%!important;max-width:100%!important;height:auto!important;border-radius:14px!important;padding:18px!important;box-sizing:border-box!important}
#adminView .control-validation-grid #controlReadinessKpis{display:grid!important;grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr))!important;gap:12px!important;margin:12px 0 18px!important}
#adminView #controlReadinessKpis > .mini-kpi{margin:0!important;min-width:0!important;position:static!important;border-radius:12px!important;padding:12px!important}
#adminView [data-control-section-panel].control-visible.card:not(.hidden){margin-block:0 18px!important;position:relative!important;inset:auto!important;height:auto!important;box-sizing:border-box!important}
#adminView #controlAuditRefreshStatus{margin:8px 0 12px!important;line-height:1.5!important;color:inherit!important;font-size:13px!important;overflow-wrap:anywhere!important}
#adminView .control-validation-grid .card-head{gap:12px!important;position:static!important}
@media(max-width:600px){#adminView .control-validation-grid.control-visible > .card{padding:12px!important}#adminView .control-validation-grid.control-visible{gap:14px!important}}

/* RC4: responsive sales report KPI cards */
html body #reportsView #reportKpis {grid-template-columns:repeat(auto-fit,minmax(min(100%,150px),1fr))!important;gap:12px!important;}
html body #reportsView #reportKpis .report-kpi {min-width:0;overflow-wrap:anywhere;}

/* RC5 CRM: independent surfaces, scoped contrast, no generic card cascade. */
html body #crmView #crmExportPanel,html body #crmView .crm-directory-panel{background:#183d4e!important;color:#f4f8fb!important;-webkit-text-fill-color:#f4f8fb!important;border:1px solid #527b8e!important;border-radius:14px!important;padding:20px!important;margin:18px 0!important;width:100%!important;max-width:100%!important;box-sizing:border-box!important;position:static!important;height:auto!important;}
html body #crmView #crmExportPanel[hidden]{display:none!important}
html body #crmView #crmExportPanel :is(h3,p,label,summary),html body #crmView .crm-directory-panel :is(h3,strong,small,b){color:#f4f8fb!important;-webkit-text-fill-color:#f4f8fb!important;line-height:1.5!important;}
html body #crmView #crmExportPanel .form-grid{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:16px!important;margin:16px 0!important;}
html body #crmView #crmExportPanel label{display:flex!important;flex-direction:column!important;gap:7px!important;min-width:0!important;font-size:14px!important;font-weight:600!important;}
html body #crmView #crmExportPanel :is(input,select),html body #crmView #crmSearch{background:#f0f7fa!important;color:#142f40!important;-webkit-text-fill-color:#142f40!important;min-height:44px!important;height:auto!important;width:100%!important;box-sizing:border-box!important;padding:10px 12px!important;border-radius:8px!important;font-size:14px!important;}
html body #crmView #crmExportPanel button{min-height:44px!important;padding:10px 16px!important;background:#086b75!important;color:#fff!important;-webkit-text-fill-color:#fff!important;border-radius:8px!important;}
html body #crmView #crmExportPanel button:disabled{background:#465b66!important;color:#e0e8ed!important;-webkit-text-fill-color:#e0e8ed!important;opacity:1!important;cursor:not-allowed!important;}
html body #crmView #crmExportPanel details{background:#263b61!important;border:1px solid #6881ad!important;border-radius:12px!important;padding:16px!important;margin:16px 0 0!important;}
html body #crmView #crmExportPanel summary{cursor:pointer!important;font-size:16px!important;font-weight:700!important;}
html body #crmView .crm-directory-panel .data-row{display:flex!important;flex-wrap:wrap!important;gap:12px!important;padding:12px!important;margin:8px 0!important;background:#244b5d!important;border-radius:8px!important;}
html body #crmView .crm-directory-panel .empty-state{color:#f4f8fb!important;-webkit-text-fill-color:#f4f8fb!important;background:transparent!important;padding:24px!important;}
html body #crmView .page-head{position:static!important;flex-wrap:wrap!important;gap:12px!important;}
@media(max-width:700px){html body #crmView #crmExportPanel .form-grid{grid-template-columns:minmax(0,1fr)!important}html body #crmView #crmExportPanel,html body #crmView .crm-directory-panel{padding:12px!important}}
