/**
 * NES — Correção de scroll e acesso ao rodapé
 * Carregar por último para sobrescrever layouts que cortam o conteúdo inferior.
 */

html,
body {
  min-height: 100%;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
}

body.nes-login-active {
  overflow: hidden;
  height: 100%;
}

body:not(.nes-login-active) {
  overflow-x: hidden;
  overflow-y: auto !important;
}

#app-screen {
  min-height: 100vh;
  height: auto;
  overflow: visible;
}

.app-shell,
.dashboard-layout,
.dashboard-shell,
#app-screen .farm-layout,
#app-screen .nes-layout,
#app-screen .app-shell {
  min-height: calc(100vh - 64px);
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

.main-content,
.content-area,
.page-content,
#app-screen .farm-main,
#app-screen .main-content,
#app-screen .nes-main {
  min-height: 0;
  height: auto !important;
  max-height: none !important;
  overflow-x: hidden;
  overflow-y: visible !important;
  padding-bottom: 120px;
}

.dashboard-footer,
.page-footer,
.nes-dashboard-footer {
  margin-top: 48px;
  padding: 24px;
  position: relative;
  text-align: center;
  color: #5f7f86;
  font-size: 0.85rem;
  border-top: 1px solid #d7e5e1;
  background: #f8fafc;
}

/* Sidebar: rolagem própria, não bloqueia o documento */
#app-screen .farm-sidebar,
#app-screen .nes-sidebar {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: calc(100vh - 64px);
}

/* Mobile: espaço para barra inferior fixa */
@media (max-width: 768px) {
  #app-screen .farm-main,
  #app-screen .main-content {
    padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  }
}
