:root {
    --fondo: #f3eee6;
    --panel: #ffffff;
    --texto: #2a2118;
    --borde: #dbcdb9;
    --accion: #9a7b57;
    --accion-off: #b7a58f;
    --aviso-bg: #f8f1e6;
    --aviso-borde: #d8c1a3;
    --empresa-azul: #1f5fa8;
    --estimacion-naranja: #d97a1a;
    --diferencia-verde: #1f8a4c;
    --sube: #9b1c1c;
    --baja: #0f6b2f;
}

body {
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    background:
        radial-gradient(circle at 12% 18%, rgba(31, 95, 168, 0.22) 0%, rgba(31, 95, 168, 0) 42%),
        radial-gradient(circle at 86% 14%, rgba(217, 122, 26, 0.25) 0%, rgba(217, 122, 26, 0) 38%),
        radial-gradient(circle at 50% 100%, rgba(154, 123, 87, 0.28) 0%, rgba(154, 123, 87, 0) 52%),
        linear-gradient(145deg, #f2e6d4 0%, #ead8bf 46%, #d9c1a0 100%);
    color: var(--texto);
    margin: 0;
    padding: 0;
}

.brand-header {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 14px 10px 4px;
}

.brand-logo {
    max-width: 260px;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.contenedor {
    max-width: 1100px;
    margin: 28px auto;
    background-color: var(--panel);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--borde);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.06);
}

h1 {
    margin-top: 0;
    margin-bottom: 16px;
    text-align: center;
}

.aviso {
    background-color: var(--aviso-bg);
    border: 1px solid var(--aviso-borde);
    padding: 14px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.checkbox { margin-bottom: 16px; }
.aviso ul { padding-left: 18px; }

button {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    background: linear-gradient(135deg, #b39370 0%, var(--accion) 60%, #7f6243 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

button:disabled {
    background-color: var(--accion-off);
    cursor: not-allowed;
}

.btn-secundario {
    margin-top: 8px;
    background: #eee3d4;
    color: #5a4733;
    border: 1px solid #ceb798;
}

#btnInstalar {
    margin-bottom: 8px;
}

.oculto { display: none; }

.opcion {
    border: 1px solid var(--borde);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 12px;
    cursor: pointer;
}

.opcion:hover { background-color: #f4faf7; }
.opcion span { color: #46535a; font-size: 14px; }

input[type="number"],
input[type="file"],
input[type="range"] {
    width: 100%;
    padding: 10px;
    margin: 8px 0 14px 0;
    box-sizing: border-box;
    border-radius: 8px;
    border: 1px solid #c7d3cd;
}

input[type="range"] {
    padding: 0;
    height: 32px;
}

select {
    width: 100%;
    padding: 10px;
    margin: 8px 0 14px 0;
    box-sizing: border-box;
    border-radius: 8px;
    border: 1px solid #c7d3cd;
    background: #fff;
}

details {
    margin: 12px 0;
    padding: 10px 12px;
    border: 1px solid var(--borde);
    border-radius: 8px;
    background: #fcfaf7;
}

summary {
    cursor: pointer;
    font-weight: 700;
    margin-bottom: 8px;
}

.grid-condiciones {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
}

.lista-discapacidad {
    max-height: 190px;
    overflow-y: auto;
    border: 1px solid #d8e1db;
    border-radius: 8px;
    background: #fff;
    padding: 8px 10px;
}

.item-discapacidad label {
    margin-top: 0;
    font-weight: 600;
}

.item-discapacidad select {
    margin-top: 6px;
}

.item-discapacidad select + select {
    margin-top: 8px;
}

#tablaMeses input[type="number"] {
    margin: 0;
    min-width: 96px;
    padding: 7px;
    font-size: 13px;
}

label { font-weight: 600; display: block; margin-top: 8px; }

.hint {
    font-size: 13px;
    color: #4d6068;
    margin-top: 0;
}

.resumen {
    background: #f2f8f5;
    border: 1px solid #d6e5df;
    border-radius: 8px;
    padding: 10px;
}

.delta { font-weight: 700; }
.delta.sube { color: var(--sube); }
.delta.baja { color: var(--baja); }
.delta.igual { color: #6c5a0c; }

.tabla-wrap {
    overflow-x: auto;
    border: 1px solid var(--borde);
    border-radius: 10px;
    margin: 14px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 820px;
    background: white;
}

th, td {
    border-bottom: 1px solid #e8efec;
    padding: 8px;
    text-align: left;
    white-space: nowrap;
    font-size: 13px;
}

th { background: #f3f7f5; }
.fila-total td {
    background: #f7efe3;
    border-top: 2px solid #d8c1a3;
    font-weight: 700;
}
.th-estimacion { color: var(--estimacion-naranja); }
.th-empresa { color: var(--empresa-azul); }
.th-diferencia { color: var(--diferencia-verde); }
.valor-estimacion { color: var(--estimacion-naranja); font-weight: 700; }
.input-irpf-nomina { border: 1px solid #9ebbe0 !important; color: var(--empresa-azul); font-weight: 700; }
.valor-diferencia { color: var(--diferencia-verde); font-weight: 700; }

@media (max-width: 700px) {
    .contenedor {
        margin: 12px 6px;
        padding: 14px;
        border-radius: 10px;
    }

    .brand-logo {
        max-width: 190px;
    }

    h1 { font-size: 20px; }
    button {
        font-size: 16px;
        padding: 13px;
    }

    .hint {
        font-size: 12px;
    }

    .grid-condiciones { grid-template-columns: 1fr; }

    #tablaMeses,
    #tablaProyeccion {
        min-width: 0;
    }

    #tablaMeses thead,
    #tablaProyeccion thead {
        display: none;
    }

    #tablaMeses tbody,
    #tablaMeses tfoot,
    #tablaProyeccion tbody {
        display: block;
        width: 100%;
    }

    #tablaMeses tr,
    #tablaProyeccion tr {
        display: block;
        border: 1px solid #d9ccba;
        border-radius: 10px;
        padding: 8px 10px;
        margin-bottom: 10px;
        background: #fff;
    }

    #tablaMeses td,
    #tablaProyeccion td {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 8px;
        border: 0;
        border-bottom: 1px dashed #eadfce;
        padding: 8px 0;
        white-space: normal;
        align-items: center;
    }

    #tablaMeses td::before,
    #tablaProyeccion td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #614a32;
        font-size: 12px;
    }

    #tablaMeses td:last-child,
    #tablaProyeccion td:last-child {
        border-bottom: 0;
    }

    #tablaMeses input[type="number"] {
        min-width: 90px;
        width: 100%;
        font-size: 14px;
    }

    #tablaMeses tfoot tr {
        background: #f7efe3;
        border-style: solid;
    }

    #tablaMeses tfoot td {
        display: block;
        border-bottom: 0;
        padding: 6px 0;
    }

    #tablaMeses tfoot td::before {
        content: none;
    }
}
