/* Mobile shell fixes v3 - load last on erp_home.html */

@media (max-width: 900px) {
  html, body.erp-body {
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    display: block !important;
  }

  body.erp-body .erp-container,
  body.erp-body .erp-container > .main-content,
  body.erp-body .erp-content-scroll {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
    flex: none !important;
  }

  html.erp-mobile-drawer-open[data-active-module="landing"] body.erp-body #landing.module-section,
  html.erp-sidebar-visible[data-active-module="landing"] body.erp-body #landing.module-section {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  html.erp-mobile-drawer-open[data-active-module="landing"] body.erp-body .erp-container > .main-content,
  html.erp-sidebar-visible[data-active-module="landing"] body.erp-body .erp-container > .main-content {
    overflow: visible !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  #erpSidebarOverlay, #erpShellMobileOverlay {
    background: rgba(0, 0, 0, 0.45) !important;
  }

  html[data-active-module="landing"] body.erp-body #landing.module-section .erp-hero {
    display: block !important;
    min-height: 0 !important;
    height: auto !important;
  }

  html[data-active-module="landing"] body.erp-body #landing.module-section .erp-hero .erp-hero-stats,
  html[data-active-module="landing"] body.erp-body #landing.module-section .erp-hero-trust-strip {
    display: flex !important;
    flex-flow: row wrap !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 0.45rem 0.65rem !important;
    min-height: 0 !important;
    height: auto !important;
    position: static !important;
    width: 100% !important;
  }

  html[data-active-module="landing"] body.erp-body #landing.module-section .erp-hero-stats .erp-hero-stat,
  html[data-active-module="landing"] body.erp-body #landing.module-section .erp-hero-stats .trust-item {
    flex: 0 0 auto !important;
    display: inline-flex !important;
    flex-direction: row !important;
    white-space: nowrap !important;
    word-break: normal !important;
    writing-mode: horizontal-tb !important;
  }

  html[data-active-module="landing"] body.erp-body #landing.module-section .erp-hero-stats .erp-hero-stat-divider {
    display: none !important;
  }

  html[data-active-module="landing"] body.erp-body #landing.module-section .erp-module-card-grid,
  html[data-active-module="landing"] body.erp-body #landing.module-section .unit-gateway-grid,
  html[data-active-module="landing"] body.erp-body #landing.module-section #modules-grid,
  html[data-active-module="landing"] body.erp-body #landing.module-section .erp-featured-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  html[data-active-module="landing"] body.erp-body #landing.module-section .erp-module-card-grid .unit-card {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    word-break: normal !important;
    writing-mode: horizontal-tb !important;
  }

  body.erp-body #navbar #navMenu:not(.mobile-open),
  body.erp-body #navbar .nav-menu:not(.mobile-open) {
    display: none !important;
  }

  body.erp-body #navbar #navMenu.mobile-open,
  body.erp-body #navbar .nav-menu.mobile-open {
    display: flex !important;
    flex-direction: column !important;
    position: fixed !important;
    top: 0;
    left: 0;
    width: min(88vw, 340px) !important;
    height: 100dvh !important;
    z-index: 10060 !important;
    overflow-y: auto !important;
    background: rgba(10, 15, 30, 0.98) !important;
    padding: 72px 16px 24px !important;
  }

  body.erp-body #navbar #navMenu.mobile-open .dropdown-menu,
  body.erp-body #navbar .nav-menu.mobile-open .dropdown-menu {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    transform: none !important;
  }

  body.erp-body #navbar #navMenu.mobile-open .dropdown-menu > li[style*="display:flex"],
  body.erp-body #navbar .nav-menu.mobile-open .dropdown-menu > li[style*="display:flex"] {
    flex-direction: column !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  body.erp-body #navbar #navMenu.mobile-open .dropdown-menu > li > div[style*="flex:1"],
  body.erp-body #navbar .nav-menu.mobile-open .dropdown-menu > li > div[style*="flex:1"] {
    width: 100% !important;
    min-width: 0 !important;
    writing-mode: horizontal-tb !important;
    word-break: normal !important;
  }

  body.erp-body .erp-container > .sidebar .nav-link,
  body.erp-body .erp-container > .sidebar .submenu-link {
    writing-mode: horizontal-tb !important;
    word-break: normal !important;
    white-space: normal !important;
  }

  html.erp-mobile-drawer-open[data-active-module="landing"] body.erp-body .module-section:not(#landing),
  html.erp-sidebar-visible[data-active-module="landing"] body.erp-body .module-section:not(#landing),
  html.erp-mobile-drawer-open[data-active-module="landing"] body.erp-body .module-section:not(#landing) iframe,
  html.erp-sidebar-visible[data-active-module="landing"] body.erp-body .module-section:not(#landing) iframe {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    height: 0 !important;
    overflow: hidden !important;
  }

  html[data-active-module="landing"] body.erp-body #landing.module-section .erp-hero-stats .erp-hero-stat,
  html[data-active-module="landing"] body.erp-body #landing.module-section .erp-hero-stats .trust-item,
  html[data-active-module="landing"] body.erp-body #landing.module-section .erp-hero-stats .erp-hero-stat-value,
  html[data-active-module="landing"] body.erp-body #landing.module-section .erp-hero-stats .erp-hero-stat-label {
    padding: 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    line-height: 1.2 !important;
    text-align: left !important;
  }

}

@media (min-width: 600px) and (max-width: 900px) {
  html[data-active-module="landing"] body.erp-body #landing.module-section .erp-module-card-grid,
  html[data-active-module="landing"] body.erp-body #landing.module-section .unit-gateway-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 901px) and (max-width: 1280px) {
  html[data-active-module="landing"],
  html[data-active-module="landing"] body.erp-body {
    overflow-y: auto !important;
    height: auto !important;
    max-height: none !important;
  }

  html[data-active-module="landing"] body.erp-body #landing.module-section .erp-module-card-grid,
  html[data-active-module="landing"] body.erp-body #landing.module-section .unit-gateway-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
