/* =========================================================
   VARIABLES
   ========================================================= */

:root {
    --fondo: #f4f6f8;
    --panel: #ffffff;

    --texto: #1f2933;
    --texto-secundario: #66737f;

    --borde: #dde3e8;

    --primario: #173b57;
    --primario-hover: #0f2c42;

    --verde: #26734d;
    --verde-fondo: #e9f5ef;

    --amarillo-fondo: #fff8df;
    --amarillo-borde: #ead68b;

    --azul-claro: #edf5fa;

    --sombra:
        0 4px 18px rgba(0, 0, 0, 0.06);
}


/* =========================================================
   RESET
   ========================================================= */

* {
    box-sizing: border-box;
}


html {
    min-height: 100%;
}


body {
    margin: 0;

    min-height: 100vh;

    background: var(--fondo);

    color: var(--texto);

    font-family:
        Inter,
        "Segoe UI",
        Arial,
        sans-serif;
}


a {
    color: var(--primario);

    text-decoration: none;
}


a:hover {
    text-decoration: underline;
}


button,
input,
select,
textarea {
    font: inherit;
}


/* =========================================================
   ACCESIBILIDAD
   ========================================================= */

.sr-only {
    position: absolute;

    width: 1px;
    height: 1px;

    padding: 0;
    margin: -1px;

    overflow: hidden;

    clip: rect(
        0,
        0,
        0,
        0
    );

    white-space: nowrap;

    border: 0;
}


/* =========================================================
   CONTENEDOR
   ========================================================= */

.contenedor {
    width: min(
        1500px,
        94%
    );

    margin: 0 auto;
}


.contenido-principal {
    min-height: 60vh;
}


/* =========================================================
   CABECERA
   ========================================================= */

.topbar {
    width: 100%;

    min-height: 170px;

    background: var(--primario);

    color: white;

    box-shadow:
        0 2px 8px
        rgba(0, 0, 0, 0.12);
}


.cabecera {
    display: flex;

    align-items: center;

    min-height: 170px;

    gap: 26px;
}


.logo-marco {
    display: flex;

    align-items: center;

    justify-content: center;

    width: 150px;
    height: 150px;

    padding: 0;

    background: transparent;

    border-radius: 50%;

    flex-shrink: 0;

    overflow: hidden;

    box-shadow: none;
}


.logo-marco:hover {
    text-decoration: none;
}


.logo {
    display: block;

    width: 100%;
    height: 100%;

    /* Isotipo de mercadopublico (MP3-CC-003): entero y con aire dentro del marco cuadrado; la palabra va al lado. */
    box-sizing: border-box;
    padding: 18%;
    object-fit: contain;
}


.identidad-texto {
    display: flex;

    flex-direction: column;

    min-width: 0;
}


.marca {
    color: white;

    font-size: 1.65rem;

    font-weight: 700;

    line-height: 1.2;
}


.subtitulo {
    margin-top: 6px;

    color: #dce6ed;

    font-size: 0.95rem;
}


/* =========================================================
   NAVEGACION
   ========================================================= */

.navegacion-principal {
    background: white;

    border-bottom:
        1px solid
        var(--borde);
}


.navegacion-contenido {
    display: flex;

    align-items: stretch;

    gap: 4px;

    min-height: 52px;
}


.navegacion-contenido a {
    display: flex;

    align-items: center;

    padding:
        0
        18px;

    color: var(--texto);

    font-weight: 600;

    border-bottom:
        3px solid
        transparent;
}


.navegacion-contenido a:hover {
    background: #f7f9fa;

    text-decoration: none;
}


.navegacion-contenido a.activo {
    color: var(--primario);

    border-bottom-color:
        var(--primario);
}


/* =========================================================
   BARRA DE CONFIANZA
   ========================================================= */

.barra-confianza {
    background: #f8fafb;

    border-bottom:
        1px solid
        var(--borde);
}


.confianza-contenido {
    display: flex;

    align-items: center;

    flex-wrap: wrap;

    gap:
        8px
        18px;

    min-height: 42px;

    color:
        var(--texto-secundario);

    font-size: 0.78rem;
}


.confianza-estado {
    font-weight: 700;
}


.confianza-ok {
    color: var(--verde);
}


.confianza-alerta {
    color: #9a641c;
}


.confianza-trazabilidad {
    margin-left: auto;
}


/* =========================================================
   HERO
   ========================================================= */

.hero {
    margin:
        34px
        0
        24px;
}


.hero h1 {
    margin:
        4px
        0
        8px;

    font-size: 2rem;

    line-height: 1.2;
}


.hero p {
    max-width: 850px;

    margin-top: 0;

    color:
        var(--texto-secundario);

    line-height: 1.55;
}


.eyebrow {
    display: block;

    margin-bottom: 6px;

    color: var(--verde);

    font-size: 0.74rem;

    font-weight: 700;

    letter-spacing: 0.08em;

    text-transform: uppercase;
}


/* =========================================================
   METRICAS
   ========================================================= */

.metricas {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );

    gap: 18px;

    margin-bottom: 24px;
}


.metricas-mercado {
    grid-template-columns:
        repeat(
            6,
            minmax(0, 1fr)
        );
}


.metrica {
    background: var(--panel);

    padding: 22px;

    border:
        1px solid
        var(--borde);

    border-radius: 10px;

    box-shadow:
        var(--sombra);
}


.metrica span {
    display: block;

    color:
        var(--texto-secundario);

    font-size: 0.86rem;

    margin-bottom: 8px;
}


.metrica strong {
    font-size: 1.7rem;
}


.metrica .metrica-periodo {
    font-size: 1.3rem;
}


/* =========================================================
   PANEL
   ========================================================= */

.panel {
    background: var(--panel);

    border:
        1px solid
        var(--borde);

    border-radius: 10px;

    box-shadow:
        var(--sombra);

    padding: 20px;

    margin-bottom: 28px;
}


.panel-titulo {
    display: flex;

    align-items: flex-start;

    justify-content: space-between;

    gap: 20px;

    margin-bottom: 18px;
}


.panel-titulo h2 {
    margin:
        0;
}


/* =========================================================
   FILTROS EXISTENTES
   ========================================================= */

.filtros {
    display: grid;

    grid-template-columns:
        minmax(320px, 2fr)
        150px
        minmax(180px, 1fr)
        auto;

    gap: 16px;

    align-items: end;
}


.campo {
    display: flex;

    flex-direction: column;

    gap: 6px;
}


.campo label {
    font-size: 0.85rem;

    font-weight: 600;
}


input,
select,
textarea {
    width: 100%;

    min-height: 42px;

    border:
        1px solid
        #c9d1d8;

    border-radius: 7px;

    padding:
        9px
        11px;

    background: white;

    color: var(--texto);
}


input:focus,
select:focus,
textarea:focus {
    outline:
        2px solid
        #aac4d7;

    border-color:
        var(--primario);
}


textarea {
    resize: vertical;
}


/* =========================================================
   BOTONES
   ========================================================= */

.acciones {
    display: flex;

    gap: 8px;
}


.boton {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    min-height: 42px;

    border: 0;

    border-radius: 7px;

    padding:
        8px
        16px;

    background: var(--primario);

    color: white;

    cursor: pointer;

    font-weight: 600;

    white-space: nowrap;
}


.boton:hover {
    background:
        var(--primario-hover);

    color: white;

    text-decoration: none;
}


.boton:disabled {
    opacity: 0.55;

    cursor: not-allowed;
}


.boton-secundario {
    background: #e9eef2;

    color: var(--texto);
}


.boton-secundario:hover {
    background: #dce3e8;

    color: var(--texto);
}


.boton-grande {
    min-height: 50px;

    padding:
        10px
        22px;
}


/* =========================================================
   MERCADO - BUSCADOR
   ========================================================= */

.buscador-mercado {
    margin-bottom: 34px;
}


.form-mercado {
    display: grid;

    grid-template-columns:
        minmax(
            260px,
            1fr
        )
        auto;

    gap: 12px;

    max-width: 1000px;
}


.form-mercado input {
    min-height: 50px;

    font-size: 1rem;
}


/* =========================================================
   MERCADO - INTRO
   ========================================================= */

.mercado-inicio-grid {
    display: grid;

    grid-template-columns:
        repeat(
            4,
            minmax(0, 1fr)
        );

    gap: 18px;

    margin-bottom: 34px;
}


.panel-informativo {
    background: white;

    border:
        1px solid
        var(--borde);

    border-radius: 10px;

    padding: 22px;

    box-shadow:
        var(--sombra);
}


.panel-informativo h2 {
    margin:
        8px
        0;
}


.panel-informativo p {
    margin-bottom: 0;

    color:
        var(--texto-secundario);

    line-height: 1.55;
}


.panel-icono {
    color: var(--verde);

    font-size: 0.78rem;

    font-weight: 800;
}


/* =========================================================
   PRODUCTOS
   ========================================================= */

.productos-grid {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );

    gap: 18px;

    margin-bottom: 34px;
}


.producto-card {
    display: flex;

    flex-direction: column;

    background: white;

    border:
        1px solid
        var(--borde);

    border-radius: 10px;

    padding: 22px;

    box-shadow:
        var(--sombra);
}


.producto-card h3 {
    margin:
        8px
        0
        12px;

    line-height: 1.35;
}


.producto-codigo {
    width: fit-content;

    padding:
        4px
        8px;

    background:
        var(--azul-claro);

    border-radius: 5px;

    color: var(--primario);

    font-family:
        Consolas,
        monospace;

    font-size: 0.8rem;

    font-weight: 700;
}


.producto-codigo-grande {
    margin-top: 10px;

    font-size: 0.9rem;
}


.producto-meta {
    display: flex;

    flex-wrap: wrap;

    gap:
        6px
        14px;

    color:
        var(--texto-secundario);

    font-size: 0.78rem;
}


.producto-periodo {
    margin-top: 12px;

    color:
        var(--texto-secundario);

    font-size: 0.82rem;
}


.producto-accion {
    margin-top: auto;

    padding-top: 18px;

    font-weight: 700;
}


/* =========================================================
   PRODUCTO - HERO
   ========================================================= */

.producto-hero {
    display: flex;

    justify-content:
        space-between;

    gap: 30px;

    padding:
        26px
        0;

    margin-bottom: 20px;

    border-bottom:
        1px solid
        var(--borde);
}


.producto-hero h1 {
    margin:
        10px
        0
        8px;

    font-size: 2rem;
}


.producto-hero p {
    color:
        var(--texto-secundario);
}


.producto-integridad {
    display: flex;

    flex-direction: column;

    align-items: flex-end;

    gap: 4px;

    color: var(--verde);

    white-space: nowrap;
}


.producto-integridad span {
    color:
        var(--texto-secundario);

    font-size: 0.78rem;
}


/* =========================================================
   DOS COLUMNAS
   ========================================================= */

.grid-dos-columnas {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 20px;
}


/* =========================================================
   RANKINGS
   ========================================================= */

.ranking {
    display: flex;

    flex-direction: column;
}


.ranking-fila {
    display: grid;

    grid-template-columns:
        34px
        minmax(0, 1fr)
        auto;

    gap: 12px;

    align-items: center;

    padding:
        12px
        0;

    border-top:
        1px solid
        var(--borde);
}


.ranking-fila:first-child {
    border-top: 0;
}


.ranking-posicion {
    display: flex;

    align-items: center;

    justify-content: center;

    width: 30px;
    height: 30px;

    border-radius: 50%;

    background: #edf1f4;

    color:
        var(--texto-secundario);

    font-size: 0.75rem;

    font-weight: 700;
}


.ranking-contenido {
    display: flex;

    flex-direction: column;

    gap: 3px;

    min-width: 0;
}


.ranking-contenido strong {
    line-height: 1.35;
}


.ranking-contenido span {
    color:
        var(--texto-secundario);

    font-size: 0.77rem;
}


.ranking-valor {
    text-align: right;

    font-weight: 700;

    white-space: nowrap;
}


.ranking-valor small {
    display: block;

    color:
        var(--texto-secundario);

    font-size: 0.68rem;

    font-weight: 400;
}


/* =========================================================
   NOTAS METODOLOGICAS
   ========================================================= */

.nota-semantica {
    margin:
        0
        0
        14px;

    padding: 12px;

    border-left:
        3px solid
        #8ba9bd;

    background: #f7fafc;

    color:
        var(--texto-secundario);

    font-size: 0.82rem;

    line-height: 1.5;
}


.alerta-metodologica {
    margin-bottom: 18px;

    padding:
        14px
        16px;

    border:
        1px solid
        var(--amarillo-borde);

    border-radius: 8px;

    background:
        var(--amarillo-fondo);
}


.alerta-metodologica strong {
    display: block;

    margin-bottom: 5px;
}


.alerta-metodologica p {
    margin: 0;

    line-height: 1.5;
}


.reglas-panel {
    margin:
        10px
        0
        34px;

    padding:
        18px;

    border-left:
        4px solid
        var(--primario);

    background: white;
}


.reglas-panel p {
    margin-bottom: 0;

    color:
        var(--texto-secundario);

    line-height: 1.55;
}


/* =========================================================
   TABLA
   ========================================================= */

.tabla-contenedor {
    overflow-x: auto;

    background: white;

    border:
        1px solid
        var(--borde);

    border-radius: 10px;

    box-shadow:
        var(--sombra);
}


.tabla-mercado {
    box-shadow: none;
}


table {
    width: 100%;

    border-collapse: collapse;
}


th {
    background: #edf1f4;

    text-align: left;

    font-size: 0.82rem;

    padding: 13px;

    white-space: nowrap;
}


td {
    padding: 13px;

    border-top:
        1px solid
        var(--borde);

    vertical-align: top;
}


tbody tr:hover {
    background: #f8fafb;
}


td.proceso {
    min-width: 360px;
}


.proceso > a {
    font-weight: 600;
}


.identificador {
    margin-top: 5px;

    color:
        var(--texto-secundario);

    font-size: 0.75rem;

    word-break: break-all;
}


.numero {
    text-align: right;

    white-space: nowrap;
}


.moneda {
    color:
        var(--texto-secundario);

    font-size: 0.8rem;
}


/* =========================================================
   CABECERA RESULTADOS
   ========================================================= */

.resultados-cabecera {
    display: flex;

    justify-content:
        space-between;

    align-items: end;

    gap: 20px;

    margin-bottom: 12px;
}


.resultados-cabecera h2 {
    margin: 0;
}


.resultados-cabecera p {
    margin:
        4px
        0
        0;

    color:
        var(--texto-secundario);
}


.pagina-info {
    color:
        var(--texto-secundario);

    white-space: nowrap;
}


/* =========================================================
   ESTADOS
   ========================================================= */

.estado {
    display: inline-block;

    padding:
        4px
        8px;

    border-radius: 999px;

    background: #e9eef2;

    white-space: nowrap;

    font-size: 0.78rem;
}


.estado-grande {
    height: fit-content;
}


/* =========================================================
   VACIOS
   ========================================================= */

.sin-resultados {
    padding: 50px;

    text-align: center;

    color:
        var(--texto-secundario);
}


.estado-vacio {
    padding:
        50px
        20px;

    text-align: center;

    color:
        var(--texto-secundario);
}


/* =========================================================
   PAGINACION
   ========================================================= */

.paginacion {
    display: flex;

    justify-content: center;

    align-items: center;

    gap: 25px;

    padding:
        26px
        0;
}


/* =========================================================
   DETALLE PROCESO
   ========================================================= */

.volver {
    margin:
        28px
        0
        18px;
}


.detalle {
    background: white;

    border:
        1px solid
        var(--borde);

    border-radius: 10px;

    padding: 28px;

    box-shadow:
        var(--sombra);
}


.detalle-cabecera {
    display: flex;

    justify-content:
        space-between;

    gap: 30px;

    padding-bottom: 20px;

    margin-bottom: 25px;

    border-bottom:
        1px solid
        var(--borde);
}


.detalle-cabecera h1 {
    margin:
        6px
        0
        0;
}


.anio {
    color:
        var(--texto-secundario);

    font-weight: 600;
}


.detalle-grid {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );

    gap: 20px;
}


.dato {
    padding:
        14px
        0;
}


.dato label {
    display: block;

    margin-bottom: 5px;

    color:
        var(--texto-secundario);

    font-size: 0.78rem;

    text-transform: uppercase;
}


/* =========================================================
   ANALISTA IA
   ========================================================= */

.ia-contenedor {
    display: grid;

    grid-template-columns:
        minmax(
            0,
            2fr
        )
        minmax(
            260px,
            0.75fr
        );

    gap: 22px;

    margin-bottom: 40px;
}


.ia-chat,
.ia-lateral {
    background: white;

    border:
        1px solid
        var(--borde);

    border-radius: 10px;

    box-shadow:
        var(--sombra);
}


.ia-chat {
    padding: 22px;
}


.ia-lateral {
    padding: 22px;
}


.ia-lateral h2 {
    margin-top: 0;

    font-size: 1.1rem;
}


.ia-lateral ul {
    padding-left: 20px;

    color:
        var(--texto-secundario);

    line-height: 1.6;
}


.ia-mensaje {
    max-width: 850px;

    margin-bottom: 22px;

    padding: 18px;

    border-radius: 10px;

    background:
        var(--azul-claro);
}


.ia-mensaje p {
    line-height: 1.55;
}


.ia-formulario {
    display: flex;

    flex-direction: column;

    gap: 12px;
}


.integridad-card {
    display: flex;

    flex-direction: column;

    gap: 4px;

    margin-top: 24px;

    padding: 15px;

    border:
        1px solid
        #b8dcc8;

    border-radius: 8px;

    background:
        var(--verde-fondo);
}


.integridad-card span,
.integridad-card small {
    color:
        var(--texto-secundario);
}


.integridad-card strong {
    color:
        var(--verde);
}


/* =========================================================
   TEXTOS
   ========================================================= */

.texto-secundario {
    color:
        var(--texto-secundario);
}


/* =========================================================
   FOOTER
   ========================================================= */

.footer {
    margin-top: 40px;

    padding:
        34px
        20px;

    text-align: center;

    color:
        var(--texto-secundario);

    background: white;

    border-top:
        1px solid
        var(--borde);

    font-size: 0.8rem;
    line-height: 1.55;
}


.footer-contenido {
    display: grid;
    width: min(1100px, 94%);
    margin: 0 auto;
    gap: 5px;
}


.footer-marca {
    color: var(--primario);
    font-size: 0.9rem;
}


.footer-aviso,
.footer-registro,
.footer-aclaracion {
    display: block;
}


.footer-registro a {
    overflow-wrap: anywhere;
    color: var(--primario);
    font-weight: 600;
}


.footer-aclaracion {
    max-width: 980px;
    margin: 0 auto;
    color: #64748b;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (
    max-width: 1100px
) {

    .metricas-mercado {
        grid-template-columns:
            repeat(
                3,
                minmax(0, 1fr)
            );
    }


    .mercado-inicio-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }


    .productos-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }

}


/* =========================================================
   TABLET PEQUEÑA
   ========================================================= */

@media (
    max-width: 900px
) {

    .contenedor {
        width: 96%;
    }


    .topbar,
    .cabecera {
        min-height: 150px;
    }


    .logo-marco {
        width: 132px;
        height: 132px;
    }


    .marca {
        font-size: 1.3rem;
    }


    .metricas {
        grid-template-columns:
            1fr;
    }


    .metricas-mercado {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }


    .filtros {
        grid-template-columns:
            1fr;
    }


    .grid-dos-columnas {
        grid-template-columns:
            1fr;
    }


    .ia-contenedor {
        grid-template-columns:
            1fr;
    }


    .producto-hero {
        flex-direction:
            column;
    }


    .producto-integridad {
        align-items:
            flex-start;
    }


    .confianza-trazabilidad {
        margin-left: 0;
    }

}


/* =========================================================
   MOVIL
   ========================================================= */

@media (
    max-width: 600px
) {

    .cabecera {
        gap: 12px;
    }


    .logo-marco {
        width: 106px;
        height: 106px;
    }


    .marca {
        font-size: 1rem;
    }


    .subtitulo {
        font-size: 0.7rem;
    }


    .navegacion-contenido {
        overflow-x: auto;
    }


    .navegacion-contenido a {
        padding:
            0
            13px;

        white-space: nowrap;
    }


    .form-mercado {
        grid-template-columns:
            1fr;
    }


    .mercado-inicio-grid,
    .productos-grid,
    .metricas-mercado {
        grid-template-columns:
            1fr;
    }


    .acciones {
        flex-direction:
            column;
    }


    .detalle {
        padding: 18px;
    }


    .detalle-grid {
        grid-template-columns:
            1fr;
    }


    .detalle-cabecera {
        flex-direction:
            column;
    }


    td.proceso {
        min-width: 280px;
    }


    .ranking-fila {
        grid-template-columns:
            30px
            minmax(0, 1fr);
    }


    .ranking-valor {
        grid-column:
            2;

        text-align: left;
    }

}
