/**
 * NES — Modais com navegação padrão (Voltar / Imprimir / Fechar)
 */

.modal-overlay,
.modal-backdrop {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: rgba(8, 32, 45, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop.active,
.modal-backdrop.show,
.modal-backdrop.open,
.modal-backdrop.visible,
.modal-overlay.active,
.modal-overlay.show,
.modal-overlay.open,
.modal-overlay.visible {
  display: flex !important;
}

.modal-backdrop > .modal,
.modal-overlay > .modal,
.modal-content {
  width: min(1100px, 96vw);
  max-height: 90vh;
  background: #ffffff;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(8, 32, 45, 0.28);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(90deg, #0f4c66, #16846f);
  color: #ffffff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.modal-header .modal-title,
.modal-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.modal-actions,
.nes-modal-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.modal-actions button,
.nes-modal-nav-btn,
.modal-actions .nes-modal-nav-btn {
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.82rem;
}

.modal-actions button:hover,
.nes-modal-nav-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Cabeçalho visível em formulários amplos (fullscreen) */
.nes-form-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-left: auto;
}

body.form-fullscreen-mode .nes-form-header-actions,
body.form-fullscreen-mode .nes-form-header .nes-form-header-actions {
  display: flex !important;
}

.nes-form-header-actions .btn {
  min-height: 36px;
}

@media print {
  body.nes-print-active-form .sidebar,
  body.nes-print-active-form .topbar,
  body.nes-print-active-form .pront-nav-wrap,
  body.nes-print-active-form .nes-form-footer,
  body.nes-print-active-form .nes-m2-toolbar,
  body.nes-print-active-form .modal-actions,
  body.nes-print-active-form .nes-form-sidebar {
    display: none !important;
  }

  body.nes-print-active-form .nes-form-main,
  body.nes-print-active-form [data-nes-print-root] {
    display: block !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
  }
}
