
:root{
  --kwcrm-global-adminbar-height:0px;
  --kwcrm-global-topbar-height:64px;
}

/* ---------------------------------------------------------
   Shared Global Shell
   Keep fixed navigation at the top, BUT reserve its height
   in normal page flow so titles/buttons cannot sit under it.
   --------------------------------------------------------- */
body.kwcrm-shell-page{
  --kwcrm-shell-adminbar:var(--kwcrm-global-adminbar-height) !important;
  padding-top:var(--kwcrm-global-topbar-height) !important;
}

body.kwcrm-shell-page .kwcrm-shell-sidebar{
  top:var(--kwcrm-global-adminbar-height) !important;
  height:calc(100vh - var(--kwcrm-global-adminbar-height)) !important;
}

body.kwcrm-shell-page .kwcrm-shell-topbar{
  top:var(--kwcrm-global-adminbar-height) !important;
  height:var(--kwcrm-global-topbar-height) !important;
  margin-top:0 !important;
}

body.kwcrm-shell-page .kwcrm-shell-overlay{
  top:calc(var(--kwcrm-global-adminbar-height) + var(--kwcrm-global-topbar-height)) !important;
}

/* Calendar-specific patches used previously should follow the
   same global offset instead of fighting with it. */
body.kwcrm-calendar-polish-page{
  --kwcrm-shell-adminbar:var(--kwcrm-global-adminbar-height) !important;
  padding-top:var(--kwcrm-global-topbar-height) !important;
}

body.kwcrm-calendar-polish-page .kwcrm-shell-sidebar{
  top:var(--kwcrm-global-adminbar-height) !important;
  height:calc(100vh - var(--kwcrm-global-adminbar-height)) !important;
}

body.kwcrm-calendar-polish-page .kwcrm-shell-topbar{
  top:var(--kwcrm-global-adminbar-height) !important;
  height:var(--kwcrm-global-topbar-height) !important;
}

/* Make the first page heading/action row fully visible below the bar. */
body.kwcrm-shell-page :is(
  .kwcrm-cal-app,
  .kwdocs,
  .kwcrm-leads-app,
  .kwcrm-people-app,
  .kwcrm-listings-app,
  .kwcrm-listing-app,
  .kwcrm-deals-app,
  .kwcrm-reports-app,
  .kwcrm-rental-app
){
  scroll-margin-top:calc(var(--kwcrm-global-topbar-height) + 12px) !important;
}

/* Do not allow hidden theme headers to leave a phantom gap. */
body.kwcrm-shell-page .site-header,
body.kwcrm-shell-page header:not(#wpadminbar):not(.kwcrm-shell-topbar){
  margin-top:0 !important;
}

/* ---------------------------------------------------------
   Master Admin already has its own 64px content offset.
   Only synchronize its admin-bar/topbar positioning.
   --------------------------------------------------------- */
body.kwcrm-master-page{
  --kwmaster-adminbar:var(--kwcrm-global-adminbar-height) !important;
}

body.kwcrm-master-page .kwmaster-side{
  top:var(--kwcrm-global-adminbar-height) !important;
  height:calc(100vh - var(--kwcrm-global-adminbar-height)) !important;
}

body.kwcrm-master-page .kwmaster-top{
  top:var(--kwcrm-global-adminbar-height) !important;
  margin-top:0 !important;
}

/* Mobile/tablet drawer uses the same measured offset. */
@media(max-width:1200px){
  body.kwcrm-shell-page .kwcrm-shell-sidebar,
  body.kwcrm-calendar-polish-page .kwcrm-shell-sidebar{
    top:var(--kwcrm-global-adminbar-height) !important;
    height:calc(100vh - var(--kwcrm-global-adminbar-height)) !important;
  }
}
