/* R61: contextual links are moved by module_navigation.js. Style their final
   container, independently of sidebar collapse and original template classes. */
body#crm-ui #main-content .page-heading>.header-nav:not([hidden]){
 display:flex!important;align-items:center!important;
 position:static!important;transform:none!important;z-index:auto!important;
 flex-wrap:wrap!important;width:100%!important;max-width:100%!important;min-width:0!important;
 height:auto!important;margin:0!important;padding:10px!important;gap:8px!important;
 box-sizing:border-box!important;overflow:visible!important;border:1px solid #c9dce0!important;
 border-top:0!important;border-radius:0 0 12px 12px!important;background:#edf5f4!important;
}
body#crm-ui #main-content .page-heading>.header-nav>:is(a,button){
 display:flex!important;align-items:center!important;justify-content:flex-start!important;
 width:auto!important;min-width:0!important;max-width:100%!important;flex:0 0 auto!important;
 height:auto!important;min-height:38px!important;box-sizing:border-box!important;
 margin:0!important;padding:8px 10px!important;gap:8px!important;
 white-space:normal!important;overflow-wrap:anywhere!important;line-height:1.3!important;
 text-align:left!important;transform:none!important;
}
body#crm-ui #main-content .page-heading>.header-nav :is(.module-nav-label,.module-nav-count){
 display:block!important;position:static!important;width:auto!important;height:auto!important;
 max-width:100%!important;min-width:0!important;opacity:1!important;clip:auto!important;
 clip-path:none!important;overflow:visible!important;white-space:normal!important;
 overflow-wrap:anywhere!important;
}
body#crm-ui #main-content .page-heading>.header-nav :is(.module-nav-icon,.crm-action-icon){
 display:inline-flex!important;align-items:center!important;justify-content:center!important;
 width:18px!important;height:18px!important;flex:0 0 18px!important;margin:0!important;
 padding:0!important;background:transparent!important;
}
body#crm-ui #main-content .page-heading>.header-nav svg{width:18px!important;height:18px!important}
body#crm-ui #main-content .page-heading:has(>.header-nav:not([hidden]))>.executive-header{
 padding:14px 18px!important;min-height:0!important;margin:0!important;
 border-radius:12px 12px 0 0!important;gap:10px!important;
}
body#crm-ui #main-content .business-heading>.executive-header{display:flex!important;flex-wrap:wrap!important;align-items:center!important}
body#crm-ui #main-content .business-heading>.executive-header>div:first-child{flex:1 1 420px;min-width:0}
body#crm-ui #main-content .business-heading>.executive-header h1{margin:3px 0 6px!important}
body#crm-ui #main-content .business-heading>.executive-header p{margin:4px 0!important;line-height:1.4!important}
body#crm-ui #main-content .business-heading>.executive-header .head-actions{margin:0!important;align-self:center}
body#crm-ui #main-content .page-heading:has(>.header-nav:not([hidden])){margin-bottom:12px!important}
@media(max-width:700px){
 body#crm-ui #main-content .page-heading>.header-nav:not([hidden]){flex-wrap:wrap!important;padding:8px!important;gap:6px!important}
 body#crm-ui #main-content .page-heading>.header-nav>:is(a,button){min-height:44px!important;padding:7px 8px!important;font-size:12px!important}
 body#crm-ui #main-content .page-heading:has(>.header-nav:not([hidden]))>.executive-header{padding:12px!important}
}

/* Keep the original dashboard controls together without a forced status row. */
body#crm-ui #main-content .dashboard-header>.pd-toolbar{display:flex!important;flex-wrap:wrap!important;align-items:center!important;gap:8px!important;grid-column:1!important;grid-row:2!important}
body#crm-ui #main-content .dashboard-header>.pd-toolbar [data-save-status]{flex-basis:auto!important;margin:0!important}
body#crm-ui #main-content .dashboard-header>.pd-toolbar [data-save-status]:empty{display:none!important}
body#crm-ui #main-content .dashboard-header>.pd-toolbar [data-save-status]{order:3}
body#crm-ui #main-content .dashboard-header .header-copy p{margin:4px 0!important}
@media(max-width:700px){body#crm-ui #main-content .page-heading>.header-nav>:is(a,button){flex:0 1 auto!important;max-width:100%!important}body#crm-ui #main-content .dashboard-header>.pd-toolbar{grid-row:auto!important}}
/* Compact dashboard across Overview, Operations, Activity and Health. */
body#crm-ui #main-content .page-heading>.dashboard-header{padding:12px 16px!important;min-height:0!important;gap:8px 16px!important}
body#crm-ui #main-content .dashboard-header h1{font-size:26px!important;line-height:1.15!important;margin:2px 0 5px!important}
body#crm-ui #main-content .dashboard-header .eyebrow{margin:0 0 3px!important}
body#crm-ui #main-content .dashboard-summary{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:10px!important;margin:0 0 12px!important}
body#crm-ui #main-content .dashboard-summary>a{display:flex!important;align-items:center!important;justify-content:space-between!important;gap:10px!important;min-height:48px!important;height:auto!important;padding:10px 14px!important;border-radius:12px!important;box-sizing:border-box!important;line-height:1.3!important}
body#crm-ui #main-content .dashboard-summary>a :is(span,small){font-size:13px!important;min-width:0;overflow-wrap:anywhere}
body#crm-ui #main-content .dashboard-summary>a strong{font-size:23px!important;line-height:1!important;white-space:nowrap}
body#crm-ui #main-content .dashboard-header.liquid-surface::before,body#crm-ui #main-content .dashboard-header.liquid-surface::after{display:none!important;animation:none!important;content:none!important}
@media(max-width:700px){body#crm-ui #main-content .dashboard-summary{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}body#crm-ui #main-content .dashboard-summary>a{padding:9px 10px!important}body#crm-ui #main-content .dashboard-header h1{font-size:23px!important}}

/* Reference header: metrics inside teal; compact tabs on the lower edge. */
body#crm-ui #main-content .page-heading.dashboard-heading>.executive-header.dashboard-header{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(320px,480px)!important;align-items:center!important;padding:18px 20px 28px!important;gap:10px 20px!important;border-radius:18px!important}
body#crm-ui #main-content .dashboard-header .header-copy{grid-column:1!important;grid-row:1!important;min-width:0!important}
body#crm-ui #main-content .dashboard-header>.dashboard-header-metrics{grid-column:2!important;grid-row:1 / span 2!important;width:100%!important;max-width:100%!important;display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important;margin:0!important}
body#crm-ui #main-content .dashboard-header>.dashboard-header-metrics>a{position:relative!important;display:grid!important;grid-template-columns:32px minmax(0,1fr)!important;column-gap:10px!important;row-gap:3px!important;align-content:center!important;align-items:center!important;min-height:56px!important;padding:9px 12px!important;border-radius:28px!important;background:var(--ref-selected)!important;color:#293538!important;border:1px solid #d8b932!important;text-decoration:none!important;box-sizing:border-box!important}
body#crm-ui #main-content .dashboard-header>.dashboard-header-metrics>a::before{content:"";grid-column:1;grid-row:1 / span 2;width:32px;height:32px;border-radius:50%;background:#123c46 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.7'%3E%3Cpath d='M5 6h14v13H5zM8 3v6m8-6v6M8 12h8m-8 3h5'/%3E%3C/svg%3E") center/18px 18px no-repeat}
body#crm-ui #main-content .dashboard-header>.dashboard-header-metrics>a:nth-child(2)::before{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.7'%3E%3Ccircle cx='12' cy='7' r='3'/%3E%3Cpath d='M6 20v-3a6 6 0 0 1 12 0v3'/%3E%3C/svg%3E")}
body#crm-ui #main-content .dashboard-header>.dashboard-header-metrics>a:nth-child(3)::before{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.7'%3E%3Cpath d='m12 3 8 5v8l-8 5-8-5V8zM8 12l3 3 5-6'/%3E%3C/svg%3E")}
body#crm-ui #main-content .dashboard-header>.dashboard-header-metrics>a:nth-child(4)::before{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.7'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M12 6v7m0 3v1'/%3E%3C/svg%3E")}
body#crm-ui #main-content .dashboard-header>.dashboard-header-metrics>a>:is(span,small){grid-column:2!important;grid-row:1!important;font-size:11px!important;line-height:1.2!important;color:inherit!important;margin:0!important}
body#crm-ui #main-content .dashboard-header>.dashboard-header-metrics>a>strong{grid-column:2!important;grid-row:2!important;font-size:20px!important;line-height:1!important;color:inherit!important;margin:0!important}
body#crm-ui #main-content .dashboard-heading>.header-nav:not([hidden]){display:flex!important;flex-wrap:wrap!important;position:relative!important;z-index:2!important;margin:-17px 0 0!important;padding:0 16px 4px!important;gap:8px!important;border:0!important;background:transparent!important;border-radius:0!important}
body#crm-ui #main-content .dashboard-heading>.header-nav>:is(a,button){flex:0 1 auto!important;width:auto!important;min-width:110px!important;min-height:38px!important;padding:8px 16px!important;justify-content:center!important;border-radius:24px!important;box-shadow:inset 0 1px #fff,0 3px 8px #163e4720!important}
@media(max-width:850px){body#crm-ui #main-content .page-heading.dashboard-heading>.executive-header.dashboard-header{grid-template-columns:minmax(0,1fr)!important;padding:15px 14px 28px!important}body#crm-ui #main-content .dashboard-header>.dashboard-header-metrics{grid-column:1!important;grid-row:auto!important}body#crm-ui #main-content .dashboard-header>.pd-toolbar{grid-column:1!important;grid-row:auto!important}body#crm-ui #main-content .dashboard-heading>.header-nav>:is(a,button){min-width:0!important;padding:8px 12px!important}}
/* Fix4: use the reference's bottom-edge tabs on every contextual page header. */
body#crm-ui #main-content .page-heading:has(>.header-nav:not([hidden]))>.executive-header{padding-bottom:28px!important;border-radius:16px!important;overflow:visible!important}
body#crm-ui #main-content .page-heading>.header-nav:not([hidden]){display:flex!important;align-items:center!important;flex-wrap:wrap!important;position:relative!important;z-index:2!important;transform:none!important;margin:-17px 0 0!important;padding:0 16px 4px!important;gap:8px!important;border:0!important;background:transparent!important;border-radius:0!important;width:100%!important;max-width:100%!important;box-sizing:border-box!important}
body#crm-ui #main-content .page-heading>.header-nav>:is(a,button){flex:0 1 auto!important;width:auto!important;min-width:0!important;max-width:100%!important;min-height:38px!important;padding:8px 14px!important;justify-content:center!important;border-radius:24px!important;white-space:normal!important;overflow-wrap:anywhere!important;line-height:1.3!important;box-shadow:inset 0 1px #fff,0 3px 8px #163e4720!important}
body#crm-ui #main-content .page-heading>.executive-header.liquid-surface::before,body#crm-ui #main-content .page-heading>.executive-header.liquid-surface::after{display:none!important;content:none!important;animation:none!important}
@media(max-width:700px){body#crm-ui #main-content .page-heading>.header-nav:not([hidden]){padding:0 9px 4px!important;gap:6px!important}body#crm-ui #main-content .page-heading>.header-nav>:is(a,button){min-height:44px!important;padding:7px 10px!important;font-size:12px!important}}
