/* AES ENCABEZADOS_A — scoped */
.aes-e-main .aes-e-toolbar {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: 0.75rem 1rem;
  align-items: end;
  margin-bottom: 1rem;
}
.aes-e-toolbar-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.aes-e-block {
  border: 1px solid rgba(15, 61, 54, 0.12);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  background: #fff;
}
.aes-e-block > summary {
  cursor: pointer;
  font-weight: 600;
  color: #212529;
  list-style: none;
}
.aes-e-block > summary::-webkit-details-marker { display: none; }
.aes-e-block > summary .bi { color: var(--primary); margin-right: 0.35rem; }
.aes-e-block-body { padding-top: 0.65rem; }
.aes-e-preview-card {
  border: 1px solid rgba(15, 61, 54, 0.12);
  border-radius: 0.5rem;
  background: #fff;
  padding: 0.75rem 1rem 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  position: sticky;
  top: 0.75rem;
}
.aes-e-preview-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6c757d;
  margin-bottom: 0.5rem;
}
.aes-e-preview-frame {
  border: 1px dashed rgba(15, 61, 54, 0.2);
  border-radius: 0.35rem;
  min-height: 220px;
  background: #fafbfb;
  overflow: auto;
  /* Paridad con informe: inset = márgenes documento (aes_documento_margenes_v1). */
  box-sizing: border-box;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
  padding-left: var(--aes-doc-margen-izq, 7.5mm);
  padding-right: var(--aes-doc-margen-der, 7.5mm);
}
.aes-e-preview-frame .aes-e3enc {
  background: #fff;
  /* Neutraliza canvas histórico embebido (p.ej. 15mm) para no duplicar. */
  padding-left: 0 !important;
  padding-right: 0 !important;
}
.aes-e-pager { margin-top: 0.5rem; color: #6c757d; font-size: 0.9rem; }

/* Aviso centrado sobre modal Bootstrap (~1055) — familia AES feedback */
.aes-e-fb-overlay {
  position: fixed;
  inset: 0;
  z-index: 11060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.45);
}
.aes-e-fb-overlay[hidden] {
  display: none !important;
  pointer-events: none !important;
}
/* Éxito: no intercepta clics del editor ni cierra el modal */
.aes-e-fb-overlay.aes-e-fb-overlay--pass {
  pointer-events: none;
  background: rgba(15, 23, 42, 0.28);
}
/* Persistente de alta prioridad (gracia S4, etc.): fondo más opaco */
.aes-e-fb-overlay.aes-e-fb-overlay--opaque {
  background: rgba(15, 23, 42, 0.72);
}
.aes-e-fb-overlay.aes-e-fb-overlay--pass .aes-e-fb-dialog {
  pointer-events: auto;
}
.aes-e-fb-dialog {
  position: relative;
  width: min(420px, 100%);
  background: #fff;
  border-radius: 0.65rem;
  padding: 1.25rem 2.4rem 1.1rem 1.35rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  border-top: 4px solid var(--primary);
  text-align: center;
}
.aes-e-fb-dialog--ok { border-top-color: #198754; }
.aes-e-fb-dialog--err { border-top-color: #dc3545; }
.aes-e-fb-dialog--warn { border-top-color: #d97706; }
.aes-e-fb-close {
  position: absolute;
  top: 0.45rem;
  right: 0.55rem;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 1.45rem;
  line-height: 1;
  padding: 0.15rem 0.35rem;
  cursor: pointer;
  border-radius: 0.25rem;
}
.aes-e-fb-close:hover,
.aes-e-fb-close:focus-visible {
  color: #0f172a;
  outline: 2px solid color-mix(in srgb, var(--primary) 45%, transparent);
  outline-offset: 1px;
}
.aes-e-fb-icon {
  font-size: 1.75rem;
  margin-bottom: 0.35rem;
  color: var(--primary);
}
.aes-e-fb-dialog--ok .aes-e-fb-icon { color: #198754; }
.aes-e-fb-dialog--err .aes-e-fb-icon { color: #dc3545; }
.aes-e-fb-dialog--warn .aes-e-fb-icon { color: #d97706; }
.aes-e-fb-titulo {
  font-size: 1.1rem;
  font-weight: 650;
  margin: 0 0 0.5rem;
  border-left: 3px solid var(--primary);
  padding-left: 0.5rem;
  text-align: left;
  color: #0f172a;
}
.aes-e-fb-dialog--ok .aes-e-fb-titulo { border-left-color: #198754; }
.aes-e-fb-dialog--err .aes-e-fb-titulo { border-left-color: #dc3545; }
.aes-e-fb-dialog--warn .aes-e-fb-titulo { border-left-color: #d97706; }
.aes-e-fb-msg {
  margin: 0 0 0.85rem;
  color: #334155;
  text-align: left;
  font-size: 0.95rem;
  white-space: pre-wrap;
}
.aes-e-fb-progress {
  height: 3px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 0 0.85rem;
}
/* Barra controlada por JS (transform + transition); no usar animation shorthand
   porque pisa animation-play-state y desincroniza pausa/autocierre. */
.aes-e-fb-progress-bar {
  height: 100%;
  width: 100%;
  background: #198754;
  transform-origin: left center;
  transform: scaleX(1);
  will-change: transform;
}
.aes-e-fb-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

@media (max-width: 991.98px) {
  .aes-e-main .aes-e-toolbar { grid-template-columns: 1fr 1fr; }
  .aes-e-preview-card { position: static; }
}
@media (max-width: 575.98px) {
  .aes-e-main .aes-e-toolbar { grid-template-columns: 1fr; }
}
