/* ═══════════════════════════════════════════════════════════════════════════
   SUS 360° — Core CSS (Isolado para Release 1.0.0)
   Merge de: vars + reset + theme + animations + topbar + nav-paineis +
             uf-bar + cards + charts + table + footer
   Gerado: 2026-03-27
   ═══════════════════════════════════════════════════════════════════════════ */

/* Inter font (self-hosted) */
@import url('../vendor/inter/inter.css');


/* ── vars ─────────────────────────── */
/* ═══════════════════════════════════════════════════════════════════════════
   SUS 360° — Design Tokens
   v0.1.0 | Extraído do Saldo-Gestor 0.10.5 (padrão ouro)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    /* ── Brand ────────────────────────────────────────────────────────── */
    --sus-blue: #0066CC;
    --sus-blue-bright: #0088FF;
    --sus-blue-glow: rgba(0, 136, 255, 0.4);
    --sus-blue-light: #4a9eff;

    --brasil-green: #009c3b;
    --brasil-yellow: #ffdf00;

    /* ── Semânticas ───────────────────────────────────────────────────── */
    --color-success: #22c55e;
    --color-danger: #dc3545;
    --color-warning: #f59e0b;
    --color-info: #3b82f6;

    /* ── Superfícies (Light) ──────────────────────────────────────────── */
    --bg-body: #eff1f3;
    --bg-card: #ffffff;
    --bg-elevated: #ffffff;

    /* ── Texto (Light) ────────────────────────────────────────────────── */
    --text-primary: #2d2d2d;
    --text-secondary: #444444;
    --text-muted: #6b7280;

    /* ── Bordas (Light) ───────────────────────────────────────────────── */
    --border-color: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.05);

    /* ── Sombras ──────────────────────────────────────────────────────── */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);

    /* ── Espaçamento ──────────────────────────────────────────────────── */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* ── Tipografia ────────────────────────────────────────────────────── */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --font-size-xs: 0.6875rem;   /* 11px */
    --font-size-sm: 0.8125rem;   /* 13px */
    --font-size-base: 0.875rem;  /* 14px */
    --font-size-lg: 1rem;        /* 16px */
    --font-size-xl: 1.25rem;     /* 20px */
    --font-size-2xl: 1.5rem;     /* 24px */
    --font-size-3xl: 2rem;       /* 32px */

    /* ── Border Radius ────────────────────────────────────────────────── */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* ── Transições ────────────────────────────────────────────────────── */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;

    /* ── Layout ────────────────────────────────────────────────────────── */
    --header-height: 60px;
    --uf-bar-height: 56px;
    --section-nav-height: 44px;
    --section-nav-height-mobile: 40px;
    --content-top: calc(var(--header-height) + var(--uf-bar-height));
    --content-top-with-section-nav: calc(var(--header-height) + var(--uf-bar-height) + var(--section-nav-height));

    /* ── Z-Index ───────────────────────────────────────────────────────── */
    --z-section-nav: 998;
    --z-uf-bar: 999;
    --z-header: 1001;
    --z-search-backdrop: 1000;
    --z-search-dropdown: 1002;
    --z-mobile-menu: 9999;
}
/* Instant theme switch — no cascading transitions */
body.theme-switching, body.theme-switching * {
    transition-duration: 0s !important;
    transition-delay: 0s !important;
}



/* ── reset ─────────────────────────── */
/* ═══════════════════════════════════════════════════════════════════════════
   SUS 360° — Reset + Body Defaults
   v0.1.0 | Plataforma (a11y aprimorado)
   ═══════════════════════════════════════════════════════════════════════════ */

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

body {
    font-family: var(--font-family);
    min-height: 100vh;
    background: var(--bg-body);
    color: var(--text-primary);
    overflow-y: scroll;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Focus visible (a11y) ──────────────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--sus-blue);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

/* ── Reduced motion ────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── Skip navigation link (a11y) ──────────────────────────────────────── */
.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 10000;
    padding: 8px 16px;
    background: var(--sus-blue);
    color: #fff;
    font-weight: 700;
    font-size: var(--font-size-sm);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    text-decoration: none;
    transition: top 0.15s ease;
}

.skip-link:focus {
    top: 0;
}

/* ── Screen-reader only (a11y) ─────────────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Scrollbar ────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.35);
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

/* Dark mode scrollbar */
body.dark ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.35);
    border-radius: 4px !important;
    border: none !important;
    background-clip: unset !important;
}
body.dark ::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05) !important;
}
body.dark ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.85) !important;
    border: none !important;
    background-clip: unset !important;
}
body.dark * {
    scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

/* ── Imagens ──────────────────────────────────────────────────────────── */
img { max-width: 100%; height: auto; }

/* ── Links ────────────────────────────────────────────────────────────── */
a { color: var(--sus-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Conteúdo principal ───────────────────────────────────────────────── */
.sus360-main {
    padding-top: var(--content-top);
    max-width: 1400px;
    margin: 0 auto;
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
    padding-bottom: var(--space-2xl);
}

/* Quando não tem UF bar */
.sus360-main.no-uf-bar {
    padding-top: var(--header-height);
}


/* ── theme ─────────────────────────── */
/* ═══════════════════════════════════════════════════════════════════════════
   SUS 360° — Sistema Dark/Light
   v0.1.0 | Extraído do Saldo-Gestor 0.10.5

   Uso: body.dark ativa modo escuro
        Variáveis de vars.css são sobrescritas aqui
   ═══════════════════════════════════════════════════════════════════════════ */

body.dark {
    color-scheme: light; /* Força scrollbar customizável pelo CSS (Chrome ignora CSS scrollbar com color-scheme:dark) */
    /* ── Superfícies ──────────────────────────────────────────────────── */
    --bg-body: #0d1117;
    --bg-card: #161b22;
    --bg-elevated: #1c2333;

    /* ── Texto ────────────────────────────────────────────────────────── */
    --text-primary: #e0e0e0;
    --text-secondary: #8b949e;
    --text-muted: #8b8fa3; /* Corrigido: 5.2:1 contra #0d1117 (era #6b7280 = 4.1:1, abaixo do mínimo WCAG AA 4.5:1) */

    /* ── Bordas ───────────────────────────────────────────────────────── */
    --border-color: rgba(255, 255, 255, 0.1);
    --border-light: rgba(255, 255, 255, 0.05);

    /* ── Sombras ──────────────────────────────────────────────────────── */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);

    /* ── Brand ajustado ───────────────────────────────────────────────── */
    --sus-blue: #3b9eff;
    --sus-blue-bright: #60b4ff;
    --sus-blue-glow: rgba(59, 158, 255, 0.5);
    --sus-blue-light: #60b4ff;

    /* ── Semânticas ajustadas ─────────────────────────────────────────── */
    --color-success: #34d399;
    --color-danger: #f87171;
    --color-warning: #fbbf24;
    --color-info: #60a5fa;
}


/* ── animations ─────────────────────────── */
/* ═══════════════════════════════════════════════════════════════════════════
   SUS 360° — Animações Compartilhadas
   v0.1.0 | Extraído do Saldo-Gestor 0.10.5
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Logo pulse glow ──────────────────────────────────────────────────── */
@keyframes pulse-glow {
    0%, 100% { filter: brightness(1) drop-shadow(0 0 0 transparent); }
    50% { filter: brightness(1.1) drop-shadow(0 0 8px rgba(0, 73, 144, 0.3)); }
}

@keyframes pulse-glow-dark {
    0%, 100% { filter: brightness(0) invert(1) drop-shadow(0 0 0 transparent); }
    50% { filter: brightness(0) invert(1) drop-shadow(0 0 10px rgba(255, 255, 255, 0.4)); }
}

/* ── Grau sparkle (º) ─────────────────────────────────────────────────── */
@keyframes grau-sparkle {
    0%, 85%, 100% { color: var(--text-primary); text-shadow: none; }
    90% { color: var(--brasil-green); text-shadow: 0 0 8px rgba(0, 156, 59, 0.4); }
    95% { color: var(--brasil-yellow); text-shadow: 0 0 8px rgba(255, 223, 0, 0.4); }
}

/* ── Status dot pulse ─────────────────────────────────────────────────── */
@keyframes pulse-live {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4); }
    50% { opacity: 0.8; box-shadow: 0 0 0 4px rgba(40, 167, 69, 0); }
}

/* ── Subtle glow ──────────────────────────────────────────────────────── */
@keyframes subtle-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ── Shimmer (loading) ────────────────────────────────────────────────── */
@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

/* ── Typing cursor ────────────────────────────────────────────────────── */
@keyframes typing-cursor {
    0%, 100% { border-right-color: var(--text-secondary); }
    50% { border-right-color: transparent; }
}

/* ── Fade in / Slide in ───────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* ── Município fade in (mapa) ─────────────────────────────────────────── */
@keyframes munFadeIn {
    to { opacity: 1; }
}

/* ── Skeleton loading ─────────────────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg,
        var(--bg-card) 25%,
        rgba(0,0,0,0.04) 50%,
        var(--bg-card) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

body.dark .skeleton {
    background: linear-gradient(90deg,
        var(--bg-card) 25%,
        rgba(255,255,255,0.06) 50%,
        var(--bg-card) 75%
    );
    background-size: 200% 100%;
}


/* ── topbar ─────────────────────────── */
/* ═══════════════════════════════════════════════════════════════════════════
   SUS 360° — Topbar Padrão Ouro
   v0.1.0 | Plataforma (a11y aprimorado)
   Estrutura: .header > .header-left + .header-center + .header-right
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Container ────────────────────────────────────────────────────────── */
.header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height, 60px);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: var(--z-header, 1001);
}

body.dark .header {
    background: rgba(13, 17, 23, 0.85);
}

/* ── Esquerda: gov.br + Logo SUS360 ───────────────────────────────────── */
.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.gov-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    padding-right: 16px;
    border-right: 1px solid var(--border-color);
}
.gov-logo img { height: 24px; width: auto; }
body.dark .gov-logo img { filter: brightness(0) invert(1); }

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.logo:hover { text-decoration: none; }

.logo-icon {
    width: auto;
    height: 40px;
    animation: pulse-glow 3s ease-in-out infinite;
}
body.dark .logo-icon {
    filter: brightness(0) invert(1);
    animation: pulse-glow-dark 3s ease-in-out infinite;
}

.logo-info { display: flex; flex-direction: column; gap: 1px; }
.logo-text { display: flex; align-items: baseline; gap: 4px; }
.logo-sus { font-size: 18px; font-weight: 900; color: var(--sus-blue); letter-spacing: -0.5px; }
.logo-360 { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.logo-grau { font-size: 16px; font-weight: 700; color: var(--text-primary); animation: grau-sparkle 10s ease-in-out infinite; }
.logo-subtitle { font-size: 11px; font-weight: 500; color: var(--text-secondary); }

/* ── Centro: Customizável por painel ──────────────────────────────────── */
.header-center {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    justify-content: flex-start;
    margin-left: 16px;
}

.header-sep {
    width: 1px;
    height: 28px;
    background: var(--border-color);
}

.header-title-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 180px;
}

.header-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.header-version {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
}

.header-subtitle {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ── Visão Atual (badge com bandeira) ─────────────────────────────────── */
.header-view {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-body);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    height: 36px;
    flex-shrink: 0;
}

.header-view-flag {
    width: 24px;
    height: 18px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.header-view-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-view-close {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 12px;
    display: flex;
    align-items: center;
}
.header-view-close:hover { color: var(--color-danger); }

.header-view.has-filter {
    background: rgba(0, 102, 204, 0.08);
    border-color: var(--sus-blue);
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}
body.dark .header-view.has-filter {
    background: rgba(59, 158, 255, 0.12);
    box-shadow: 0 0 0 2px rgba(59, 158, 255, 0.15);
}

/* ── Breadcrumbs ──────────────────────────────────────────────────────── */
.breadcrumb-link {
    cursor: pointer;
    color: var(--sus-blue);
    opacity: 0.8;
    transition: opacity var(--transition-fast);
}
.breadcrumb-link:hover { opacity: 1; text-decoration: underline; }
.breadcrumb-active { font-weight: 700; color: var(--text-primary); }
.breadcrumb-sep {
    margin: 0 4px;
    color: var(--text-secondary);
    opacity: 0.5;
    font-size: 14px;
}

/* ── Direita: Ações ───────────────────────────────────────────────────── */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 11px;
}
.header-status-dot {
    width: 6px;
    height: 6px;
    background: #28a745;
    border-radius: 50%;
    animation: pulse-live 2s ease-in-out infinite;
}

.header-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
}

/* ── Botões de ação ───────────────────────────────────────────────────── */
.header-action-btn {
    width: 44px; height: 44px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    font-size: 16px;
}
.header-action-btn:hover {
    background: var(--bg-body);
    color: var(--sus-blue);
}
.header-action-btn.active {
    background: var(--sus-blue);
    color: white;
}

/* Tema toggle icon swap */
.header-action-btn .sun-icon { display: none; }
body.dark .header-action-btn .sun-icon { display: block; }
body.dark .header-action-btn .moon-icon { display: none; }

/* ── Busca inline no header ───────────────────────────────────────────── */
.header-search-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--sus-blue);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: all var(--transition-fast);
}
.header-search-btn:hover {
    background: #003d7a;
    transform: scale(1.05);
}
body.dark .header-search-btn { background: #58a6ff; color: #0d1117; }
body.dark .header-search-btn:hover { background: #79c0ff; }

/* ── Search backdrop ──────────────────────────────────────────────────── */
.search-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-search-backdrop, 1000);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}
.search-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}
body.dark .search-backdrop { background: rgba(0, 0, 0, 0.7); }

/* ── Search results dropdown ──────────────────────────────────────────── */
.search-results-dropdown {
    position: fixed;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    width: min(480px, calc(100vw - 32px));
    z-index: var(--z-search-dropdown, 1002);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
}

/* ── Hamburger mobile ─────────────────────────────────────────────────── */
.header-hamburger {
    display: none;
    width: 44px; height: 44px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

/* ── Mobile: < 768px ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .header { padding: 0 12px; }
    .header-center { display: none; }
    .header-status { display: none; }
    .header-hamburger { display: flex; }
    .header-divider { display: none; }
    .gov-logo { padding-right: 10px; }
    .gov-logo img { height: 20px; }
    .logo-icon { height: 32px; }
    .logo-sus { font-size: 16px; }
    .logo-360 { font-size: 14px; }
    .logo-grau { font-size: 14px; }
    .logo-subtitle { font-size: 10px; }
}

/* ── Skip-link posicionamento relativo ao header ──────────────────────── */
.header ~ .skip-link:focus,
.skip-link:focus + .header {
    z-index: var(--z-header, 1001);
}

/* Focus visible nos botões do header */
.header-action-btn:focus-visible,
.header-hamburger:focus-visible,
.header-search-btn:focus-visible {
    outline: 2px solid var(--sus-blue);
    outline-offset: 2px;
}


/* ── nav-paineis ─────────────────────────── */
/* ═══════════════════════════════════════════════════════════════════════════
   SUS 360° — Nav Painéis (Componente Compartilhado)
   v0.1.0 | Menu dropdown de painéis + hamburger mobile
   Depende de: topbar.css (variáveis CSS do header)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Nav container ────────────────────────────────────────────────────── */
.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Links do nav ─────────────────────────────────────────────────────── */
.nav-link-hd {
    padding: 6px 14px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.nav-link-hd:hover { background: rgba(0,73,144,0.08); color: var(--sus-blue); text-decoration: none; }
.nav-link-hd.active { background: var(--sus-blue); color: white; }

/* ── Dropdown container ───────────────────────────────────────────────── */
.nav-dropdown-hd { position: relative; }
.nav-dropdown-hd .nav-link-hd { cursor: pointer; border: none; background: transparent; }
.nav-dropdown-hd .nav-link-hd i.chevron { font-size: 10px; transition: transform 0.2s; }
.nav-dropdown-hd:hover .nav-link-hd i.chevron { transform: rotate(180deg); }

/* ── Dropdown menu (2 colunas) ────────────────────────────────────────── */
.nav-dropdown-menu-hd {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.18);
    padding: 16px;
    width: 520px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 1101;
    margin-top: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}
.nav-dropdown-hd:hover .nav-dropdown-menu-hd { opacity: 1; visibility: visible; }

/* ── Colunas ──────────────────────────────────────────────────────────── */
.dd-col { display: flex; flex-direction: column; }
.dd-col + .dd-col { border-left: 1px solid var(--border-color); padding-left: 20px; }

/* ── Seções com mini-header ───────────────────────────────────────────── */
.dd-section { margin-bottom: 4px; }
.dd-section + .dd-section { border-top: 1px solid var(--border-color); padding-top: 10px; margin-top: 6px; }
.dd-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 6px;
}
.dd-section-icon {
    width: 28px; height: 28px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: #fff; flex-shrink: 0;
}
.dd-section-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.dd-section-sub {
    font-size: 9px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* ── Itens do dropdown ────────────────────────────────────────────────── */
.dd-item-hd {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 12.5px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.15s;
}
.dd-item-hd:hover { background: rgba(0,73,144,0.06); color: var(--sus-blue); text-decoration: none; }
.dd-item-hd.dd-active { background: rgba(0,73,144,0.08); color: var(--sus-blue); font-weight: 700; }
.dd-item-hd i { font-size: 13px; width: 18px; text-align: center; flex-shrink: 0; opacity: 0.7; }
.dd-item-hd.dd-active i { opacity: 1; }

/* ── Badge "Novo" (cor oncologia/violeta) ───────────────────────────────── */
.dd-badge-novo {
    font-size: 7px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 1.5px 5px;
    border-radius: 3px;
    background: rgba(139, 92, 246, 0.12);
    color: #7c3aed;
    border: 1px solid rgba(139, 92, 246, 0.22);
    margin-left: auto;
    line-height: 1.3;
    flex-shrink: 0;
}
body.dark .dd-badge-novo {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border-color: rgba(167, 139, 250, 0.2);
}

/* ── Close button (mobile only) ───────────────────────────────────────── */
.mobile-menu-close { display: none; }

/* ── Hamburger button (mobile only) ───────────────────────────────────── */
.mobile-menu-btn {
    display: none;
    background: none; border: none; cursor: pointer;
    color: var(--text-primary); font-size: 20px;
    padding: 6px; border-radius: 8px;
    transition: background 0.15s;
}
.mobile-menu-btn:hover { background: rgba(0,73,144,0.08); }

/* ── Mobile: < 768px ──────────────────────────────────────────────────── */
@media (max-width:768px) {
    .header-nav { display: none; }
    .mobile-menu-btn { display: flex; align-items: center; justify-content: center; }

    /* Overlay — force header-center visible when menu open */
    .mobile-menu-open .header-center {
        display: block !important;
        position: static;
    }
    .mobile-menu-open .header-nav {
        display: block !important;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: var(--bg-body);
        z-index: 9999;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0;
    }
    .mobile-menu-open .header-nav .nav-link-hd { display: none; }
    .mobile-menu-open .nav-dropdown-hd { position: static; }
    .mobile-menu-open .nav-dropdown-menu-hd {
        position: static !important;
        transform: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        margin-top: 0 !important;
        padding: 60px 20px 30px !important;
        gap: 0 !important;
    }
    .mobile-menu-open .dd-col { width: 100%; }
    .mobile-menu-open .dd-col + .dd-col {
        border-left: none; padding-left: 0;
        border-top: 1px solid var(--border-color);
        padding-top: 14px; margin-top: 10px;
    }
    .mobile-menu-open .dd-item-hd { font-size: 15px; padding: 11px 14px; }
    .mobile-menu-open .dd-section-label { font-size: 13px; }
    .mobile-menu-open .dd-section-sub { font-size: 10px; }
    .mobile-menu-open .dd-section-icon { width: 32px; height: 32px; font-size: 16px; }

    /* Close button inside overlay */
    .mobile-menu-close {
        position: fixed; top: 12px; right: 16px; z-index: 10000;
        background: none; border: none; cursor: pointer;
        font-size: 26px; color: var(--text-primary);
        padding: 6px; border-radius: 8px;
        display: none;
    }
    .mobile-menu-close:hover { background: rgba(0,73,144,0.08); }
    .mobile-menu-open .mobile-menu-close { display: flex; align-items: center; justify-content: center; }
}


/* ── uf-bar ─────────────────────────── */
/* ═══════════════════════════════════════════════════════════════════════════
   SUS 360° — Barra de UFs com Bandeiras
   v0.1.0 | Plataforma (a11y aprimorado)
   ═══════════════════════════════════════════════════════════════════════════ */

.uf-bar {
    position: fixed;
    top: var(--header-height, 60px);
    left: 0;
    right: 0;
    height: var(--uf-bar-height, 56px);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 12px;
    z-index: var(--z-uf-bar, 999);
    gap: 0;
}

/* Esconder header mobile no desktop */
.uf-bar-mobile-header { display: none; }
.uf-flags-container { display: contents; }

.uf-flag {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 9px;
    font-weight: 600;
    color: var(--text-secondary);
}
.uf-flag:hover {
    background: var(--bg-body);
    color: var(--sus-blue);
}
.uf-flag.active {
    background: var(--sus-blue);
    color: white;
}
body.dark .uf-flag.active {
    background: #080b0f;
    color: var(--text-primary);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}
.uf-flag img {
    width: 24px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
}
body.dark .uf-flag img {
    box-shadow: 0 0 0 1px rgba(255,255,255,0.18), 0 1px 2px rgba(0,0,0,0.3);
}

/* ── Brasil (item especial) ───────────────────────────────────────────── */
.uf-flag.brasil {
    background: linear-gradient(135deg, rgba(0,156,59,0.1) 0%, rgba(0,73,144,0.1) 100%);
    color: var(--brasil-green);
    font-weight: 700;
}
.uf-flag.brasil:hover {
    background: linear-gradient(135deg, rgba(0,156,59,0.2) 0%, rgba(0,73,144,0.2) 100%);
}
.uf-flag.brasil.active {
    background: linear-gradient(135deg, #009c3b 0%, #004990 100%);
    color: white;
}

/* ── Dimming: escurece UFs não selecionadas ───────────────────────────── */
.uf-bar:has(.uf-flag:not(.brasil).active) .uf-flag:not(.active) {
    opacity: 0.3;
    filter: grayscale(0.6);
}
.uf-bar:has(.uf-flag:not(.brasil).active) .uf-flag:not(.active):hover {
    opacity: 0.8;
    filter: grayscale(0);
}

/* ── Mobile: < 768px ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .uf-bar {
        height: auto;
        min-height: 48px;
        flex-wrap: wrap;
        padding: 6px 8px;
        gap: 4px;
    }

    .uf-bar-mobile-header {
        display: flex;
        width: 100%;
        align-items: center;
        justify-content: space-between;
        padding: 4px 8px;
        cursor: pointer;
    }

    .uf-bar-mobile-header span {
        font-size: 12px;
        font-weight: 600;
        color: var(--text-secondary);
    }

    .uf-flags-container {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        width: 100%;
    }

    .uf-flags-container.collapsed {
        display: none;
    }

    .uf-flag {
        flex: 0 0 auto;
        min-width: 48px;
        min-height: 44px;
        padding: 4px 6px;
    }
}

/* ── Focus visible (a11y) ──────────────────────────────────────────────── */
.uf-flag:focus-visible {
    outline: 2px solid var(--sus-blue);
    outline-offset: 2px;
    z-index: 1;
}

.uf-flag.active:focus-visible {
    outline-color: #fff;
}


/* ── cards ─────────────────────────── */
/* ═══════════════════════════════════════════════════════════════════════════
   SUS 360° — Cards KPI + Panorama
   v0.1.0 | Extraído do Saldo-Gestor 0.10.5
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Grid de KPIs ─────────────────────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

@media (max-width: 1024px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
}

/* ── Card KPI ─────────────────────────────────────────────────────────── */
.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: box-shadow var(--transition-normal);
}
.kpi-card:hover {
    box-shadow: var(--shadow-md);
}

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.kpi-icon.blue   { background: rgba(0, 102, 204, 0.1); color: var(--sus-blue); }
.kpi-icon.red    { background: rgba(220, 53, 69, 0.1);  color: var(--color-danger); }
.kpi-icon.green  { background: rgba(34, 197, 94, 0.1);  color: var(--color-success); }
.kpi-icon.purple { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.kpi-icon.amber  { background: rgba(245, 158, 11, 0.1); color: var(--color-warning); }

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

.kpi-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.kpi-value {
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

/* ── Badge de variação ────────────────────────────────────────────────── */
.kpi-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 700;
    margin-top: 4px;
}
.kpi-badge.up {
    background: rgba(34, 197, 94, 0.1);
    color: var(--color-success);
}
.kpi-badge.down {
    background: rgba(220, 53, 69, 0.1);
    color: var(--color-danger);
}
.kpi-badge.neutral {
    background: rgba(107, 114, 128, 0.1);
    color: var(--text-muted);
}

/* ── Breakdown (SIA/SIH, MAC/FAEC) ───────────────────────────────────── */
.kpi-breakdown {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.kpi-breakdown-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-secondary);
}

.kpi-breakdown-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Progress bar ─────────────────────────────────────────────────────── */
.kpi-progress {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.kpi-progress-bar {
    height: 100%;
    border-radius: 2px;
    background: var(--sus-blue);
    transition: width 0.6s ease;
}

/* ── Card genérico ────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text-primary);
}

.card-body {
    padding: 20px;
}


/* ── charts ─────────────────────────── */
/* ═══════════════════════════════════════════════════════════════════════════
   SUS 360° — Gráficos (Chart.js wrapper)
   v0.1.0
   ═══════════════════════════════════════════════════════════════════════════ */

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

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

.chart-title {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text-primary);
}

.chart-subtitle {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ── Toggle tabs (dentro de chart) ────────────────────────────────────── */
.chart-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-body);
    border-radius: var(--radius-md);
    padding: 3px;
}

.chart-tab {
    padding: 5px 12px;
    border: none;
    border-radius: 6px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    background: transparent;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}
.chart-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}
.chart-tab:not(.active):hover {
    color: var(--text-primary);
}

/* ── Canvas wrapper ───────────────────────────────────────────────────── */
.chart-body {
    padding: 16px 20px;
    position: relative;
}

.chart-canvas-wrap {
    position: relative;
    width: 100%;
}

/* Aspect ratios padrão */
.chart-canvas-wrap.ratio-16-9 { aspect-ratio: 16 / 9; }
.chart-canvas-wrap.ratio-4-3  { aspect-ratio: 4 / 3; }
.chart-canvas-wrap.ratio-2-1  { aspect-ratio: 2 / 1; }
.chart-canvas-wrap.ratio-3-1  { aspect-ratio: 3 / 1; }

.chart-canvas-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ── Legenda ──────────────────────────────────────────────────────────── */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.chart-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* ── Empty state ──────────────────────────────────────────────────────── */
.chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.chart-empty i {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.4;
}
.chart-empty span {
    font-size: var(--font-size-sm);
    font-weight: 500;
}


/* ── table ─────────────────────────── */
/* ═══════════════════════════════════════════════════════════════════════════
   SUS 360° — Tabela de Dados (paginação, busca, ordenação)
   v0.1.0 | Plataforma (a11y aprimorado)
   ═══════════════════════════════════════════════════════════════════════════ */

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* ── Toolbar ──────────────────────────────────────────────────────────── */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
    flex-wrap: wrap;
}

.table-search {
    position: relative;
    flex: 1;
    max-width: 300px;
}

.table-search input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    background: var(--bg-body);
    color: var(--text-primary);
    font-family: var(--font-family);
}
.table-search input:focus {
    outline: none;
    border-color: var(--sus-blue);
    box-shadow: 0 0 0 3px var(--sus-blue-glow);
}

.table-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.table-actions {
    display: flex;
    gap: 8px;
}

.table-action-btn {
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}
.table-action-btn:hover {
    border-color: var(--sus-blue);
    color: var(--sus-blue);
}

/* ── Tabela ───────────────────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 10px 16px;
    text-align: left;
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-body);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.data-table th:hover { color: var(--sus-blue); }
.data-table th .sort-icon { margin-left: 4px; font-size: 10px; opacity: 0.5; }
.data-table th.sorted .sort-icon { opacity: 1; color: var(--sus-blue); }

.data-table td {
    padding: 10px 16px;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    font-variant-numeric: tabular-nums;
}

.data-table tbody tr:hover {
    background: rgba(0, 102, 204, 0.04);
}
body.dark .data-table tbody tr:hover {
    background: rgba(59, 158, 255, 0.06);
}

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

/* ── Paginação ────────────────────────────────────────────────────────── */
.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

.table-pagination-info {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.table-pagination-buttons {
    display: flex;
    gap: 4px;
}

.table-page-btn {
    width: 44px; height: 44px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}
.table-page-btn:hover { border-color: var(--sus-blue); color: var(--sus-blue); }
.table-page-btn.active {
    background: var(--sus-blue);
    border-color: var(--sus-blue);
    color: white;
}
.table-page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Scope styling (a11y) ─────────────────────────────────────────────── */
.data-table th[scope="col"] { font-weight: 700; }
.data-table th[scope="row"] { text-align: left; font-weight: 600; color: var(--text-primary); }
.data-table caption { font-size: var(--font-size-sm); color: var(--text-secondary); padding: 8px 16px; text-align: left; }


/* ── footer ─────────────────────────── */
/* ═══════════════════════════════════════════════════════════════════════════
   SUS 360° — Footer
   v0.1.0
   ═══════════════════════════════════════════════════════════════════════════ */

.sus360-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 24px;
    text-align: center;
    margin-top: var(--space-2xl);
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.footer-brand-text {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text-primary);
}

.footer-subtitle {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.footer-legal {
    font-size: 10px;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
}

.footer-links a {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}
.footer-links a:hover {
    color: var(--sus-blue);
    text-decoration: none;
}

