/*
 * Portal del firmante — mobile first: los estilos base son los de una pantalla
 * angosta y los puntos de quiebre ascendentes (min-width) amplían el diseño.
 */

.enpat-ff-portal { max-width: 860px; margin: 0 auto; box-sizing: border-box; } /* el tema ya aporta los márgenes laterales */
.enpat-ff-portal *, .enpat-ff-portal *::before, .enpat-ff-portal *::after { box-sizing: border-box; }
.enpat-ff-portal h2 { margin-top: 1.4em; overflow-wrap: anywhere; }
.enpat-ff-empty { color: #646970; }

/* Tarjetas */
.enpat-ff-card { border: 1px solid #dcdcde; border-radius: 8px; padding: 14px 16px; margin: 0 0 12px; background: #fff; }
.enpat-ff-card--highlight { border-color: #2271b1; box-shadow: 0 0 0 1px #2271b1 inset; }
.enpat-ff-card__head { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 8px; overflow-wrap: anywhere; }
.enpat-ff-card__actions { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 0; }

.enpat-ff-progress { height: 8px; background: #dcdcde; border-radius: 4px; overflow: hidden; }
.enpat-ff-progress > span { display: block; height: 100%; background: #00a32a; }
.enpat-ff-progress__label { color: #50575e; }

/* Botones: objetivo táctil de al menos 44 px */
.enpat-ff-btn { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; border: 1px solid #2271b1; border-radius: 4px; background: #fff; color: #2271b1; text-decoration: none; font-size: 16px; line-height: 1.3; text-align: center; cursor: pointer; }
.enpat-ff-btn:hover { background: #f0f6fc; }
.enpat-ff-btn--primary { background: #2271b1; color: #fff; }
.enpat-ff-btn--primary:hover { background: #135e96; color: #fff; }
.enpat-ff-btn--danger { border-color: #b32d2e; color: #b32d2e; }
.enpat-ff-btn[disabled] { opacity: .6; cursor: not-allowed; }
.enpat-ff-link { min-height: 44px; padding: 0 4px; background: none; border: 0; color: #2271b1; text-decoration: underline; cursor: pointer; font-size: 16px; }
.enpat-ff-btn:focus-visible, .enpat-ff-link:focus-visible, .enpat-ff-portal a:focus-visible,
.enpat-ff-portal input:focus-visible, .enpat-ff-portal textarea:focus-visible, .enpat-ff-portal summary:focus-visible { outline: 3px solid #2271b1; outline-offset: 2px; }

/* Insignias */
.enpat-ff-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: #f0f0f1; color: #3c434a; }
.enpat-ff-badge--en_curso, .enpat-ff-badge--su_turno { background: #fcf0c0; color: #6b4e00; }
.enpat-ff-badge--completado, .enpat-ff-badge--firmado { background: #d3f0d9; color: #0a5a1f; }
.enpat-ff-badge--rechazado, .enpat-ff-badge--cancelado { background: #f8d7da; color: #8a1f2b; }
.enpat-ff-badge--en_espera, .enpat-ff-badge--borrador { background: #e8eaed; color: #3c434a; }

/*
 * Tabla de seguimiento. En pantallas angostas cada fila es una tarjeta con
 * "Etiqueta: valor" (las etiquetas salen de data-label); desde 600 px es tabla.
 */
.enpat-ff-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.enpat-ff-table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.enpat-ff-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.enpat-ff-table tr { display: block; padding: 8px 0; border-bottom: 1px solid #e0e0e0; }
.enpat-ff-table td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 4px; border: 0; font-size: 14px; text-align: right; overflow-wrap: anywhere; }
.enpat-ff-table td::before { content: attr(data-label); flex: 0 0 auto; font-weight: 600; color: #50575e; text-align: left; }
.enpat-ff-table td:not([data-label])::before { content: none; }

/* Pantalla de firma */
.enpat-ff-preview { display: none; width: 100%; height: 380px; border: 1px solid #dcdcde; border-radius: 6px; }
.enpat-ff-fieldset { min-width: 0; border: 1px solid #dcdcde; border-radius: 8px; padding: 10px; margin: 16px 0; }
.enpat-ff-fieldset legend { font-weight: 600; padding: 0 6px; }
.enpat-ff-hint { color: #646970; font-size: 14px; margin: 0 0 8px; }
.enpat-ff-canvas { display: block; width: 100%; height: 220px; border: 2px dashed #8c8f94; border-radius: 6px; background: #fff; touch-action: none; cursor: crosshair; }
.enpat-ff-consent { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.5; }
.enpat-ff-consent input { flex: 0 0 auto; width: 24px; height: 24px; margin: 2px 0 0; }
.enpat-ff-notice { background: #f0f6fc; border-left: 4px solid #2271b1; padding: 10px 14px; }
.enpat-ff-alert { padding: 10px 14px; border-radius: 4px; margin: 12px 0; }
.enpat-ff-alert--error { background: #fcf0f1; border-left: 4px solid #b32d2e; }
.enpat-ff-alert--ok { background: #edfaef; border-left: 4px solid #00a32a; }
.enpat-ff-decline { margin-top: 24px; }
.enpat-ff-decline summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; }
.enpat-ff-decline textarea { width: 100%; font-size: 16px; }
.enpat-ff-portal input[type="file"] { width: 100%; max-width: 100%; font-size: 16px; }

/* Horizontal con poca altura (teléfono girado): recuadro de firma más bajo */
@media (orientation: landscape) and (max-height: 500px) {
	.enpat-ff-canvas { height: 150px; }
}

/* Pantallas medianas y grandes (tablet y escritorio) */
@media (min-width: 600px) {
	.enpat-ff-card__head { flex-direction: row; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
	.enpat-ff-card__actions { flex-direction: row; flex-wrap: wrap; }
	.enpat-ff-btn { display: inline-flex; padding: 8px 16px; font-size: 14px; }
	.enpat-ff-link { font-size: 14px; }
	.enpat-ff-fieldset { padding: 12px 16px; }
	.enpat-ff-canvas { height: 200px; }

	.enpat-ff-preview { display: block; }
	.enpat-ff-open-doc { display: inline-flex; }

	.enpat-ff-table thead { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; }
	.enpat-ff-table tr { display: table-row; padding: 0; border: 0; }
	.enpat-ff-table td { display: table-cell; padding: 8px; border-bottom: 1px solid #e0e0e0; text-align: left; }
	.enpat-ff-table td::before { content: none; }
	.enpat-ff-table th { text-align: left; padding: 8px; border-bottom: 1px solid #e0e0e0; font-size: 14px; }
	.enpat-ff-hint { font-size: 13px; }
	.enpat-ff-consent { font-size: 14px; }
}

@media (min-width: 900px) {
	.enpat-ff-preview { height: 560px; }
}

/* Cédula por ambos lados, método de firma y pasos de la firma avanzada */
.enpat-ff-idside { margin: 0 0 16px; }
.enpat-ff-idside h4 { margin: 0 0 6px; font-size: 16px; }
.enpat-ff-idside__buttons { display: flex; flex-direction: column; gap: 8px; }
.enpat-ff-idside__status { margin: 6px 0 0; font-size: 14px; color: #50575e; min-height: 1.4em; }
.enpat-ff-hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.enpat-ff-methods { display: flex; flex-direction: column; gap: 8px; margin: 0 0 12px; }
.enpat-ff-method { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; }
.enpat-ff-method input { width: 22px; height: 22px; margin: 0; }
.enpat-ff-signature-preview { margin: 12px 0 0; padding: 8px; border: 1px solid #dcdcde; border-radius: 6px; background: #fff; text-align: center; }
.enpat-ff-signature-preview img { max-width: 100%; max-height: 160px; }
.enpat-ff-steps { margin: 0; padding-left: 20px; }
.enpat-ff-steps li { margin: 0 0 14px; line-height: 1.5; }
.enpat-ff-steps .enpat-ff-btn { margin-top: 8px; }

@media (min-width: 600px) {
	.enpat-ff-idside__buttons { flex-direction: row; }
	.enpat-ff-methods { flex-direction: row; gap: 24px; }
}
