/* Portal shell v226: wide account menu and mobile left drawer. */
html body.template-saas .saas-sidebar-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  min-width: 0 !important;
}

html body.template-saas .saas-sidebar-head .saas-brand {
  min-width: 0 !important;
  flex: 1 1 auto !important;
}

html body.template-saas .saas-mobile-menu-toggle,
html body.template-saas .saas-mobile-menu-close,
html body.template-saas .saas-mobile-nav-backdrop {
  display: none !important;
}

html body.template-saas .saas-account-menu summary {
  width: 220px !important;
  min-width: 220px !important;
  max-width: 220px !important;
}

html body.template-saas .saas-account-menu .saas-account-dropdown,
html body.template-saas .portal-account-floating {
  width: min(460px, calc(100vw - 24px)) !important;
  min-width: 400px !important;
  max-width: 460px !important;
  max-height: min(560px, calc(100vh - 72px)) !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  align-items: start !important;
  padding: 8px !important;
  gap: 7px !important;
  border: 1px solid #cbd5cf !important;
  border-radius: 4px !important;
  background: #fff !important;
  box-shadow: 0 18px 46px rgba(17, 35, 26, .16) !important;
}

html body.template-saas .saas-account-menu .saas-account-dropdown > div,
html body.template-saas .portal-account-floating > div {
  min-width: 0 !important;
  padding: 8px !important;
  border: 1px solid #e1e7e3 !important;
  border-radius: 3px !important;
  background: #fff !important;
}

html body.template-saas .saas-account-menu .saas-account-dropdown a,
html body.template-saas .portal-account-floating a {
  min-height: 30px !important;
  padding: 6px 8px !important;
  border-radius: 3px !important;
  font-size: 11px !important;
}

html body.template-saas .saas-account-menu .saas-account-dropdown > .saas-logout-link,
html body.template-saas .portal-account-floating > .saas-logout-link {
  grid-column: 1 / -1 !important;
  min-height: 34px !important;
}

@media (max-width: 900px) {
  html body.template-saas {
    overflow-x: hidden !important;
  }

  html body.template-saas .saas-app-sidebar,
  html body.template-saas:has(.minimal-dashboard) .saas-app-sidebar {
    display: block !important;
    grid-template-columns: none !important;
    min-height: 100vh !important;
  }

  html body.template-saas .saas-app-sidebar .saas-sidebar,
  html body.template-saas:has(.minimal-dashboard) .saas-sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    z-index: 2147483500 !important;
    width: min(320px, 86vw) !important;
    min-width: 0 !important;
    max-width: min(320px, 86vw) !important;
    max-height: none !important;
    height: 100dvh !important;
    padding: 12px 10px 24px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    border: 0 !important;
    border-right: 1px solid #cfd8d2 !important;
    background: #fff !important;
    color: #172019 !important;
    box-shadow: 18px 0 50px rgba(10, 24, 16, .18) !important;
    transform: translateX(-103%) !important;
    transition: transform .22s cubic-bezier(.2, .7, .2, 1) !important;
    visibility: hidden !important;
  }

  html body.template-saas.portal-nav-open .saas-app-sidebar .saas-sidebar,
  html body.template-saas.portal-nav-open:has(.minimal-dashboard) .saas-sidebar {
    transform: translateX(0) !important;
    visibility: visible !important;
  }

  html body.template-saas .saas-sidebar-head {
    position: sticky !important;
    top: -12px !important;
    z-index: 2 !important;
    margin: -2px 0 10px !important;
    padding: 6px 0 8px !important;
    border-bottom: 1px solid #e2e8e4 !important;
    background: #fff !important;
  }

  html body.template-saas .saas-mobile-menu-close {
    display: inline-grid !important;
    place-items: center !important;
    flex: 0 0 34px !important;
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    border: 1px solid #d6dfd8 !important;
    border-radius: 3px !important;
    background: #fff !important;
    color: #172019 !important;
    font: inherit !important;
    font-size: 21px !important;
    line-height: 1 !important;
    cursor: pointer !important;
  }

  html body.template-saas .saas-mobile-nav-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483400 !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: rgba(7, 17, 12, .48) !important;
    backdrop-filter: blur(2px) !important;
    cursor: default !important;
  }

  html body.template-saas.portal-nav-open .saas-mobile-nav-backdrop {
    display: block !important;
  }

  html body.template-saas .saas-content,
  html body.template-saas:has(.minimal-dashboard) .saas-content {
    width: 100% !important;
    min-width: 0 !important;
  }

  html body.template-saas .saas-global-topbar,
  html body.template-saas .saas-topbar,
  html body.template-saas:has(.minimal-dashboard) .saas-global-topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 2147482000 !important;
    display: grid !important;
    grid-template-columns: 38px minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    height: 52px !important;
    min-height: 52px !important;
    padding: 7px 10px !important;
    border: 0 !important;
    border-bottom: 1px solid #dfe6e1 !important;
    background: rgba(255, 255, 255, .98) !important;
    overflow: visible !important;
  }

  html body.template-saas .saas-mobile-menu-toggle {
    display: inline-grid !important;
    place-items: center !important;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    border: 1px solid #d6dfd8 !important;
    border-radius: 3px !important;
    background: #fff !important;
    color: #172019 !important;
    cursor: pointer !important;
  }

  html body.template-saas .saas-mobile-menu-toggle > span,
  html body.template-saas .saas-mobile-menu-toggle > span::before,
  html body.template-saas .saas-mobile-menu-toggle > span::after {
    position: relative !important;
    display: block !important;
    width: 15px !important;
    height: 2px !important;
    border-radius: 1px !important;
    background: currentColor !important;
    content: "" !important;
  }

  html body.template-saas .saas-mobile-menu-toggle > span::before,
  html body.template-saas .saas-mobile-menu-toggle > span::after {
    position: absolute !important;
    left: 0 !important;
  }

  html body.template-saas .saas-mobile-menu-toggle > span::before {
    top: -5px !important;
  }

  html body.template-saas .saas-mobile-menu-toggle > span::after {
    top: 5px !important;
  }

  html body.template-saas .saas-header-search {
    width: min(100%, 430px) !important;
    min-width: 0 !important;
  }

  html body.template-saas .saas-account-menu {
    justify-self: end !important;
    min-width: 0 !important;
  }

  html body.template-saas .saas-account-menu summary {
    width: 190px !important;
    min-width: 190px !important;
    max-width: 190px !important;
  }

  html body.template-saas .saas-account-menu .saas-account-dropdown,
  html body.template-saas .portal-account-floating {
    right: 0 !important;
    left: auto !important;
    width: min(390px, calc(100vw - 20px)) !important;
    min-width: 0 !important;
    max-width: min(390px, calc(100vw - 20px)) !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  html body.template-saas.portal-nav-open {
    overflow: hidden !important;
  }
}

@media (max-width: 640px) {
  html body.template-saas .saas-global-topbar,
  html body.template-saas .saas-topbar,
  html body.template-saas:has(.minimal-dashboard) .saas-global-topbar {
    grid-template-columns: 38px minmax(0, 1fr) !important;
  }

  html body.template-saas .saas-header-search {
    display: none !important;
  }

  html body.template-saas .saas-account-menu {
    grid-column: 2 !important;
    width: 100% !important;
  }

  html body.template-saas .saas-account-menu summary {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  html body.template-saas .saas-account-menu .saas-account-dropdown,
  html body.template-saas .portal-account-floating {
    width: min(360px, calc(100vw - 20px)) !important;
    max-width: min(360px, calc(100vw - 20px)) !important;
    grid-template-columns: 1fr !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body.template-saas .saas-sidebar {
    transition: none !important;
  }
}
