:root {
    --fondo: #eef4f2;
    --tarjeta: #ffffff;
    --tinta: #12323b;
    --tinta-suave: #5f7d86;
    --acento: #0e8f8a;
    --acento-claro: #4fd1c5;
    --marino: #08303c;
    --borde: #d5e2e0;
    --excelente: #1e8e3e;
    --buena: #1971c2;
    --suficiente: #f9a825;
    --insuficiente: #c62828;
    --sindato: #9e9e9e;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--tinta);
    background: var(--fondo);
}

body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ---- Cabecera ---- */
.topbar {
    background: linear-gradient(180deg, #08303c, #0b3a46);
    color: #fff;
    padding: 10px 18px 8px;
    flex: 0 0 auto;
}
.topbar-main {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.topbar .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: #fff;
    text-decoration: none;
}
.topbar .brand span { color: var(--acento-claro); }
.topbar .logo {
    height: 30px;
    width: auto;
    display: block;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}
.nav {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 0.92rem;
}
.nav a {
    color: #b9d6d3;
    text-decoration: none;
}
.nav a:hover { color: #fff; }
.nav a.on {
    color: #fff;
    font-weight: 700;
    border-bottom: 2px solid var(--acento-claro);
    padding-bottom: 3px;
}
.nav .soon {
    color: #6f9694;
    cursor: default;
}
.fresh {
    margin: 0 0 0 auto;
    text-align: right;
    font-size: 0.74rem;
    line-height: 1.4;
    color: #9dc3c0;
}
.fresh b { color: #e9f7f5; font-weight: 600; }

.leyenda {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 22px;
    align-items: center;
    font-size: 0.86rem;
    padding: 12px 0 6px;
}
a.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #e9f7f5;
    text-decoration: none;
    padding: 2px 4px;
    border-radius: 6px;
}
a.chip:hover { background: rgba(255, 255, 255, 0.1); }
.chip .somb {
    width: 16px;
    height: 16px;
    display: block;
    flex: 0 0 auto;
}
.chip .n { font-weight: 700; }

/* ---- Cuerpo: panel + mapa ---- */
.layout {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

.panel {
    flex: 0 0 330px;
    width: 330px;
    background: var(--tarjeta);
    border-right: 1px solid var(--borde);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow-y: auto;
}
.panel .bloque { display: flex; flex-direction: column; }
.h2 {
    margin: 0;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6b8b90;
    font-weight: 700;
}
.big {
    margin: 8px 0 0;
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--acento);
}
.big small {
    display: block;
    margin-top: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #6b8b90;
}
.nota {
    margin: 8px 0 0;
    font-size: 0.78rem;
    color: #7f9ba0;
    line-height: 1.4;
}
.bar {
    display: flex;
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: #eef4f2;
    margin-top: 10px;
}
.bar i { display: block; height: 100%; }
.rows {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 12px;
    font-size: 0.84rem;
}
.row { display: flex; align-items: center; gap: 8px; }
.row .dot {
    width: 11px;
    height: 11px;
    border-radius: 3px;
    flex: 0 0 auto;
}
.row .pct {
    margin-left: auto;
    color: #8aa6aa;
    font-size: 0.78rem;
    width: 44px;
    text-align: right;
}
.row .n {
    width: 52px;
    text-align: right;
    font-weight: 700;
    color: #3c5a60;
}
.pie-panel {
    margin-top: auto;
    border-top: 1px solid #e3ecea;
    padding-top: 14px;
    font-size: 0.78rem;
    color: #7f9ba0;
    line-height: 1.5;
}
.pie-panel p { margin: 0 0 8px; }
.pie-panel p:last-child { margin-bottom: 0; }
.pie-panel .aviso {
    background: #f2f8f7;
    border: 1px solid var(--borde);
    border-radius: 10px;
    padding: 9px 11px;
}
.pie-panel a { color: var(--acento); text-decoration: none; }

/* ---- Mapa ---- */
.map-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
}
#map {
    position: absolute;
    inset: 0;
}
.map-notice {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff3cd;
    border: 1px solid #ffe69c;
    color: #664d03;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    z-index: 5;
    max-width: 90%;
}
.hidden { display: none; }

/* ---- Ficha (InfoWindow) ---- */
.ficha { font-size: 0.85rem; line-height: 1.45; min-width: 210px; max-width: 260px; }
.ficha h3 {
    margin: 0 0 6px;
    font-size: 0.95rem;
    color: var(--tinta);
}
.ficha .badge {
    display: inline-block;
    font-weight: 700;
    font-size: 0.75rem;
    color: #fff;
    padding: 2px 9px;
    border-radius: 999px;
    margin-bottom: 6px;
}
.ficha table { border-collapse: collapse; width: 100%; }
.ficha td {
    padding: 2px 0;
    vertical-align: top;
}
.ficha td.k {
    color: var(--tinta-suave);
    padding-right: 8px;
    white-space: nowrap;
}

/* ---- Pie ---- */
.foot {
    flex: 0 0 auto;
    padding: 7px 18px;
    font-size: 0.74rem;
    color: var(--tinta-suave);
    background: var(--tarjeta);
    border-top: 1px solid var(--borde);
}
.foot a { color: var(--acento); }

/* ---- Responsive: el rediseño es de escritorio; en móvil, mapa a pantalla completa ---- */
@media (max-width: 900px) {
    /* El panel de la vista no se muestra en móvil: el mapa manda. */
    .panel { display: none; }
}

@media (max-width: 700px) {
    /* La cabecera se queda con lo mínimo: marca + leyenda. La fuente y la fecha de los datos
     * bajan al pie: si no, entre el navegador y la cabecera se comen casi media pantalla y el
     * mapa queda aplastado (visto en móvil real, 16-sep-2026). */
    .topbar { padding: 6px 12px 4px; }
    .topbar .brand { font-size: 1.05rem; }
    .topbar .logo { height: 22px; }
    .nav { display: none; }
    .fresh { display: none; }
    /* Leyenda en UNA sola línea deslizable: no crece en alto y sigue siendo pulsable. */
    .leyenda {
        font-size: 0.72rem;
        gap: 14px;
        padding: 6px 0 2px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .leyenda::-webkit-scrollbar { display: none; }
    .chip { flex: 0 0 auto; }
    .chip .n { display: none; }   /* los totales son informacion de escritorio */
    .chip .somb { width: 13px; height: 13px; }
    .foot { font-size: 0.62rem; padding: 5px 12px; line-height: 1.5; }
}
