/*
 * Firma handoff — applet PC + página móvil (Design spec 2026-08-09)
 * Estilos v2 aplicables a ambos contextos + media query que oculta
 * alternativas en móvil (§1.1).
 */

/* ============================================================================
 * APPLET INSERTABLE (PC)
 * ============================================================================ */

.aim-fh-widget {
  display: block;
  margin: 12px 0;
}

.aim-fh-canvas-slot {
  /* Contenedor del canvas del motor 34 — sin estilos propios,
   * el motor ya trae sus canvas + botones */
}

/* Sección alternativas: visible en escritorio, oculta en móvil (§1.1) */
.aim-fh-alternativas {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #F0F1F2;
}
@media (hover: none) and (pointer: coarse) {
  .aim-fh-alternativas { display: none; }
}
.aim-fh-alternativas__intro {
  font-size: 12.5px;
  color: #6B7280;
  margin-bottom: 11px;
}
.aim-fh-alternativas__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

/* Fila de alternativa: icono cuadrado + título + descripción una línea */
.aim-fh-alt {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 13px 15px;
  color: #1F2937;
  transition: border-color .15s ease, background .15s ease;
}
.aim-fh-alt:hover,
.aim-fh-alt:focus-visible {
  border-color: #2E7D32;
  background: #F7FBF7;
}
.aim-fh-alt__icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #E8F5E9;
  display: grid;
  place-items: center;
  flex: none;
}
.aim-fh-alt__icon i {
  font-size: 16px;
  color: #2E7D32;
}
.aim-fh-alt__body {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
}
.aim-fh-alt__t {
  display: block;
  font-size: 14px;
  font-weight: 600;
}
.aim-fh-alt__d {
  display: block;
  font-size: 12.5px;
  color: #6B7280;
  margin-top: 2px;
  line-height: 1.45;
}

/* Bloque de espera (después de pedir QR/email) */
.aim-fh-espera {
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  background: #F9FAFB;
  padding: 22px;
  margin-top: 20px;
}
.aim-fh-espera__inner {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.aim-fh-espera__qr-wrap {
  background: #FFF;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 12px;
  flex: none;
}
.aim-fh-espera__qr svg,
.aim-fh-espera__qr img {
  display: block;
  width: 200px;
  height: 200px;
}
.aim-fh-espera__body {
  flex: 1 1 240px;
  min-width: 0;
}
.aim-fh-espera__title {
  font-size: 15.5px;
  font-weight: 600;
  text-wrap: pretty;
}
.aim-fh-espera__desc {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: #4B5563;
  line-height: 1.55;
  text-wrap: pretty;
}

/* Timeline 3 pasos (§1.5) */
.aim-fh-timeline {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.aim-fh-timeline__step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: #9CA3AF;
}
.aim-fh-timeline__step[data-step="1"] {
  color: #2E7D32;
}
.aim-fh-timeline__step[data-step="2"] {
  color: #4B5563;
}
.aim-fh-timeline__step[data-step="1"] i {
  color: #2E7D32;
  font-size: 15px;
}
.aim-fh-timeline__step[data-step="2"] i {
  color: #6B7280;
  font-size: 14px;
}
.aim-fh-timeline__step[data-step="3"] i {
  font-size: 14px;
}
.aim-fh-espera__ttl {
  font-size: 12.5px;
  color: #9CA3AF;
  margin-top: 14px;
}
.aim-fh-espera__actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.aim-fh-espera__cancel,
.aim-fh-espera__toggle {
  font-size: 13.5px;
  font-weight: 600;
  color: #2E7D32;
  text-decoration: none;
}
.aim-fh-espera__cancel:hover,
.aim-fh-espera__toggle:hover { text-decoration: underline; }

/* Firma recibida (§1.4) */
.aim-fh-recibida {
  margin-top: 12px;
}
.aim-fh-recibida__preview {
  position: relative;
  border: 2px solid #2E7D32;
  border-radius: 10px;
  background: #FFFFFF;
  height: 200px;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
}
.aim-fh-canvas-clear {
  margin-left: 10px;
  background: none;
  border: none;
  color: #2E7D32;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.aim-fh-recibida__img {
  flex: 1 1 auto;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain;
  padding: 10px;
  box-sizing: border-box;
  display: block;
}
.aim-fh-recibida__badge {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #2E7D32;
  color: #fff;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.aim-fh-recibida__badge i {
  font-size: 14px;
}
.aim-fh-recibida__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.aim-fh-recibida__reset {
  font-size: 13.5px;
  font-weight: 600;
  color: #2E7D32;
  text-decoration: none;
}
.aim-fh-recibida__reset:hover { text-decoration: underline; }
.aim-fh-recibida__nota {
  font-size: 12px;
  color: #9CA3AF;
}

/* Bloque error (aparece cuando el poll devuelve expired) */
.aim-fh-error {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #FFF3E0;
  border: 1px solid #FFCC80;
  border-radius: 10px;
  padding: 15px 16px;
}
.aim-fh-error > i {
  font-size: 16px;
  color: #E65100;
  margin-top: 2px;
  flex: none;
}
.aim-fh-error__title {
  font-size: 14.5px;
  font-weight: 600;
  color: #A04A00;
  line-height: 1.45;
}
.aim-fh-error__desc {
  margin: 5px 0 0;
  font-size: 13.5px;
  color: #A04A00;
  line-height: 1.55;
  text-wrap: pretty;
}
.aim-fh-error__retry {
  display: inline-block;
  margin: 14px 16px 0 0;
  background: #2E7D32;
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
}
.aim-fh-error__retry:hover { background: #1B5E20; }
.aim-fh-error__back {
  font-size: 13.5px;
  font-weight: 600;
  color: #2E7D32;
  text-decoration: none;
}

/* ============================================================================
 * PÁGINA MÓVIL /firmar-en-movil/
 * ============================================================================ */

.aim-fh-movil {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #FFF;
  font-family: 'Figtree', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1F2937;
}
.aim-fh-movil__main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: 18px 20px 20px;
}
.aim-fh-movil__main--estado {
  place-items: center;
  display: grid;
  text-align: center;
  padding: 40px 28px;
}
.aim-fh-movil__eyebrow {
  font-size: 11.5px;
  font-weight: 700;
  color: #6B7280;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.aim-fh-movil__title {
  margin: 6px 0 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
  text-wrap: pretty;
  color: #1F2937;
}
.aim-fh-movil__detalle {
  margin: 6px 0 0;
  font-size: 14px;
  color: #4B5563;
  line-height: 1.55;
  text-wrap: pretty;
}
.aim-fh-movil__canvas-wrap {
  position: relative;
  margin-top: 16px;
  flex: 1 1 auto;
  min-height: 260px;
}
.aim-fh-movil__canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 2px dashed #C8E6C9;
  border-radius: 12px;
  background: #F8FBF8;
  touch-action: none;
  box-sizing: border-box;
}
.aim-fh-movil__place {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-size: 14px;
  color: #9CA3AF;
}
.aim-fh-movil__giro {
  font-size: 12px;
  color: #9CA3AF;
  margin-top: 8px;
  text-align: center;
}
.aim-fh-movil__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.aim-fh-movil__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s ease;
}
.aim-fh-movil__btn--sec {
  flex: 0 0 auto;
  padding: 0 18px;
  background: #FFF;
  color: #4B5563;
  border-color: #E5E7EB;
}
.aim-fh-movil__btn--pri {
  flex: 1 1 auto;
  background: #2E7D32;
  color: #fff;
}
.aim-fh-movil__btn--pri:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.aim-fh-movil__aviso {
  font-size: 12px;
  color: #9CA3AF;
  margin-top: 10px;
  text-align: center;
  line-height: 1.5;
  text-wrap: pretty;
}

/* Estados (expirado, usado, éxito, error) */
.aim-fh-movil__icon {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto;
}
.aim-fh-movil__icon--warn { background: #FFF3E0; }
.aim-fh-movil__icon--warn i { font-size: 34px; color: #E65100; }
.aim-fh-movil__icon--info { background: #E3F2FD; }
.aim-fh-movil__icon--info i { font-size: 34px; color: #1565C0; }
.aim-fh-movil__icon--ok { background: #E8F5E9; }
.aim-fh-movil__icon--ok i { font-size: 34px; color: #2E7D32; }
.aim-fh-movil__main--estado .aim-fh-movil__title {
  margin: 20px 0 0;
  font-size: 21px;
}
.aim-fh-movil__parrafo {
  margin: 10px 0 0;
  font-size: 14.5px;
  color: #4B5563;
  line-height: 1.6;
  text-wrap: pretty;
}
.aim-fh-movil__parrafo--sm {
  font-size: 13px;
  color: #9CA3AF;
  margin-top: 18px;
}

/* Pie */
.aim-fh-movil__foot {
  flex: none;
  background: #FAFAFA;
  border-top: 1px solid #EEE;
  padding: 16px 24px;
  text-align: center;
}
.aim-fh-movil__foot-org {
  font-size: 11px;
  color: #8A8F8A;
  line-height: 1.5;
}
.aim-fh-movil__foot-org strong {
  color: #2E7D32;
  font-weight: 700;
}
.aim-fh-movil__foot-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
  font-size: 11px;
}
.aim-fh-movil__foot-links a {
  color: #2E7D32;
  text-decoration: none;
}
