/* ATLAS 4D navigation and touch usability patch */
html, body {
  width: 100%;
  height: 100%;
  overscroll-behavior: none;
}

body {
  overflow: hidden;
}

.login-view {
  height: 100dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.app {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  height: 100dvh;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.nav {
  flex: 0 0 auto;
  padding-bottom: 18px;
}

.nav-item {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.workspace {
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  flex: 0 0 82px;
  position: relative;
  top: auto;
}

.content {
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scroll-behavior: smooth;
}

.hero::after,
.login-visual::after,
.orb {
  pointer-events: none;
}

@media (max-width: 900px) {
  .mobile-only {
    display: grid;
  }

  .app {
    display: block;
  }

  .workspace {
    width: 100%;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(88vw, 330px);
    transform: translate3d(-105%, 0, 0);
    transition: transform .24s ease;
    visibility: hidden;
    pointer-events: none;
    z-index: 200;
    box-shadow: 24px 0 70px rgba(0, 0, 0, .42);
  }

  .sidebar.open {
    transform: translate3d(0, 0, 0);
    visibility: visible;
    pointer-events: auto;
  }

  .topbar {
    height: auto;
    min-height: 72px;
    flex-basis: auto;
    padding: 10px 14px;
  }

  .topbar-actions {
    min-width: 0;
  }

  .search-trigger {
    min-width: 0;
    width: 42px;
  }

  .search-trigger span,
  .search-trigger kbd {
    display: none;
  }

  .content {
    padding: 16px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  .kpi-grid,
  .two-grid,
  .module-grid,
  .report-metrics {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .hero-content {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .topbar-actions #theme-btn,
  .topbar-actions #language-btn,
  .topbar-actions #notifications-btn {
    display: none;
  }

  .topbar h2 {
    max-width: 45vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hero {
    padding: 20px;
  }
}
