/**
 * Modales ERP — por encima del menú lateral (z-50) y del layout (z-[1]).
 * Tras montarse en <body> (erp-modals.js) el overlay cubre también el sidebar.
 */

:root {
  /* Cabecera estándar: púrpura → azul (marca Kairo) */
  --erp-modal-header-bg: linear-gradient(135deg, #845ADF 0%, #5B3FFF 50%, #0088FF 100%);
}

.erp-modal,
[data-erp-modal],
body > [id$="Modal"].fixed.inset-0,
body > [id*="Modal"].fixed.inset-0 {
  z-index: 10050 !important;
}

/* Overlay: oscurece menú + contenido */
.erp-modal > [class*="overlay"],
.erp-modal > [data-ship-addr-close].absolute,
.erp-modal > .absolute.inset-0 {
  background: rgba(15, 23, 42, 0.55) !important;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

/* Panel con elevación profesional */
.erp-modal > [class*="-panel"],
.erp-modal > .relative {
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.06),
    0 28px 72px rgba(15, 23, 42, 0.32) !important;
}

body.erp-modal-open {
  overflow: hidden !important;
}

/* Choices dentro del modal por encima del panel */
.erp-modal .choices__list--dropdown,
.erp-modal .choices__list[aria-expanded],
.erp-modal .erp-choices .choices__list--dropdown,
.erp-modal .erp-choices .choices__list[aria-expanded] {
  z-index: 10100 !important;
}

/* Capa alta incluso antes de reparentar (evita flash bajo el menú) */
[id$="Modal"].fixed.inset-0,
[id*="Modal"].fixed.inset-0,
#shipAddrModal {
  z-index: 10050 !important;
}

/*
 * Cabeceras de modales: unificar al degradado púrpura → azul.
 * Excluye cabeceras internas (lines-head, kanban-head) y el modal de alertas (rojo).
 */
[id$="Modal"] [class$="-head"]:not([class*="lines-"]):not([class*="kanban-"]),
[id*="Modal"] [class$="-head"]:not([class*="lines-"]):not([class*="kanban-"]),
#agendaQuickModal .aq-header,
#shipAddrModal [class*="-head"] {
  background: var(--erp-modal-header-bg) !important;
}

/* Panel estándar Agricultura (y reutilizable): overlay + cabecera + pie */
.ag-overlay {
  position: absolute;
  inset: 0;
}

.ag-panel {
  position: relative;
  width: min(560px, calc(100vw - 1.5rem));
  max-height: min(90vh, 820px);
  display: flex;
  flex-direction: column;
  border-radius: 1rem;
  overflow: hidden;
  background: #fff;
}

.ag-panel--wide {
  width: min(720px, calc(100vw - 1.5rem));
}

html.dark .ag-panel {
  background: #161822;
}

.ag-head {
  color: #fff;
  padding: 1.1rem 1.25rem;
  flex-shrink: 0;
}

.ag-body {
  overflow-y: auto;
  padding: 1.15rem 1.25rem;
  flex: 1;
}

.ag-foot {
  flex-shrink: 0;
  padding: 0.9rem 1.25rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(248, 250, 252, 0.9);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

html.dark .ag-foot {
  border-top-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

