/* ============================================================
   PRESUPUESTO — Wizard paso a paso (tema claro)
   ============================================================ */

.wizard-shell {
    box-shadow: var(--sombra);
    border: 1px solid #e9eff6;
}
/* Las columnas pueden encogerse hasta el ancho de la pantalla (si no, en móviles
   estrechos el contenido se salía de la tarjeta y quedaba cortado) */
.wizard-shell > * {
    min-width: 0;
}

/* Botones Atrás / Continuar más compactos en móviles estrechos */
@media (max-width: 400px) {
    .wz-nav .btn {
        padding: 0.85rem 1.05rem;
        font-size: 0.9rem;
    }
}

/* ---------- Sidebar claro ---------- */
.wizard-aside {
    background: linear-gradient(165deg, #e8f4fe 0%, #f5fbff 60%, #ffffff 100%);
}

/* ---------- Stepper ---------- */
.stepnav {
    color: #7488a4;
    transition: color 0.3s;
}
/* Cada paso es un botón: los ya hechos se pueden pulsar (también con el teclado) para volver */
.stepnav-btn {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    width: 100%;
    padding: 0.55rem 0;
    text-align: left;
    color: inherit;
    border-radius: 0.9rem;
}
.stepnav.done .stepnav-btn:not(:disabled) {
    cursor: pointer;
}
.stepnav.done .stepnav-btn:not(:disabled):hover .sn-label {
    color: #0369a1;
}
.stepnav-btn:focus-visible {
    outline: 3px solid #0369a1;
    outline-offset: 2px;
}
.stepnav .sn-num {
    display: grid;
    place-items: center;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 0.8rem;
    background: #ffffff;
    border: 1px solid #d7e6f3;
    font-family: var(--letra);
    font-weight: 600;
    font-size: 0.9rem;
    color: #556378; /* 5,9:1 sobre blanco */
    flex-shrink: 0;
    transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.stepnav .sn-label {
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.15;
    color: #334155;
}
.stepnav .sn-label small {
    display: block;
    font-size: 0.72rem;
    font-weight: 400;
    color: #556378; /* antes #8aa0bb: 2,5:1, no se leía bien */
    margin-top: 2px;
}
.stepnav.active .sn-num {
    background: linear-gradient(120deg, #38bdf8, #0284c7);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 10px 22px -8px rgba(2, 132, 199, 0.55);
}
.stepnav.active .sn-label {
    color: #0c4a6e;
}
.stepnav.done .sn-num {
    background: #0284c7;
    border-color: transparent;
    color: #fff;
}

/* ---------- Barra de progreso ---------- */
.wz-progress {
    height: 6px;
    border-radius: 99px;
    background: #e2eaf3;
    overflow: hidden;
}
.wz-progress > span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 99px;
    background: linear-gradient(90deg, #0ea5e9, #0284c7);
    transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Pasos ---------- */
.wz-step {
    display: none;
    animation: wz-in 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    border: 0;
    padding: 0;
    margin: 0;
    min-inline-size: 0;
}
.wz-step.active {
    display: block;
}
@keyframes wz-in {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.wz-kicker {
    font-family: var(--letra);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #0369a1; /* 5,9:1: legible en letra pequeña */
}

/* ============================================================
   OPCIONES TIPO TARJETA (radio / checkbox) — robustas
   ============================================================ */
.opt {
    position: relative;
    display: flex;
    cursor: pointer;
}
.opt input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}
.opt-card {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    border: 1.5px solid #e4eaf4;
    border-radius: 1.1rem;
    padding: 1.35rem 2.9rem 1.35rem 1.35rem;
    background: #fff;
    transition: border-color 0.25s, box-shadow 0.3s, transform 0.3s, background 0.25s;
}
.opt-card .opt-ico {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: 0.85rem;
    background: #eaf5ff;
    color: #0284c7;
    margin-bottom: 0.7rem;
    transition: all 0.3s;
}
.opt-card h3 {
    font-family: var(--letra);
    font-weight: 600;
    font-size: 1.02rem;
    line-height: 1.25;
    color: #0f1b2d;
}
.opt-card p {
    font-size: 0.85rem;
    color: #6b7689;
    line-height: 1.45;
}
.opt-card .opt-check {
    position: absolute;
    top: 1.1rem;
    right: 1.1rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    border: 1.5px solid #cdd8e8;
    display: grid;
    place-items: center;
    color: #fff;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.opt:hover .opt-card {
    border-color: #93c5ec;
    transform: translateY(-3px);
}
.opt input:checked + .opt-card {
    border-color: #0ea5e9;
    background: #f4fbff;
    box-shadow: 0 18px 36px -22px rgba(2, 132, 199, 0.5);
}
.opt input:checked + .opt-card .opt-ico {
    background: linear-gradient(120deg, #38bdf8, #0284c7);
    color: #fff;
}
.opt input:checked + .opt-card .opt-check {
    opacity: 1;
    transform: scale(1);
    background: #0ea5e9;
    border-color: #0ea5e9;
}
.opt input:focus-visible + .opt-card {
    outline: 3px solid #0369a1; /* 5,9:1: el azul transparente de antes no llegaba a 3:1 */
    outline-offset: 2px;
}

/* Variante chip (una sola línea) */
.opt-chip .opt-card {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 2.6rem 0.9rem 1rem;
}
.opt-chip .opt-card .opt-ico {
    width: 2.4rem;
    height: 2.4rem;
    margin-bottom: 0;
    border-radius: 0.7rem;
}

/* ---------- Segmentado (Sí/No) ---------- */
.seg {
    display: inline-flex;
    background: #eaf0f7;
    border-radius: 0.9rem;
    padding: 0.3rem;
    gap: 0.3rem;
}
.seg label {
    cursor: pointer;
}
.seg input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.seg span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.4rem;
    border-radius: 0.65rem;
    font-weight: 600;
    font-size: 0.92rem;
    color: #5b6678;
    transition: all 0.25s;
}
.seg input:checked + span {
    background: #fff;
    color: #0284c7;
    box-shadow: 0 6px 16px -8px rgba(2, 32, 71, 0.3);
}
/* La ✓ solo aparece en la opción elegida (antes salía siempre en «Sí» y parecía marcada) */
.seg .seg-check {
    display: none;
}
.seg input:checked + span .seg-check {
    display: inline-block;
}
.seg input:focus-visible + span {
    outline: 3px solid #0369a1; /* 5,2:1 sobre el gris de la pista */
    outline-offset: 2px;
}

/* ---------- Inputs ---------- */
.wz-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #0f1b2d;
    margin-bottom: 0.45rem;
}
.wz-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 0.8rem;
    border: 1.5px solid #dde6f1;
    background: #f8fafc;
    color: #0f1b2d;
    font-size: 1rem; /* 16 px: con menos, el iPhone amplía la página al tocar el campo */
    transition: all 0.25s;
}
.wz-input::placeholder {
    color: var(--tinta-3); /* 5,1:1 sobre el campo gris y 5,4:1 enfocado (antes #9aa6b8, 2,4:1) */
}
.wz-input:focus {
    outline: none;
    background: #fff;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.14);
}
textarea.wz-input {
    resize: vertical;
    min-height: 7rem;
}

/* ---------- Subida de archivos ---------- */
.wz-file {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.4rem;
    padding: 1.6rem 1rem;
    border: 1.6px dashed #b9d2ea;
    border-radius: 1rem;
    background: #f5fbff;
    color: #5b7796;
    cursor: pointer;
    transition: all 0.25s;
}
/* ".wz-field label" (display:block) pisaba la maquetación de la zona de subida */
.wz-field .wz-file {
    display: flex;
    margin-bottom: 0;
    font-size: inherit;
    font-weight: 400;
    color: #5b7796;
}
.wz-file:hover {
    border-color: #0ea5e9;
    background: #eef8ff;
}
.wz-file input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.wz-file .wz-file-ico {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: 0.85rem;
    background: #e0f2fe;
    color: #0284c7;
    margin-bottom: 0.2rem;
}
.wz-file strong {
    color: #0f1b2d;
    font-weight: 600;
}
#wz-file-list {
    margin-top: 0.7rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
#wz-file-list .wz-file-warn {
    flex-basis: 100%;
    font-size: 0.8rem;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 0.75rem;
    padding: 0.5rem 0.75rem;
}
/* Cada archivo elegido, con su botón para quitarlo */
#wz-file-list .wz-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: #0c4a6e;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    border-radius: 99px;
    padding: 0.25rem 0.3rem 0.25rem 0.7rem;
    max-width: 100%;
}
#wz-file-list .wz-pill-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#wz-file-list .wz-pill-remove {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 2rem; /* 32 px: fácil de pulsar con el dedo */
    height: 2rem;
    margin: -0.3rem -0.15rem -0.3rem 0;
    border-radius: 99px;
    color: #0369a1;
    transition: background 0.2s, color 0.2s;
}
#wz-file-list .wz-pill-remove:hover,
#wz-file-list .wz-pill-remove:focus-visible {
    background: #fee2e2;
    color: #b91c1c;
    outline: none;
}

/* Input dinámico "Otros" */
#otros-wrap {
    display: none;
    margin-top: 0.85rem;
}
#otros-wrap.show {
    display: block;
    animation: wz-in 0.35s ease-out;
}

/* ---------- Error inline ---------- */
.wz-error {
    display: none;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: #b91c1c; /* 5,9:1 sobre #fef2f2 (antes #dc2626: 4,4:1) */
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.7rem;
    padding: 0.7rem 1rem;
}
.wz-error.show {
    display: flex;
    animation: wz-shake 0.4s;
}
@keyframes wz-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ---------- Éxito ---------- */
#wz-success {
    display: none;
}
#wz-success.show {
    display: block;
    animation: wz-in 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.success-check {
    position: relative;
    width: 6rem;
    height: 6rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    margin: 0 auto;
    color: #fff;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 22px 50px -18px rgba(34, 197, 94, 0.6);
    animation: pop 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes pop {
    0% { transform: scale(0.4); opacity: 0; }
    60% { transform: scale(1.12); }
    100% { transform: scale(1); opacity: 1; }
}
.success-check::after {
    content: "";
    position: absolute;
    width: 6rem;
    height: 6rem;
    border-radius: 999px;
    border: 2px solid #22c55e;
    animation: wa-ping 2.2s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

.summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.85rem;
    border-radius: 99px;
    background: #eef6fd;
    border: 1px solid #d4e8f8;
    font-size: 0.82rem;
    font-weight: 500;
    color: #1f3a52;
    max-width: 100%;
}
.summary-pill i {
    color: #0284c7;
}

/* ---------- Errores por campo ---------- */
.wz-field-error {
    margin-top: 0.45rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: #b91c1c; /* 6,5:1 sobre blanco */
}
/* Dentro de la rejilla de tarjetas, el mensaje ocupa toda la fila */
.wz-group > .wz-field-error {
    grid-column: 1 / -1;
}
.wz-field.is-invalid .wz-input {
    border-color: #ef4444;
    background-color: #fff;
}
/* Con el borde en rojo, el foco se marca con el contorno azul de siempre (si no, no se ve cuál está activo) */
.wz-field.is-invalid .wz-input:focus {
    outline: 2px solid #0369a1;
    outline-offset: 2px;
    box-shadow: none;
}
.wz-group.is-invalid .opt-card {
    border-color: #fca5a5;
}
.wz-field.is-invalid .seg {
    box-shadow: 0 0 0 2px #fca5a5;
}
.wz-consent.is-invalid label {
    color: #b91c1c;
}

/* ---------- Sugerencias de direcciones (script_direcciones.js) ----------
   La lista cuelga del campo de la calle y flota sobre lo que hay debajo; cada opción mide 44 px o más */
.dir-envoltura {
    position: relative;
}
.dir-lista {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 0.35rem);
    z-index: 30;
    background: #fff;
    border: 1.5px solid #bae6fd;
    border-radius: 0.8rem;
    box-shadow: 0 10px 24px rgba(15, 27, 45, 0.12);
    overflow: hidden;
}
.dir-lista ul {
    max-height: 17rem;
    overflow-y: auto;
    margin: 0;
    padding: 0.3rem 0;
    list-style: none;
}
.dir-opcion {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.55rem 1rem;
    cursor: pointer;
    line-height: 1.3;
}
.dir-opcion:hover,
.dir-opcion.is-activa {
    background: #e0f2fe;
}
/* La opción elegida con las flechas se marca con un contorno completo, como el foco del resto del formulario */
.dir-opcion.is-activa {
    outline: 2px solid #0369a1;
    outline-offset: -2px;
}
.dir-opcion__calle {
    font-weight: 600;
    color: #0f1b2d;
}
.dir-opcion__lugar {
    font-size: 0.85rem;
    color: #475569; /* 7,2:1 sobre blanco; 6,4:1 sobre la opción activa */
}
.dir-fuente {
    margin: 0;
    padding: 0.4rem 1rem 0.5rem;
    border-top: 1px solid #e2e8f0;
    font-size: 0.75rem;
    color: #475569;
}
.dir-fuente a {
    color: #0369a1;
    text-decoration: underline;
}
.dir-pista {
    margin-top: 0.4rem;
    font-size: 0.82rem;
    color: #556378; /* 5,9:1 sobre blanco */
}
/* El título recibe el foco al cambiar de paso (para lectores de pantalla): sin marco */
.wz-step h2:focus {
    outline: none;
}

/* «¿Hay ascensor?» es un fieldset: sin el marco del navegador y con la leyenda como las etiquetas */
fieldset.wz-field {
    border: 0;
    padding: 0;
    margin: 0;
    min-inline-size: 0;
}
.wz-field legend {
    display: block;
    padding: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #0f1b2d;
    margin-bottom: 0.45rem;
}

/* ---------- Desplegable (planta) con la misma pinta que los campos de texto ----------
   La flecha va también en :focus: .wz-input:focus usa «background» y la borraría */
select.wz-input,
select.wz-input:focus {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 2.6rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230369a1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    background-size: 1.1rem;
    cursor: pointer;
}

/* ---------- Casilla «Aún no tengo fecha exacta» ---------- */
.wz-check {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-top: 1rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: #0f1b2d;
    cursor: pointer;
}
.wz-check input {
    flex-shrink: 0;
    width: 1.05rem;
    height: 1.05rem;
    margin-top: 0.2rem;
    accent-color: #0284c7;
}
.wz-check small {
    display: block;
    font-size: 0.8rem;
    font-weight: 400;
    color: #556378; /* 5,9:1 sobre blanco */
}
/* Con fecha flexible, las fechas se ven apagadas (están desactivadas y no se envían) */
#wz-fechas.is-off .wz-field {
    opacity: 0.45;
}

/* ---------- Aviso del borrador (guardado o recuperado) ---------- */
.wz-draft {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    border-radius: 0.9rem;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0c4a6e;
    font-size: 0.88rem;
}
.wz-draft p {
    flex: 1 1 14rem;
    margin: 0;
}
.wz-draft-reset {
    font-weight: 600;
    color: #0369a1;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.wz-draft-reset:hover {
    color: #0c4a6e;
}
.wz-draft-reset:focus-visible {
    outline: 3px solid #0369a1;
    outline-offset: 2px;
    border-radius: 0.3rem;
}

/* ---------- Móvil: las tres opciones del paso 1 se ven sin bajar ----------
   Medido en el área visible de un iPhone con Safari (390×664). style_presu.css se carga
   antes que tailwind.css: por eso algunos selectores llevan etiqueta (más especificidad). */
@media (max-width: 639px) {
    section.presu-intro {
        padding-top: 1.25rem;
        padding-bottom: 7.5rem;
    }
    .presu-intro h1 {
        margin-top: 0;
        font-size: 2rem;
    }
    /* El texto largo sobra aquí: lo mismo se dice debajo del formulario y en el paso 6 */
    .presu-intro-long {
        display: none;
    }
    div.wz-progress {
        margin-bottom: 1.25rem;
    }
    /* Tarjetas de opción en una fila: icono a la izquierda, título y texto a la derecha */
    .opt:not(.opt-chip) .opt-card {
        display: grid;
        grid-template-columns: auto 1fr;
        column-gap: 0.9rem;
        row-gap: 0.1rem;
        align-items: center;
        padding: 0.9rem 2.6rem 0.9rem 0.95rem;
    }
    .opt:not(.opt-chip) .opt-card .opt-ico {
        grid-row: 1 / span 2;
        width: 2.6rem;
        height: 2.6rem;
        margin-bottom: 0;
    }
    .opt:not(.opt-chip) .opt-card .opt-check {
        top: 50%;
        margin-top: -0.75rem;
    }
}

/* El título de éxito recibe el foco (lectores de pantalla): sin marco */
#wz-success h2:focus {
    outline: none;
}

/* ---------- Rediseño (octubre de 2026): ayudas del paso 4 y avisos ---------- */
.wz-ayuda {
    margin-top: 1.5rem;
    padding: 1rem 1.15rem;
    border: 1px solid #bfe3f8;
    border-radius: 0.75rem;
    background: #f0f9ff;
}
.wz-ayuda-titulo {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    font-weight: 600;
    color: #0c4a6e;
}
.wz-ayuda-titulo svg {
    flex-shrink: 0;
    margin-top: 0.15rem;
    color: #0369a1;
}
.wz-details {
    margin-top: 0.6rem;
    border-top: 1px solid #bfe3f8;
}
.wz-details summary {
    display: flex;
    align-items: center;
    min-height: 44px;
    cursor: pointer;
    font-weight: 600;
    color: #0369a1;
    text-decoration: underline;
    text-underline-offset: 0.2em;
}
.wz-details-cuerpo {
    padding: 0.25rem 0 0.75rem;
    color: #3c4b60;
    font-size: 0.95rem;
}
.wz-details-cuerpo p + p,
.wz-details-cuerpo ul + p {
    margin-top: 0.5rem;
}
.wz-details-cuerpo ul {
    list-style: disc;
    padding-left: 1.2rem;
}
.wz-aviso {
    margin-top: 1rem;
    padding: 0.8rem 1rem;
    border: 1px solid #bfe3f8;
    border-radius: 0.75rem;
    background: #f0f9ff;
    color: #0c4a6e;
    font-size: 0.95rem;
}
noscript .wz-aviso {
    margin: 0 0 1.5rem;
}

/* El contenedor del asistente con el radio del resto de la web (pisa rounded-[2rem] de Tailwind) */
#wizard-shell.wizard-shell {
    border-radius: var(--radio-grande);
}
