* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Skin final Educacao: leve, colorida e menos institucional */
body:not([data-theme="dark"]) {
    background:
        radial-gradient(circle at 8% 10%, rgba(244, 114, 182, 0.10), transparent 28%),
        radial-gradient(circle at 92% 18%, rgba(45, 212, 191, 0.12), transparent 30%),
        #f8f6f3;
}

body:not([data-theme="dark"]) .header {
    background: linear-gradient(135deg, #273246 0%, #40324a 52%, #1e4a47 100%) !important;
    color: #ffffff;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.18);
}

body:not([data-theme="dark"]) .header::before {
    background: linear-gradient(90deg, #ef476f 0%, #f59e0b 34%, #22c55e 66%, #38bdf8 100%) !important;
}

body:not([data-theme="dark"]) .header h1 {
    color: #172033;
}

body:not([data-theme="dark"]) .header-subtitle {
    color: #6b5f70;
    opacity: 1;
}

body:not([data-theme="dark"]) .theme-toggle,
body:not([data-theme="dark"]) .header-sync-sources .sync-chip {
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(148, 82, 113, 0.16);
    color: #374151;
}

body:not([data-theme="dark"]) .nav {
    background: rgba(255, 252, 250, 0.94) !important;
}

body:not([data-theme="dark"]) .nav a.active {
    color: #be185d !important;
    border-bottom-color: #ec4899 !important;
}

body:not([data-theme="dark"]) .nav a.active svg {
    stroke: #be185d !important;
}

body:not([data-theme="dark"]) .nav a:hover {
    color: #be185d !important;
    background: #fff1f2 !important;
}

body:not([data-theme="dark"]) .educ-portal-hero {
    background:
        linear-gradient(90deg, rgba(255,255,255,0.84) 0%, rgba(255,247,237,0.66) 44%, rgba(255,255,255,0.86) 100%),
        radial-gradient(circle at 18% 18%, rgba(251, 113, 133, 0.22), transparent 30%),
        radial-gradient(circle at 80% 20%, rgba(56, 189, 248, 0.18), transparent 32%),
        radial-gradient(circle at 55% 90%, rgba(132, 204, 22, 0.16), transparent 34%),
        linear-gradient(135deg, #fff7ed 0%, #fdf2f8 45%, #ecfeff 100%) !important;
}

body:not([data-theme="dark"]) .educ-portal-brand span {
    color: #172033;
}

body:not([data-theme="dark"]) .educ-portal-brand strong {
    color: #7c6576;
}

body:not([data-theme="dark"]) .educ-portal-grid {
    border-color: rgba(190, 24, 93, 0.18);
    background: #fff7ed;
    box-shadow: 0 22px 48px rgba(148, 82, 113, 0.16);
}

body:not([data-theme="dark"]) .tile-red { background: linear-gradient(135deg, #e11d48, #fb7185); }
body:not([data-theme="dark"]) .tile-pink { background: linear-gradient(135deg, #be185d, #f472b6); }
body:not([data-theme="dark"]) .tile-purple { background: linear-gradient(135deg, #7c3aed, #c084fc); }
body:not([data-theme="dark"]) .tile-blue { background: linear-gradient(135deg, #2563eb, #38bdf8); }
body:not([data-theme="dark"]) .tile-green { background: linear-gradient(135deg, #059669, #5eead4); }
body:not([data-theme="dark"]) .tile-lime { background: linear-gradient(135deg, #65a30d, #bef264); }
body:not([data-theme="dark"]) .tile-yellow { background: linear-gradient(135deg, #d97706, #facc15); }
body:not([data-theme="dark"]) .tile-orange { background: linear-gradient(135deg, #ea580c, #fb923c); }
body:not([data-theme="dark"]) .tile-slate { background: linear-gradient(135deg, #475569, #94a3b8); }

body:not([data-theme="dark"]) .global-filter-bar,
body:not([data-theme="dark"]) .data-info,
body:not([data-theme="dark"]) .card-section,
body:not([data-theme="dark"]) .table-container,
body:not([data-theme="dark"]) .chart-container,
body:not([data-theme="dark"]) .kpi-card {
    background: rgba(255, 255, 255, 0.92) !important;
}

body:not([data-theme="dark"]) .global-municipio-selector:focus-within,
body:not([data-theme="dark"]) input:focus,
body:not([data-theme="dark"]) select:focus,
body:not([data-theme="dark"]) textarea:focus {
    border-color: #ec4899 !important;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.13) !important;
}

body:not([data-theme="dark"]) .card-section-title [data-lucide],
body:not([data-theme="dark"]) .section-panel-title [data-lucide],
body:not([data-theme="dark"]) .chart-title [data-lucide] {
    color: #be185d !important;
}

body:not([data-theme="dark"]) .table-title::before,
body:not([data-theme="dark"]) .chart-title::before {
    background: #ec4899 !important;
}

body:not([data-theme="dark"]) .mapa-indicador-card.active {
    background: linear-gradient(135deg, #be185d 0%, #0f766e 100%) !important;
    border-color: #be185d !important;
    box-shadow: 0 10px 22px rgba(190, 24, 93, 0.18);
}

body:not([data-theme="dark"]) .mapa-layer-card.active {
    background: linear-gradient(135deg, #d97706 0%, #f472b6 100%) !important;
    border-color: #d97706 !important;
}

body:not([data-theme="dark"]) .kpi-card.kpi-hero,
body:not([data-theme="dark"]) .stat-card.highlight {
    background: linear-gradient(135deg, #be185d 0%, #0f766e 100%) !important;
}

body:not([data-theme="dark"]) .explicacao-aba {
    background: linear-gradient(135deg, #fff7ed 0%, #fdf2f8 100%) !important;
    border-color: #fbcfe8 !important;
    border-left-color: #ec4899 !important;
}

/* Ajustes de usabilidade apos revisao */
.educ-portal-tile {
    min-height: 66px !important;
    padding: 0.52rem 0.7rem !important;
}
.educ-portal-tile i,
.educ-portal-tile svg {
    width: 17px !important;
    height: 17px !important;
}
.educ-portal-tile span {
    font-size: 0.78rem !important;
    line-height: 1.05 !important;
}
.educ-portal-tile::after {
    width: 62px !important;
    height: 62px !important;
    right: -24px !important;
    bottom: -30px !important;
}
.educ-portal-grid {
    height: auto !important;
}
.global-municipio-selector {
    height: 40px !important;
    align-items: center !important;
    overflow: visible !important;
}
.global-municipio-input {
    min-height: 36px !important;
    font-size: 0.9rem !important;
    padding-left: 0.15rem !important;
}
.global-municipio-icon {
    width: 17px !important;
    height: 17px !important;
    margin-left: 0.15rem !important;
    flex: 0 0 auto !important;
}
.card-section:has(.mapa-indicador-grid) .mapa-legenda {
    margin: 0.65rem 1.25rem 0 !important;
    padding: 0.55rem 0.75rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.8rem !important;
}
.mapa-legenda-titulo {
    margin: 0 !important;
    white-space: nowrap !important;
}
.mapa-legenda-faixas {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.75rem !important;
    flex-wrap: wrap !important;
    margin: 0 !important;
}
.legenda-faixa {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    font-size: 0.78rem !important;
    color: var(--text-secondary) !important;
}
.legenda-cor {
    width: 14px !important;
    height: 14px !important;
    border-radius: 3px !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
}

/* Compactacao da primeira dobra: mapa aparece mais cedo */
.educ-portal-hero {
    padding: 0.65rem 2.5rem 0.9rem !important;
}

.educ-portal-brand {
    display: none !important;
}

.educ-portal-grid {
    max-width: 1280px;
}

.educ-portal-tile {
    min-height: 112px !important;
    padding: 0.85rem 1rem !important;
}

.educ-portal-tile i,
.educ-portal-tile svg {
    width: 24px !important;
    height: 24px !important;
}

.educ-portal-tile span {
    font-size: 0.94rem !important;
    line-height: 1.08 !important;
}

.global-filter-bar-inner {
    padding-top: 0.65rem !important;
    padding-bottom: 0.65rem !important;
}

.container {
    padding-top: 1rem !important;
}

.data-info {
    margin-bottom: 0.9rem !important;
    padding: 0.7rem 1rem !important;
}

.card-section-header {
    padding-top: 1rem !important;
    padding-bottom: 0.7rem !important;
}

.mapa-indicador-grid {
    padding-top: 0.45rem !important;
    gap: 0.55rem !important;
}

.mapa-indicador-card {
    min-height: 60px !important;
    padding: 0.6rem 0.75rem !important;
}

.card-section:has(.mapa-indicador-grid) .mapa-container {
    margin-top: 0.65rem !important;
}

/* Filtro no topo, compacto como o Radar Saude */
.global-filter-bar {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    width: min(580px, calc(100vw - 620px));
    min-width: 360px;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

.global-filter-bar-inner {
    padding: 0 !important;
    gap: 0 !important;
}

.global-filter-label,
.global-filter-hint {
    display: none !important;
}

.global-municipio-selector {
    width: 100%;
    max-width: none !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    border: 1px solid rgba(203, 213, 225, 0.9) !important;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.10) !important;
}

.global-municipio-input {
    min-height: 42px;
}

.educ-portal-hero {
    margin-top: 0 !important;
}

@media (max-width: 1180px) {
    .global-filter-bar {
        position: static;
        transform: none;
        width: auto;
        min-width: 0;
        padding: 0.65rem 1rem !important;
        background: rgba(255,255,255,0.92) !important;
        border-bottom: 1px solid var(--border) !important;
    }
}

/* Ajustes finais: filtro sem colidir e mosaico menos duplicado */
.header-content {
    padding-top: 0.62rem !important;
    padding-bottom: 0.62rem !important;
}

.global-filter-bar {
    top: 10px !important;
    left: 57% !important;
    width: min(500px, calc(100vw - 840px)) !important;
    min-width: 360px !important;
}

.global-municipio-input {
    min-height: 36px !important;
    font-size: 0.9rem !important;
}

.educ-portal-hero {
    padding-top: 0.45rem !important;
    padding-bottom: 0.6rem !important;
}

.educ-portal-grid {
    max-width: 1180px !important;
    opacity: 0.94;
}

.educ-portal-tile {
    min-height: 82px !important;
    padding: 0.65rem 0.78rem !important;
}

.educ-portal-tile i,
.educ-portal-tile svg {
    width: 19px !important;
    height: 19px !important;
}

.educ-portal-tile span {
    font-size: 0.82rem !important;
    line-height: 1.05 !important;
}

.educ-portal-tile::after {
    width: 78px !important;
    height: 78px !important;
    right: -24px !important;
    bottom: -30px !important;
}

@media (max-width: 1180px) {
    .global-filter-bar {
        top: auto !important;
        width: auto !important;
        min-width: 0 !important;
    }
}

/* Uso mais completo da largura da tela */
.container {
    max-width: none !important;
    width: 100% !important;
    padding-left: clamp(1.25rem, 2.6vw, 2.5rem) !important;
    padding-right: clamp(1.25rem, 2.6vw, 2.5rem) !important;
}

.educ-portal-grid {
    max-width: none !important;
    width: calc(100% - clamp(5rem, 10vw, 10rem)) !important;
}

.data-info,
.card-section,
.table-container,
.chart-container,
.home-er-summary {
    width: 100% !important;
}

.card-section:has(.mapa-indicador-grid) {
    min-height: calc(100vh - 190px);
}

.mapa-indicador-grid {
    grid-template-columns: repeat(7, minmax(130px, 1fr)) !important;
}

.card-section:has(.mapa-indicador-grid) .mapa-container {
    height: min(680px, calc(100vh - 335px)) !important;
    min-height: 470px !important;
}

/* Navegacao principal em faixa colorida; remove a barra textual duplicada. */
.nav {
    display: none !important;
}

.educ-portal-hero {
    display: block !important;
}

@media (max-width: 1100px) {
    .educ-portal-grid {
        width: calc(100% - 2rem) !important;
    }
    .mapa-indicador-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

/* Alinhamento horizontal consistente */
:root {
    --page-gutter: clamp(1.5rem, 3vw, 3rem);
}

.header-content {
    padding-left: var(--page-gutter) !important;
    padding-right: var(--page-gutter) !important;
}

.global-filter-bar {
    left: calc(var(--page-gutter) + 560px) !important;
    right: 250px !important;
    transform: none !important;
    width: auto !important;
    min-width: 360px !important;
}

.educ-portal-hero {
    padding-left: var(--page-gutter) !important;
    padding-right: var(--page-gutter) !important;
}

.educ-portal-grid {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.container {
    padding-left: var(--page-gutter) !important;
    padding-right: var(--page-gutter) !important;
}

.card-section:has(.mapa-indicador-grid) .mapa-container {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
}

.card-section:has(.mapa-indicador-grid) .mapa-legenda {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

@media (max-width: 1180px) {
    .global-filter-bar {
        left: auto !important;
        right: auto !important;
        width: auto !important;
    }
}

/* Estado definitivo: menu textual nunca aparece; os cards coloridos navegam em todas as abas. */
body .nav {
    display: none !important;
}

body .educ-portal-hero {
    display: block !important;
}

.educ-portal-tile.active {
    outline: 3px solid rgba(255, 255, 255, 0.92);
    outline-offset: -7px;
    filter: saturate(1.08) brightness(1.04);
}

.home-er-summary {
    margin: 1rem 0 1.1rem;
    padding: 1rem 1.15rem;
    border: 1px solid #fbcfe8;
    border-left: 4px solid #ec4899;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(255,247,237,0.94), rgba(253,242,248,0.94));
    display: grid;
    grid-template-columns: minmax(240px, 1.15fr) minmax(360px, 2fr) auto;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-xs);
}

.home-er-summary[hidden] {
    display: none !important;
}

.home-er-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.home-er-title > i,
.home-er-title > svg {
    width: 24px;
    height: 24px;
    color: #be185d;
    flex: 0 0 auto;
}

.home-er-title h3 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.15;
    color: #172033;
}

.home-er-title p {
    margin: 0.2rem 0 0;
    font-size: 0.78rem;
    line-height: 1.28;
    color: var(--text-secondary);
}

.home-er-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
}

.home-er-metrics div {
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(236, 72, 153, 0.14);
    border-radius: 8px;
    background: rgba(255,255,255,0.72);
}

.home-er-metrics strong {
    display: block;
    font-size: 1.25rem;
    line-height: 1;
    color: #be185d;
}

.home-er-metrics small {
    font-size: 0.68em;
}

.home-er-metrics span {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.68rem;
    line-height: 1.15;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
}

.home-er-link {
    border: 1px solid rgba(190, 24, 93, 0.24);
    border-radius: 8px;
    background: #ffffff;
    color: #be185d;
    font-weight: 700;
    padding: 0.65rem 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    white-space: nowrap;
}

.home-er-link:hover {
    background: #fdf2f8;
}

.home-er-link i,
.home-er-link svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 1100px) {
    .home-er-summary {
        grid-template-columns: 1fr;
    }
    .home-er-link {
        justify-content: center;
    }
}

@media (max-width: 700px) {
    .home-er-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Ajuste de tom: Educacao mais leve e acolhedora */
body {
    background:
        radial-gradient(circle at 8% 10%, rgba(244, 114, 182, 0.10), transparent 28%),
        radial-gradient(circle at 92% 18%, rgba(45, 212, 191, 0.12), transparent 30%),
        #f8f6f3;
}

.header {
    background: linear-gradient(135deg, #fff7ed 0%, #fdf2f8 48%, #eefdf8 100%);
    color: #263143;
    box-shadow: 0 1px 0 rgba(148, 163, 184, 0.18);
}

.header::before {
    background: linear-gradient(90deg, #ef476f 0%, #f59e0b 34%, #22c55e 66%, #38bdf8 100%);
}

.header-brand img {
    box-shadow: 0 8px 18px rgba(148, 82, 113, 0.14);
}

.header h1 {
    color: #172033;
}

.header-subtitle {
    color: #6b5f70;
    opacity: 1;
}

.theme-toggle,
.header-sync-sources .sync-chip {
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(148, 82, 113, 0.16);
    color: #374151;
}

.nav {
    background: rgba(255, 252, 250, 0.94);
}

.nav a.active {
    color: #be185d;
    border-bottom-color: #ec4899;
}

.nav a.active svg {
    stroke: #be185d;
}

.nav a:hover {
    color: #be185d;
    background: #fff1f2;
}

.educ-portal-hero {
    background:
        linear-gradient(90deg, rgba(255,255,255,0.84) 0%, rgba(255,247,237,0.66) 44%, rgba(255,255,255,0.86) 100%),
        radial-gradient(circle at 18% 18%, rgba(251, 113, 133, 0.22), transparent 30%),
        radial-gradient(circle at 80% 20%, rgba(56, 189, 248, 0.18), transparent 32%),
        radial-gradient(circle at 55% 90%, rgba(132, 204, 22, 0.16), transparent 34%),
        linear-gradient(135deg, #fff7ed 0%, #fdf2f8 45%, #ecfeff 100%);
}

.educ-portal-hero::before {
    background:
        repeating-linear-gradient(90deg, rgba(236, 72, 153, 0.05) 0 1px, transparent 1px 78px),
        repeating-linear-gradient(0deg, rgba(14, 165, 233, 0.035) 0 1px, transparent 1px 64px);
}

.educ-portal-brand span {
    color: #172033;
}

.educ-portal-brand strong {
    color: #7c6576;
}

.educ-portal-grid {
    border-color: rgba(190, 24, 93, 0.18);
    background: #fff7ed;
    box-shadow: 0 22px 48px rgba(148, 82, 113, 0.16);
}

.educ-portal-tile {
    border-right-color: rgba(255,255,255,0.36);
}

.educ-portal-tile::before {
    background:
        radial-gradient(circle at 72% 18%, rgba(255,255,255,0.30), transparent 32%),
        linear-gradient(145deg, rgba(255,255,255,0.12), rgba(80,30,50,0.20));
}

.tile-red { background: linear-gradient(135deg, #e11d48, #fb7185); }
.tile-pink { background: linear-gradient(135deg, #be185d, #f472b6); }
.tile-purple { background: linear-gradient(135deg, #7c3aed, #c084fc); }
.tile-blue { background: linear-gradient(135deg, #2563eb, #38bdf8); }
.tile-green { background: linear-gradient(135deg, #059669, #5eead4); }
.tile-lime { background: linear-gradient(135deg, #65a30d, #bef264); }
.tile-yellow { background: linear-gradient(135deg, #d97706, #facc15); }
.tile-orange { background: linear-gradient(135deg, #ea580c, #fb923c); }
.tile-slate { background: linear-gradient(135deg, #475569, #94a3b8); }

.global-filter-bar,
.data-info,
.card-section,
.table-container,
.chart-container,
.kpi-card {
    background: rgba(255, 255, 255, 0.92);
}

.global-municipio-selector:focus-within,
input:focus,
select:focus,
textarea:focus {
    border-color: #ec4899 !important;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.13) !important;
}

.card-section-title [data-lucide],
.section-panel-title [data-lucide],
.chart-title [data-lucide] {
    color: #be185d;
}

.table-title::before,
.chart-title::before {
    background: #ec4899;
}

.mapa-indicador-card.active {
    background: linear-gradient(135deg, #be185d 0%, #0f766e 100%);
    border-color: #be185d;
    box-shadow: 0 10px 22px rgba(190, 24, 93, 0.18);
}

.mapa-layer-card.active {
    background: linear-gradient(135deg, #d97706 0%, #f472b6 100%);
    border-color: #d97706;
}

.kpi-card.kpi-hero,
.stat-card.highlight {
    background: linear-gradient(135deg, #be185d 0%, #0f766e 100%);
}

.explicacao-aba {
    background: linear-gradient(135deg, #fff7ed 0%, #fdf2f8 100%);
    border-color: #fbcfe8;
    border-left-color: #ec4899;
}

[data-theme="dark"] body {
    background: var(--bg-light);
}

[data-theme="dark"] .header {
    background: #0b111b;
    color: var(--text-dark);
}

[data-theme="dark"] .nav {
    background: var(--bg-card);
}

/* Portal estilo mosaico TCE Educacao */
.educ-portal-hero {
    position: relative;
    overflow: hidden;
    padding: 1.35rem 2.5rem 1.6rem;
    border-bottom: 1px solid var(--border);
    background:
        linear-gradient(90deg, rgba(255,255,255,0.92) 0%, rgba(255,255,255,0.78) 42%, rgba(255,255,255,0.92) 100%),
        radial-gradient(circle at 16% 16%, rgba(222, 42, 65, 0.18), transparent 30%),
        radial-gradient(circle at 86% 10%, rgba(20, 150, 190, 0.18), transparent 34%),
        linear-gradient(135deg, #f7efe7 0%, #eef5f4 45%, #f5f0fb 100%);
}

.educ-portal-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(115deg, transparent 0 12%, rgba(29, 78, 216, 0.07) 12% 13%, transparent 13% 27%, rgba(220, 38, 38, 0.07) 27% 28%, transparent 28%),
        repeating-linear-gradient(90deg, rgba(15, 23, 42, 0.04) 0 1px, transparent 1px 72px);
    opacity: 0.45;
    pointer-events: none;
}

.educ-portal-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.1rem;
    color: #111827;
    text-align: left;
}

.educ-portal-brand img {
    height: 58px;
    width: auto;
    padding: 5px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.82);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.educ-portal-brand span {
    display: block;
    font-size: 2rem;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0;
}

.educ-portal-brand strong {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
}

.educ-portal-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(9, minmax(96px, 1fr));
    max-width: 1280px;
    margin: 0 auto;
    border: 1px solid rgba(15, 23, 42, 0.18);
    background: #111827;
    box-shadow: 0 22px 50px rgba(15, 23, 42, 0.18);
}

.educ-portal-tile {
    min-height: 142px;
    border: 0;
    border-right: 1px solid rgba(255,255,255,0.28);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.05rem;
    text-align: left;
    cursor: pointer;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    font-family: inherit;
}

.educ-portal-tile::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 72% 18%, rgba(255,255,255,0.22), transparent 32%),
        linear-gradient(145deg, rgba(255,255,255,0.08), rgba(0,0,0,0.28));
    z-index: -1;
}

.educ-portal-tile::after {
    content: "";
    position: absolute;
    right: -30px;
    bottom: -36px;
    width: 116px;
    height: 116px;
    border: 1px solid rgba(255,255,255,0.24);
    transform: rotate(16deg);
    z-index: -1;
}

.educ-portal-tile:hover,
.educ-portal-tile:focus-visible {
    transform: translateY(-2px);
    outline: 3px solid rgba(255,255,255,0.7);
    outline-offset: -6px;
}

.educ-portal-tile i,
.educ-portal-tile svg {
    width: 28px;
    height: 28px;
    stroke-width: 2.2;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.educ-portal-tile span {
    display: block;
    max-width: 15ch;
    font-size: 1rem;
    line-height: 1.12;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0,0,0,0.32);
}

.tile-wide { grid-column: span 1; }
.tile-red { background: linear-gradient(135deg, #b91c1c, #ef4444); }
.tile-pink { background: linear-gradient(135deg, #be185d, #ec4899); }
.tile-purple { background: linear-gradient(135deg, #6d28d9, #a855f7); }
.tile-blue { background: linear-gradient(135deg, #1d4ed8, #0ea5e9); }
.tile-green { background: linear-gradient(135deg, #047857, #22c55e); }
.tile-lime { background: linear-gradient(135deg, #4d7c0f, #84cc16); }
.tile-yellow { background: linear-gradient(135deg, #a16207, #eab308); }
.tile-orange { background: linear-gradient(135deg, #c2410c, #f97316); }
.tile-slate { background: linear-gradient(135deg, #334155, #64748b); }

.busca-cidadao-bar {
    display: none;
}

.global-filter-bar {
    background: rgba(255,255,255,0.96);
}

body:not(.tab-active-visao-geral) .educ-portal-hero {
    display: none;
}

body:not(.tab-active-visao-geral) .container {
    padding-top: 1.15rem;
}

body:not(.tab-active-visao-geral) .data-info {
    margin-bottom: 1rem;
}

body:not(.tab-active-visao-geral) .explicacao-aba {
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
}

body:not(.tab-active-visao-geral) .explicacao-aba h4 {
    margin-bottom: 0.25rem;
    font-size: 0.92rem;
}

body:not(.tab-active-visao-geral) .explicacao-aba p {
    font-size: 0.86rem;
    line-height: 1.42;
}

#tab-etnico-racial #er-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
}

#tab-etnico-racial #er-kpis .kpi-card {
    min-height: 92px;
    padding: 1rem 1.15rem;
    display: flex;
    align-items: center;
}

#tab-etnico-racial #er-kpis .kpi-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
}

#tab-etnico-racial #er-kpis .kpi-value {
    font-size: 1.55rem;
    line-height: 1;
}

#tab-etnico-racial #er-kpis .kpi-label {
    font-size: 0.72rem;
    line-height: 1.25;
}

@media (max-width: 1100px) {
    #tab-etnico-racial #er-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    #tab-etnico-racial #er-kpis {
        grid-template-columns: 1fr;
    }
}

.select-indicador {
    position: absolute;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0 !important;
}

.mapa-indicador-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(132px, 1fr));
    gap: 0.7rem;
    padding: 1rem 1.25rem 0;
}

.mapa-indicador-card {
    min-height: 72px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text-dark);
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 0.65rem;
    padding: 0.75rem 0.85rem;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.mapa-indicador-card i,
.mapa-indicador-card svg {
    grid-row: 1 / span 2;
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.mapa-indicador-card strong {
    font-size: 0.86rem;
    line-height: 1.1;
    font-weight: 700;
}

.mapa-indicador-card span {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.1;
}

.mapa-indicador-card:hover {
    border-color: rgba(47, 95, 159, 0.5);
    background: #eef6ff;
}

.mapa-indicador-card.active {
    background: linear-gradient(135deg, #073b6d 0%, #0b7a75 100%);
    border-color: #073b6d;
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(7, 59, 109, 0.24);
}

.mapa-indicador-card.active i,
.mapa-indicador-card.active svg,
.mapa-indicador-card.active span {
    color: rgba(255,255,255,0.86);
}

.mapa-layer-card.active {
    background: linear-gradient(135deg, #92400e 0%, #f59e0b 100%);
    border-color: #92400e;
}

.card-section:has(.mapa-indicador-grid) .mapa-container {
    margin: 1rem 1.25rem 0;
    width: calc(100% - 2.5rem);
}

.card-section:has(.mapa-indicador-grid) .mapa-legenda {
    margin-left: 1.25rem;
    margin-right: 1.25rem;
}

[data-theme="dark"] .educ-portal-hero {
    background:
        linear-gradient(90deg, rgba(11,17,27,0.94) 0%, rgba(23,34,50,0.86) 45%, rgba(11,17,27,0.94) 100%),
        radial-gradient(circle at 14% 16%, rgba(222, 42, 65, 0.24), transparent 31%),
        radial-gradient(circle at 86% 10%, rgba(20, 150, 190, 0.2), transparent 34%),
        #0b111b;
}

[data-theme="dark"] .educ-portal-brand,
[data-theme="dark"] .educ-portal-brand strong {
    color: var(--text-dark);
}

[data-theme="dark"] .mapa-indicador-card {
    background: var(--bg-subtle);
    border-color: var(--border);
    color: var(--text-dark);
}

[data-theme="dark"] .mapa-indicador-card:hover {
    background: var(--bg-hover);
}

@media (max-width: 1100px) {
    .educ-portal-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .mapa-indicador-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .educ-portal-hero {
        padding: 1rem;
    }
    .educ-portal-brand {
        justify-content: flex-start;
    }
    .educ-portal-brand img {
        height: 44px;
    }
    .educ-portal-brand span {
        font-size: 1.35rem;
    }
    .educ-portal-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .educ-portal-tile {
        min-height: 118px;
        padding: 0.85rem;
    }
    .mapa-indicador-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 0.8rem 0.85rem 0;
    }
    .card-section:has(.mapa-indicador-grid) .mapa-container {
        margin: 0.8rem 0.85rem 0;
        width: calc(100% - 1.7rem);
    }
    .card-section:has(.mapa-indicador-grid) .mapa-legenda {
        margin-left: 0.85rem;
        margin-right: 0.85rem;
    }
}

:root {
    /* === CORES TCM-BA (tons sóbrios) === */
    --primary: #1f3f73;
    --primary-dark: #14243d;
    --primary-light: #2f5f9f;
    --accent: #2f8a68;
    --accent-light: #49a983;
    --danger: #8f2f2b;
    --danger-light: #b9433b;
    --warning: #b87520;
    --warning-light: #d59a3a;
    --info: #2b7199;
    --info-light: #4d99bf;

    /* === TEXTO === */
    --text-dark: #1f2530;
    --text-secondary: #596273;
    --text-muted: #7a8494;
    --text-tertiary: #a8afbb;

    /* === FUNDOS === */
    --bg-light: #f4f6f8;
    --bg-subtle: #fafbfc;
    --bg-card: #ffffff;
    --bg-hover: #f0f3f6;

    /* === BORDAS === */
    --border: #e1e6ee;
    --border-strong: #cbd3df;

    /* === RAIOS === */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-2xl: 16px;
    --radius-full: 9999px;

    /* === TIPOGRAFIA === */
    --text-xs: 0.72rem;
    --text-sm: 0.82rem;
    --text-base: 0.92rem;
    --text-md: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.35rem;
    --text-2xl: 1.65rem;
    --text-3xl: 2rem;

    /* === SOMBRAS === */
    --shadow-xs: 0 1px 2px rgba(20, 28, 42, 0.04);
    --shadow: 0 1px 3px rgba(20, 28, 42, 0.05), 0 1px 2px rgba(20, 28, 42, 0.04);
    --shadow-md: 0 4px 8px -2px rgba(20, 28, 42, 0.06), 0 2px 4px -2px rgba(20, 28, 42, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(20, 28, 42, 0.08), 0 4px 6px -2px rgba(20, 28, 42, 0.04);

    /* === TRANSICOES === */
    --transition: 0.15s ease;
}

/* Dark mode — tema institucional sóbrio */
[data-theme="dark"] {
    --primary: #75a7f0;
    --primary-dark: #a9c9f8;
    --primary-light: #93bcf4;
    --accent: #63c59c;
    --accent-light: #8fd8bb;
    --text-dark: #e7ebf2;
    --text-secondary: #c7ced9;
    --text-muted: #9aa4b4;
    --text-tertiary: #737e90;
    --bg-light: #101722;
    --bg-subtle: #0d131d;
    --bg-card: #172232;
    --bg-hover: #1f2c3f;
    --border: #2b394c;
    --border-strong: #3a4b62;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] body { background: var(--bg-light); color: var(--text-dark); }
[data-theme="dark"] .data-info,
[data-theme="dark"] .mapa-legenda { background: #0b1220; }
[data-theme="dark"] .chart-container,
[data-theme="dark"] .card-section,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .kpi-card { background: var(--bg-card); color: var(--text-dark); }
[data-theme="dark"] .card-section-title,
[data-theme="dark"] .chart-title,
[data-theme="dark"] .kpi-value { color: var(--text-dark); }
[data-theme="dark"] .nav { background: var(--bg-card); border-bottom-color: var(--border); }
[data-theme="dark"] .nav a:hover { background: #0b1220; }
[data-theme="dark"] .nav a.active { background: rgba(59, 130, 246, 0.12); color: var(--primary-light); }

/* Botao toggle tema */
.theme-toggle {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.theme-toggle:hover { background: rgba(255,255,255,0.22); }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    font-size: 14px;
}

/* Header Institucional */
.header {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 30%, #5a2a2a 100%);
    color: white;
    padding: 0;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #8a7a5a 0%, #7a6a4a 50%, #5a2a2a 100%);
}

.header-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 0.75rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    line-height: 1.15;
}

.header-subtitle {
    opacity: 0.8;
    font-size: 0.75rem;
    font-weight: 400;
    margin-top: 0.05rem;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Garante que atributo hidden tenha prioridade sobre display: flex dos componentes */
[hidden] { display: none !important; }

/* === Barra de filtro global (linha dedicada abaixo do nav) === */
.global-filter-bar {
    background: linear-gradient(180deg, var(--bg-subtle) 0%, var(--bg-light) 100%);
    border-bottom: 1px solid var(--border);
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.03);
}
.global-filter-bar-inner {
    max-width: 100%;
    margin: 0 auto;
    padding: 0.9rem 3rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.global-filter-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}
.global-filter-label [data-lucide] {
    color: var(--primary);
}
.global-filter-hint {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-left: auto;
    font-style: italic;
    white-space: nowrap;
}

/* Seletor: input principal da barra */
.global-municipio-selector {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.9rem 0.55rem 1rem;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-full);
    flex: 1;
    max-width: 560px;
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition), border-color var(--transition);
}
.global-municipio-selector:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(201, 162, 39, 0.15);
}
.global-municipio-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}
.global-municipio-input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    color: var(--text-dark) !important;
    padding: 0.25rem 0 !important;
    font-size: var(--text-base) !important;
    font-weight: 500 !important;
    outline: none;
    min-width: 0;
}
.global-municipio-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}
.global-municipio-input:hover {
    border: none !important;
}
.global-municipio-clear {
    background: var(--bg-hover);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), color var(--transition);
}
.global-municipio-clear:hover {
    background: var(--danger-light);
    color: #fff;
}
.global-municipio-sugestoes {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 320px;
    overflow-y: auto;
    z-index: 1100;
}

/* === Badge de município filtrado (abaixo do header) === */
.municipio-filtro-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.15rem;
    margin-bottom: 1.25rem;
    background: linear-gradient(90deg, rgba(201, 162, 39, 0.12) 0%, rgba(201, 162, 39, 0.04) 100%);
    border: 1px solid rgba(201, 162, 39, 0.35);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    color: var(--text-dark);
    box-shadow: var(--shadow-xs);
}
.municipio-filtro-badge [data-lucide] {
    color: var(--accent);
}
.municipio-filtro-badge strong {
    color: var(--primary);
    font-weight: 600;
}
.municipio-filtro-regiao {
    color: var(--text-muted);
    font-size: var(--text-xs);
    padding: 0.15rem 0.5rem;
    background: var(--bg-hover);
    border-radius: var(--radius-full);
}
.municipio-filtro-regiao:empty {
    display: none;
}
.municipio-filtro-limpar {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    cursor: pointer;
    transition: all var(--transition);
}
.municipio-filtro-limpar:hover {
    border-color: var(--danger-light);
    color: var(--danger-light);
}

/* Responsivo: barra empilhada em telas menores */
@media (max-width: 900px) {
    .global-filter-bar-inner {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.6rem;
    }
    .global-municipio-selector {
        max-width: 100%;
    }
    .global-filter-hint {
        display: none;
    }
}

/* Dark mode para barra global */
[data-theme="dark"] .global-filter-bar {
    background: linear-gradient(180deg, var(--bg-subtle) 0%, var(--bg-card) 100%);
    border-bottom-color: var(--border);
}
[data-theme="dark"] .global-municipio-selector {
    background: var(--bg-card);
    border-color: var(--border);
}

/* =========================================================
   COMPONENTES SEMÂNTICOS REUTILIZÁVEIS
   Objetivo: substituir os blocos inline spalhados pelo HTML.
   Uso progressivo — as abas serão refatoradas para consumir
   estas classes ao invés de style="" inline.
   ========================================================= */

/* Painel de seção: caixa branca com cabeçalho e conteúdo */
.section-panel {
    background: var(--bg-card);
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    margin-top: 0.75rem;
}
.section-panel--muted {
    background: var(--bg-subtle);
}
.section-panel--accent   { border-left: 3px solid var(--primary); }
.section-panel--success  { border-left: 3px solid var(--accent); }
.section-panel--warning  { border-left: 3px solid var(--warning-light); }
.section-panel--danger   { border-left: 3px solid var(--danger-light); }
.section-panel--info     { border-left: 3px solid var(--info-light); }

.section-panel-title {
    font-size: var(--text-sm);
    font-weight: 600;
    margin: 0 0 0.6rem 0;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.section-panel-title [data-lucide] {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}
.section-panel-hint {
    margin-left: auto;
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: 400;
    font-style: italic;
}
.section-panel-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.section-panel-heading {
    font-size: var(--text-lg);
    font-weight: 600;
    margin: 0;
    color: var(--text-dark);
    letter-spacing: -0.2px;
}
.section-panel-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin: 0.3rem 0 0 0;
}
.section-panel-subtitle strong {
    color: var(--text-secondary);
    font-weight: 600;
}
.section-panel-sep {
    margin: 0 0.5rem;
    color: var(--text-tertiary);
}

/* Cabeçalho municipal: contexto forte quando viewing um município */
.municipio-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: white;
    border-radius: var(--radius-lg);
    gap: 1rem;
}
.municipio-header h2 {
    font-size: var(--text-xl);
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.3px;
}
.municipio-header-meta {
    display: flex;
    gap: 1.25rem;
    margin-top: 0.4rem;
    font-size: var(--text-sm);
    opacity: 0.92;
}
.municipio-header-meta strong {
    font-weight: 600;
    opacity: 1;
}

/* Metric card semântico — substitui stat-card com background inline por tipo */
.metric-card {
    background: var(--bg-card);
    padding: 1rem 1.15rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border-strong);
    transition: transform var(--transition), box-shadow var(--transition);
}
.metric-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.metric-card--neutral  { border-left-color: var(--text-tertiary); }
.metric-card--info     { border-left-color: var(--info-light); }
.metric-card--success  { border-left-color: var(--accent); }
.metric-card--warning  { border-left-color: var(--warning-light); }
.metric-card--danger   { border-left-color: var(--danger-light); }
.metric-card--clickable { cursor: pointer; }
.metric-card--clickable:hover { border-color: var(--primary-light); }

.metric-card-value {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.1;
}
.metric-card-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 0.25rem;
}
.metric-card-hint {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Dark mode para componentes semânticos */
[data-theme="dark"] .section-panel { background: var(--bg-card); border-color: var(--border); }
[data-theme="dark"] .metric-card   { background: var(--bg-card); border-color: var(--border); }
[data-theme="dark"] .metric-card-value { color: var(--text-dark); }
[data-theme="dark"] .municipio-filtro-badge {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.12) 0%, rgba(59, 130, 246, 0.03) 100%);
    border-color: rgba(59, 130, 246, 0.3);
}

.header-sync-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius-lg);
    font-size: var(--text-xs);
    color: rgba(255,255,255,0.9);
}

.header-sync-info svg {
    opacity: 0.7;
}

/* Card section header — icones alinhados */
.card-section-title [data-lucide],
.card-section-title .lucide {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

/* Inputs com estilo moderno e consistente */
input[type="text"],
input[type="search"],
input[type="number"],
select {
    font-family: inherit;
    font-size: var(--text-base);
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-dark);
    transition: all var(--transition);
}
input[type="text"]:hover,
select:hover {
    border-color: var(--border-strong);
}

/* Navigation */
.nav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.nav ul {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    list-style: none;
    padding: 0 3rem;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    border-bottom: 4px solid transparent;
    transition: all 0.15s;
    position: relative;
}

.nav a:hover {
    color: var(--primary);
    background: var(--bg-light);
}

.nav a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: linear-gradient(180deg, transparent 0%, rgba(30, 58, 138, 0.08) 100%);
    font-weight: 600;
}

.nav a.active svg { stroke: var(--primary); }
.nav a [data-lucide], .nav a .lucide { width: 18px; height: 18px; }

/* Container */
.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 1.5rem 3rem;
}

/* Data Info */
.data-info {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.data-info strong {
    color: var(--text-dark);
}

/* Tab Content */
.tab-content {
    display: none !important;
}

.tab-content.active {
    display: block !important;
}

/* Alertas Banner */
.alertas-banner {
    background: linear-gradient(135deg, #f5f3ee 0%, #ece8dd 100%);
    border: 1px solid #c8c0b0;
    border-left: 4px solid #8a7a5a;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
}

.alerta-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.alertas-banner span {
    font-size: 0.9rem;
    color: #5a5040;
}

.alerta-link {
    margin-left: auto;
    color: #975a16;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.875rem;
    white-space: nowrap;
}

.alerta-link:hover {
    text-decoration: underline;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    opacity: 0.45;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card.highlight {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
}

.stat-card.highlight::before {
    background: var(--accent);
}

.stat-card.highlight .stat-value,
.stat-card.highlight .stat-label,
.stat-card.highlight .stat-change {
    color: white;
}

/* Card clicável (drill-down para lista/detalhe) */
.stat-card--clickable {
    cursor: pointer;
}
.stat-card--clickable:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}
.stat-card--clickable:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.stat-card-arrow {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    width: 14px;
    height: 14px;
    color: var(--text-tertiary);
    opacity: 0.5;
    transition: opacity var(--transition), color var(--transition), transform var(--transition);
    pointer-events: none;
}
.stat-card--clickable:hover .stat-card-arrow {
    opacity: 1;
    color: var(--primary);
    transform: translate(2px, -2px);
}

/* === Modal de estabelecimentos (lista) === */
.modal-estab {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 10000;
    overflow-y: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
    backdrop-filter: blur(2px);
}
.modal-estab-dialog {
    background: var(--bg-card);
    width: 100%;
    max-width: 1000px;
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    animation: modalEstabFadeIn 0.18s ease-out;
}
@keyframes modalEstabFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.modal-estab-header {
    padding: 1.25rem 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #fff;
    gap: 1rem;
}
.modal-estab-title {
    margin: 0;
    font-size: var(--text-xl);
    font-weight: 600;
    letter-spacing: -0.3px;
}
.modal-estab-subtitle {
    margin: 0.3rem 0 0 0;
    font-size: var(--text-sm);
    opacity: 0.9;
}
.modal-estab-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--transition);
}
.modal-estab-close:hover {
    background: rgba(255, 255, 255, 0.28);
}
.modal-estab-loading {
    padding: 3rem;
    text-align: center;
}
.modal-estab-loading p {
    margin-top: 1rem;
    color: var(--text-muted);
}
.modal-estab-spinner {
    display: inline-block;
    width: 44px;
    height: 44px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
.modal-estab-body {
    max-height: 70vh;
    overflow-y: auto;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.stat-icon {
    font-size: 1.5rem;
    opacity: 0.9;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.4px;
    margin-bottom: 0.2rem;
    color: var(--text-dark);
    line-height: 1.15;
}

.stat-label {
    font-size: 0.72rem;
    opacity: 0.75;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
}

.stat-change {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.stat-change.positive {
    color: var(--accent);
}

.stat-change.negative {
    color: var(--danger);
}

/* Mini Stat Cards */
.stat-card-mini {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    text-align: center;
    transition: all 0.2s;
}

.stat-card-mini:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-mini-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.stat-mini-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Charts */
.charts-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.chart-container {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-title::before {
    content: '';
    width: 4px;
    height: 18px;
    background: var(--accent);
    border-radius: 2px;
}

.chart-wrapper {
    height: 280px;
    position: relative;
}

/* Table */
.table-container {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.table-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-title::before {
    content: '';
    width: 4px;
    height: 18px;
    background: var(--accent);
    border-radius: 2px;
}

.table-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.search-input,
.filter-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    background: white;
    color: var(--text-dark);
    transition: border-color 0.2s;
}

.search-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

.search-input {
    width: 200px;
}

.btn-export {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-export:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(56, 161, 105, 0.4);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.875rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr {
    transition: background 0.15s;
}

tbody tr:hover {
    background: var(--bg-light);
}

tbody tr:last-child td {
    border-bottom: none;
}

.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem;
    font-size: 0.9rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.excelente {
    background: #f0ebe0;
    color: #6a5a3a;
    border: 1px solid #d8d0c0;
}

.badge.bom {
    background: #e8f0eb;
    color: #3d6b52;
    border: 1px solid #c8d8ce;
}

.badge.atencao {
    background: #f5f0e6;
    color: #7a6030;
    border: 1px solid #e0d8c8;
}

.badge.critico {
    background: #f5e8e8;
    color: #7a3b3b;
    border: 1px solid #e0c8c8;
}

/* Footer */
.footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.7);
    padding: 1.5rem 3rem;
    margin-top: 2rem;
}

.footer-content {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer p {
    font-size: 0.8rem;
    margin: 0;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: white;
}

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1rem 1.5rem;
    }

    .nav ul {
        flex-wrap: wrap;
        justify-content: center;
        padding: 0 1.5rem;
    }

    .nav a {
        padding: 0.75rem 1rem;
    }

    .container {
        padding: 1rem 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    th, td {
        padding: 0.75rem 1rem;
        font-size: 0.75rem;
    }

    .table-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-input {
        width: 100%;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* ===================================
   BUSCA DE MUNICÍPIO PRINCIPAL
   =================================== */

.search-municipio-principal {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.search-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.search-header svg {
    width: 28px;
    height: 28px;
    color: var(--primary);
}

.search-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-dark);
    font-weight: 600;
}

.search-box-container {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-box-large {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-light);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 0 1.25rem;
    transition: all 0.2s ease;
}

.search-box-large:focus-within {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
}

.search-box-large svg {
    width: 24px;
    height: 24px;
    color: var(--text-muted);
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.search-box-large input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 1.25rem 0;
    font-size: 1.125rem;
    color: var(--text-dark);
    outline: none;
}

.search-box-large input::placeholder {
    color: var(--text-muted);
}

.clear-search {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.75rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    transition: all 0.2s ease;
    display: none;
}

.clear-search:hover {
    color: var(--danger);
}

.search-box-large input:not(:placeholder-shown) ~ .clear-search {
    display: block;
}

.select-municipio-large {
    width: 100%;
    padding: 1.25rem 1.5rem;
    font-size: 1.125rem;
    color: var(--text-dark);
    background: var(--bg-light);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.select-municipio-large:hover {
    border-color: #cbd5e0;
}

.select-municipio-large:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--primary);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    max-height: 500px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-suggestions.active {
    display: block;
}

.suggestion-item {
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    border-bottom: 1px solid #e2e8f0;
    transition: all 0.15s ease;
    position: relative;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: linear-gradient(90deg, #f7fafc 0%, #edf2f7 100%);
    border-left: 4px solid var(--primary);
    padding-left: calc(1.5rem - 4px);
}

.suggestion-item:active {
    background: #e2e8f0;
}

.suggestion-item-nome {
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.35rem;
    font-size: 1.05rem;
}

.suggestion-item-regiao {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.municipio-selecionado {
    background: linear-gradient(135deg, var(--primary) 0%, #1e4976 100%);
    border-radius: 12px;
    padding: 1.75rem;
    color: white;
    display: none;
}

.municipio-selecionado.show {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.municipio-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.municipio-header h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
    font-weight: 700;
}

.municipio-header p {
    margin: 0;
    font-size: 1rem;
    opacity: 0.9;
}

.municipio-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.mini-stat {
    background: rgba(255, 255, 255, 0.15);
    padding: 1rem;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.mini-stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.mini-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Sugestões de Município */
.sugestoes-municipio {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--primary);
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.sugestao-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.15s;
}

.sugestao-item:last-child {
    border-bottom: none;
}

.sugestao-item:hover {
    background: #f7fafc;
}

.sugestao-item-nome {
    font-weight: 600;
    color: var(--text-dark);
}

.sugestao-item-regiao {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.sugestao-item-dados {
    font-size: 0.75rem;
    color: var(--primary);
    margin-top: 4px;
}

.hospital-tipo-card {
    background: rgba(255,255,255,0.15);
    padding: 0.75rem;
    border-radius: 8px;
    text-align: center;
}

/* ==========================================
   KPI Cards (topo Visão Geral)
   ========================================== */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Hero: primeiro KPI destacado */
.kpi-card.kpi-hero {
    background: linear-gradient(135deg, #1f3f73 0%, #2f5f9f 60%, #5a2a2a 100%);
    border: none;
    color: white;
    position: relative;
    overflow: hidden;
}
.kpi-card.kpi-hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #8a7a5a, #7a6a4a, #5a2a2a);
}
.kpi-card.kpi-hero .kpi-icon { background: rgba(255,255,255,0.15); color: white; width: 56px; height: 56px; }
.kpi-card.kpi-hero .kpi-value { color: white; font-size: 2.25rem; }
.kpi-card.kpi-hero .kpi-label { color: rgba(255,255,255,0.85); }

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-content {
    min-width: 0;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-dark);
    line-height: 1.15;
}

.kpi-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 500;
    margin-top: 0.2rem;
}

@media (max-width: 1200px) {
    .kpi-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .kpi-row { grid-template-columns: repeat(2, 1fr); }
    .kpi-value { font-size: 1.25rem; }
}

/* ==========================================
   Legenda do mapa — gradiente contínuo
   ========================================== */
.mapa-legenda-gradient {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.mapa-legenda-bar {
    flex: 1;
    height: 10px;
    border-radius: 4px;
    background: linear-gradient(90deg, #d8dce4 0%, #a8b0c0 25%, #788090 50%, #586070 75%, #384050 100%);
    position: relative;
}
.mapa-legenda-min, .mapa-legenda-max {
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
}

/* ==========================================
   Footer institucional
   ========================================== */
.site-footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.85);
    margin-top: 3rem;
    padding: 1.75rem 3rem 1.25rem;
    border-top: 4px solid;
    border-image: linear-gradient(90deg, #8a7a5a, #7a6a4a, #5a2a2a) 1;
}
.site-footer-inner {
    max-width: 100%;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.site-footer h4 {
    color: white;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
    font-weight: 600;
}
.site-footer p, .site-footer li {
    font-size: 0.82rem;
    line-height: 1.6;
}
.site-footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.site-footer a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
}
.site-footer a:hover { color: #c8b888; text-decoration: underline; }
.site-footer-bottom {
    padding-top: 1rem;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
}
@media (max-width: 768px) {
    .site-footer { padding: 1.5rem 1.5rem 1rem; }
    .site-footer-inner { grid-template-columns: 1fr; gap: 1.25rem; }
}

/* Mapa responsivo */
@media (max-width: 768px) {
    .mapa-container { height: 320px !important; }
}

/* ==========================================
   Card Sections (mapa, conteúdo genérico)
   ========================================== */
.card-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.card-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.card-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.select-indicador {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    background: white;
    transition: border-color 0.2s;
}

.select-indicador:focus {
    border-color: var(--primary);
    outline: none;
}

/* ==========================================
   Mapa
   ========================================== */
.mapa-container {
    height: 600px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.mapa-legenda {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-radius: 6px;
    flex-wrap: wrap;
}

.mapa-legenda-titulo {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
}

.mapa-legenda-faixas {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.legenda-faixa {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: #64748b;
}

.legenda-cor {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    display: inline-block;
    border: 1px solid rgba(0,0,0,0.1);
}

.mapa-legenda-dica {
    margin-left: auto;
    font-size: 0.8rem;
    color: #94a3b8;
    font-style: italic;
}

/* ==========================================
   Sub-abas (Financeiro)
   ========================================== */
.subtabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 4px;
}

.subtab {
    flex: 1;
    padding: 0.75rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.subtab:hover {
    color: var(--text-dark);
    background: rgba(255,255,255,0.5);
}

.subtab.active {
    background: white;
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.subtab-content {
    display: none;
}

.subtab-content.active {
    display: block;
}

/* ==========================================
   Input e hints genéricos
   ========================================== */
.input-busca {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.input-busca:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.input-hint {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #94a3b8;
}

/* ==========================================
   Toast Notifications
   ========================================== */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastEntrar 0.3s ease;
    max-width: 420px;
    min-width: 280px;
}

.toast-erro {
    background: var(--danger);
    color: white;
    border-left: 4px solid #7f1d1d;
}

.toast-saindo {
    animation: toastSair 0.3s ease forwards;
}

@keyframes toastEntrar {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSair {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ==========================================
   DESIGN SYSTEM — Botoes, Zebra, Focus, Empty
   ========================================== */

/* Icones Lucide — peso e tamanho consistentes */
[data-lucide], .lucide {
    width: 18px;
    height: 18px;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    flex-shrink: 0;
}
.icon-lg [data-lucide], .icon-lg.lucide { width: 22px; height: 22px; }
.icon-xl [data-lucide], .icon-xl.lucide { width: 28px; height: 28px; }
.icon-sm [data-lucide], .icon-sm.lucide { width: 14px; height: 14px; }

/* Botoes — sistema unificado */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    font-size: var(--text-sm);
    font-weight: 500;
    font-family: inherit;
    line-height: 1.3;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
    white-space: nowrap;
    text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn [data-lucide] { width: 15px; height: 15px; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-light); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover:not(:disabled) { background: var(--accent-light); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-danger { background: transparent; color: var(--danger-light); border-color: var(--danger-light); }
.btn-danger:hover:not(:disabled) { background: rgba(220, 38, 38, 0.08); }

.btn-ghost { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-dark); border-color: var(--border-strong); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: var(--text-xs); }
.btn-lg { padding: 0.75rem 1.5rem; font-size: var(--text-md); }

/* Zebra striping em tabelas — escopado (nao afeta analise e alguns customs) */
table.data-table tbody tr:nth-child(even) td { background: var(--bg-subtle); }
[data-theme="dark"] table.data-table tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.025); }

/* Focus rings globais acessiveis */
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.12);
    outline: none;
}
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Empty states */
.empty-state {
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-muted);
    background: var(--bg-subtle);
    border-radius: var(--radius-xl);
    border: 2px dashed var(--border);
}
.empty-state [data-lucide],
.empty-state .lucide {
    width: 48px;
    height: 48px;
    stroke-width: 1.5;
    color: var(--text-tertiary);
    margin: 0 auto 1rem;
}
.empty-state h3 {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 0.35rem;
}
.empty-state p {
    font-size: var(--text-sm);
    margin: 0;
}

/* Skeleton loading */
.skeleton {
    display: inline-block;
    background: linear-gradient(90deg, var(--bg-hover) 0%, var(--bg-light) 50%, var(--bg-hover) 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s infinite;
    border-radius: var(--radius-sm);
    color: transparent;
}
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Card highlight (substitui gradientes inline) */
.card-highlight {
    background: linear-gradient(135deg, #f0f3f7 0%, #e6eaef 100%);
    border: 1px solid #d1d7e0;
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
}
.card-highlight-success {
    background: linear-gradient(135deg, #f0ebe0 0%, #e6e0d0 100%);
    border: 1px solid #d8d0c0;
    border-left: 4px solid var(--accent);
}
.card-highlight-warn {
    background: linear-gradient(135deg, #f5f3ee 0%, #ece8dd 100%);
    border: 1px solid #d8d0c0;
    border-left: 4px solid #8a7a5a;
}
[data-theme="dark"] .card-highlight {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.3);
}
[data-theme="dark"] .card-highlight-success {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.3);
}
[data-theme="dark"] .card-highlight-warn {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.3);
}

/* Header actions — sync por fonte */
.header-sync-sources {
    display: flex;
    gap: 0.5rem;
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, 0.85);
    align-items: center;
}
.header-sync-sources .sync-chip {
    padding: 0.25rem 0.6rem;
    background: rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-variant-numeric: tabular-nums;
}
.header-sync-sources .sync-chip strong { font-weight: 600; opacity: 0.95; }

/* ==========================================
   Aba Análises — overrides escopados em #resultadosAnalise
   Estiliza o HTML inline gerado por app-analise.js sem reescrever o JS
   ========================================== */
#resultadosAnalise > div {
    margin-top: 2rem;
}

/* Cabecalho do municipio analisado */
#resultadosAnalise > div > div:first-child {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 1.75rem 2rem !important;
    margin-bottom: 1.5rem !important;
    box-shadow: var(--shadow-lg) !important;
    position: relative !important;
    overflow: hidden !important;
}
#resultadosAnalise > div > div:first-child::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #8a7a5a, #7a6a4a, #5a2a2a);
}
#resultadosAnalise > div > div:first-child h2 {
    color: white !important;
    font-size: 1.75rem !important;
    letter-spacing: -0.5px !important;
    margin-bottom: 0.75rem !important;
}
#resultadosAnalise > div > div:first-child div,
#resultadosAnalise > div > div:first-child strong {
    color: rgba(255, 255, 255, 0.92) !important;
}

/* Secoes — cards */
#resultadosAnalise > div > div:not(:first-child) {
    background: white !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    padding: 1.5rem 1.75rem !important;
    margin-bottom: 1.25rem !important;
    box-shadow: var(--shadow) !important;
    transition: box-shadow 0.2s;
}
#resultadosAnalise > div > div:not(:first-child):hover {
    box-shadow: var(--shadow-lg) !important;
}

/* Titulos das secoes — faixa colorida a esquerda */
#resultadosAnalise h3 {
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    letter-spacing: 1.2px !important;
    text-transform: uppercase !important;
    color: var(--primary) !important;
    border-bottom: 2px solid var(--border) !important;
    padding: 0 0 0.75rem 0.9rem !important;
    margin: 0 0 1.25rem 0 !important;
    position: relative;
}
#resultadosAnalise h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.1rem;
    bottom: 0.9rem;
    width: 4px;
    background: var(--primary);
    border-radius: 2px;
}

/* Tabelas */
#resultadosAnalise table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}
#resultadosAnalise thead tr {
    background: var(--bg-light) !important;
}
#resultadosAnalise thead th {
    padding: 0.7rem 0.9rem !important;
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: var(--text-muted) !important;
    border-bottom: 2px solid var(--border) !important;
}
#resultadosAnalise thead th:first-child { border-top-left-radius: 6px; }
#resultadosAnalise thead th:last-child { border-top-right-radius: 6px; }

#resultadosAnalise tbody tr {
    transition: background 0.15s;
}
#resultadosAnalise tbody tr:hover {
    background: var(--bg-light) !important;
}
#resultadosAnalise tbody td {
    padding: 0.7rem 0.9rem !important;
    border-bottom: 1px solid var(--border) !important;
    font-size: 0.88rem !important;
}
#resultadosAnalise tbody tr:last-child td {
    border-bottom: none !important;
}

/* Destaque coluna do municipio (2a coluna) */
#resultadosAnalise tbody td:nth-child(2) {
    background: rgba(30, 58, 138, 0.04) !important;
    border-left: 3px solid var(--primary) !important;
    color: var(--primary-dark) !important;
    font-weight: 700 !important;
}
#resultadosAnalise thead th:nth-child(2) {
    color: var(--primary) !important;
    background: rgba(30, 58, 138, 0.06) !important;
    border-left: 3px solid var(--primary) !important;
}

/* Colunas de comparacao (3a,4a,5a) */
#resultadosAnalise tbody td:nth-child(n+3) {
    color: var(--text-muted) !important;
    font-variant-numeric: tabular-nums;
}

/* Dark mode na aba analises */
[data-theme="dark"] #resultadosAnalise > div > div:not(:first-child) {
    background: var(--bg-card) !important;
    border-color: var(--border) !important;
}
[data-theme="dark"] #resultadosAnalise thead tr { background: #0b1220 !important; }
[data-theme="dark"] #resultadosAnalise tbody tr:hover { background: #0b1220 !important; }
[data-theme="dark"] #resultadosAnalise tbody td:nth-child(2) {
    background: rgba(59, 130, 246, 0.12) !important;
    color: var(--primary-light) !important;
}
[data-theme="dark"] #resultadosAnalise thead th:nth-child(2) {
    background: rgba(59, 130, 246, 0.15) !important;
}

/* Empty state mais sutil */
#analiseAguardando {
    border: 2px dashed var(--border) !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 3.5rem 2rem !important;
}
#analiseAguardando h3 {
    font-size: 0.95rem !important;
    font-weight: 500 !important;
}

/* Busca de municipio — mais polida */
#tab-analises .alertas-banner {
    background: linear-gradient(135deg, #f0f3f7 0%, #e6eaef 100%) !important;
    border: 1px solid #d1d7e0 !important;
    border-left: 4px solid var(--primary) !important;
}
#tab-analises .alertas-banner span { color: var(--primary-dark) !important; }

@media (max-width: 768px) {
    #resultadosAnalise table { font-size: 0.8rem; }
    #resultadosAnalise tbody td,
    #resultadosAnalise thead th { padding: 0.5rem !important; }
    #resultadosAnalise > div > div:first-child { padding: 1.25rem !important; }
    #resultadosAnalise > div > div:first-child h2 { font-size: 1.35rem !important; }
    #resultadosAnalise > div > div:not(:first-child) { padding: 1rem !important; }
}

/* ==========================================================================
   Refinamento visual Radar Saude 2026-04
   Camada reversivel: preserva markup e logica, reduz ruido e melhora leitura.
   ========================================================================== */
:root {
    --primary: #1f3f73;
    --primary-dark: #14243d;
    --primary-light: #2f5f9f;
    --accent: #2f8a68;
    --accent-light: #49a983;
    --danger: #8f2f2b;
    --danger-light: #b9433b;
    --warning: #b87520;
    --warning-light: #d59a3a;
    --info: #2b7199;
    --info-light: #4d99bf;
    --text-dark: #1f2530;
    --text-secondary: #596273;
    --text-muted: #7a8494;
    --text-tertiary: #a8afbb;
    --bg-light: #f4f6f8;
    --bg-subtle: #fafbfc;
    --bg-card: #ffffff;
    --bg-hover: #f0f3f6;
    --border: #e1e6ee;
    --border-strong: #cbd3df;
    --radius-sm: 5px;
    --radius-md: 7px;
    --radius-lg: 9px;
    --radius-xl: 11px;
    --shadow-xs: 0 1px 2px rgba(20, 28, 42, 0.04);
    --shadow: 0 1px 2px rgba(20, 28, 42, 0.05), 0 8px 22px rgba(20, 28, 42, 0.035);
    --shadow-md: 0 2px 6px rgba(20, 28, 42, 0.06), 0 14px 32px rgba(20, 28, 42, 0.06);
    --shadow-lg: 0 10px 28px rgba(20, 28, 42, 0.14);
}

[data-theme="dark"] {
    --primary: #75a7f0;
    --primary-dark: #a9c9f8;
    --primary-light: #93bcf4;
    --accent: #63c59c;
    --accent-light: #8fd8bb;
    --text-dark: #e7ebf2;
    --text-secondary: #c7ced9;
    --text-muted: #9aa4b4;
    --text-tertiary: #737e90;
    --bg-light: #101722;
    --bg-subtle: #0d131d;
    --bg-card: #172232;
    --bg-hover: #1f2c3f;
    --border: #2b394c;
    --border-strong: #3a4b62;
}

body {
    background: var(--bg-light);
    letter-spacing: 0;
}

.header {
    background: #152033;
    box-shadow: 0 1px 0 rgba(255,255,255,0.04), 0 12px 30px rgba(20,28,42,0.12);
}
.header::before {
    height: 3px;
    background: linear-gradient(90deg, #2f8a68 0%, #2f5f9f 54%, #b87520 100%);
}
.header-content {
    padding: 0.85rem 3rem;
}
.header-brand img {
    background: rgba(255,255,255,0.96);
    border-radius: 7px;
    padding: 4px 9px;
    height: 40px !important;
    margin-right: 0.85rem !important;
}
.header h1 {
    font-size: 1.2rem;
    letter-spacing: 0;
}
.header-subtitle {
    opacity: 0.68;
    letter-spacing: 0;
}
.theme-toggle,
.header-sync-sources .sync-chip {
    background: rgba(255,255,255,0.09);
    border-color: rgba(255,255,255,0.14);
    border-radius: 8px;
}

.nav {
    background: rgba(255,255,255,0.92);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(20,28,42,0.02);
    backdrop-filter: blur(12px) saturate(1.15);
}
.nav ul {
    padding: 0 2.5rem;
    gap: 0.15rem;
}
.nav a {
    border-radius: 0;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0;
}
.nav a:hover {
    background: var(--bg-hover);
    color: var(--primary);
}
.nav a.active {
    background: transparent;
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.global-filter-bar {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    box-shadow: none;
}
.global-filter-bar-inner {
    padding: 0.85rem 3rem;
}
.global-filter-label {
    letter-spacing: 0.35px;
}
.global-municipio-selector {
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    box-shadow: none;
    max-width: 620px;
}
.global-municipio-selector:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(47, 138, 104, 0.14);
}
.global-filter-hint {
    font-style: normal;
}

.container {
    max-width: 1440px;
    padding-left: 2.5rem;
    padding-right: 2.5rem;
}
.data-info,
.municipio-filtro-badge,
.alertas-banner,
.section-panel,
.search-municipio-principal,
.municipio-selecionado,
.card-highlight {
    border-radius: 9px !important;
    box-shadow: var(--shadow-xs) !important;
}
.data-info {
    background: #ffffff;
    border: 1px solid var(--border);
}

.card-section,
.chart-container,
.stat-card,
.kpi-card,
.metric-card,
.stat-card-mini,
.table-container,
.section-panel,
.modal-estab-content,
.hospital-tipo-card {
    border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.card-section:hover,
.chart-container:hover,
.stat-card:hover,
.kpi-card:hover,
.metric-card:hover,
.stat-card-mini:hover,
.hospital-tipo-card:hover {
    transform: none;
    box-shadow: var(--shadow-md);
}
.card-section-header,
.chart-header,
.table-header {
    border-bottom-color: var(--border);
}
.card-section-title,
.chart-title,
.section-panel-title,
.section-panel-heading,
.search-header h2 {
    color: var(--text-dark);
    letter-spacing: 0;
}
.card-section-title [data-lucide],
.section-panel-title [data-lucide],
.chart-title [data-lucide] {
    color: var(--primary);
}

.mapa-container {
    border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: none;
}
.mapa-legenda {
    border-radius: 9px;
    border: 1px solid var(--border);
    box-shadow: none;
}
.mapa-legenda-bar {
    border-radius: 999px;
}

.kpi-card.kpi-hero {
    background: linear-gradient(135deg, #1f3f73 0%, #2f8a68 100%);
}
.kpi-card.kpi-hero::before {
    opacity: 0.08;
}
.kpi-icon,
.stat-card-arrow,
.metric-card-icon {
    border-radius: 8px;
}
.stat-card {
    overflow: hidden;
}
.stat-card::before {
    height: 3px;
    opacity: 0.9;
}
.stat-value,
.kpi-value,
.metric-card-value {
    letter-spacing: -0.02em;
}
.stat-label,
.kpi-label,
.metric-card-label {
    letter-spacing: 0.02em;
}
.stat-card.highlight {
    background: linear-gradient(135deg, #1f3f73 0%, #2f8a68 100%);
}

input,
select,
textarea,
.select-indicador,
.select-municipio-large {
    border-radius: 8px !important;
    border-color: var(--border-strong) !important;
}
input:focus,
select:focus,
textarea:focus,
.select-indicador:focus,
.select-municipio-large:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(47, 138, 104, 0.14) !important;
    outline: none !important;
}
.btn,
.btn-export,
.municipio-filtro-limpar,
.global-municipio-clear {
    border-radius: 8px;
    box-shadow: none;
}
.btn-primary,
.btn-export {
    background: var(--primary);
}
.btn-primary:hover:not(:disabled),
.btn-export:hover {
    background: var(--primary-light);
    transform: none;
    box-shadow: var(--shadow-md);
}
.btn-accent {
    background: var(--accent);
}
.btn-accent:hover:not(:disabled) {
    background: var(--accent-light);
    transform: none;
    box-shadow: var(--shadow-md);
}

.sugestoes-municipio,
.global-municipio-sugestoes {
    border-radius: 9px;
    border-color: var(--border);
    box-shadow: var(--shadow-lg);
}
.modal-estab-overlay {
    backdrop-filter: blur(3px);
}
.modal-estab-content {
    overflow: hidden;
}
.modal-estab-header {
    background: #152033;
}

[data-theme="dark"] .header {
    background: #0b111b;
}
[data-theme="dark"] .nav,
[data-theme="dark"] .global-filter-bar,
[data-theme="dark"] .data-info,
[data-theme="dark"] .mapa-legenda,
[data-theme="dark"] .global-municipio-selector {
    background: var(--bg-card);
}
[data-theme="dark"] .nav a.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary-light);
}
[data-theme="dark"] .nav a:hover {
    background: var(--bg-hover);
}
[data-theme="dark"] .card-section,
[data-theme="dark"] .chart-container,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .kpi-card,
[data-theme="dark"] .metric-card,
[data-theme="dark"] .stat-card-mini,
[data-theme="dark"] .table-container,
[data-theme="dark"] .section-panel,
[data-theme="dark"] .search-municipio-principal,
[data-theme="dark"] .municipio-selecionado {
    background: var(--bg-card);
    border-color: var(--border);
}
[data-theme="dark"] .data-info,
[data-theme="dark"] .global-filter-bar {
    border-color: var(--border);
}

@media (max-width: 900px) {
    .header-content,
    .global-filter-bar-inner {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .nav ul {
        padding: 0 0.75rem;
    }
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 768px) {
    .header-content {
        align-items: flex-start;
        gap: 0.8rem;
    }
    .header-brand {
        min-width: 0;
    }
    .header-brand img {
        height: 34px !important;
        margin-right: 0.45rem !important;
    }
    .header h1 {
        font-size: 1.05rem;
    }
    .header-subtitle {
        font-size: 0.7rem;
    }
    .header-actions {
        gap: 0.45rem;
    }
    .global-filter-bar-inner {
        gap: 0.65rem;
    }
    .global-municipio-selector {
        max-width: none;
        width: 100%;
    }
    .card-section,
    .chart-container,
    .section-panel {
        border-radius: 9px;
    }
}

/* ==========================================
   PORTAL EDUCACAO — Mescla cidadao + tecnico
   ========================================== */

/* Busca cidadao */
.busca-cidadao-bar {
    background: linear-gradient(180deg, #f0f3f7 0%, #ffffff 100%);
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 3rem;
}
.busca-cidadao-box {
    position: relative;
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-full);
    padding: 0.75rem 1.1rem;
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition), border-color var(--transition);
}
.busca-cidadao-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(47, 138, 104, 0.12);
}
.busca-cidadao-box i {
    color: var(--text-muted);
    flex-shrink: 0;
}
.busca-cidadao-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: var(--text-base);
    font-family: inherit;
    color: var(--text-dark);
    min-width: 0;
}
.busca-cidadao-box input::placeholder {
    color: var(--text-muted);
}
.busca-sugestoes {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1100;
}
.busca-sugestoes .sugestao-item {
    padding: 0.7rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.busca-sugestoes .sugestao-item:last-child {
    border-bottom: none;
}
.busca-sugestoes .sugestao-item:hover {
    background: var(--bg-hover);
}
.busca-sugestoes .sugestao-item-nome {
    font-weight: 600;
    color: var(--text-dark);
    font-size: var(--text-sm);
}
.busca-sugestoes .sugestao-item-regiao {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* Ficha do municipio */
.ficha-municipio {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
}
.ficha-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.ficha-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.ficha-cidade {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-dark);
    margin: 0.15rem 0;
    letter-spacing: -0.3px;
}
.ficha-regiao {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}
.ficha-nota-box {
    text-align: center;
    min-width: 90px;
}
.ficha-nota-letra {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    font-weight: 800;
    color: white;
    margin: 0 auto 0.35rem;
    box-shadow: var(--shadow-md);
}
.ficha-nota-letra.nota-a { background: linear-gradient(135deg, #2a4a6e, #4a6a8e); }
.ficha-nota-letra.nota-b { background: linear-gradient(135deg, #3d6b52, #5a8b6e); }
.ficha-nota-letra.nota-c { background: linear-gradient(135deg, #8a6a3a, #a88a5a); }
.ficha-nota-letra.nota-d { background: linear-gradient(135deg, #7a3b3b, #9a5b5b); }
.ficha-nota-texto {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-secondary);
}

/* Comparativo */
.ficha-comparativo {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin-bottom: 1.25rem;
}
.ficha-barra-item {
    display: grid;
    grid-template-columns: 150px 1fr 70px;
    align-items: center;
    gap: 0.75rem;
}
.ficha-barra-item > span:first-child {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: 500;
    text-align: right;
}
.ficha-barra-fundo {
    background: var(--bg-hover);
    border-radius: var(--radius-full);
    height: 22px;
    overflow: hidden;
}
.ficha-barra-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transition: width 0.8s ease;
}
.ficha-barra-fill.ficha-barra-media {
    background: linear-gradient(90deg, #6b7280, #9ca3af);
}
.ficha-barra-fill.ficha-barra-meta {
    background: repeating-linear-gradient(45deg, #d1d5db, #d1d5db 8px, #e5e7eb 8px, #e5e7eb 16px);
    border: 2px dashed #9ca3af;
}
.ficha-barra-item > strong {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-dark);
}

/* Indicadores mini */
.ficha-indicadores {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}
.ficha-mini-card {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    text-align: center;
    position: relative;
}
.ficha-mini-nome {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.35rem;
}
.ficha-mini-valor {
    display: block;
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}
.ficha-mini-ajuda {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all var(--transition);
}
.ficha-mini-ajuda:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Ranking */
.ficha-ranking {
    background: linear-gradient(135deg, #f5f3e8, #ece8d5);
    border: 1px solid #c8c0a0;
    border-radius: var(--radius-md);
    padding: 0.85rem 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: var(--text-sm);
    color: #5a5040;
    font-weight: 500;
}

/* Explicacao de aba */
.explicacao-aba {
    background: linear-gradient(135deg, #f0f3f7 0%, #e6eaef 100%);
    border: 1px solid #d1d7e0;
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-xs);
}
.explicacao-aba h4 {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--primary-dark);
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.explicacao-aba h4 i {
    width: 16px;
    height: 16px;
}
.explicacao-aba p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Escala IDEB */
.escala-idEB {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.escala-item {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
}

/* Modal ajuda */
.modal-ajuda {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
    backdrop-filter: blur(2px);
}
.modal-ajuda[hidden] {
    display: none !important;
}
.modal-ajuda-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    position: relative;
    animation: modalFadeIn 0.18s ease-out;
}
@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.modal-ajuda-fechar {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--bg-hover);
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.modal-ajuda-fechar:hover {
    background: var(--danger-light);
    color: white;
}
.modal-ajuda-content h3 {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 0.75rem 0;
}
.modal-ajuda-content p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.65;
    margin: 0 0 0.5rem 0;
}

/* Dark mode overrides */
[data-theme="dark"] .busca-cidadao-bar {
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-light) 100%);
    border-bottom-color: var(--border);
}
[data-theme="dark"] .busca-cidadao-box {
    background: var(--bg-card);
    border-color: var(--border);
}
[data-theme="dark"] .ficha-municipio {
    background: var(--bg-card);
    border-color: var(--border);
}
[data-theme="dark"] .ficha-mini-card {
    background: rgba(255,255,255,0.03);
}
[data-theme="dark"] .ficha-ranking {
    background: linear-gradient(135deg, rgba(254,252,232,0.08), rgba(254,249,195,0.05));
    border-color: rgba(253,224,71,0.3);
    color: #c8b888;
}
[data-theme="dark"] .explicacao-aba {
    background: linear-gradient(135deg, rgba(59,130,246,0.08) 0%, rgba(37,99,235,0.05) 100%);
    border-color: rgba(59,130,246,0.25);
}
[data-theme="dark"] .explicacao-aba h4 {
    color: var(--primary-light);
}
[data-theme="dark"] .modal-ajuda-content {
    background: var(--bg-card);
}

/* Responsivo */
@media (max-width: 768px) {
    .busca-cidadao-bar {
        padding: 1rem 1.5rem;
    }
    .ficha-municipio {
        padding: 1.25rem;
    }
    .ficha-header {
        flex-direction: column;
        text-align: center;
    }
    .ficha-nota-box {
        order: -1;
    }
    .ficha-barra-item {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }
    .ficha-barra-item > span:first-child {
        text-align: left;
    }
    .ficha-indicadores {
        grid-template-columns: 1fr;
    }
    .escala-idEB {
        flex-direction: column;
    }
}

/* Skin final Educacao: prevalece sobre os overrides antigos */
body:not([data-theme="dark"]) {
    background:
        radial-gradient(circle at 8% 10%, rgba(244, 114, 182, 0.10), transparent 28%),
        radial-gradient(circle at 92% 18%, rgba(45, 212, 191, 0.12), transparent 30%),
        #f8f6f3;
}
body:not([data-theme="dark"]) .header {
    background: linear-gradient(135deg, #273246 0%, #40324a 52%, #1e4a47 100%) !important;
    color: #ffffff;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.18);
}
body:not([data-theme="dark"]) .header::before {
    background: linear-gradient(90deg, #ef476f 0%, #f59e0b 34%, #22c55e 66%, #38bdf8 100%) !important;
}
body:not([data-theme="dark"]) .header h1 { color: #ffffff; }
body:not([data-theme="dark"]) .header-subtitle { color: rgba(255,255,255,0.78); opacity: 1; }
body:not([data-theme="dark"]) .theme-toggle,
body:not([data-theme="dark"]) .header-sync-sources .sync-chip {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}
body:not([data-theme="dark"]) .nav { background: rgba(255, 252, 250, 0.94) !important; }
body:not([data-theme="dark"]) .nav a.active {
    color: #be185d !important;
    border-bottom-color: #ec4899 !important;
}
body:not([data-theme="dark"]) .nav a.active svg { stroke: #be185d !important; }
body:not([data-theme="dark"]) .nav a:hover {
    color: #be185d !important;
    background: #fff1f2 !important;
}
body:not([data-theme="dark"]) .educ-portal-hero {
    background:
        linear-gradient(90deg, rgba(255,255,255,0.84) 0%, rgba(255,247,237,0.66) 44%, rgba(255,255,255,0.86) 100%),
        radial-gradient(circle at 18% 18%, rgba(251, 113, 133, 0.22), transparent 30%),
        radial-gradient(circle at 80% 20%, rgba(56, 189, 248, 0.18), transparent 32%),
        radial-gradient(circle at 55% 90%, rgba(132, 204, 22, 0.16), transparent 34%),
        linear-gradient(135deg, #fff7ed 0%, #fdf2f8 45%, #ecfeff 100%) !important;
}
body:not([data-theme="dark"]) .educ-portal-brand span { color: #172033; }
body:not([data-theme="dark"]) .educ-portal-brand strong { color: #7c6576; }
body:not([data-theme="dark"]) .educ-portal-grid {
    border-color: rgba(190, 24, 93, 0.18);
    background: #fff7ed;
    box-shadow: 0 22px 48px rgba(148, 82, 113, 0.16);
}
body:not([data-theme="dark"]) .tile-red { background: linear-gradient(135deg, #e11d48, #fb7185); }
body:not([data-theme="dark"]) .tile-pink { background: linear-gradient(135deg, #be185d, #f472b6); }
body:not([data-theme="dark"]) .tile-purple { background: linear-gradient(135deg, #7c3aed, #c084fc); }
body:not([data-theme="dark"]) .tile-blue { background: linear-gradient(135deg, #2563eb, #38bdf8); }
body:not([data-theme="dark"]) .tile-green { background: linear-gradient(135deg, #059669, #5eead4); }
body:not([data-theme="dark"]) .tile-lime { background: linear-gradient(135deg, #65a30d, #bef264); }
body:not([data-theme="dark"]) .tile-yellow { background: linear-gradient(135deg, #d97706, #facc15); }
body:not([data-theme="dark"]) .tile-orange { background: linear-gradient(135deg, #ea580c, #fb923c); }
body:not([data-theme="dark"]) .tile-slate { background: linear-gradient(135deg, #475569, #94a3b8); }
body:not([data-theme="dark"]) .global-filter-bar,
body:not([data-theme="dark"]) .data-info,
body:not([data-theme="dark"]) .card-section,
body:not([data-theme="dark"]) .table-container,
body:not([data-theme="dark"]) .chart-container,
body:not([data-theme="dark"]) .kpi-card {
    background: rgba(255, 255, 255, 0.92) !important;
}
body:not([data-theme="dark"]) .global-municipio-selector:focus-within,
body:not([data-theme="dark"]) input:focus,
body:not([data-theme="dark"]) select:focus,
body:not([data-theme="dark"]) textarea:focus {
    border-color: #ec4899 !important;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.13) !important;
}
body:not([data-theme="dark"]) .card-section-title [data-lucide],
body:not([data-theme="dark"]) .section-panel-title [data-lucide],
body:not([data-theme="dark"]) .chart-title [data-lucide] {
    color: #be185d !important;
}
body:not([data-theme="dark"]) .table-title::before,
body:not([data-theme="dark"]) .chart-title::before { background: #ec4899 !important; }
body:not([data-theme="dark"]) .mapa-indicador-card.active {
    background: linear-gradient(135deg, #be185d 0%, #0f766e 100%) !important;
    border-color: #be185d !important;
    box-shadow: 0 10px 22px rgba(190, 24, 93, 0.18);
}
body:not([data-theme="dark"]) .mapa-layer-card.active {
    background: linear-gradient(135deg, #d97706 0%, #f472b6 100%) !important;
    border-color: #d97706 !important;
}
body:not([data-theme="dark"]) .kpi-card.kpi-hero,
body:not([data-theme="dark"]) .stat-card.highlight {
    background: linear-gradient(135deg, #be185d 0%, #0f766e 100%) !important;
}
body:not([data-theme="dark"]) .explicacao-aba {
    background: linear-gradient(135deg, #fff7ed 0%, #fdf2f8 100%) !important;
    border-color: #fbcfe8 !important;
    border-left-color: #ec4899 !important;
}
