/*
 * Formulario público de referido (se abre con el enlace o incrustado en la web
 * del cliente). Autónomo: sin Falcon ni Bootstrap cargados, así que la fuente
 * del tema se define aquí con su misma pila (sin Google Fonts: dentro de la web
 * de un cliente mandarían la IP del visitante a terceros). El color de la
 * cuenta llega en --rf-brand / --rf-ink (y, si la cuenta lo cambia, el fondo
 * en --rf-ground) desde el <style nonce> de la vista.
 */
:root {
    --falcon-font-sans-serif: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    --rf-brand: #2c7be5;
    --rf-ink: #fff;
    --rf-text: #344050;
    --rf-muted: #5e6e82;
    --rf-faint: #748194;
    --rf-line: #d8e2ef;
    --rf-soft: #edf2f9;
    --rf-paper: #fff;
    --rf-ground: #edf2f9;
    --rf-danger: #e63757;
    --rf-danger-text: #a61d38;
    --rf-danger-soft: #fdeef1;
    --rf-radius: 8px;
}

[hidden] {
    display: none !important;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--rf-ground);
    color: var(--rf-text);
    font-family: var(--falcon-font-sans-serif);
    font-size: 1rem;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

/* Incrustado: fondo transparente, sin márgenes y sin cabecera (la web del
   cliente ya lleva su marca). Nunca 100vh: la altura la da el contenido. */
.rf-embed body {
    background: transparent;
}

.rf-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 640px;
    margin: 0 auto;
    padding: 32px 16px 48px;
}

.rf-embed .rf-page {
    max-width: none;
    padding: 0;
}

.rf-embed .rf-brand {
    display: none;
}

.rf-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Campo trampa: sin pintar, que los autocompletados no rellenan lo que no se
   ve (un lead real con el campo lleno se perdería en silencio). */
.rf-hp {
    display: none;
}

/* Cabecera: logo de la cuenta (o su nombre) */
.rf-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.rf-logo {
    display: block;
    max-width: 220px;
    max-height: 56px;
    object-fit: contain;
}

.rf-brand-name {
    font-size: 1.25rem;
    font-weight: 600;
}

.rf-tagline {
    margin: 0;
    color: var(--rf-muted);
    font-size: .9375rem;
}

/* Tarjeta */
.rf-card {
    background: var(--rf-paper);
    border: 1px solid var(--rf-line);
    border-radius: var(--rf-radius);
    overflow: hidden;
}

.rf-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    background: var(--rf-brand);
    color: var(--rf-ink);
}

.rf-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.3;
    text-wrap: balance;
}

.rf-title:focus {
    outline: none;
}

.rf-lang {
    display: flex;
    flex-shrink: 0;
    gap: 2px;
}

.rf-lang a {
    padding: 4px 8px;
    border-radius: 4px;
    color: inherit;
    font-size: .875rem;
    text-decoration: none;
    opacity: .8;
}

.rf-lang a:hover {
    opacity: 1;
    text-decoration: underline;
}

.rf-lang a[aria-current] {
    font-weight: 600;
    opacity: 1;
    box-shadow: inset 0 0 0 1px currentColor;
}

.rf-lang a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.rf-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
}

/* Progreso */
.rf-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rf-progress-track {
    height: 6px;
    border-radius: 3px;
    background: var(--rf-soft);
    overflow: hidden;
}

.rf-progress-fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: 3px;
    background: var(--rf-brand);
    transition: width .25s ease;
}

.rf-progress-text {
    margin: 0;
    color: var(--rf-muted);
    font-size: .8125rem;
    font-variant-numeric: tabular-nums;
}

/* Pasos y campos */
.rf-step {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.rf-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.rf-field,
.rf-coholder {
    grid-column: 1 / -1;
    min-width: 0;
}

.rf-field--half {
    grid-column: auto;
}

@media (max-width: 479px) {
    .rf-field--half {
        grid-column: 1 / -1;
    }
}

.rf-label {
    display: block;
    margin-bottom: 6px;
    font-size: .875rem;
    font-weight: 500;
}

.rf-optional {
    color: var(--rf-faint);
    font-weight: 400;
}

/* «*» en los obligatorios (si la cuenta lo elige) y su leyenda, una vez,
   bajo la barra de progreso. */
.rf-required {
    color: var(--rf-danger-text);
    font-weight: 600;
}

.rf-required-legend {
    margin: 0;
    color: var(--rf-muted);
    font-family: var(--falcon-font-sans-serif);
    font-size: .8125rem;
}

/* Grupos de controles bajo un rótulo (radios, Sí/No, antigüedad, préstamo):
   un <fieldset> sin su marco. La <legend> flota para portarse como un rótulo
   normal (sin flotar, el navegador la monta sobre el borde del fieldset y no
   respeta sus márgenes). */
.rf-group {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.rf-group > legend {
    float: left;
    width: 100%;
    padding: 0;
}

.rf-group > legend + * {
    clear: both;
}

/* Opciones en radios: apiladas, con un objetivo táctil de 44 px. Desde 480 px,
   en fila si son tres o menos (Sí/No). */
.rf-choice-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rf-choice {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--rf-line);
    border-radius: 6px;
    background: var(--rf-paper);
    font-size: 1rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
    cursor: pointer;
}

.rf-choice input {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--rf-brand);
    cursor: pointer;
}

.rf-choice input:focus-visible {
    outline: 2px solid var(--rf-brand);
    outline-offset: 2px;
}

.rf-choice:has(input:checked) {
    border-color: var(--rf-brand);
    box-shadow: inset 0 0 0 1px var(--rf-brand);
}

.rf-choice:has(input[aria-invalid="true"]) {
    border-color: var(--rf-danger);
}

@media (min-width: 480px) {
    .rf-choices--inline .rf-choice-list {
        flex-flow: row wrap;
    }

    .rf-choices--inline .rf-choice {
        flex: 1 1 8rem;
        min-width: 0;
    }
}

/* Antigüedad (años + meses, dos columnas siempre: caben a 375 px) y préstamo
   (2×2; por debajo de 480 px, una columna). */
.rf-parts {
    display: grid;
    gap: 12px;
}

.rf-parts--duration {
    grid-template-columns: repeat(2, minmax(0, 8rem));
}

.rf-parts--loan {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 479px) {
    .rf-parts--loan {
        grid-template-columns: minmax(0, 1fr);
    }
}

.rf-part {
    min-width: 0;
}

.rf-part-label {
    display: block;
    margin-bottom: 4px;
    color: var(--rf-muted);
    font-size: .8125rem;
}

/* 16px en los controles: con menos, Safari de iPhone amplía la página al tocar. */
.rf-control {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid var(--rf-line);
    border-radius: 6px;
    background: var(--rf-paper);
    color: var(--rf-text);
    font: inherit;
    font-size: 1rem;
    line-height: 1.5;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.rf-control:focus {
    border-color: var(--rf-brand);
    outline: 2px solid var(--rf-brand);
    outline-offset: -1px;
}

.rf-control[aria-invalid="true"] {
    border-color: var(--rf-danger);
}

.rf-control[aria-invalid="true"]:focus {
    outline-color: var(--rf-danger);
}

select.rf-control {
    padding-right: 36px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%235e6e82' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 14px 10px;
    cursor: pointer;
}

.rf-control--short {
    max-width: 8rem;
}

.rf-control--date {
    max-width: 14rem;
}

/* Texto largo (preguntas libres): crece hacia abajo, nunca a lo ancho. */
.rf-control--area {
    min-height: 6rem;
    resize: vertical;
}

.rf-affix {
    position: relative;
}

.rf-affix .rf-control {
    padding-right: 36px;
    font-variant-numeric: tabular-nums;
}

.rf-affix-text {
    position: absolute;
    top: 50%;
    right: 12px;
    color: var(--rf-faint);
    transform: translateY(-50%);
    pointer-events: none;
}

.rf-help,
.rf-error {
    margin: 6px 0 0;
    font-size: .8125rem;
    overflow-wrap: anywhere;
}

.rf-help {
    color: var(--rf-muted);
}

.rf-error {
    color: var(--rf-danger-text);
}

/* Interruptor («¿Hay más de un titular?») */
.rf-switch,
.rf-check {
    display: flex;
    gap: 12px;
    cursor: pointer;
}

.rf-switch {
    align-items: center;
    font-weight: 500;
}

.rf-switch input {
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 24px;
    margin: 0;
    border-radius: 12px;
    background: var(--rf-line);
    appearance: none;
    cursor: pointer;
    transition: background-color .2s ease;
}

.rf-switch input::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--rf-paper);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
    transition: transform .2s ease;
}

.rf-switch input:checked {
    background: var(--rf-brand);
}

.rf-switch input:checked::before {
    transform: translateX(20px);
}

.rf-switch input:focus-visible,
.rf-check input:focus-visible {
    outline: 2px solid var(--rf-brand);
    outline-offset: 2px;
}

/* Casillas de protección de datos */
.rf-check {
    align-items: flex-start;
    font-size: .9375rem;
}

.rf-check input {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin: 2px 0 0;
    accent-color: var(--rf-brand);
    cursor: pointer;
}

.rf-check input[aria-invalid="true"] {
    outline: 2px solid var(--rf-danger);
    outline-offset: 1px;
}

.rf-privacy-hint {
    margin: 0 0 16px;
    color: var(--rf-muted);
    font-size: .8125rem;
}

.rf-privacy {
    overflow-wrap: anywhere;
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid var(--rf-soft);
    border-radius: 6px;
    background: #f9fafd;
    color: var(--rf-muted);
    font-size: .8125rem;
    line-height: 1.55;
}

.rf-privacy p {
    margin: 0 0 6px;
}

.rf-privacy p:last-child {
    margin-bottom: 0;
}

.rf-privacy strong,
.rf-privacy-title {
    color: var(--rf-text);
    font-weight: 600;
}

/* La política de privacidad de la cuenta: en el color del texto y no en el de
   la marca, que sobre este fondo claro puede no leerse. */
.rf-privacy a {
    color: var(--rf-text);
    text-decoration: underline;
}

.rf-privacy a:focus-visible {
    outline: 2px solid var(--rf-brand);
    outline-offset: 2px;
}

/* Introducción propia de la cuenta, al principio del primer paso (también incrustado) */
.rf-intro {
    margin: 0 0 16px;
    color: var(--rf-text);
    font-family: var(--falcon-font-sans-serif);
    font-size: .9375rem;
    overflow-wrap: anywhere;
}

.rf-intro p {
    margin: 0 0 8px;
}

.rf-intro p:last-child {
    margin-bottom: 0;
}

/* Texto propio de cada etapa (una portada, una explicación), tras la introducción */
.rf-step-desc {
    margin: 0 0 16px;
    color: var(--rf-text);
    font-family: var(--falcon-font-sans-serif);
    font-size: .9375rem;
    overflow-wrap: anywhere;
}

.rf-step-desc p {
    margin: 0 0 8px;
}

.rf-step-desc p:last-child {
    margin-bottom: 0;
}

/* Segundo titular: un <fieldset> (desactivado mientras no se conteste «Sí»)
   con la raya de arriba y su título como <legend>, flotada por lo mismo que
   la de los grupos. */
.rf-coholder {
    min-width: 0;
    margin: 0;
    padding: 16px 0 0;
    border: 0;
    border-top: 1px solid var(--rf-soft);
}

.rf-coholder-title {
    float: left;
    width: 100%;
    margin: 0 0 12px;
    padding: 0;
    font-size: 1rem;
    font-weight: 600;
}

.rf-coholder-title + * {
    clear: both;
}

/* Botones */
.rf-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    margin-top: 24px;
}

.rf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 9px 22px;
    border: 1px solid transparent;
    border-radius: 6px;
    font: inherit;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.rf-btn-next,
.rf-btn-send {
    background: var(--rf-brand);
    color: var(--rf-ink);
}

.rf-actions .rf-btn-next,
.rf-actions .rf-btn-send {
    margin-left: auto;
}

.rf-btn-next:hover,
.rf-btn-send:hover {
    filter: brightness(.93);
}

.rf-btn-back {
    border-color: var(--rf-line);
    background: var(--rf-paper);
    color: var(--rf-text);
}

.rf-btn-back:hover {
    background: var(--rf-soft);
}

.rf-btn:focus-visible {
    outline: 2px solid var(--rf-brand);
    outline-offset: 2px;
}

.rf-btn:disabled {
    opacity: .65;
    cursor: progress;
    filter: none;
}

/* «Recargar», bajo el aviso de que la cuenta ha cambiado el formulario. */
.rf-btn-reload {
    margin: 0 0 16px;
    border-color: var(--rf-line);
    background: var(--rf-paper);
    color: var(--rf-text);
}

.rf-btn-reload:hover {
    background: var(--rf-soft);
}

/* Avisos */
.rf-alert {
    overflow-wrap: anywhere;
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid #f7c4ce;
    border-radius: 6px;
    background: var(--rf-danger-soft);
    color: var(--rf-danger-text);
    font-size: .9375rem;
}

/* Vista previa de «Ajustes de referido»: el aviso de que Enviar no envía va en
   la misma caja que los errores, pero sin el rojo (no es un error). */
.rf-alert.rf-preview-note {
    border-color: var(--rf-line);
    background: var(--rf-soft);
    color: var(--rf-text);
    font-family: var(--falcon-font-sans-serif);
}

.rf-done {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
}

.rf-done p {
    margin: 0;
}

/* «Te llevamos a {host}…» (o, en la vista previa, que de aquí no se sale). */
.rf-done .rf-done-go {
    color: var(--rf-muted);
    font-size: .9375rem;
}

/* «Hacer otra solicitud» cuando «Continuar» es el botón principal. */
.rf-btn-ghost {
    border-color: var(--rf-line);
    background: var(--rf-paper);
    color: var(--rf-text);
}

.rf-btn-ghost:hover {
    background: var(--rf-soft);
}

/* «Continuar» de la vista previa: no es un enlace (no se sale de la pantalla). */
.rf-btn[aria-disabled="true"] {
    cursor: default;
    filter: none;
}

.rf-card--notice .rf-body {
    gap: 8px;
    padding: 28px 24px;
    text-align: center;
}

.rf-notice-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.rf-notice-text {
    margin: 0;
    color: var(--rf-muted);
}

@media (max-width: 479px) {
    .rf-card-head,
    .rf-body {
        padding-right: 16px;
        padding-left: 16px;
    }

    .rf-actions .rf-btn {
        flex: 1 1 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
    }
}
