:root {
    --pobreza-azul: #1d4ed8;
    --pobreza-azul-oscuro: #172554;
    --pobreza-texto: #1e293b;
    --pobreza-suave: #64748b;
    --pobreza-borde: #dbe3ec;
    --pobreza-fondo: #f8fafc;
    --pobreza-radio: 14px;
    --pobreza-sombra: 0 10px 30px rgba(15, 23, 42, .07);
}

.pobreza-pagina {
    margin-inline: auto;
    color: var(--pobreza-texto);
}

.pobreza-cabecera {
    position: relative;
    overflow: hidden;
    padding: 9px;
    border: 1px solid #bfdbfe;
    border-radius: var(--pobreza-radio);
    background: linear-gradient(135deg, #fbc2c2 0%, #b0ffb5 55%, #f26868 100%);
}

.pobreza-cabecera::after {
    position: absolute;
    right: -80px;
    bottom: -110px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    content: "";
}

.pobreza-cabecera h1 {
    position: relative;
    z-index: 1;
    margin: .3rem 0 .65rem;
    line-height: 1.08;
    text-align: center;
    font-size: 1.5rem;
}

.pobreza-cabecera p {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: 0.8rem;
    color: #575555;
    text-align: center;
}

.pobreza-etiqueta {
    font-weight: 700;
    letter-spacing: .045em;
    text-align: center;
}

.pobreza-navegacion {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .5rem;
    margin: 1rem;
}

.pobreza-navegacion a {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0 .5rem;
    align-items: center;
    /*! min-height: 668px; */
    padding: .7rem;
    border: 1px solid var(--pobreza-borde);
    border-radius: 4px;
    background: #fff;
    color: var(--pobreza-texto);
    text-decoration: none;
    /*! box-shadow: 0 4px 14px rgba(15, 23, 42, .05); */
}

.pobreza-navegacion a:hover {
    border-color: #60a5fa;
    background: #f8fbff;
    transform: translateY(-1px);
}

.pobreza-navegacion a > span {
    grid-row: 1 / 3;
    font-size: 1.55rem;
}

.pobreza-navegacion strong,
.pobreza-navegacion small {
    min-width: 0;
}

.pobreza-navegacion small {
    color: var(--pobreza-suave);
}

.pobreza-resumen-indicadores {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 4px;
    margin-top: 1.25rem;
}

.pobreza-resumen-tarjeta {
    display: flex;
    flex-direction: column;
    min-height: 250px;
    padding: 1rem;
    border: 1px solid var(--pobreza-borde);
    border-top: 4px solid var(--pobreza-azul);
    border-radius: 4px;
    background: #fff;
    /*! box-shadow: var(--pobreza-sombra); */
}

.pobreza-resumen-tarjeta:nth-child(3n + 2) { border-top-color: #be123c; }
.pobreza-resumen-tarjeta:nth-child(3n) { border-top-color: #059669; }

.pobreza-resumen-tarjeta h2 {
    margin: .35rem 0 .55rem;
    color: var(--pobreza-azul-oscuro);
    font-size: 1.1rem;
    line-height: 1.25;
    text-align: center;
}

.pobreza-resumen-tarjeta > p:not(.pobreza-resumen-etiqueta) {
    flex: 1;
    margin: 0 0 9px;
    color: var(--pobreza-suave);
    line-height: 1.3rem;
}

.pobreza-resumen-etiqueta {
    margin: 0;
    color: #475569;
    font-size: .82rem;
    font-weight: 700;
}

.pobreza-resumen-tarjeta button {
    min-height: 43px;
    border: 1px solid var(--pobreza-azul);
    border-radius: 8px;
    background: #eff6ff;
    color: #1e40af;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.pobreza-resumen-tarjeta button:hover {
    background: #dbeafe;
}

.pobreza-modal {
    width: min(1100px, calc(100% - 2rem));
    max-height: calc(100vh - 2rem);
    margin: auto;
    overflow: auto;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: #fff;
    color: var(--pobreza-texto);
    box-shadow: 0 25px 70px rgba(15, 23, 42, .35);
}

.pobreza-modal::backdrop {
    background: rgba(15, 23, 42, .68);
    backdrop-filter: blur(2px);
}

.pobreza-modal-cerrar {
    position: sticky;
    z-index: 50;
    top: .65rem;
    float: right;
    width: 42px;
    height: 42px;
    margin: .65rem .65rem 0 0;
    border: 1px solid #cbd5e1;
    border-radius: 50%;
    background: #fff;
    color: #0f172a;
    font: 700 1.65rem/1 system-ui, sans-serif;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .12);
}

.pobreza-modal-cerrar:hover {
    background: #fee2e2;
    color: #991b1b;
}

.pobreza-modal .pobreza-panel,
.pobreza-modal .pobreza-tabla-seccion,
.pobreza-modal .pobreza-filtros {
    clear: both;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.pobreza-modal-filtros {
    width: min(1000px, calc(100% - 2rem));
}

body:has(.pobreza-modal[open]) {
    overflow: hidden;
}

.pobreza-alternar-filtros {
    display: block;
    /*! align-items: center; */
    /*! justify-content: center; */
    /*! gap: .45rem; */
    min-height: 46px;
    margin-top: 1.25rem;
    border: 1px solid #1d4ed8;
    border-radius: 4px;
    background: #1d4ed8;
    color: #fff;
    /*! box-shadow: 0 5px 14px rgba(29, 78, 216, .18); */
    font-weight: 700;
    /*! cursor: pointer; */
    transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease;
    /*! text-align: center; */
    width: 100%;
    /*! margin: 0 4rem; */
    /*! margin-left: 4rem; */
    /*! margin-right: 4rem; */
}

.pobreza-alternar-filtros:hover {
    background: #1e40af;
    transform: translateY(-1px);
    color: #fff;
}

.pobreza-filtros-cerrados {
    display: none;
}

.pobreza-filtros,
.pobreza-panel,
.pobreza-tabla-seccion,
.pobreza-fuente {
    margin-top: 1.25rem;
    padding: clamp(1rem, 3vw, 1.5rem);
    border: 1px solid var(--pobreza-borde);
    border-radius: var(--pobreza-radio);
    background: #fff;
    box-shadow: var(--pobreza-sombra);
}

.pobreza-filtros-cabecera,
.pobreza-panel-cabecera {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.pobreza-filtros-cabecera h2,
.pobreza-filtros-cabecera p {
    margin: 0;
}

.pobreza-filtros-cabecera p {
    margin-top: .25rem;
    color: var(--pobreza-suave);
}

.pobreza-filtros-cabecera > span,
.pobreza-panel-cabecera > span {
    width: auto;
    padding: .32rem .7rem;
    border-radius: 999px;
    background: #dbeafe;
    color: #1e3a8a;
    font-weight: 700;
    white-space: nowrap;
}

.pobreza-filtros-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.pobreza-filtros fieldset {
    margin: 0;
    min-width: 0;
    padding: 1rem;
    border: 1px solid var(--pobreza-borde);
    border-radius: 11px;
    background: var(--pobreza-fondo);
    display: block;
}

.pobreza-filtros legend,
.pobreza-panel h2,
.pobreza-tabla-seccion h2 {
    margin: 0;
    color: var(--pobreza-azul-oscuro);
    font-size: clamp(1.15rem, 2.5vw, 1.35rem);
    font-weight: 700;
    width: auto;
    margin: 0;
    padding: 0 .35rem;
    text-align: left;
}

.pobreza-ayuda {
    margin: .4rem 0 1rem;
    color: var(--pobreza-suave);
    line-height: 1.5;
}

.pobreza-comunidades {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: .55rem;
}

.pobreza-comunidades label {
    display: flex;
    align-items: center;
    gap: .6rem;
    min-height: 43px;
    padding: .6rem .75rem;
    border: 1px solid var(--pobreza-borde);
    border-radius: 8px;
    background: var(--pobreza-fondo);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}

.pobreza-comunidades label:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.pobreza-comunidades input,
.pobreza-contexto-control input,
.pobreza-contexto-regional input {
    width: 1.05rem;
    height: 1.05rem;
    flex: 0 0 auto;
    accent-color: var(--pobreza-azul);
}

.pobreza-paises-filtro {
    margin-top: 0 !important;
    padding-top: 1rem !important;
    border: 1px solid var(--pobreza-borde) !important;
}

.pobreza-desplegable {
    position: relative;
    max-width: none;
}

.pobreza-desplegable summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .7rem .9rem;
    border: 1px solid #94a3b8;
    border-radius: 4px;
    background: #f0faff;
    color: var(--pobreza-azul-oscuro);
    font-weight: 700;
    cursor: pointer;
}

.pobreza-desplegable summary span {
    padding: .25rem .6rem;
    border-radius: 999px;
    background: #dbeafe;
    color: #1e3a8a;
    font-size: .82rem;
    white-space: nowrap;
}

.pobreza-desplegable[open] summary {
    border-color: var(--pobreza-azul);
    border-radius: 9px 9px 0 0;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.pobreza-desplegable-panel {
    position: absolute;
    z-index: 20;
    width: 100%;
    max-height: min(430px, 70vh);
    overflow: auto;
    padding: .85rem;
    border: 1px solid var(--pobreza-azul);
    border-top: 0;
    border-radius: 0 0 9px 9px;
    background: #fff;
    box-shadow: 0 16px 32px rgba(15, 23, 42, .17);
}

.pobreza-desplegable-panel > input {
    width: 100%;
    min-height: 43px;
    margin-bottom: .75rem;
    padding: .55rem .75rem;
    border: 1px solid #94a3b8;
    border-radius: 8px;
    font: inherit;
}

.pobreza-limpiar-seleccion {
    min-height: 39px;
    margin-top: .75rem;
    padding: .45rem .75rem;
    border: 1px solid #94a3b8;
    border-radius: 7px;
    background: #fff;
    color: #334155;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.pobreza-periodo {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: .9rem;
    margin-top: 1.25rem;
    justify-content: flex-start;
    padding: .8rem 1rem;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    background: #eff6ff;
}

.pobreza-periodo > strong {
    align-self: center;
    margin-right: auto;
    color: var(--pobreza-azul-oscuro);
}

.pobreza-periodo label {
    font-weight: 640;
    color: #334155;
    margin-right: 9px;
}

.pobreza-periodo select {
    min-height: 43px;
    padding: .2rem .75rem;
    border: 1px solid #94a3b8;
    border-radius: 4px;
    background: #fff;
    color: var(--pobreza-texto);
    font: inherit;
    margin-left: 9px;
}

.pobreza-acciones-filtro {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.4rem;
}

.pobreza-acciones-filtro button {
    min-height: 46px;
    padding: .65rem 1.05rem;
    border: 1px solid #1d4ed8;
    border-radius: 9px;
    background: #1d4ed8;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.pobreza-acciones-filtro button:hover {
    background: #1e40af;
}

.pobreza-panel-cabecera {
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.pobreza-panel-cabecera h2,
.pobreza-panel-cabecera p {
    margin: 0 1rem 1rem;
}

.pobreza-panel-cabecera p {
    color: var(--pobreza-suave);
    line-height: 1.55;
}

.pobreza-panel-cabecera > span {
    font-size: .9rem;
}

.pobreza-panel,
.pobreza-tabla-seccion {
    scroll-margin-top: 1rem;
}

.pobreza-internacional {
    border-top: 4px solid #0284c7;
}

.pobreza-internacional + .pobreza-internacional {
    border-top-color: #16a34a;
}

.pobreza-definicion {
    margin: .8rem 0 0;
    padding: .8rem 1rem;
    border-left: 4px solid #60a5fa;
    border-radius: 0 8px 8px 0;
    background: #eff6ff;
    color: #334155;
    line-height: 1.5;
}

.pobreza-mpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: .8rem;
    margin-top: 1rem;
}

.pobreza-mpi-grid article {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding: 1rem;
    border: 1px solid var(--pobreza-borde);
    border-radius: 10px;
    background: var(--pobreza-fondo);
}

.pobreza-mpi-grid h3 {
    margin: 0;
    color: var(--pobreza-azul-oscuro);
    font-size: 1rem;
}

.pobreza-mpi-grid article > strong {
    color: #be123c;
    font-size: 1.7rem;
}

.pobreza-mpi-grid span,
.pobreza-mpi-grid small {
    color: var(--pobreza-suave);
    line-height: 1.4;
}

.pobreza-contexto-control,
.pobreza-contexto-regional label {
    display: flex;
    align-items: center;
    gap: .55rem;
}

.pobreza-contexto-control {
    width: max-content;
    max-width: 100%;
    margin-top: 1rem;
    padding: .6rem .75rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: var(--pobreza-fondo);
    color: #334155;
    font-weight: 650;
}

.pobreza-contexto-regional {
    display: flex;
    gap: .65rem;
    margin-top: .9rem;
    padding: .9rem;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: var(--pobreza-fondo);
    color: #334155;
    align-items: center;
}

.pobreza-contexto-regional label {
    min-height: 38px;
    padding: .35rem .5rem;
    border-radius: 7px;
    cursor: pointer;
}

.pobreza-contexto-regional label:hover {
    background: #eaf2ff;
}

.pobreza-contexto-regional strong,
.pobreza-contexto-regional span {
    grid-column: 1 / -1;
}

.pobreza-contexto-regional span {
    color: var(--pobreza-suave);
    font-size: .88rem;
    line-height: 1.45;
}

.pobreza-grafica-contenedor {
    min-height: 280px;
    margin-top: 1rem;
    padding: .45rem;
    border-radius: 10px;
    background: linear-gradient(180deg, #fff, #fbfdff);
}

.pobreza-grafica-contenedor canvas {
    display: block;
    max-width: 100%;
}

.pobreza-leyenda {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem .9rem;
    margin-top: .85rem;
    justify-content: center;
}

.pobreza-leyenda span {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .25rem .5rem;
    border-radius: 999px;
    background: var(--pobreza-fondo);
    font-size: .9rem;
}

.pobreza-leyenda i {
    width: .8rem;
    height: .8rem;
    border-radius: 50%;
}

.pobreza-tabla-scroll {
    overflow-x: auto;
    margin-top: .75rem;
    border: 1px solid var(--pobreza-borde);
    border-radius: 10px;
}

.pobreza-tabla-seccion table,
.pobreza-panel table {
    width: 100%;
    font-size: .92rem;
}

.pobreza-tabla-seccion th,
.pobreza-tabla-seccion td,
.pobreza-panel th,
.pobreza-panel td {
    padding: .5rem .7rem;
    border-bottom: 1px solid #e2e8f0;
    text-align: right;
    white-space: nowrap;
}

.pobreza-tabla-seccion thead th,
.pobreza-panel thead th {
    background: #eef4ff;
    color: #1e3a8a;
    font-weight: 700;
}

.pobreza-tabla-seccion tbody tr:nth-child(even),
.pobreza-panel tbody tr:nth-child(even) {
    background: #f8fafc;
}

.pobreza-tabla-seccion th:first-child,
.pobreza-panel th:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: inherit;
    text-align: left;
}

.pobreza-infantil {
    border: 2px solid #be123c;
}

.pobreza-infantil .pobreza-tabla-scroll {
    margin-top: 2rem;
}

.pobreza-aviso {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 10px;
    background: #f1f5f9;
    color: #334155;
}

.pobreza-error {
    background: #fee2e2;
    color: #991b1b;
}

.pobreza-fuente {
    color: #475569;
    font-size: .9rem;
    line-height: 1.55;
    background: none;
    border: none;
}

.pobreza-fuente a {
    color: #1d4ed8;
    text-underline-offset: 2px;
}

.pobreza-pagina button:focus-visible,
.pobreza-pagina input:focus-visible,
.pobreza-pagina select:focus-visible,
.pobreza-pagina summary:focus-visible,
.pobreza-pagina a:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .3);
    outline-offset: 2px;
}

@media (max-width: 760px) {
    .pobreza-pagina {
        width: min(100% - 1rem, 1180px);
    }

    .pobreza-cabecera {
        border-radius: 15px;
    }

    .pobreza-alternar-filtros {
        width: 100%;
    }

    .pobreza-navegacion,
    .pobreza-filtros-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pobreza-modal {
        width: 100%;
        max-width: none;
        max-height: 100dvh;
        height: 100dvh;
        margin: 0;
        border-radius: 0;
    }

    .pobreza-desplegable-panel {
        position: static;
        max-height: 60vh;
    }

    .pobreza-comunidades,
    .pobreza-contexto-regional {
        grid-template-columns: 1fr;
    }

    .pobreza-panel-cabecera {
        display: block;
    }

    .pobreza-panel-cabecera > span {
        display: inline-block;
        margin-top: .55rem;
    }

    .pobreza-acciones-filtro button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .pobreza-cabecera h1 {

    font-size: 1.25rem;
    }
    .pobreza-navegacion {
        grid-template-columns: 1fr;
    }

    .pobreza-navegacion a {
        min-height: 58px;
    }

    .pobreza-filtros-grid {
        grid-template-columns: 1fr;
    }

    .pobreza-filtros-cabecera {
        display: block;
    }

    .pobreza-filtros-cabecera > span {
        display: inline-block;
        margin-top: .65rem;
    }
    .pobreza-filtros,
    .pobreza-panel,
    .pobreza-tabla-seccion,
    .pobreza-fuente {
        padding: .9rem;
        border-radius: 11px;
    }

    .pobreza-periodo > * {
        flex: 1 1 110px;
    }

    .pobreza-periodo > strong {
        flex-basis: 100%;
    }

    .pobreza-desplegable summary {
        align-items: flex-start;
        flex-direction: column;
        gap: .45rem;
    }

    .pobreza-contexto-regional {
    padding: 0 0 0 20%;
    padding-left: 20%;
    flex-direction: column;
    align-items: flex-start;
    padding-left: 20%;
  }

    .pobreza-grafica-contenedor {
        margin-inline: -.35rem;
        padding-inline: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pobreza-pagina * {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
