/* Herramientas gratis (cotización y cuenta de cobro): formulario sobre los estilos de soluciones.css */

.h-form {
    margin: 28px 0 40px;
    padding: 24px;
    border: 1px solid #e3e7ee;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(17, 24, 39, .06);
}

.h-form [hidden] {
    display: none !important;
}

.h-form fieldset {
    min-width: 0;
    margin: 0 0 20px;
    padding: 14px 16px 16px;
    border: 1px solid #e3e7ee;
    border-radius: 12px;
}

.h-form legend {
    width: auto;
    float: none;
    margin: 0;
    padding: 0 6px;
    font-size: 1.05rem;
    font-weight: 700;
}

/* Rejillas: dos bloques lado a lado y grupos de 2, 3 o 4 campos */
.h-fila2,
.h-pie {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.h-pie {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    align-items: start;
}

.h-campos2,
.h-campos3,
.h-campos4 {
    display: grid;
    gap: 0 12px;
}

.h-campos2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.h-campos3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.h-campos4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.h-campo {
    min-width: 0;
    margin-top: 10px;
}

.h-campo label {
    display: block;
    margin-bottom: 4px;
    font-size: .9rem;
    font-weight: 600;
    color: #334155;
}

.h-form input:not([type="checkbox"]),
.h-form select,
.h-form textarea {
    box-sizing: border-box;
    width: 100%;
    min-height: 44px;
    padding: 9px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #1f2937;
    font: inherit;
}

.h-form input:focus,
.h-form select:focus,
.h-form textarea:focus {
    outline: 2px solid #93c5fd;
    border-color: #3b82f6;
}

.h-form textarea {
    min-height: 84px;
    resize: vertical;
}

.h-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0 4px;
    font-weight: 600;
    cursor: pointer;
}

.h-check input {
    width: 20px;
    height: 20px;
}

/* Tabla de líneas: cabecera en escritorio, etiquetas solo en celular */
.h-cabecera,
.h-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 100px 150px 130px 44px;
    gap: 8px;
    align-items: center;
}

.h-cabecera {
    padding: 4px 0;
    font-size: .85rem;
    font-weight: 700;
    color: #64748b;
}

.h-cabecera span:nth-child(4) {
    text-align: right;
}

.h-lines {
    display: grid;
    gap: 8px;
}

.h-line .h-campo {
    margin: 0;
}

.h-line label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.h-line-total {
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
}

.h-quitar,
.h-agregar {
    min-height: 44px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    cursor: pointer;
}

.h-quitar:hover {
    color: #b91c1c;
    border-color: #fca5a5;
}

.h-agregar {
    margin-top: 10px;
    padding: 8px 14px;
    font-weight: 600;
}

.h-valor {
    max-width: 320px;
}

/* Totales y descarga */
.h-total {
    padding: 16px 18px;
    border-radius: 12px;
    background: #f5f7fb;
}

.h-total p {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0;
}

.h-total-final {
    margin-top: 10px !important;
    padding-top: 10px;
    border-top: 1px solid #e3e7ee;
    font-size: 1.25rem;
    font-weight: 800;
}

/* La cuenta de cobro solo muestra el total: sin raya encima */
.h-total-final:first-child {
    margin-top: 0 !important;
    padding-top: 0;
    border-top: 0;
}

.h-error {
    min-height: 1.4em;
    margin: 10px 0 4px;
    color: #b91c1c;
    font-weight: 600;
}

.h-descargar {
    width: 100%;
    justify-content: center;
    border: 0;
    cursor: pointer;
}

.h-descargar:disabled {
    opacity: .7;
    cursor: wait;
}

.h-borrar {
    display: block;
    margin-top: 12px;
    text-align: center;
    font-size: .9rem;
}

.h-solucion {
    margin-top: 32px;
}

.h-qr-tipos {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.h-qr-tipo { position: relative; cursor: pointer; }
.h-qr-tipo input { position: absolute; opacity: 0; }
.h-qr-tipo span { display: flex; min-height: 58px; align-items: center; gap: 10px; padding: 10px; border: 1px solid #cbd5e1; border-radius: 10px; font-weight: 600; }
.h-qr-tipo input:checked + span { border: 2px solid #2563eb; background: #eff6ff; }
.h-qr-tipo input:focus-visible + span { outline: 3px solid #93c5fd; }
.h-qr-tipo i { color: #1d4ed8; font-size: 1.2rem; }
.h-qr-color { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.h-form input[type="color"] { width: 48px; height: 44px; min-height: 44px; padding: 4px; }
.h-qr-muestras { display: flex; gap: 9px; }
.h-qr-muestras button { width: 32px; height: 32px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: var(--muestra); box-shadow: 0 0 0 1px #94a3b8; cursor: pointer; }
.h-qr-muestras button:focus-visible { outline: 3px solid #60a5fa; outline-offset: 2px; }
.h-qr-vista { display: flex; width: min(100%, 320px); aspect-ratio: 1; align-items: center; justify-content: center; margin: 0 auto 14px; padding: 16px; border: 1px dashed #cbd5e1; border-radius: 12px; color: #64748b; background: #f8fafc; }
.h-qr-vista img { display: block; width: 100%; height: 100%; object-fit: contain; }
.h-qr-descargas { display: grid; gap: 10px; }
.h-qr-descargas button { width: 100%; justify-content: center; }
.h-qr-descargas button:disabled { opacity: .55; cursor: not-allowed; }

.h-festivos-tabs { display: flex; gap: 8px; margin: 18px 0; }
.h-festivos-tabs button { padding: 9px 16px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; font: inherit; cursor: pointer; }
.h-festivos-tabs button[aria-selected="true"] { border-color: #2563eb; color: #1d4ed8; background: #eff6ff; }
.h-tabla-contenedor { max-width: 100%; overflow-x: auto; }
.h-tabla-festivos { width: 100%; border-collapse: collapse; text-align: left; }
.h-tabla-festivos caption { padding: 8px; font-weight: 700; text-align: left; }
.h-tabla-festivos th, .h-tabla-festivos td { padding: 10px 12px; border-bottom: 1px solid #e2e8f0; }
.h-tabla-festivos tbody tr:nth-child(even) { background: #f8fafc; }
.h-pasado { color: #94a3b8; }
.h-negativo { color: #b91c1c !important; }
.h-resultado { font-size: 1.25rem; font-weight: 800; }
.h-form [hidden], .h-anio-festivos[hidden] { display: none !important; }

@media (max-width: 900px) {
    .h-campos4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
    .h-form {
        padding: 14px;
        margin-left: -4px;
        margin-right: -4px;
    }

    .h-fila2,
    .h-pie,
    .h-campos3 {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .h-qr-tipos { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .h-form fieldset {
        padding: 10px 12px 14px;
    }

    /* Cada línea pasa a ser una tarjeta con sus etiquetas visibles */
    .h-cabecera {
        display: none;
    }

    .h-line {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        padding: 10px;
        border: 1px solid #e3e7ee;
        border-radius: 10px;
        background: #f8fafc;
    }

    .h-line .h-campo:first-child {
        grid-column: 1 / -1;
    }

    .h-line label {
        position: static;
        width: auto;
        height: auto;
        clip: auto;
        overflow: visible;
    }

    .h-line-total {
        text-align: left;
    }

    .h-quitar {
        justify-self: end;
        width: 44px;
    }

    .h-valor {
        max-width: none;
    }

    .h-tabla-festivos tbody tr { display: grid; grid-template-columns: minmax(0, 1fr); }
    .h-tabla-festivos th, .h-tabla-festivos td { padding: 8px 6px; }
    .h-tabla-festivos tbody td:last-child { padding-top: 0; border-bottom: 0; font-size: .85rem; }
}
