/* Celular + WebView Android — menu drawer + ☰ no topo */

html.mobile-shell #splash,
html.android-webview #splash {
  display: none !important;
  pointer-events: none !important;
}

html.mobile-shell #app.active,
html.android-webview #app.active {
  display: flex !important;
  flex-direction: column;
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
}

html.mobile-shell .main-content,
html.android-webview .main-content {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100vw !important;
  flex: 1 !important;
  min-width: 0 !important;
}

html.mobile-shell .top-bar,
html.android-webview .top-bar {
  position: sticky;
  top: 0;
  z-index: 10020;
  flex-shrink: 0;
  padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top, 0));
  min-height: 56px;
  height: auto;
}

html.mobile-shell .menu-toggle,
html.android-webview .menu-toggle {
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-width: 48px !important;
  min-height: 48px !important;
  font-size: 1.5rem;
  z-index: 10021;
  pointer-events: auto !important;
  touch-action: manipulation;
}

html.mobile-shell .page-title,
html.android-webview .page-title {
  flex: 1;
  min-width: 0;
  font-size: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.mobile-shell .global-search-wrap,
html.android-webview .global-search-wrap {
  display: none !important;
}

html.mobile-shell .page-content,
html.android-webview .page-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0));
}

/* Menu lateral — acima do fundo escuro (backdrop não cobre o menu) */
html.mobile-shell #sidebar,
html.android-webview #sidebar {
  display: flex !important;
  position: fixed !important;
  left: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: min(272px, 85vw) !important;
  z-index: 10050 !important;
  flex-direction: column !important;
  margin: 0 !important;
  transform: translate3d(-105%, 0, 0) !important;
  transition: transform 0.25s ease !important;
  pointer-events: none !important;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  isolation: isolate;
}

html.mobile-shell #sidebar.open,
html.android-webview #sidebar.open {
  transform: translate3d(0, 0, 0) !important;
  pointer-events: auto !important;
}

html.mobile-shell #sidebar.open *,
html.android-webview #sidebar.open * {
  pointer-events: auto;
}

html.mobile-shell #sidebar .nav-menu,
html.android-webview #sidebar .nav-menu {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

html.mobile-shell #sidebar .nav-item,
html.android-webview #sidebar .nav-item {
  min-height: 48px;
  touch-action: manipulation;
  pointer-events: auto !important;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.sidebar-backdrop {
  display: none !important;
  pointer-events: none !important;
}

/* Fundo escuro só à DIREITA do menu — não bloqueia toque nos módulos */
html.mobile-shell .sidebar-backdrop.visible,
html.android-webview .sidebar-backdrop.visible {
  display: block !important;
  pointer-events: auto !important;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: var(--sidebar-drawer-w, min(272px, 85vw));
  z-index: 10040;
  background: rgba(0, 0, 0, 0.55);
}

html.mobile-shell.sidebar-open body,
html.android-webview.sidebar-open body {
  overflow: hidden;
}

html.mobile-shell .scada-2col,
html.android-webview .scada-2col {
  grid-template-columns: 1fr !important;
}

html.mobile-shell .dashboard-grid,
html.android-webview .dashboard-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

button.stat-card,
button.search-result {
  touch-action: manipulation;
  -webkit-appearance: none;
}

html.mobile-shell input,
html.mobile-shell select,
html.mobile-shell textarea,
html.android-webview input,
html.android-webview select,
html.android-webview textarea {
  font-size: 16px !important;
}

html.mobile-shell .btn,
html.android-webview .btn {
  min-height: 44px;
  touch-action: manipulation;
}

html.mobile-shell .exp-grid-2,
html.mobile-shell .exp-grid-3,
html.mobile-shell .card-grid,
html.android-webview .exp-grid-2,
html.android-webview .exp-grid-3,
html.android-webview .card-grid {
  grid-template-columns: 1fr !important;
}

html.mobile-shell .loader-overlay.hidden,
html.mobile-shell .exp-preview-overlay.hidden,
html.mobile-shell .exp-pdf-viewer-overlay.hidden,
html.android-webview .loader-overlay.hidden,
html.android-webview .exp-preview-overlay.hidden,
html.android-webview .exp-pdf-viewer-overlay.hidden {
  display: none !important;
  pointer-events: none !important;
}

#android-bottom-nav,
#android-module-sheet {
  display: none !important;
}
