/* R59: persistent navigation inside a centred, responsive CRM workspace. */
body#crm-ui{--crm-frame:1280px;background:#f3f2ef!important}
body#crm-ui .app-shell{max-width:none;width:100%;margin:0;display:block!important}
body#crm-ui .app-main{min-width:0;width:100%;margin:0!important}
body#crm-ui .app-main>header#crm-topbar.topbar{box-sizing:border-box;padding-inline:max(20px,calc((100% - var(--crm-frame))/2))!important;gap:8px;flex-wrap:wrap;height:auto;min-height:60px}
body#crm-ui .module-layout.has-module-nav{box-sizing:border-box;display:grid;grid-template-columns:210px minmax(0,1fr)!important;gap:20px!important;width:calc(100% - 48px);max-width:var(--crm-frame);margin:20px auto 0;align-items:start}
body#crm-ui .module-layout.has-module-nav>.module-navigation{display:block!important;box-sizing:border-box;width:100%;margin:0!important;padding:10px!important;top:var(--crm-nav-offset,100px);background:#fff!important;border:1px solid #d8dfdc;border-radius:12px;max-height:calc(100dvh - var(--crm-nav-offset,100px) - 20px)}
body#crm-ui .module-layout.has-module-nav>.content{min-width:0;padding:0 0 90px!important;overflow-wrap:anywhere}
body#crm-ui .module-destinations{display:grid;gap:7px}
body#crm-ui .side-module-group>summary{padding:9px 5px;cursor:pointer;font-size:12px;font-weight:700;color:#315c61}
body#crm-ui .module-destinations a{display:flex;align-items:center;gap:8px;padding:8px;border-radius:8px;text-decoration:none;color:#284e55;font-size:13px;line-height:1.4}
body#crm-ui .module-destinations a.active,body#crm-ui .module-destinations a:hover{background:#eaf3f1;color:#006d69}
body#crm-ui .module-destinations .module-nav-icon{flex:0 0 20px;width:20px;height:20px}
body#crm-ui .module-destinations a:focus-visible{outline:2px solid #006d69;outline-offset:2px}
body#crm-ui #main-content .dashboard-header{padding:18px!important;min-height:0}
body#crm-ui #main-content .dashboard-header .header-copy{min-width:0}
body#crm-ui #main-content :is(.table-wrap,.table-scroll,.sheet-grid-wrap){max-width:100%;overflow-x:auto}
@media(min-width:851px){
 body#crm-ui .module-layout.has-module-nav.module-nav-collapsed{grid-template-columns:60px minmax(0,1fr)!important}
 body#crm-ui .module-nav-collapsed .side-module-group>summary{display:none}
 body#crm-ui .module-nav-collapsed .side-module-group> :not(summary){display:flex!important}
 body#crm-ui .module-nav-collapsed .module-destinations .module-nav-label{display:none!important}
 body#crm-ui .module-nav-collapsed .module-destinations a{justify-content:center;padding:9px 2px}
}
@media(max-width:1500px) and (min-width:851px){body#crm-ui .module-layout.has-module-nav{width:calc(100% - 120px)}}
@media(max-width:1100px) and (min-width:851px){body#crm-ui .module-layout.has-module-nav{grid-template-columns:180px minmax(0,1fr)!important;gap:14px!important}body#crm-ui .topbar .global-search{min-width:180px!important}}
@media(max-width:850px){
 body#crm-ui .module-layout.has-module-nav{display:block;width:calc(100% - 24px);margin:12px auto 0}
 body#crm-ui .module-layout.has-module-nav>.module-navigation{position:static;max-height:42dvh;margin-bottom:14px!important}
 body#crm-ui .app-main>header#crm-topbar.topbar{padding-inline:12px!important}
 body#crm-ui .module-layout.has-module-nav>.content{padding:0 0 90px!important}
}

body#crm-ui #workspace-home{width:calc(100% - 48px)!important;max-width:1280px!important;margin:20px auto!important;box-sizing:border-box}
body#crm-ui #workspace-home>.module-layout.has-module-nav{width:100%!important;max-width:none;margin:14px 0 0}
body#crm-ui #workspace-home .module-navigation{font-family:inherit}
@media(max-width:850px){body#crm-ui #workspace-home{width:calc(100% - 24px)!important;margin:12px auto!important}}

/* Embedded forms retain their parent page navigation instead of nesting another rail. */
html.embedded-workflow body#crm-ui .module-layout.has-module-nav{display:block!important;width:100%!important;max-width:none;margin:0;gap:0!important}
html.embedded-workflow body#crm-ui .module-layout.has-module-nav>.module-navigation{display:none!important}
html.embedded-workflow body#crm-ui .module-layout.has-module-nav>.content{padding:12px!important}
