/* ux-mapa.css — Bloque #22 (UX del tablero: estructura). Se carga DESPUÉS de site.css.
   No modifica site.css; sobrescribe lo necesario (algunos !important de site.css y estilos en línea de index.js / poligono.js).
   Breakpoints propios: >=1200 escritorio, 768-1199 tablet, <=767 celular. */

/* ---------- Variables ---------- */
:root {
    --ux-fuente: 'Quicksand', sans-serif;
    --ux-tema: #682c5c;          /* SSPE: morado */
    --ux-accion: #417272;        /* botón "Aplicar" en SSPE */
    --ux-oro: #DAAE4E;           /* amarillo del logo del Consejo */
    --ux-titulo: var(--ux-tema);
    --ux-texto: #6f6c6e;
    --ux-tarjeta: #fff;
    --ux-linea: #e7e7ea;
    --ux-radio: 12px;
    --ux-sombra: 0 1px 3px rgba(0,0,0,.08), 0 4px 14px rgba(0,0,0,.06);
    --ux-pad: 24px;
    --ux-hueco: 16px;
    --ux-mapa-alto: clamp(480px, 75vh, 960px);
}
@supports (height: 1dvh) {
    :root { --ux-mapa-alto: clamp(480px, 75dvh, 960px); }
}
body.ux-fuente-inegi {           /* INEGI: verde (index.js ya lo pinta así en línea) */
    --ux-tema: #417272;
    --ux-accion: #682c5c;
}

/* ---------- Base y tipografía única ---------- */
body { width: 100%; }
html, body, .Filtros h3, .Filtros p, .Filtros label, .TituloCardBtn, .btn, input, select, textarea,
.table, .swal2-popup, .select2-container, .select2-results__option, .ux-header, .ux-kpis, .ux-grid {
    font-family: var(--ux-fuente) !important;
}
[hidden] { display: none !important; }

/* El encabezado viejo del layout se sustituye por .ux-header */
.navbarcustom, #NewNavCustom { display: none !important; }

/* ---------- Encabezado ---------- */
.ux-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    column-gap: 16px;
    padding: 10px var(--ux-pad);
    background-color: var(--ux-tema);
    border-bottom: 1px solid rgba(255,255,255,.28);
    transition: background-color .2s;
}
.ux-marca { display: flex; align-items: center; gap: 14px; }
.ux-marca a { display: inline-flex; line-height: 0; }
.ux-logo-ficosec { height: 40px; width: auto; display: block; }
.ux-logo-consejo { height: 44px; width: auto; display: block; }
.ux-titulo {
    margin: 0; text-align: center; color: #fff;
    font-size: 1.25rem; font-weight: 700; letter-spacing: .12em; line-height: 1.2;
}
.ux-fuentes { display: flex; align-items: center; gap: 14px; justify-content: flex-end; }
.ux-fuentes-btn { display: flex; gap: 10px; }
#contenedorDatos {
    margin: 0; color: #fff; font-size: .8rem; font-weight: 500; line-height: 1.25;
    text-align: right; max-width: 170px;
}
.ux-fuente {
    width: 48px; height: 48px; padding: 3px; border: 0; border-radius: 12px; background: #fff;
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
    opacity: .85; transition: opacity .15s, box-shadow .15s;
}
.ux-fuente img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; }
.ux-fuente:hover { opacity: 1; }
.ux-fuente:focus-visible, #Flecha:focus-visible, .mapa-opcion:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.ux-fuente[aria-pressed="true"] { opacity: 1; box-shadow: 0 0 0 3px var(--ux-oro); }

/* ---------- Barra de filtros ---------- */
#Divfiltros {
    background-color: var(--ux-tema) !important;
    margin: 0 !important;
    padding: 12px var(--ux-pad) 16px;
    display: grid;
    grid-template-areas: "cab" "cont" "acc";
    row-gap: 12px;
    transition: background-color .2s;
}
.ux-cab { grid-area: cab; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.Filtros .ux-cab h3 { margin: 0; font-size: 1.25rem; font-weight: 700; color: #fff; }
#ContentFiltros { grid-area: cont; margin: 0; }
.ux-acciones { grid-area: acc; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 12px; }
#Divfiltros.ux-plegada { grid-template-areas: "cab acc"; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; }
#Divfiltros.ux-plegada .ux-cab { justify-content: flex-start; }
#Divfiltros.ux-plegada .ux-cab h3 { display: none; }

/* "Consultando datos de" queda como texto para lectores de pantalla (las fuentes se eligen con los logos) */
#Consultro {
    position: absolute !important; width: 1px; height: 1px; margin: -1px !important; padding: 0 !important;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Botón de plegado (es #Flecha: conserva su id y el handler de vialidadscript.js) */
#Flecha {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
    border: 1px solid rgba(255,255,255,.75); border-radius: 10px; color: #fff; background: transparent;
    font-weight: 700; font-size: .95rem; cursor: pointer; user-select: none; margin: 0 !important;
}
#Flecha:hover { background: rgba(255,255,255,.12); }
#Flecha .ux-flecha-ico { transition: transform .2s; color: #fff; }
#Flecha[aria-expanded="true"] .ux-flecha-ico { transform: rotate(180deg); }

/* ---------- Formulario de filtros (#23): rejilla uniforme ----------
   #ContentFiltros sigue siendo un bloque (slideToggle de vialidadscript.js le devuelve display:block); la rejilla vive en .ux-form. */
#ContentFiltros { padding: 0; }
.ux-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; align-items: start; }
/* bloque (no flex): index.js fija display:block|none en línea sobre #ContentCausa y no debe romper la celda */
.ux-campo { min-width: 0; }
.ux-campo > * + * { margin-top: 6px; }
.ux-campo > label, .ux-campo > .ux-etq, .ux-campo > .ux-ayuda { display: block; }
.ux-campo--2 { grid-column: span 2; }
.Filtros .ux-campo label, .Filtros .ux-etq {
    margin: 0; padding: 0; color: #fff; font-size: .95rem; font-weight: 700; line-height: 1.25; white-space: normal;
}
.ux-ayuda { min-height: 1.1em; margin-bottom: 0; font-size: .78rem; line-height: 1.2; color: rgba(255,255,255,.85); }
/* Controles: 44 px de alto, radio 10 px, misma tipografía */
.ux-campo input.InputFecha, .ux-campo .select2-container--default .select2-selection--multiple {
    box-sizing: border-box; width: 100% !important; height: 44px !important; min-height: 44px; margin: 0;
    border: 1px solid transparent; border-radius: 10px; background-color: #fff; color: #333; font-size: 1rem;
}
.ux-campo input.InputFecha { padding: 0 12px; }
.ux-campo input.InputFecha:focus, .ux-campo .select2-container--focus .select2-selection--multiple, .ux-campo .select2-container--open .select2-selection--multiple {
    outline: 3px solid var(--ux-oro); outline-offset: 1px; border-color: transparent;
}
.ux-campo .select2-container { width: 100% !important; max-width: 100%; display: block; }
.ux-campo .select2-selection--multiple { position: relative; overflow: hidden; display: flex !important; flex-wrap: nowrap; align-items: center; padding: 0 68px 0 10px; }
.ux-campo .select2-selection--multiple .select2-selection__rendered {
    display: flex !important; flex: 0 1 auto; flex-wrap: nowrap; align-items: center; min-width: 0; height: auto;
    margin: 0; padding: 0; overflow: hidden; list-style: none;
}
.ux-campo .select2-selection--multiple .select2-selection__choice {
    float: none; flex: none; margin: 0 6px 0 0; padding: 2px 8px; font-size: .85rem; line-height: 1.4; white-space: nowrap;
    border-radius: 999px; background: #eceaec; border: 0; color: #333;
}
.ux-campo .select2-selection--multiple .select2-search--inline { float: none; flex: 1 0 40px; margin: 0; min-width: 40px; display: flex; align-items: center; height: 100%; }
.ux-campo .select2-selection--multiple .select2-search__field {
    display: block; margin: 0 !important; width: 100% !important; height: 24px !important; min-height: 0; padding: 0; font-size: 1rem; line-height: 24px; color: #333; resize: none; overflow: hidden;
}
.ux-campo .select2-selection--multiple .select2-selection__clear {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%); margin: 0; padding: 0; float: none; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; font-size: 1.2rem; line-height: 1; color: #666; cursor: pointer;
}
.ux-mas {
    position: absolute; right: 34px; top: 50%; transform: translateY(-50%); pointer-events: none;
    background: var(--ux-oro); color: #2b2b2b; font-weight: 700; font-size: .78rem; line-height: 1; padding: 4px 8px; border-radius: 999px;
}
/* Casillas: mismo tamaño y misma altura que los controles */
.ux-checks { display: flex; flex-wrap: wrap; align-items: center; gap: 0 18px; min-height: 44px; }
.ux-checks .form-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin: 0; padding: 0; }
.ux-checks .form-check-input {
    position: static; flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--ux-oro); cursor: pointer;
}
.ux-checks .form-check-label { margin: 0; cursor: pointer; display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; }
/* La etiqueta de género que no corresponde a la fuente la oculta index.js (display:none); no deja hueco */

/* Chips de filtros activos (solo con la barra plegada; los pinta ux.js) */
.ux-chips { display: none; flex: 1 1 0; min-width: 0; flex-wrap: wrap; align-items: center; gap: 8px; }
.ux-plegada .ux-chips { display: flex; }
.ux-chip {
    display: inline-flex; align-items: center; max-width: 100%; min-height: 32px; padding: 0 12px; box-sizing: border-box;
    border-radius: 999px; background: rgba(255,255,255,.2); color: #fff; font-size: .85rem; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ux-chip--vacio { background: transparent; border: 1px dashed rgba(255,255,255,.7); font-weight: 500; }

/* Acciones: fuera de #ContentFiltros, siempre visibles; estilo propio, sin panel gris */
.ux-acciones .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-sizing: border-box;
    min-height: 44px; width: auto; margin: 0; padding: 0 22px; border-radius: 10px;
    font-size: 1rem; font-weight: 700; line-height: 1; white-space: nowrap; cursor: pointer; box-shadow: none;
}
.ux-acciones .btnOpcionesFiltros { background: var(--ux-accion) !important; color: #fff !important; border: 2px solid var(--ux-accion); }
.ux-acciones .btnDescargarFiltro { background: transparent !important; color: #fff !important; border: 2px solid rgba(255,255,255,.85); flex-direction: row; flex-wrap: nowrap; }
.ux-acciones .btnDescargarFiltro:hover { background: rgba(255,255,255,.14) !important; }
.ux-acciones .btnOpcionesFiltros:hover { filter: brightness(1.1); }
.ux-acciones .btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.ux-acciones .btnDescargarFiltro svg { flex: none; }

/* ---------- Tablero: franja de indicadores + mapa ---------- */
.ux-tablero { padding: var(--ux-hueco) var(--ux-pad) 24px; }
.ux-kpis {
    display: flex; background: var(--ux-tarjeta); border-radius: var(--ux-radio) var(--ux-radio) 0 0;
    box-shadow: var(--ux-sombra); border-bottom: 1px solid var(--ux-linea); overflow: hidden; position: relative;
}
.ux-kpi { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-left: 1px solid var(--ux-linea); }
.ux-kpi:first-child { border-left: 0; }
.ux-kpi-ico { color: #8b8890; display: inline-flex; flex: none; }
.ux-kpi-txt { min-width: 0; }
.ux-kpi-cifra { font-size: 1.6rem; font-weight: 700; line-height: 1.1; color: #333; white-space: nowrap; }
.ux-kpi-cifra span { font-size: inherit; }
.ux-kpi-etq { font-size: .8rem; font-weight: 500; color: var(--ux-texto); line-height: 1.2; }
/* Estado vacío: la cifra se muestra como "—" sin tocar el texto real que escribe index.js */
.ux-vacio #siniestros, .ux-vacio #Defuncio, .ux-vacio #lesio, .ux-vacio #Daños { font-size: 0; }
.ux-vacio #siniestros::after, .ux-vacio #Defuncio::after, .ux-vacio #lesio::after, .ux-vacio #Daños::after {
    content: "\2014"; font-size: 1.6rem; color: #a3a0a6;
}

.ux-mapa-wrap {
    position: relative; overflow: hidden; border-radius: 0 0 var(--ux-radio) var(--ux-radio);
    box-shadow: var(--ux-sombra); background: #e5e3df;
}
/* Vence a site.css:276-283 (height:807px !important; margin-right:30px !important) sin editarlo */
.ux-mapa-wrap #idmap.mapa {
    height: var(--ux-mapa-alto) !important; width: 100% !important; margin: 0 !important; border: 0 !important;
    padding: 0; position: relative; z-index: 0; isolation: isolate;
}
.ux-mapa-wrap .MapaCalor { position: absolute !important; top: 12px; left: 12px; z-index: 3; visibility: visible !important; }
.ux-mapa-wrap .mapa-opcion {
    display: flex; align-items: center; gap: 8px; width: auto; height: auto; min-height: 44px; padding: 0 14px;
    background-color: var(--ux-oro); color: #3d2b05; border-radius: 10px; font-size: .95rem; font-weight: 700;
    box-shadow: 0 2px 6px rgba(0,0,0,.25); cursor: pointer;
}
.ux-mapa-wrap .mapa-opcion:hover { background-color: #c99a3a; border-radius: 10px; }
.ux-mapa-wrap .mapa-opcion p { margin: 0; font-size: inherit; font-weight: inherit; white-space: nowrap; }
.ux-mapa-wrap .rectagulo-calor { width: 22px; height: 22px; margin: 0; border-width: 1px; border-radius: 4px; flex: none; background-size: cover; }
.ux-vacio .MapaCalor .mapa-opcion { opacity: .55; cursor: not-allowed; }

#uxMapaVacio {
    position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center;
    pointer-events: none; padding: 16px;
}
#uxMapaVacio .ux-vacio-msg {
    background: #fff; border-radius: var(--ux-radio); box-shadow: 0 4px 18px rgba(0,0,0,.18);
    padding: 16px 24px; max-width: min(440px, 100%); text-align: center;
}
#uxMapaVacio .ux-vacio-tit { margin: 0 0 6px; font-weight: 700; font-size: 1.05rem; color: var(--ux-titulo); }
#uxMapaVacio .ux-vacio-txt { margin: 0; font-size: .9rem; color: var(--ux-texto); line-height: 1.4; }

/* ---------- Rejilla de tarjetas ---------- */
.ux-grid {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-flow: row dense;
    gap: var(--ux-hueco); margin-top: var(--ux-hueco);
}
.ux-cel { min-width: 0; }
.ux-cel--2 { grid-column: span 2; }
.ux-cel > .card {
    width: 100% !important; height: 100%; margin: 0 !important; background: var(--ux-tarjeta); border: 0;
    border-radius: var(--ux-radio); box-shadow: var(--ux-sombra); text-align: left; position: relative;
    display: flex; flex-direction: column;
}
.ux-cel > .card > .row { display: block; margin: 0; padding: 16px 16px 0; }
.ux-cel > .card > .row > .col-6 { flex: none; width: 100%; max-width: 100%; padding: 0; }
.ux-cel .card .TituloCardBtn {
    background: none; color: var(--ux-titulo); border-radius: 0; width: 100%; margin: 0 0 8px; padding: 0 0 8px;
    border-bottom: 2px solid var(--ux-oro); font-size: 1rem; font-weight: 700; text-align: left; line-height: 1.25;
}
.ux-cel > .card > .card-body { flex: 1 1 auto; padding: 8px 16px 12px; }
.ux-cel > .card > .card-body:first-child { padding-top: 16px; }
.ux-cel > .card > .card-footer { background: none; border-top: 0; padding: 0 16px 12px; text-align: left; font-size: .78rem; color: var(--ux-texto); }
.ux-cel > .card > .card-footer p { margin: 0; }
.ux-cel .card .table { margin-bottom: 8px; font-size: .9rem; }
.ux-cel .card .table td, .ux-cel .card .table th { text-align: left; }
.ux-cel .card-body > p { font-size: .78rem; margin: 0; color: var(--ux-texto); }

/* Tarjeta de Género: iconos y porcentajes en una fila (sustituye las posiciones absolutas) */
.ux-genero-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 22px; margin-top: 8px; }
.ux-genero-stats > div { display: flex; align-items: center; gap: 6px; }
.ux-genero-stats img { height: 28px; width: auto; }
.ux-genero-stats p { margin: 0; font-size: 1rem; }

/* Estado vacío: tarjetas punteadas en vez de ejes en cero (visibility, no display: las gráficas conservan su medida) */
.ux-vacio .ux-cel > .card {
    height: 190px; overflow: hidden; background: #f3f3f3; box-shadow: none; border: 1px dashed #c9c9cd;
}
.ux-vacio .ux-cel > .card > * { visibility: hidden; }

/* ---------- Zoom de tarjetas: solo escritorio con puntero; sin los desplazamientos en px de site.css ---------- */
.ux-cel > .card.contenedor { cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.ux-cel .card[class*="expandido"] { left: auto !important; right: auto !important; z-index: 20; box-shadow: 0 8px 28px rgba(0,0,0,.28); }
@media (max-width: 1199px), (hover: none) {
    .ux-cel .card[class*="expandido"] { transform: none !important; box-shadow: var(--ux-sombra); z-index: auto; }
    .ux-cel > .card.contenedor { cursor: default; }
}

/* ---------- Tablet (768-1199) ---------- */
@media (max-width: 1199px) {
    :root { --ux-pad: 16px; --ux-mapa-alto: clamp(420px, 60vh, 640px); }
    .ux-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ux-cel--2 { grid-column: 1 / -1; }
    #pvDibujar, #pvBorrar { min-height: 44px !important; }
}
@supports (height: 1dvh) {
    @media (max-width: 1199px) { :root { --ux-mapa-alto: clamp(420px, 60dvh, 640px); } }
}
@media (max-width: 991px) {
    /* Encabezado en dos filas (maqueta tablet/celular): logos + fuentes arriba; título y fecha de datos debajo */
    .ux-header {
        grid-template-columns: 1fr auto; grid-template-areas: "marca src" "titulo titulo" "datos datos";
        row-gap: 6px; padding-top: 10px; padding-bottom: 10px;
    }
    .ux-marca { grid-area: marca; }
    .ux-titulo { grid-area: titulo; text-align: left; font-size: 1rem; letter-spacing: .1em; }
    .ux-fuentes { display: contents; }
    .ux-fuentes-btn { grid-area: src; justify-self: end; }
    #contenedorDatos { grid-area: datos; text-align: left; max-width: none; font-size: .78rem; }
    .ux-kpis { flex-wrap: wrap; }
    .ux-kpi { flex: 1 1 50%; border-left: 0; border-bottom: 1px solid var(--ux-linea); }
    .ux-kpi:nth-child(even) { border-left: 1px solid var(--ux-linea); }
    .ux-kpis--3 .ux-kpi:nth-child(3) { flex-basis: 100%; border-left: 0; }
    .ux-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ux-campo--2 { grid-column: 1 / -1; }
}

/* ---------- Celular (<=767) ---------- */
@media (max-width: 767px) {
    :root { --ux-pad: 12px; --ux-hueco: 12px; --ux-mapa-alto: clamp(320px, 55vh, 520px); }
    .ux-marca { gap: 10px; }
    .ux-logo-ficosec { height: 30px; }
    .ux-logo-consejo { height: 34px; }
    .ux-titulo { font-size: .95rem; letter-spacing: .1em; }
    .ux-acciones .btn { white-space: nowrap; padding: 0 12px; }
    .ux-grid { grid-template-columns: minmax(0, 1fr); }
    .ux-acciones { justify-content: stretch; }
    .ux-acciones .btn { flex: 1 1 0; justify-content: center; }
    #Divfiltros.ux-plegada { grid-template-areas: "cab" "acc"; grid-template-columns: minmax(0, 1fr); row-gap: 10px; }
    .ux-kpi { padding: 10px 12px; gap: 10px; }
    .ux-kpi-cifra { font-size: 1.3rem; }
    .ux-vacio #siniestros::after, .ux-vacio #Defuncio::after, .ux-vacio #lesio::after, .ux-vacio #Daños::after { font-size: 1.3rem; }
    .ux-kpi-ico svg { width: 24px; height: 24px; }
    /* filtros apilados: una columna; las dos fechas lado a lado (cada una >=150 px incluso a 360 px) */
    .ux-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .ux-form > .ux-campo { grid-column: 1 / -1; }
    .ux-form > .ux-campo:nth-child(-n+2) { grid-column: auto; }
    #Divfiltros.ux-plegada .ux-cab { flex-wrap: wrap; }
    .ux-chips { flex-basis: 100%; }
    #poligonoVialidad { max-width: calc(100vw - 96px) !important; }
}
@supports (height: 1dvh) {
    @media (max-width: 767px) { :root { --ux-mapa-alto: clamp(320px, 55dvh, 520px); } }
}
@media (max-width: 480px) {
    .ux-mapa-wrap .rectagulo-calor { display: none; }
    .ux-mapa-wrap .mapa-opcion { padding: 0 12px; font-size: .85rem; }
}

/* ---------- Controles de Google visibles en tablet y celular (anula site.css:1898-1919, regla heredada de <=1000px) ---------- */
@media (max-width: 1000px) {
    .gm-fullscreen-control { display: inline-block !important; }
    .gm-bundled-control-on-bottom, .gmnoprint { display: block !important; }
}

/* ---------- Malla H3 (#27) ---------- */
.ux-mapa-wrap .MapaCalor { display: flex; gap: 8px; align-items: flex-start; width: auto; height: auto; }
.ux-mapa-wrap .mapa-opcion--malla { white-space: nowrap; user-select: none; }
.ux-mapa-wrap .mapa-opcion--malla .ux-malla-ico { flex: none; }
.ux-mapa-wrap .mapa-opcion--malla.is-activo { background-color: #3d2b05; color: var(--ux-oro); box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0,0,0,.35); }
.ux-mapa-wrap .mapa-opcion--malla.is-activo:hover { background-color: #523a08; }
.ux-mapa-wrap .mapa-opcion--malla.is-activo .ux-malla-ico path { fill: currentColor; fill-opacity: .35; }
.ux-vacio .MapaCalor .mapa-opcion--malla { opacity: 1; cursor: pointer; }

#mallaLeyenda {
    margin: 0 0 10px 10px; width: 232px; max-width: calc(100vw - 100px); background: #fff; border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.3); font-family: var(--ux-fuente); font-size: 13px; line-height: 1.35; color: #3a3a3a; text-align: left;
}
#mallaLeyenda[hidden] { display: none; }
#mallaLeyenda .ml-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 12px; }
#mallaLeyenda .ml-tit { margin: 0; font-weight: 700; font-size: 13px; color: var(--ux-titulo); }
#mallaLeyenda .ml-plegar { min-width: 44px; min-height: 44px; border: 0; background: none; cursor: pointer; font-size: 16px; color: #555; border-radius: 8px; }
#mallaLeyenda .ml-plegar:focus-visible { outline: 3px solid var(--ux-tema); }
#mallaLeyenda .ml-cuerpo { padding: 0 12px 4px; }
#mallaLeyenda.ml-plegada .ml-cuerpo { display: none; }
#mallaLeyenda .ml-fila { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
#mallaLeyenda .ml-mues { flex: none; width: 22px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.25); }
#mallaLeyenda .ml-mues--cero { background: transparent; border: 1px solid rgba(107,114,128,.5); }
#mallaLeyenda .ml-rango { font-weight: 700; }
#mallaLeyenda .ml-n { margin-left: auto; color: #777; font-size: 12px; }
#mallaLeyenda .ml-lectura { min-height: 18px; margin: 4px 0 2px; font-size: 12px; color: #444; }
#mallaLeyenda .ml-msg { margin: 0 0 6px; }
#mallaLeyenda .ml-aviso { margin: 0; padding: 6px 12px 8px; border-top: 1px solid var(--ux-linea); font-size: 12px; color: #555; }
#mallaLeyenda .ml-aviso:empty { display: none; }
#mallaLeyenda .ml-aviso.ml-error { color: #b00020; font-weight: 700; }
.mallaInfo { font-family: var(--ux-fuente); font-size: 13px; line-height: 1.4; }
.mallaInfo b { color: #3a3a3a; }

@media (max-width: 767px) {
    #mallaLeyenda { width: 200px; max-width: calc(100vw - 80px); }
}
@media (max-width: 480px) {
    .ux-mapa-wrap .MapaCalor { flex-direction: column; }
    .ux-mapa-wrap .mapa-opcion--malla .ux-malla-ico { display: none; }
    /* deja libre la columna de botones de la izquierda (calor + Malla) para el control del polígono (#20) */
    #poligonoVialidad { max-width: calc(100vw - 112px) !important; }
}

/* ---------- Iconos de los botones del polígono (#35) ---------- */
#pvDibujar, #pvBorrar { display: inline-flex; align-items: center; gap: 4px; }
#pvDibujar svg, #pvBorrar svg { flex: none; }
@media (max-width: 480px) {
    /* con el icono el par de botones ya no cabe en una fila de 278 px: menos padding lateral, sin ampliar el control */
    #pvDibujar, #pvBorrar { padding-left: 6px !important; padding-right: 6px !important; }
}
@media (max-width: 380px) {
    /* a 360 px el control mide 248 px: se compacta más para conservar la fila única de antes del icono */
    #pvDibujar, #pvBorrar { padding-left: 3px !important; padding-right: 3px !important; gap: 3px; margin-right: 2px !important; }
}

/* ---------- Detalle del polígono (#30) ---------- */
#poligonoVialidad .pv-detalle {
    margin-top: 8px; min-height: 44px; min-width: 44px; padding: 0 16px; border: 0; border-radius: 8px; cursor: pointer;
    background: var(--ux-tema); color: #fff; font: 700 13px var(--ux-fuente);
}
#poligonoVialidad .pv-detalle:hover { filter: brightness(1.12); }
#poligonoVialidad .pv-detalle:focus-visible { outline: 3px solid var(--ux-oro); outline-offset: 2px; }

.pd-modal { --pd-alto: 88vh; font-family: var(--ux-fuente); }
@supports (height: 1dvh) { .pd-modal { --pd-alto: 88dvh; } }
.pd-modal .modal-dialog { max-width: min(1100px, 92vw) !important; width: 92vw; margin: 1rem auto !important; }   /* site.css:1825 fuerza max-width: 89VW !important en <=1000px */
.pd-modal .modal-content { max-height: var(--pd-alto); border: 0; border-radius: var(--ux-radio) !important; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.pd-cab { align-items: flex-start; gap: 12px; padding: 12px 8px 12px 18px; background: var(--ux-tema); color: #fff; border-bottom: 0; border-radius: 0; }
.pd-cab-txt { min-width: 0; }
.pd-titulo { margin: 0; font-family: var(--ux-fuente); font-size: 1.2rem; font-weight: 700; line-height: 1.25; color: #fff; }
.pd-sub { margin: 2px 0 0; font-size: .85rem; line-height: 1.35; color: rgba(255,255,255,.92); }
.pd-cab .pd-x { flex: none; margin: 0; padding: 0; min-width: 44px; min-height: 44px; color: #fff; opacity: 1; font-size: 2rem; font-weight: 400; line-height: 1; text-shadow: none; border-radius: 8px; }
.pd-cab .pd-x:hover { background: rgba(255,255,255,.16); }
.pd-cab .pd-x:focus-visible { outline: 3px solid var(--ux-oro); }

.pd-tabs { display: flex; flex-wrap: nowrap; gap: 2px; padding: 6px 10px 0; overflow-x: auto; overflow-y: hidden; border-bottom: 1px solid var(--ux-linea); background: #fff; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.pd-tab {
    flex: none; min-height: 44px; padding: 0 14px; border: 0; border-bottom: 3px solid transparent; background: none; cursor: pointer; scroll-snap-align: center;
    font: 600 .9rem var(--ux-fuente); color: var(--ux-texto); white-space: nowrap;
}
.pd-tab:hover { color: var(--ux-tema); }
.pd-tab.is-activa { color: var(--ux-tema); border-bottom-color: var(--ux-tema); font-weight: 700; }
.pd-tab:focus-visible { outline: 3px solid var(--ux-tema); outline-offset: -3px; border-radius: 6px; }

.pd-cuerpo { padding: 0; min-height: 0; overflow: auto; background: #fff; }
.pd-panel { padding: 14px 18px 18px; }
.pd-panel:focus { outline: none; }
.pd-bloque { min-width: 0; }
.pd-scroll { max-height: calc(var(--pd-alto) - 210px); overflow: auto; border: 1px solid var(--ux-linea); border-radius: 8px; -webkit-overflow-scrolling: touch; }
.pd-tabla { width: 100%; margin: 0; border-collapse: separate; border-spacing: 0; font-size: .92rem; color: #3a3a3a; }
.pd-tabla th, .pd-tabla td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--ux-linea); background: #fff; }
.pd-tabla thead th { position: sticky; top: 0; z-index: 2; background: var(--ux-tema); color: #fff; font-weight: 700; white-space: nowrap; border-bottom: 0; }
.pd-tabla tbody th { font-weight: 600; }
.pd-tabla tbody tr:nth-child(even) th, .pd-tabla tbody tr:nth-child(even) td { background: #f7f5f7; }
.pd-tabla tfoot th, .pd-tabla tfoot td { position: sticky; bottom: 0; z-index: 2; background: #efe9ee; font-weight: 700; border-top: 2px solid var(--ux-tema); border-bottom: 0; }
.pd-tabla .pd-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pd-tabla .pd-vacio { text-align: center; color: var(--ux-texto); padding: 22px 12px; }
.pd-sub2 { display: block; font-size: .78rem; font-weight: 400; color: var(--ux-texto); }
.pd-tabla--mapa { min-width: 640px; }
.pd-tabla--mapa tbody th, .pd-tabla--mapa thead th:first-child { position: sticky; left: 0; z-index: 3; white-space: nowrap; }
.pd-tabla--mapa thead th:first-child { z-index: 4; }
.pd-tabla--mapa td { text-align: center; }
.pd-tabla--mapa thead th:not(:first-child) { text-align: center; }
.pd-nota { margin: 8px 2px 0; font-size: .8rem; line-height: 1.4; color: var(--ux-texto); }
.pd-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.pd-cero { padding: 34px 12px 38px; text-align: center; }
.pd-cero-tit { margin: 0 0 8px; font-size: 1.2rem; font-weight: 700; color: var(--ux-titulo); }
.pd-cero-txt { margin: 0 auto; max-width: 46ch; font-size: .95rem; line-height: 1.45; color: var(--ux-texto); }

@media (max-width: 1199px) {
    .pd-modal .modal-dialog { max-width: 94vw !important; width: 94vw; }
    .pd-modal { --pd-alto: 90vh; }
    @supports (height: 1dvh) { .pd-modal { --pd-alto: 90dvh; } }
}
@media (max-width: 767px) {
    .pd-modal { --pd-alto: 100vh; }
    @supports (height: 1dvh) { .pd-modal { --pd-alto: 100dvh; } }
    .pd-modal .modal-dialog { max-width: none !important; width: 100vw; height: var(--pd-alto); min-height: 0; margin: 0 !important; align-items: stretch; }
    .pd-modal .modal-content { height: 100%; max-height: none; border-radius: 0 !important; }
    .pd-cuerpo { flex: 1 1 auto; }
    .pd-scroll { max-height: calc(var(--pd-alto) - 190px); }
    .pd-panel { padding: 12px 12px 16px; }
    .pd-titulo { font-size: 1.05rem; }
    .pd-tabla { font-size: .88rem; }
    .pd-tabla th, .pd-tabla td { padding: 9px 8px; }
    .pd-tabla thead th, .pd-tabla thead th.pd-num { white-space: normal; }
    .pd-tabla--mapa thead th, .pd-tabla--mapa thead th.pd-num { white-space: nowrap; }
}
@media (max-width: 480px) {
    .pd-tabla { font-size: .82rem; }
    .pd-tabla th, .pd-tabla td { padding: 8px 6px; }
    .pd-panel { padding: 12px 10px 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .pd-modal, .pd-modal * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
