body {
    font-family: Arial, sans-serif;
    background: #f4f4f4;
    margin: 0;
    padding: 20px;
    color: #222;
}

.container {
    max-width: 1100px;
    margin: auto;
    background: white;
    padding: 25px;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

h1 {
    text-align: center;
    margin-bottom: 10px;
}

.intro {
    text-align: center;
    color: #555;
    margin-bottom: 25px;
}

label {
    display: block;
    margin-top: 16px;
    font-weight: bold;
}

input, select {
    width: 100%;
    padding: 12px;
    margin-top: 6px;
    font-size: 18px;
    border-radius: 8px;
    border: 1px solid #aaa;
    box-sizing: border-box;
    background: white;
}

button {
    width: 100%;
    margin-top: 22px;
    padding: 14px;
    font-size: 18px;
    border: none;
    border-radius: 8px;
    background: #222;
    color: white;
    cursor: pointer;
}

button:hover {
    background: #444;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

@media (max-width: 760px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

.resultados {
    margin-top: 25px;
    display: grid;
    gap: 14px;
}

.resultado {
    background: #f7f7f7;
    border-left: 5px solid #222;
    padding: 15px;
    border-radius: 8px;
}

.resultado span {
    display: block;
    font-size: 26px;
    font-weight: bold;
    margin-top: 5px;
}

.ok {
    border-left-color: #0b7a28;
    background: #effaf2;
}

.warning {
    border-left-color: #c47a00;
    background: #fff7e8;
}

.no {
    border-left-color: #b00020;
    background: #fff0f3;
}

.nota {
    margin-top: 22px;
    font-size: 14px;
    color: #555;
    background: #f1f1f1;
    padding: 14px;
    border-radius: 8px;
    line-height: 1.45;
}

.error {
    margin-top: 18px;
    color: #b00020;
    font-weight: bold;
    display: none;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
    font-size: 14px;
}

th, td {
    border: 1px solid #ccc;
    padding: 8px;
    text-align: center;
}

th {
    background: #eee;
}


.visual-grid {
    margin-top: 25px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

@media (max-width: 900px) {
    .visual-grid {
        grid-template-columns: 1fr;
    }
}

.visual-card {
    background: #fafafa;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 14px;
}

.visual-card h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.visual-card svg {
    margin-top: 0;
    border: none;
    background: white;
}

.truck-img {
    width: 100%;
    height: auto;
    max-height: 260px;
    object-fit: contain;
    display: block;
    background: white;
    border-radius: 10px;
}

.truck-svg-fallback {
    width: 100%;
    display: block;
}

.small-note {
    font-size: 13px;
    color: #555;
    margin-top: 8px;
    line-height: 1.35;
}

svg {
    width: 100%;
    margin-top: 25px;
    background: #fafafa;
    border-radius: 10px;
    border: 1px solid #ddd;
}

.registro-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.72);
}

.registro-card {
    width: 100%;
    max-width: 460px;
    background: white;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.registro-card h2 {
    margin: 0 0 8px;
    font-size: 24px;
}

.usuario-activo {
    text-align: center;
    color: #555;
    font-size: 14px;
    margin: -10px 0 20px;
    line-height: 1.35;
}


.optimizacion {
    margin-top: 22px;
    background: #f8fafc;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 16px;
}

.optimizacion h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.accion-ok {
    color: #0b7a28;
    font-weight: bold;
}

.accion-no {
    color: #b00020;
    font-weight: bold;
}


.header-titulo {
    text-align: center;
    margin-bottom: 24px;
}

.header-titulo h1 {
    margin: 0;
    font-size: 52px;
    font-weight: 900;
    letter-spacing: 3px;
    line-height: 1;
}

.header-titulo h2 {
    margin: 12px 0 0 0;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
}

.subtitulo-loreto {
    margin-top: 10px;
    color: #555;
    font-size: 17px;
    font-weight: 600;
}

@media (max-width: 760px) {
    .header-titulo h1 {
        font-size: 38px;
    }

    .header-titulo h2 {
        font-size: 18px;
    }

    .subtitulo-loreto {
        font-size: 15px;
    }
}


.detalle-desplegable {
    margin-top: 14px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 12px;
}

.detalle-desplegable summary {
    cursor: pointer;
    font-weight: bold;
    color: #333;
    user-select: none;
}

.detalle-desplegable .detalle-contenido {
    margin-top: 10px;
    font-size: 14px;
    color: #444;
    line-height: 1.45;
}

.detalle-desplegable p {
    margin: 8px 0;
}


.aviso-general-loreto {
    margin-top: 22px;
    font-size: 16px;
    color: #555;
    background: #f1f1f1;
    padding: 18px;
    border-radius: 12px;
    line-height: 1.45;
}

.aviso-general-loreto p {
    margin: 0 0 12px 0;
}

.aviso-general-loreto p:last-child {
    margin-bottom: 0;
}


#panelOptimizacion table th:nth-child(1),
#panelOptimizacion table td:nth-child(1) {
    width: 38%;
}

#panelOptimizacion table th:nth-child(2),
#panelOptimizacion table td:nth-child(2) {
    width: 62%;
}

.visual-grid {
    grid-template-columns: 1fr !important;
}


@media (max-width: 760px) {
    body {
        padding: 8px;
    }

    .container {
        padding: 14px;
        border-radius: 10px;
    }

    .resultados {
        display: block !important;
        margin-top: 18px;
    }

    .resultado {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box;
        margin-bottom: 12px;
        overflow-wrap: anywhere;
    }

    .resultado span {
        font-size: 22px;
        line-height: 1.2;
    }

    #factibilidadCaja {
        display: block !important;
        width: 100% !important;
    }

    #detalle {
        display: block !important;
        width: 100% !important;
    }

    #panelOptimizacion {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #panelOptimizacion table {
        width: 100%;
        min-width: 0;
        table-layout: fixed;
        font-size: 14px;
    }

    #panelOptimizacion th,
    #panelOptimizacion td {
        padding: 8px 6px;
        word-break: break-word;
        white-space: normal;
    }

    #panelOptimizacion th:nth-child(1),
    #panelOptimizacion td:nth-child(1) {
        width: 38%;
    }

    #panelOptimizacion th:nth-child(2),
    #panelOptimizacion td:nth-child(2) {
        width: 62%;
    }

    .accion-ok,
    .accion-no {
        font-size: 14px;
        line-height: 1.25;
    }

    .visual-grid {
        display: block !important;
    }
}


#tablaResultado th,
#tablaResultado td {
    word-break: normal;
    overflow-wrap: anywhere;
}

@media (max-width: 760px) {
    #tablaResultado {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    #tablaResultado table,
    #tablaResultado thead,
    #tablaResultado tbody,
    #tablaResultado tr {
        width: 100%;
    }

    #tablaResultado th,
    #tablaResultado td {
        font-size: 13px;
        padding: 8px 6px;
    }
}


.campo-error-operativo {
    border-color: #c62828 !important;
    background: #fff5f5 !important;
}
