/* ==========================================================================
 * nc-emit-signoff.css — Commit legal en 2 pasos (F3 móvil v3 §24 2026-07-10, F3.4).
 *
 * Interstitial "Revisar y firmar" de la memoria DOM (DocuSign adopt-then-sign +
 * GOV.UK check-answers). Tema oscuro slate del app.
 *
 * DESKTOP-SAFETY (regla dura 1): overlay nuevo; NO altera layout existente. Desktop =
 * card centrado; móvil (<=768px) = full-viewport. Todo scoped a .nc-esf-*.
 * A11y §24: bordes significantes >= slate-500 #64748b, targets >= 44px, estado con
 * ícono + texto (nunca solo color), prefers-reduced-motion, safe-areas iOS.
 * z-index sobre bottom-nav (8600) y demás modales del app — 10050.
 * ========================================================================== */

.nc-esf-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding-top: max(20px, env(safe-area-inset-top, 0px));
  padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
  background: rgba(5, 5, 5, 0.78);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  overflow-y: auto;
  animation: nc-esf-in 0.18s ease-out;
}
@keyframes nc-esf-in { from { opacity: 0.4; } to { opacity: 1; } }

.nc-esf-dialog {
  width: 100%;
  max-width: 640px;
  max-height: 100%;
  margin: auto;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #101216;
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
  outline: none;
}
.nc-esf-dialog:focus-visible { outline: 2px solid #0ea5e9; outline-offset: 2px; }

.nc-esf-step { display: flex; flex-direction: column; }

/* Header ------------------------------------------------------------------ */
.nc-esf-head { padding: 24px 24px 8px; }
.nc-esf-stepno {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}
.nc-esf-title {
  margin: 0 0 6px;
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.3;
  color: #e5e7eb;
  outline: none;
}
.nc-esf-title:focus-visible { outline: 2px solid #0ea5e9; outline-offset: 3px; border-radius: 4px; }
.nc-esf-title .fas { color: #fcd34d; margin-right: 4px; }
.nc-esf-sub { margin: 0; font-size: 0.88rem; line-height: 1.5; color: #94a3b8; }
.nc-esf-sub strong { color: #cbd5e1; }

/* Body -------------------------------------------------------------------- */
.nc-esf-body { padding: 16px 24px 8px; flex: 1 1 auto; }
.nc-esf-h3 {
  margin: 8px 0 10px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

/* check-answers (GOV.UK summary-list) ------------------------------------- */
.nc-esf-summary { margin: 0; display: flex; flex-direction: column; }
.nc-esf-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px 14px;
  padding: 11px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}
.nc-esf-row:first-child { border-top: none; }
.nc-esf-row-label { margin: 0; font-size: 0.9rem; line-height: 1.4; color: #e5e7eb; }
.nc-esf-row-status { margin: 0; display: flex; flex-direction: column; gap: 2px; text-align: right; }
.nc-esf-row-change { margin: 0; }

.nc-esf-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 600;
}
.nc-esf-badge.is-ok { color: #6ee7b7; }        /* emerald-300: 7:1 sobre #101216 */
.nc-esf-badge.is-pending { color: #fcd34d; }   /* amber-300 */
.nc-esf-signer-name { font-size: 0.9rem; font-weight: 600; color: #e5e7eb; }
.nc-esf-signer-rut { font-size: 0.78rem; color: #94a3b8; }

.nc-esf-change {
  min-height: 44px;
  padding: 6px 10px;
  border: none;
  background: transparent;
  color: #38bdf8;                              /* sky-400 */
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.nc-esf-change:hover { color: #7dd3fc; }
.nc-esf-change:focus-visible { outline: 2px solid #0ea5e9; outline-offset: 2px; border-radius: 4px; }

.nc-esf-warn {
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(252, 211, 77, 0.3);
  border-radius: 8px;
  background: rgba(252, 211, 77, 0.07);
  color: #fcd34d;
  font-size: 0.84rem;
  line-height: 1.5;
}

/* Paso B: aviso legal + consentimiento ------------------------------------ */
.nc-esf-legal {
  margin: 4px 0 16px;
  padding: 14px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.06);
}
.nc-esf-legal p { margin: 0; font-size: 0.86rem; line-height: 1.55; color: #cbd5e1; }
.nc-esf-legal .fas { color: #38bdf8; margin-right: 4px; }

.nc-esf-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid #64748b;                   /* significante a11y */
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}
.nc-esf-consent-cb {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  accent-color: #10b981;
  cursor: pointer;
}
.nc-esf-consent-cb:focus-visible { outline: 2px solid #0ea5e9; outline-offset: 2px; }
.nc-esf-consent-txt { font-size: 0.86rem; line-height: 1.5; color: #e5e7eb; }
.nc-esf-consent-note {
  margin: 0;
  padding: 12px;
  font-size: 0.84rem;
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.06);
}
.nc-esf-consent-note .fas { margin-right: 4px; }

/* Footer ------------------------------------------------------------------ */
.nc-esf-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-wrap: wrap;
}
.nc-esf-foot-spacer { flex: 1 1 auto; }
.nc-esf-btn {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid #64748b;
  background: #1e293b;
  color: #e5e7eb;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.nc-esf-btn:focus-visible { outline: 2px solid #0ea5e9; outline-offset: 2px; }
.nc-esf-btn--ghost { background: transparent; }
.nc-esf-btn--primary { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.nc-esf-btn--sign { background: #047857; border-color: #047857; color: #fff; }
.nc-esf-btn:disabled,
.nc-esf-btn[aria-disabled="true"] {
  background: #475569;
  border-color: #475569;
  color: #94a3b8;
  cursor: not-allowed;
}

/* screen-reader-only ------------------------------------------------------ */
.nc-esf-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* prefers-reduced-motion -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .nc-esf-overlay { animation: none; }
}

/* ==========================================================================
 * MÓVIL (<=768px): interstitial full-viewport, columna única, targets amplios.
 * Scoped: NO afecta desktop.
 * ========================================================================== */
@media (max-width: 768px) {
  .nc-esf-overlay {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .nc-esf-dialog {
    max-width: none;
    max-height: none;
    min-height: 100%;
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
  .nc-esf-step { min-height: 100%; }
  /* El footer queda pegado abajo aunque el body sea corto. */
  .nc-esf-body { flex: 1 1 auto; }
  .nc-esf-head { padding: max(18px, env(safe-area-inset-top, 0px)) 18px 8px; }
  .nc-esf-body { padding-left: 18px; padding-right: 18px; }
  .nc-esf-foot { padding-left: 18px; padding-right: 18px; }
  .nc-esf-btn { min-height: 48px; }
  /* En pantallas muy angostas la fila apila estado y "Cambiar" bajo el label. */
  .nc-esf-row { grid-template-columns: 1fr auto; }
  .nc-esf-row-change { grid-column: 2; }
}
@media (max-width: 420px) {
  .nc-esf-row {
    grid-template-columns: 1fr;
    gap: 4px 0;
  }
  .nc-esf-row-status { text-align: left; flex-direction: row; align-items: center; gap: 8px; }
  .nc-esf-row-change { grid-column: 1; justify-self: start; }
  .nc-esf-change { padding-left: 0; padding-right: 12px; }
}
