/* Medical Events: touch, safe-area and scrolling improvements */
html{scroll-padding-top:96px;scrollbar-gutter:stable}
body{min-height:100dvh}
.medical-events-install{font:600 14px/1.5 Arial,sans-serif;background:#a92343;color:#fff;border:0;border-radius:9px;padding:12px 18px;min-height:44px;margin:12px;cursor:pointer}
@supports(padding:env(safe-area-inset-bottom)){body{padding-bottom:env(safe-area-inset-bottom)}}
@media(max-width:1050px){
 body .app-dashboard.medical-crm.crm-private .primary-top-menu{height:auto!important;min-height:0!important;max-height:65dvh!important;overflow-y:auto!important;overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch}
}
@media(max-width:900px){
 html{scroll-padding-top:80px}
 body .medical-service-nav{gap:10px;min-width:0;padding-left:max(14px,env(safe-area-inset-left));padding-right:max(14px,env(safe-area-inset-right))}
 body .medical-service-brand{min-width:0;max-width:calc(100% - 84px)}
 body .medical-service-brand>span{font-size:17px;line-height:1.2;white-space:normal}
 body .medical-service-brand strong{font-size:9px;letter-spacing:.06em}
 body .medical-service-utility{flex-wrap:wrap;gap:6px;padding-left:14px;padding-right:14px}
 body .medical-service-utility>span{font-size:12px;line-height:1.5}
 body #shared-service-navigation[data-mobile-open="true"]{max-height:min(70dvh,calc(100dvh - 148px));overflow-y:auto;overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch;padding-bottom:max(16px,env(safe-area-inset-bottom))}
 body .service-mega-panel{max-width:100%;-webkit-overflow-scrolling:touch}
 body .service-mega-links>a,body .service-mega-links>button{min-width:0}
 body .service-mega-links strong,body .service-mega-heading h2{overflow-wrap:anywhere}
 body .me-crm .me-sidebar{max-height:calc(100dvh - 70px);padding-bottom:calc(20px + env(safe-area-inset-bottom));overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch}
 body .me-crm .me-frame,body .me-crm .me-content,body .app-dashboard.medical-crm .dashboard-frame,body .app-dashboard.medical-crm .dashboard-content{min-width:0;max-width:100%}
 body .me-crm .me-table-scroll,body .medical-crm .table-scroll,body .medical-crm .med-table-wrap{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}
 body .me-crm .me-top-actions{flex-shrink:0}
 body .me-crm .me-topbar,body .me-crm .me-workspace-strip{min-width:0}
 body .medical-crm .aw-controls{align-items:stretch;flex-wrap:wrap}
 body .medical-crm .aw-controls>label{min-width:0;max-width:100%}
 body .medical-crm .aw-controls select{max-width:100%}
 body input:not([type="checkbox"]):not([type="radio"]),body textarea,body select{font-size:16px!important}
 body button,body [role="button"]{touch-action:manipulation}
 body .service-mobile-toggle,body .top-menu-toggle,body .me-mobile-toggle{min-width:44px;min-height:44px}
}
@media(max-width:600px){
 body .medical-service-utility>span{display:none}
 body .medical-service-brand img{max-width:52px;max-height:52px;object-fit:contain}
 body .corporate-service-header .medical-service-brand img{max-width:76px}
 body .me-crm .me-topbar{padding-top:max(12px,env(safe-area-inset-top));gap:6px}
 body .me-crm .me-content{padding-left:14px;padding-right:14px}
 body .me-crm .me-overview-stats,body .me-crm .me-provider-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 body .medical-crm .aw-chart-grid,body .medical-crm .aw-stats{grid-template-columns:1fr!important}
 body .medical-crm .aw-period{display:flex;max-width:100%}
 body .medical-crm .aw-brand{flex-wrap:wrap}
 body .me-crm .me-document-controls>*,body .me-crm .me-search{min-width:0;max-width:100%}
 body .me-crm .me-auth-story h1{font-size:clamp(28px,8vw,34px)}
}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto!important}}


/* Keep mobile document scrolling on the browser, not three nested roots. */
@media(max-width:1023px){
 html{overflow-x:clip!important;overflow-y:auto!important}
 html body:not([data-scroll-locked]){overflow-x:clip!important;overflow-y:visible!important;overscroll-behavior-y:auto}
 html body #root{overflow-x:clip!important;overflow-y:visible!important}
 html body .welcome-gateway.reference-home{overflow-x:clip;overflow-y:visible}
}


/* Mobile service menus stay inside the visible screen. */
@media(max-width:900px){
 body .medical-service-header:is(.service-mega-header,.corporate-service-header) .medical-service-nav{gap:12px;align-items:center}
 body .medical-service-header:is(.service-mega-header,.corporate-service-header) .medical-service-nav #shared-service-navigation{flex:0 0 auto!important;flex-basis:auto!important;width:100%;min-width:0;gap:0;padding:8px 0}
 body .medical-service-header:is(.service-mega-header,.corporate-service-header) #shared-service-navigation[data-mobile-open="true"]{max-height:calc(100dvh - 230px);overflow-y:auto}
 body .medical-service-header:is(.service-mega-header,.corporate-service-header) #shared-service-navigation>a,body .medical-service-header:is(.service-mega-header,.corporate-service-header) #shared-service-navigation>.service-mega-trigger{justify-content:space-between;width:100%;min-height:46px;padding:12px 8px}
 body .medical-service-header:is(.service-mega-header,.corporate-service-header):has(.service-mega-panel){z-index:10000}
 body .medical-service-header:is(.service-mega-header,.corporate-service-header) .service-mega-panel{position:fixed!important;inset:12px 12px max(12px,env(safe-area-inset-bottom))!important;transform:none!important;width:auto!important;max-width:none!important;height:auto!important;max-height:calc(100dvh - 24px)!important;overflow-x:hidden!important;overflow-y:auto!important;overscroll-behavior:contain;border-radius:12px;z-index:10001;scrollbar-gutter:auto!important;animation:none}
 body .medical-service-header:is(.service-mega-header,.corporate-service-header) .service-mega-heading{position:sticky;top:0;z-index:2;background:inherit;padding:16px;gap:12px}
 body .medical-service-header:is(.service-mega-header,.corporate-service-header) .service-mega-heading>div{min-width:0}
 body .medical-service-header:is(.service-mega-header,.corporate-service-header) .service-mega-heading>button{min-width:44px;min-height:44px}
 body .medical-service-header:is(.service-mega-header,.corporate-service-header) .service-mega-heading h2{font-size:22px}
 body .medical-service-header:is(.service-mega-header,.corporate-service-header) .service-mega-body{grid-template-columns:minmax(0,1fr);padding:12px}
 body .medical-service-header:is(.service-mega-header,.corporate-service-header) .service-mega-links{grid-template-columns:minmax(0,1fr);padding:8px}
 body .medical-service-header:is(.service-mega-header,.corporate-service-header) .service-mega-links>a>span:not(.service-mega-icon){min-width:0}
}

@media(max-width:900px){
 body .medical-service-header .service-mobile-toggle{display:flex;min-height:44px;min-width:44px}
 body .medical-service-header .medical-service-nav nav[data-mobile-open="false"]{display:none!important}
 body .medical-service-header .medical-service-nav nav[data-mobile-open="true"]{display:flex!important;flex-direction:column;align-items:stretch;flex:0 0 auto!important;width:100%;gap:0}
 body .medical-service-header .medical-service-nav{flex-wrap:wrap}
 body .medical-service-header .service-header-cta{order:2;margin:0 0 0 auto}
 body .medical-service-header #shared-service-navigation{order:3}
}
/* The expanded mobile menu covers the utility bar and scrolls as one sheet. */
@media(max-width:900px){
 body .medical-service-header:has(#shared-service-navigation[data-mobile-open="true"]){position:fixed!important;inset:0!important;width:100%!important;height:100dvh!important;max-height:100dvh!important;z-index:10000!important;overflow-y:auto!important;overscroll-behavior:contain;animation:me-menu-up .22s ease-out;transform:none!important;padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom)}
 body .medical-service-header:has(#shared-service-navigation[data-mobile-open="true"]) .medical-service-utility{display:none!important}
 body .medical-service-header:has(#shared-service-navigation[data-mobile-open="true"]) .medical-service-nav{align-content:start;min-height:100%;padding-top:18px;padding-bottom:24px}
 body .medical-service-header #shared-service-navigation[data-mobile-open="true"]{max-height:none!important;overflow:visible!important}
 body:has(#shared-service-navigation[data-mobile-open="true"]){overflow:hidden}
 @keyframes me-menu-up{from{translate:0 30px;opacity:0}to{translate:0 0;opacity:1}}
}
@media(prefers-reduced-motion:reduce){body .medical-service-header:has(#shared-service-navigation[data-mobile-open="true"]){animation:none!important}}

/* On scroll, the main menu slides over the utility row and stays at the top. */
@media(max-width:900px){
 body .medical-service-header:not(:has(#shared-service-navigation[data-mobile-open="true"])){
  position:sticky!important;
  top:calc(-1 * var(--me-utility-height, 98px))!important;
  z-index:90;
 }
}

/* Clear link groups and deliberate mobile top-bar reveal. */
body .medical-service-utility{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;column-gap:24px}
body .medical-service-utility .service-utility-links,body .medical-service-utility .project-account-menu{display:flex;align-items:center;gap:16px;justify-content:flex-end}
body .medical-service-utility .service-utility-links>a,body .medical-service-utility .project-menu-link{display:inline-flex;align-items:center;gap:6px;line-height:1.35;min-height:36px}
body .medical-service-utility .service-utility-links>span[aria-hidden]{display:none}
body .service-utility-toggle{display:none}
@media(min-width:901px) and (max-width:1250px){body .medical-service-utility{grid-template-columns:1fr auto}body .medical-service-utility>span:first-child{display:none}}
@media(max-width:900px){
 body .medical-service-header:not(:has(#shared-service-navigation[data-mobile-open="true"])){top:0!important}
 body .medical-service-utility{grid-template-columns:minmax(0,1fr);gap:6px;padding:8px 16px;box-sizing:border-box}
 body .medical-service-utility>span:first-child{display:none}
 body .medical-service-utility .service-utility-links,body .medical-service-utility .corporate-menu-switch{display:flex;align-items:center;justify-content:center;gap:20px;width:100%;margin:0}
 body .medical-service-utility .project-account-menu{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;width:100%;margin:0;padding-top:6px;border-top:1px solid #ffffff30}
 body .medical-service-utility .project-menu-link{justify-content:center;gap:5px;min-width:0;min-height:40px;margin:0;padding:5px 2px;font-size:12px;white-space:normal;text-align:center}
 body .medical-service-utility .project-menu-link svg{flex-shrink:0}
 body .medical-service-header[data-top-bar="collapsed"] .medical-service-utility{max-height:0!important;min-height:0!important;padding-top:0!important;padding-bottom:0!important;margin:0!important;border:0!important;overflow:hidden!important;visibility:hidden;pointer-events:none}
 body .medical-service-nav{position:relative;touch-action:pan-x;padding-top:36px!important}
 body .medical-service-nav .service-utility-toggle{position:absolute;top:0;left:50%;transform:translateX(-50%);display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:36px;min-width:110px;border:0;background:transparent;color:inherit;font-family:inherit;font-size:12px;font-weight:600;line-height:1.2;cursor:pointer}
 body .service-utility-grip{width:24px;height:3px;border-radius:2px;background:currentColor;opacity:.65}
 body .medical-service-header[data-top-bar="expanded"] .service-utility-toggle>svg{rotate:180deg}
 body .service-utility-toggle:focus-visible{outline:2px solid white;outline-offset:-3px;border-radius:8px}
 body .medical-service-header:has(#shared-service-navigation[data-mobile-open="true"]) .service-utility-toggle{display:none}
}
/* Reference mobile header: brand left, Menu and Get Started stacked right. */
@media(max-width:900px){
 body .medical-service-header .medical-service-nav{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(100px,32%);column-gap:12px;row-gap:8px;align-items:center;padding:46px 12px 18px!important;touch-action:pan-y;box-sizing:border-box;width:100%;max-width:100%}
 body .medical-service-header .medical-service-nav .medical-service-brand{grid-column:1;grid-row:1 / 3;min-width:0;gap:8px!important;width:auto!important;margin:0!important;align-items:center}
 body .medical-service-header .medical-service-nav .medical-service-brand img{width:clamp(44px,16vw,64px)!important;height:clamp(44px,16vw,64px)!important;flex:0 0 auto!important;padding:4px!important;border-radius:12px;object-fit:contain;box-sizing:border-box;background:white}
 body .medical-service-header .medical-service-nav .medical-service-brand>span{min-width:0;font-size:clamp(17px,4.5vw,25px)!important;line-height:1.15!important;letter-spacing:-.025em!important;overflow-wrap:normal}
 body .medical-service-header .medical-service-nav .medical-service-brand strong{max-width:100%!important;font-size:12px!important;line-height:1.35!important;letter-spacing:0!important;margin-top:6px!important;white-space:normal}
 body .medical-service-header .medical-service-nav .service-mobile-toggle{grid-column:2;grid-row:1;justify-self:end;display:flex;align-items:center;justify-content:center;gap:7px;min-height:46px;max-width:100%;padding:10px 12px;font-size:15px;margin:0;border:1px solid #ffffff88;border-radius:9px;background:#ffffff12;color:inherit}
 body .medical-service-header .medical-service-nav .service-header-cta{grid-column:2;grid-row:2;justify-self:stretch;display:flex;align-items:center;justify-content:center;gap:6px;min-height:44px;min-width:0;padding:9px 6px;font-size:13px;line-height:1.3;margin:0;border:1px solid #ffffff77;border-radius:8px;background:linear-gradient(110deg,#d50036,#ad002b);color:white;white-space:normal;text-align:center;box-sizing:border-box}
 body .medical-service-header .medical-service-nav .service-header-cta svg{width:17px;flex-shrink:0}
 body .medical-service-header .medical-service-nav #shared-service-navigation{grid-column:1/-1;grid-row:3;padding:8px 0!important;gap:0!important}
 body .medical-service-header #shared-service-navigation>a,body .medical-service-header #shared-service-navigation>.service-mega-trigger{min-height:48px;padding:13px 4px!important;border:0;border-bottom:1px solid #ffffff26;font-size:14px;line-height:1.4;text-align:left;box-shadow:none}
 body .medical-service-header:has(#shared-service-navigation[data-mobile-open="true"]) .medical-service-nav{min-height:0!important;align-content:start}
 body .medical-service-header .service-utility-toggle{top:3px;min-height:36px;font-size:13px}
}
