/* La animación acompaña la Promise; nunca decide cuándo termina el bloqueo. */
.ui-cargando { cursor: progress !important; }
.ui-carga-posicion, .ui-clic-posicion { position: relative !important; }
.ui-cargando-boton { color: transparent !important; }
.ui-cargando-boton > :not(.ui-carga-boton):not(.ui-clic-destello) { visibility: hidden !important; }
.ui-clic-destello {
  position: absolute; inset: 0; z-index: 1; border-radius: inherit;
  pointer-events: none; border: 1px solid #e7c676a6;
  background: radial-gradient(ellipse at var(--clic-x,50%) var(--clic-y,50%), #fff7dba8, #dcb66c47 45%, transparent 78%);
  box-shadow: 0 0 0 2px #d7b26842, 0 0 26px #d7b26875;
  animation: ui-carga-destello 420ms ease-out both;
}
/* El dorado necesita un destello blanco y un borde oscuro: dorado sobre
   dorado se perdía. :active responde desde la presión, incluso si el clic
   abre una ventana síncrona y su velo cubre enseguida el botón. */
:is(.btn-gold, .btn-primary, .lg-entrar, .btn-login) > .ui-clic-destello {
  border-color: #fff6df;
  background: radial-gradient(ellipse at var(--clic-x,50%) var(--clic-y,50%), #fffef5f2, #fff1c975 36%, #52340a33 67%, transparent 85%);
  box-shadow: inset 0 0 0 1px #fff6df, inset 0 0 18px #f4ce79b3;
  animation-name: ui-carga-destello-dorado;
}
html[data-arte] :is(.btn-gold, .btn-primary, .lg-entrar, .btn-login):active:not(:disabled):not([aria-disabled="true"]) {
  box-shadow: inset 0 0 0 2px #fff6dfb3, inset 0 0 18px #f4ce79a6 !important;
}
.ui-carga-boton {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; gap: 8px; color: var(--ui-carga-color, var(--text));
  pointer-events: none; font: inherit; white-space: nowrap; border-radius: inherit;
  isolation: isolate; z-index: 2; animation: ui-carga-texto 150ms ease-out both;
}
.ui-carga-boton::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit;
  border: 1px solid #e6c374b3; z-index: -1;
  box-shadow: 0 0 0 2px #d7b26838, 0 0 22px #d7b26873;
  animation: ui-carga-halo 900ms ease-in-out infinite;
}
/* En los primarios el brillo se queda dentro del contorno redondeado.
   No sumar sombras exteriores: vuelven a formar un marco rectangular. */
:is(.btn-gold, .btn-primary, .lg-entrar, .btn-login) > .ui-carga-boton::before {
  inset: 0;
  box-shadow: inset 0 0 0 1px #fff6dfb3, inset 0 0 18px #f4ce79a6;
}
.ui-carga-barrido { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; z-index: -1; }
.ui-carga-barrido::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 72%;
  background: linear-gradient(110deg, transparent, #f2d89438 22%, #fff8dba6 50%, #f2d89438 78%, transparent);
  animation: ui-carga-barrido 900ms cubic-bezier(.4,0,.2,1) infinite;
}
:is(.btn-gold, .btn-primary, .lg-entrar, .btn-login) .ui-carga-barrido::before {
  background: linear-gradient(110deg, transparent, #52340a29 22%, #fffef5ed 50%, #52340a29 78%, transparent);
}
.ui-carga-marca, .ui-carga-estado::before {
  display: inline-block; width: 19px; height: 19px; flex: 0 0 19px;
  background: currentColor; -webkit-mask: url("../img/aurea-marca.svg") center/contain no-repeat;
  mask: url("../img/aurea-marca.svg") center/contain no-repeat;
  animation: ui-carga-pulso 900ms ease-in-out infinite;
}
.ui-carga-estado {
  position: fixed; z-index: 100100; bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%); max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: 10px; overflow: hidden;
  box-sizing: border-box; padding: 11px 17px; border-radius: 12px;
  background: var(--surface, #fff); color: var(--text, #222);
  border: 1px solid var(--border, #ccc); box-shadow: 0 4px 20px #0002, 0 0 18px #d7b2682b;
  font: 500 13px/1.5 Inter, sans-serif; text-align: center; pointer-events: none;
  animation: ui-carga-aviso 180ms ease-out both;
}
.ui-carga-estado::before { content: ""; color: var(--gold, #af8a49); }
.ui-carga-estado::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 72%;
  background: linear-gradient(90deg, transparent, #d7b268, #fff2c2, transparent);
  animation: ui-carga-barrido 900ms cubic-bezier(.4,0,.2,1) infinite;
}
/* Control usa su modal propio, sin cargar anime.js. Mantiene el mismo gesto. */
#modal-container > .modal-overlay > .modal.ui-modal-control {
  animation: ui-carga-modal 500ms cubic-bezier(.25,.46,.45,.94) both !important;
}
@keyframes ui-carga-destello { 0% { opacity: 0; } 18% { opacity: .9; } 100% { opacity: 0; } }
@keyframes ui-carga-destello-dorado { 0% { opacity: .35; } 18%,45% { opacity: 1; } 100% { opacity: 0; } }
@keyframes ui-carga-texto { from { opacity: 0; } to { opacity: 1; } }
@keyframes ui-carga-barrido {
  0% { transform: translateX(-150%); opacity: 0; }
  15% { opacity: .9; } 75% { opacity: .9; }
  100% { transform: translateX(250%); opacity: 0; }
}
@keyframes ui-carga-pulso { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
@keyframes ui-carga-halo { 0%,100% { opacity: .45; } 50% { opacity: 1; } }
@keyframes ui-carga-aviso { from { opacity: 0; transform: translate(-50%,12px); } to { opacity: 1; transform: translate(-50%,0); } }
@keyframes ui-carga-modal { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .ui-carga-boton, .ui-carga-boton::before, .ui-carga-marca,
  .ui-carga-estado, .ui-carga-estado::before, .ui-carga-estado::after,
  .ui-carga-barrido::before, .ui-clic-destello,
  #modal-container > .modal-overlay,
  #modal-container > .modal-overlay > .modal.ui-modal-control { animation: none !important; }
  .ui-carga-barrido, .ui-clic-destello, .ui-carga-estado::after { display: none; }
}
