/**
 * Modo formulário em tela cheia — Método NES
 */

body.form-fullscreen-mode {
  overflow: hidden;
}

body.form-fullscreen-mode #dashboard-view,
body.form-fullscreen-mode #metodo-nes-view,
body.form-fullscreen-mode #farm-empty {
  display: none !important;
}

body.form-fullscreen-mode .pront-nav-wrap,
body.form-fullscreen-mode .pront-quick-rail,
body.form-fullscreen-mode .pront-modulo-select {
  display: none !important;
}

body.form-fullscreen-mode #prontuario-view {
  display: flex !important;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

body.form-fullscreen-mode .main-panel {
  height: calc(100dvh - 64px, 100vh - 64px);
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px) !important;
}

body.form-fullscreen-mode .prontuario-body {
  padding: 0 !important;
  overflow: hidden !important;
  flex: 1 1 auto;
  min-height: 0;
}

/* Aba Dados/Timeline: manter scroll mesmo se body ainda tiver classe residual */
body.form-fullscreen-mode #tab-dados.active:not(.form-fullscreen),
body.form-fullscreen-mode #tab-timeline.active:not(.form-fullscreen) {
  overflow-y: auto !important;
  padding: var(--space-4) var(--space-5) 220px !important;
}

body.form-fullscreen-mode #tab-dados.active:not(.form-fullscreen) .prontuario-body,
body.form-fullscreen-mode .prontuario-body:has(#tab-dados.active:not(.form-fullscreen)) {
  overflow-y: auto !important;
}

body.form-fullscreen-mode .tab-panel.pront-modulo-panel.active {
  display: flex !important;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

body.form-fullscreen-mode .form-fullscreen,
body.form-fullscreen-mode .nes-m2-layout.form-fullscreen {
  min-height: calc(100vh - 64px);
  max-height: none;
  height: auto;
  display: flex;
  flex-direction: column;
  overflow: visible;
  margin: 0;
  border-radius: 0;
}

body.form-fullscreen-mode .form-fullscreen-header {
  flex: 0 0 auto;
}

body.form-fullscreen-mode .form-fullscreen-header .nes-m2-toolbar {
  display: none;
}

body.form-fullscreen-mode .form-fullscreen-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px;
  padding-bottom: 260px !important;
  -webkit-overflow-scrolling: touch;
}

body.form-fullscreen-mode .form-fullscreen-body .nes-m2-main,
body.form-fullscreen-mode .nes-form-main,
body.form-fullscreen-mode .nes-form-nes-main {
  max-height: none;
  overflow: visible;
  padding-bottom: 260px !important;
}

body.form-fullscreen-mode .nes-form-sidebar {
  display: block !important;
}

body.form-fullscreen-mode .nes-m2-sidebar:not(.nes-form-sidebar) {
  display: none !important;
}

body.form-fullscreen-mode .nes-form-page {
  border-radius: 0;
  margin: 0;
  max-height: none;
}

body.form-fullscreen-mode .nes-form-page .nes-form-layout {
  padding-bottom: 0;
}

body.form-fullscreen-mode .form-fullscreen-footer,
body.form-fullscreen-mode .form-actions-sticky.form-fullscreen-footer {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  z-index: 100;
  background: #ffffff;
  border-top: 1px solid #dbe7ef;
  padding: 14px 24px;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
}

/* Editor inline NES (anamnese, microscopia) */
body.form-fullscreen-mode .nes-form-nes-editor-fs {
  display: flex !important;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  max-height: calc(100dvh - 64px, 100vh - 64px);
  height: 100%;
}

body.form-fullscreen-mode .nes-form-nes-editor-fs .nes-form-layout,
body.form-fullscreen-mode .nes-form-page.nes-form-nes-editor-fs .nes-form-layout {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

body.form-fullscreen-mode .nes-form-nes-editor-fs .nes-form-main,
body.form-fullscreen-mode .nes-form-nes-editor-fs .nes-form-nes-main {
  overflow: visible;
  max-height: none;
  padding-bottom: 260px !important;
}

body.form-fullscreen-mode .nes-form-page > .nes-form-footer {
  position: sticky;
  bottom: 0;
  z-index: 300;
  min-height: 72px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
}

body.form-fullscreen-mode .nes-form-nes-editor-fs .nes-form-nes-aside.nes-form-sidebar,
body.form-fullscreen-mode .nes-form-page .nes-form-sidebar {
  display: block !important;
}

body.form-fullscreen-mode .tab-panel.form-fullscreen > .nes-form-nes-tab-head,
body.form-fullscreen-mode .tab-panel.form-fullscreen > .nes-form-tab-head,
body.form-fullscreen-mode .tab-panel.form-fullscreen > .nes-form-nes-list,
body.form-fullscreen-mode .tab-panel.form-fullscreen > #nes-sol-exame-list {
  display: none !important;
}

body.form-fullscreen-mode #tab-solicitacao-exames.form-fullscreen .nes-sol-exame-panel-inner {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  height: 100%;
}

body.form-fullscreen-mode #tab-solicitacao-exames.form-fullscreen .nes-sol-exame-panel-inner .nes-form-tab-head {
  display: flex !important;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid #e2e8f0;
}

body.form-fullscreen-mode #tab-solicitacao-exames.form-fullscreen .nes-sol-exame-panel-inner #nes-sol-exame-list {
  display: block !important;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px 220px;
}

body.form-fullscreen-mode #tab-retornos.form-fullscreen .nes-retorno-panel-inner {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  height: 100%;
}

body.form-fullscreen-mode #tab-retornos.form-fullscreen .nes-retorno-panel-inner .nes-retorno-head,
body.form-fullscreen-mode #tab-retornos.form-fullscreen .nes-retorno-panel-inner .nes-form-tab-head {
  display: flex !important;
  flex: 0 0 auto;
}

body.form-fullscreen-mode #tab-retornos.form-fullscreen .nes-retorno-panel-inner #nes-retorno-list,
body.form-fullscreen-mode #tab-retornos.form-fullscreen .nes-retorno-panel-inner #nes-retorno-form-host {
  display: block !important;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 20px 120px;
}

body.form-fullscreen-mode .nes-form-nes-wrap.form-fullscreen:not(.nes-form-nes-editor-fs) {
  height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.form-fullscreen-mode .nes-form-nes-wrap.form-fullscreen:not(.nes-form-nes-editor-fs) .nes-form-nes-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px 260px !important;
}

body.form-fullscreen-mode .nes-form-nes-wrap.form-fullscreen:not(.nes-form-nes-editor-fs) .nes-form-nes-aside {
  display: none !important;
}

body.form-fullscreen-mode .nes-form-nes-toolbar.form-fullscreen-footer {
  margin-top: 0;
}

body.form-fullscreen-mode .nes-form-nes-tab-head {
  flex-shrink: 0;
}

body.form-fullscreen-mode .nes-form-nes-list {
  flex-shrink: 0;
  max-height: 28vh;
  overflow-y: auto;
}

body.form-fullscreen-mode #paciente-ativo-bar.visible {
  max-height: 72px;
  padding: 8px 12px;
  margin-bottom: 0;
}

body.form-fullscreen-mode #paciente-ativo-bar .patient-bar-tags {
  display: none;
}

body.form-fullscreen-mode .nes-prontuario-loading-banner {
  padding: 10px 16px;
  font-size: 0.82rem;
  color: #64748b;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
