/* ==========================================================================
   RADAR FISCAL — Design System v3 (Light Mode Institucional)
   Tema único, limpo, sem dark-mode.
   Paleta: azul TCM (#1f3f73), cinzas institucionais, cores de status.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* Paleta institucional TCM — versão mais profunda */
    --primary: #1f3f73;
    --primary-dark: #14243d;
    --primary-light: #2f5f9f;
    --accent-gold: #c08a2e;        /* dourado TCM (escudo, detalhes) */

    /* Cores de status (dessaturadas, institucionais) */
    --success: #2f8a68;
    --warning: #b87520;
    --danger: #8f2f2b;
    --info: #2b7199;

    /* Fundos — mais contraste entre layers */
    --bg-primary: #eef2f6;          /* fundo da área principal (mais marcado) */
    --bg-surface: #ffffff;          /* cards/panels */
    --bg-sidebar: #142036;          /* sidebar dark navy institucional */
    --bg-sidebar-hover: #1d2c47;
    --bg-sidebar-active: #243450;
    --bg-hover: #e3e8f0;
    --bg-panel-head: #f5f7fa;       /* header de panel mais marcado */
    --bg-soft: #f4f7fa;             /* superfícies internas suaves (fórmulas, chips) */

    /* Texto */
    --text-primary: #1a2230;
    --text-secondary: #475065;
    --text-muted: #6f7a8c;
    --text-on-dark: #e8edf5;        /* texto sobre sidebar escuro */
    --text-on-dark-muted: #8b97ad;

    /* Bordas */
    --border: #d8dee8;
    --border-light: #c4ccda;
    --border-strong: #b6c0d1;

    /* Sombras (mais perceptíveis) */
    --shadow-sm: 0 1px 2px rgba(20, 28, 42, 0.08);
    --shadow-md: 0 4px 12px rgba(20, 28, 42, 0.10);
    --shadow-lg: 0 8px 24px rgba(20, 28, 42, 0.12);

    /* Raio */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;

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

    --transition: all 0.15s ease;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================
   LAYOUT
   ============================================ */

.app-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas: 
        "sidebar header"
        "sidebar main"
        "sidebar footer";
    min-height: 100vh;
}

@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "header"
            "main"
            "footer";
    }
    .app-sidebar { display: none; }
}

/* ============================================
   HEADER
   ============================================ */

.app-header {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 22px;
    background: var(--bg-surface);
    border-bottom: 2px solid var(--primary);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-logo {
    height: 36px;
    width: auto;
}

.header-brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.header-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 1px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-meta-group {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
}

.header-meta-label {
    font-size: 0.62rem;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    font-weight: 700;
}

.header-meta-value {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 600;
}

.header-meta-value-sm {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* Select de município */
.municipio-select {
    position: relative;
}

.municipio-select select {
    appearance: none;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    padding: 9px 40px 9px 14px;
    min-width: 280px;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-sans);
    font-weight: 500;
}

.municipio-select select:hover,
.municipio-select select:focus {
    border-color: var(--primary-light);
    outline: none;
    box-shadow: 0 0 0 3px rgba(47, 95, 159, 0.1);
}

.municipio-select::after {
    content: '▼';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.55rem;
    color: var(--text-muted);
    pointer-events: none;
}

/* ============================================
   SIDEBAR
   ============================================ */

.app-sidebar {
    grid-area: sidebar;
    background: var(--bg-sidebar);
    border-right: 1px solid #0c1424;
    padding: 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-shadow: inset -1px 0 0 rgba(255,255,255,0.04);
}

.sidebar-section-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: var(--accent-gold);
    padding: 0 10px;
    margin-bottom: 4px;
    margin-top: 14px;
    opacity: 0.85;
}
.sidebar-section-label:first-child { margin-top: 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 11px;
    border-radius: 5px;
    color: var(--text-on-dark);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    border-left: 2px solid transparent;
}

.nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: #fff;
}

.nav-item.active {
    background: var(--bg-sidebar-active);
    color: #fff;
    border-left-color: var(--accent-gold);
    font-weight: 600;
}
.nav-item i { color: var(--text-on-dark-muted); }
.nav-item:hover i, .nav-item.active i { color: var(--accent-gold); }

.nav-item i {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-foot-item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 0 10px;
    font-size: 0.7rem;
    color: var(--text-on-dark-muted);
}

.sidebar-foot-icon {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--accent-gold);
    opacity: 0.7;
}

.sidebar-foot-title {
    font-weight: 600;
    color: var(--text-on-dark);
    margin-bottom: 2px;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.app-main {
    grid-area: main;
    background: var(--bg-primary);
    padding: 14px 18px;
    overflow-y: auto;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

.section-title {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.01em;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    width: 17px;
    height: 17px;
    color: var(--primary);
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 500;
    margin-top: -0.5rem;
    margin-bottom: 0.85rem;
}

/* ============================================
   PANELS / CARDS
   ============================================ */

.panel,
.hero-card,
.kpi-card,
.chart-container {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.panel:hover,
.hero-card:hover,
.kpi-card:hover {
    box-shadow: var(--shadow-md);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 13px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel-head);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-primary);
}

.panel-title .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: rgba(31, 63, 115, 0.08);
    border-radius: 5px;
    color: var(--primary);
}

.panel-title .icon i {
    width: 13px;
    height: 13px;
}

.panel-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.panel-body {
    padding: 12px 14px;
    color: var(--text-primary);
}

/* ============================================
   KPI CARDS
   ============================================ */

.kpi-hero-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

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

@media (max-width: 768px) {
    .kpi-hero-grid { grid-template-columns: 1fr; }
}

.kpi-hero-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-sm);
}

.kpi-hero-card:hover {
    box-shadow: var(--shadow-md);
}

.kpi-label {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    font-size: 0.68rem;
    margin-bottom: 6px;
}

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

.kpi-change {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

.kpi-change.negative { color: var(--danger); }
.kpi-change.positive { color: var(--success); }

/* Status indicators on KPIs */
.kpi-hero-card.ok { border-left: 3px solid var(--success); }
.kpi-hero-card.atencao { border-left: 3px solid var(--warning); }
.kpi-hero-card.critico { border-left: 3px solid var(--danger); }

/* Hero cards (resumo BA) */
.hero-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.hero-icon.blue { background: rgba(47, 95, 159, 0.1); color: var(--primary-light); }
.hero-icon.gold { background: rgba(184, 117, 32, 0.1); color: var(--warning); }
.hero-icon.green { background: rgba(47, 138, 104, 0.1); color: var(--success); }
.hero-icon.red { background: rgba(143, 47, 43, 0.1); color: var(--danger); }

.hero-label {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}

.hero-value {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: -0.3px;
}

/* ============================================
   DASHBOARD ROWS
   ============================================ */

.dashboard-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 1024px) {
    .dashboard-row { grid-template-columns: 1fr; }
}

/* ============================================
   SCORE PANEL
   ============================================ */

#scorePanel {
    border: 1px solid var(--border);
    background: var(--bg-surface);
}

#scorePanel .panel-body { padding: 1.5rem; }

#scoreBigNumber {
    font-weight: 800;
    letter-spacing: -2px;
    font-size: 3.5rem;
    line-height: 1;
    color: var(--text-primary);
}

#scoreClassificacao {
    letter-spacing: 1px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-top: 6px;
}

#scoreCobertura {
    color: var(--text-muted);
    font-size: 0.7rem;
}

#scoreComponentes > div {
    padding: 0.3rem 0;
    border-bottom: 1px dashed var(--border);
}

#scoreComponentes > div:last-child { border-bottom: none; }

/* ============================================
   TABELAS
   ============================================ */

.table-wrapper {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    color: var(--text-primary);
    background: #fff;
    border-collapse: collapse;
    font-size: 0.85rem;
}

table thead th {
    background: var(--bg-panel-head);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

table tbody tr:last-child td { border-bottom: none; }
table tbody tr:hover { background: var(--bg-hover); }

/* ============================================
   BADGES
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 0.25rem 0.6rem;
}

.badge-success { background: rgba(47, 138, 104, 0.1); color: var(--success); }
.badge-warning { background: rgba(184, 117, 32, 0.1); color: var(--warning); }
.badge-danger  { background: rgba(143, 47, 43, 0.1); color: var(--danger); }
.badge-info    { background: rgba(43, 113, 153, 0.1); color: var(--info); }

/* ============================================
   ALERTAS
   ============================================ */

.alerta-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 10px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alerta-card.critico { border-left: 3px solid var(--danger); }
.alerta-card.atencao { border-left: 3px solid var(--warning); }
.alerta-card.ok { border-left: 3px solid var(--success); }

.alerta-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alerta-card.critico .alerta-icon { color: var(--danger); }
.alerta-card.atencao .alerta-icon { color: var(--warning); }
.alerta-card.ok .alerta-icon { color: var(--success); }

.alerta-titulo {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.alerta-mensagem {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.alertas-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (max-width: 768px) {
    .alertas-grid { grid-template-columns: 1fr; }
}

/* ============================================
   PRIORITY LIST
   ============================================ */

.priority-list { display: flex; flex-direction: column; gap: 8px; }

.priority-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.priority-pos {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text-muted);
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.priority-main { flex: 1; }

.priority-nome {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.priority-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.priority-counts {
    display: flex;
    gap: 8px;
}

/* ============================================
   COBERTURA GRID
   ============================================ */

.coverage-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.coverage-item {
    text-align: center;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.coverage-item-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
    margin-bottom: 4px;
}

.coverage-item-value {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.coverage-item-value.ok { color: var(--success); }
.coverage-item-value.atencao { color: var(--warning); }
.coverage-item-value.critico { color: var(--danger); }

/* ============================================
   PROGRESSO
   ============================================ */

.estado-progresso {
    padding: 12px 14px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.estado-progresso-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.estado-progresso-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.estado-progresso-bar > div {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.estado-progresso-texto {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: right;
}

/* ============================================
   ACCORDION
   ============================================ */

.accordion-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    overflow: hidden;
}

.accordion-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    transition: background 0.15s;
}

.accordion-header:hover { background: var(--bg-hover); }

.accordion-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(31, 63, 115, 0.08);
    border-radius: 6px;
    color: var(--primary);
    flex-shrink: 0;
}

.accordion-title {
    flex: 1;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.accordion-arrow {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.accordion-section.open .accordion-arrow { transform: rotate(180deg); }

.accordion-body {
    display: none;
    padding: 0 18px 18px;
    border-top: 1px solid var(--border);
}

.accordion-section.open .accordion-body { display: block; }

/* ============================================
   INFO GRID
   ============================================ */

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 18px;
}

@media (max-width: 768px) {
    .info-grid { grid-template-columns: 1fr; }
}

.info-grid h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.info-grid ul {
    list-style: none;
    padding: 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.audit-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(184, 117, 32, 0.06);
    border: 1px solid rgba(184, 117, 32, 0.15);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.audit-note i {
    width: 16px;
    height: 16px;
    color: var(--warning);
    flex-shrink: 0;
    margin-top: 1px;
}

/* ============================================
   MUNICÍPIO HEADER
   ============================================ */

.municipio-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.municipio-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.municipio-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(31, 63, 115, 0.08);
    border-radius: 10px;
    color: var(--primary);
}

.municipio-header-kicker {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.municipio-header-nome {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-top: 2px;
}

.municipio-header-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.municipio-header-right {
    display: flex;
    gap: 8px;
}

/* ============================================
   NARRATIVA
   ============================================ */

.narrativa-box {
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.narrativa-box p { margin-bottom: 0.75rem; }
.narrativa-box p:last-child { margin-bottom: 0; }

/* ============================================
   BOTÕES
   ============================================ */

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-secondary);
}

.btn-action:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.btn-action.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-action.primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-action i {
    width: 14px;
    height: 14px;
}

.action-row {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* ============================================
   MAPA
   ============================================ */

#mapaBahia {
    height: 500px;
    width: 100%;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.map-container {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
}

/* ============================================
   EXEC SUMMARY
   ============================================ */

.exec-summary {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    margin-bottom: 20px;
}

.exec-summary-icon {
    width: 18px;
    height: 18px;
    color: var(--info);
    flex-shrink: 0;
    margin-top: 2px;
}

.exec-summary-title {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.exec-summary-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ============================================
   SKELETON
   ============================================ */

.skeleton {
    background: linear-gradient(90deg, #e8ecf2 25%, #f0f3f6 50%, #e8ecf2 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   INFO TIP
   ============================================ */

.info-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: help;
    color: var(--text-muted);
}

.info-tip i {
    width: 14px;
    height: 14px;
}

.info-tip-pop {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    padding: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 200;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.info-tip:hover .info-tip-pop,
.info-tip:focus .info-tip-pop {
    display: block;
}

.info-tip-pop strong {
    color: var(--text-primary);
    font-size: 0.82rem;
}

.info-tip-pop ul {
    margin-top: 6px;
    padding-left: 16px;
}

.info-tip-pop li {
    margin-bottom: 4px;
}

/* ============================================
   FOOTER
   ============================================ */

.app-footer {
    grid-area: footer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 22px;
    background: var(--primary-dark);
    color: var(--text-on-dark-muted);
    border-top: 2px solid var(--primary);
    font-size: 0.72rem;
}
.app-footer strong { color: #fff; }

.footer-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.footer-left strong {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.8rem;
}

.footer-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.footer-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.footer-meta i {
    width: 12px;
    height: 12px;
}

.footer-right {
    font-weight: 500;
}

@media (max-width: 768px) {
    .app-footer {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    .footer-center { align-items: center; }
}

/* ============================================
   MOBILE
   ============================================ */

.mobile-tabs {
    display: none;
    grid-area: header;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 0 12px;
    overflow-x: auto;
    gap: 0;
}

@media (max-width: 1024px) {
    .mobile-tabs {
        display: flex;
    }
}

.mobile-tab {
    padding: 10px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.mobile-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* ============================================
   UTILS
   ============================================ */

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }

.icon-sm {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ============================================
   PÁGINA DE TÓPICO (Radar Fiscal v3) — densidade compacta
   ============================================ */

.topico-header {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    padding: 0.7rem 0.95rem;
    margin-bottom: 0.7rem;
    border-left: 3px solid var(--primary);
    background: linear-gradient(90deg, rgba(31, 63, 115, 0.05), var(--bg-surface) 60%);
}
.topico-header-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}
.topico-header-icon [data-lucide] { width: 17px; height: 17px; }
.topico-header-body { flex: 1; min-width: 0; }
.topico-header-kicker {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--primary);
    margin-bottom: 0.1rem;
}
.topico-header-titulo {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.2rem;
    line-height: 1.2;
}
.topico-header-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}
.topico-header-meta strong { color: var(--text-secondary); font-weight: 600; }

.topico-formula {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.74rem;
    background: var(--bg-soft);
    padding: 0.5rem 0.7rem;
    border-radius: 4px;
    border-left: 2px solid var(--primary);
    margin-bottom: 0.55rem;
    color: var(--text-secondary);
    line-height: 1.4;
}
.topico-formula strong { color: var(--text-primary); }
.topico-descricao {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 0.6rem;
}
.topico-descricao strong { color: var(--text-primary); font-weight: 600; }

.topico-limites {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 0.55rem;
}
.topico-limite-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.7rem;
    align-items: baseline;
    padding: 0.4rem 0.65rem;
    border-radius: 4px;
    background: var(--bg-soft);
    border-left: 2px solid var(--text-muted);
    font-size: 0.74rem;
}
.topico-limite-row.critico { border-left-color: var(--danger); }
.topico-limite-row.atencao { border-left-color: var(--warning); }
.topico-limite-row.aviso { border-left-color: rgba(184,117,32,0.6); }
.topico-limite-label { color: var(--text-primary); font-weight: 600; }
.topico-limite-valor {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.78rem;
}
.topico-limite-fund { color: var(--text-muted); font-size: 0.66rem; }

.topico-mun-grid {
    display: grid;
    grid-template-columns: minmax(140px, 180px) 1fr;
    gap: 1rem;
    align-items: center;
}
.topico-mun-valor {
    text-align: center;
    padding: 0.6rem 0.7rem;
    background: rgba(31, 63, 115, 0.04);
    border-radius: 6px;
}
.topico-mun-valor-num {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
    line-height: 1.05;
}
.topico-mun-valor-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-top: 0.2rem;
}
.topico-posicao {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.6;
}
.topico-posicao strong {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    color: var(--text-primary);
    font-weight: 700;
}

.topico-top-item {
    display: grid;
    grid-template-columns: 26px 1fr auto;
    gap: 0.5rem;
    align-items: center;
    padding: 0.4rem 0.55rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.78rem;
}
.topico-top-item:hover { background: var(--bg-hover, #f4f6f8); }
.topico-top-item:last-child { border-bottom: none; }
.topico-top-pos {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
}
.topico-top-nome { color: var(--text-primary); font-weight: 500; }
.topico-top-valor {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.78rem;
}

.topico-serie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(85px, 1fr));
    gap: 0.4rem;
}
.topico-serie-cell {
    text-align: center;
    padding: 0.45rem 0.3rem;
    background: var(--bg-soft);
    border-radius: 4px;
    border-left: 2px solid var(--primary);
}
.topico-serie-ano {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
}
.topico-serie-val {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 0.15rem;
}

.dashboard-dist-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.4rem;
}
.dashboard-dist-titulo { font-weight: 600; color: var(--text-primary); font-size: 0.82rem; }
.dashboard-dist-base { font-size: 0.68rem; color: var(--text-muted); }
.dashboard-dist-stats {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
    font-size: 0.7rem;
    color: var(--text-muted);
}
.dashboard-dist-stats strong {
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.mapa-legenda-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}

#mapaDashboard { width: 100%; height: 380px; }

@media (max-width: 720px) {
    .topico-mun-grid { grid-template-columns: 1fr; }
    .topico-header { flex-direction: column; }
}

/* ============================================
   FILTRO DE MUNICÍPIO (search + sugestões + badge)
   ============================================ */

.municipio-search-box {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    min-width: 320px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.municipio-search-box:focus-within {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(47, 95, 159, 0.12);
    background: #fff;
}
.municipio-search-box .municipio-search-icon {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.municipio-search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-family: inherit;
    min-width: 0;
}
.municipio-search-box input::placeholder {
    color: var(--text-muted);
}
.municipio-search-clear {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    display: flex;
    border-radius: 3px;
}
.municipio-search-clear:hover { color: var(--danger); background: var(--bg-hover); }
.municipio-search-clear i { width: 12px; height: 12px; }

.municipio-search-suggest {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 7px;
    box-shadow: 0 12px 30px rgba(20, 28, 42, 0.18);
    max-height: 420px;
    overflow-y: auto;
    z-index: 100;
}
.municipio-suggest-header {
    position: sticky;
    top: 0;
    padding: 0.4rem 0.75rem;
    background: var(--bg-panel-head);
    border-bottom: 1px solid var(--border);
    font-size: 0.66rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
    z-index: 1;
}
.municipio-suggest-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    padding: 0.5rem 0.7rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-primary);
    transition: background 0.1s;
}
.municipio-suggest-item:hover,
.municipio-suggest-item.active {
    background: rgba(31, 63, 115, 0.06);
}
.municipio-suggest-item:last-child { border-bottom: none; }
.municipio-suggest-nome { font-weight: 600; color: var(--text-primary); }
.municipio-suggest-meta {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.municipio-suggest-empty {
    padding: 0.85rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* Filter badge ativo */
.municipio-filtro-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.85rem;
    margin-bottom: 0.85rem;
    background: rgba(31, 63, 115, 0.06);
    border: 1px solid rgba(31, 63, 115, 0.18);
    border-radius: 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.municipio-filtro-badge i { width: 14px; height: 14px; color: var(--primary); }
.municipio-filtro-badge strong { color: var(--text-primary); font-weight: 700; }
.municipio-filtro-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 0.4rem;
}
.municipio-filtro-limpar {
    margin-left: auto;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.15s;
}
.municipio-filtro-limpar:hover {
    background: var(--bg-hover);
    color: var(--danger);
    border-color: var(--danger);
}
.municipio-filtro-limpar i { width: 12px; height: 12px; }

@media (max-width: 720px) {
    .municipio-search-box { min-width: 0; width: 100%; }
}

/* ============================================
   TÓPICO — layout consolidado em 2 colunas
   ============================================ */
.topico-grid-2col {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    gap: 0.7rem;
    align-items: start;
}
.topico-mun-band {
    border-top: 1px solid var(--border);
    background: rgba(31, 63, 115, 0.03);
    padding: 10px 14px;
}
.topico-mun-band-empty {
    border-top: 1px solid var(--border);
    background: var(--bg-sidebar);
    padding: 8px 14px;
    color: var(--text-muted);
    font-size: 0.74rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.topico-mun-band-empty i { color: var(--text-muted); }

.topico-sub {
    padding: 9px 14px 11px;
    border-bottom: 1px solid var(--border);
}
.topico-sub:last-child { border-bottom: none; }
.topico-sub-titulo {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.topico-sub-titulo i { width: 13px; height: 13px; color: var(--primary); }

.topico-tops-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}
.topico-tops-cap {
    font-size: 0.66rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 3px;
}

/* Legenda do mapa — chips compactos */
.legenda-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
}
.legenda-quad {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    display: inline-block;
}
.mapa-legenda-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    padding: 7px 14px;
    border-top: 1px solid var(--border);
    background: #fafbfc;
    font-size: 0.7rem;
    color: var(--text-muted);
    align-items: center;
}

/* Mapa do dashboard — altura mais compacta */
#mapaDashboard { width: 100%; height: 380px; }

@media (max-width: 1024px) {
    .topico-grid-2col { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .topico-tops-grid { grid-template-columns: 1fr; }
    #mapaDashboard { height: 260px; }
}

/* ============================================
   MAP TOOLTIP — institucional, sólido, legível
   ============================================ */
/* desabilita o tooltip nativo do Leaflet — usamos caixa fixa custom */
.leaflet-tooltip { display: none !important; }

.mapa-hover-info {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 500;
    background: #142036;
    border: 1px solid #243450;
    border-left: 3px solid #c08a2e;
    color: #fff;
    padding: 8px 11px;
    border-radius: 5px;
    font-family: var(--font-sans);
    min-width: 180px;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(20, 28, 42, 0.18);
}
.mapa-hover-nome {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
    margin-bottom: 1px;
}
.mapa-hover-meta {
    font-size: 0.65rem;
    color: #c08a2e;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
    margin-bottom: 3px;
}
.mapa-hover-valor {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    color: #f0f4f8;
    font-variant-numeric: tabular-nums;
}
.leaflet-tooltip.map-tooltip {
    background: #142036 !important;
    border: 1px solid #243450 !important;
    border-left: 3px solid #c08a2e !important;
    color: #fff !important;
    box-shadow: 0 4px 10px rgba(20, 28, 42, 0.20) !important;
    border-radius: 5px !important;
    padding: 7px 10px !important;
    font-family: var(--font-sans) !important;
    opacity: 1 !important;
    pointer-events: none;
}
.leaflet-tooltip.map-tooltip::before {
    border-top-color: #142036 !important;
}
.map-tooltip-inner { min-width: 130px; }
.map-tooltip-nome {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
    letter-spacing: -0.01em;
}
.map-tooltip-meta {
    font-size: 0.66rem;
    color: #c08a2e;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
    margin-bottom: 1px;
}
.map-tooltip-valor {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 700;
    color: #f0f4f8;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   PÁGINA DE TÓPICO — layout v2 (3 cards no topo + descrição + comparação)
   ============================================ */
.topico-row-3 {
    display: grid;
    grid-template-columns: 0.9fr 1.3fr 1.4fr;
    gap: 0.65rem;
    margin-bottom: 0.65rem;
}
.topico-card-cap {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--accent-gold);
    margin-bottom: 5px;
}

/* Card valor */
.topico-card-valor {
    padding: 11px 14px 13px;
    background: linear-gradient(180deg, rgba(31,63,115,0.06), #fff 60%);
    border-left: 3px solid var(--primary);
}
.topico-card-valor.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-align: center;
    padding: 18px 12px;
    border-left: 3px solid var(--border);
    background: var(--bg-soft);
}
.topico-card-valor.empty i { width: 22px; height: 22px; margin-bottom: 6px; color: var(--text-muted); }
.topico-card-num {
    font-family: var(--font-mono);
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
}
.topico-card-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 1px;
}
.topico-card-pos {
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px solid var(--border);
    font-size: 0.74rem;
    color: var(--text-secondary);
    line-height: 1.4;
}
.topico-card-pos strong {
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

/* Card limites */
.topico-card-limites {
    padding: 11px 14px 12px;
}
.topico-card-limites .topico-limite-row {
    margin-bottom: 4px;
}
.topico-card-limites .topico-limite-row:last-of-type { margin-bottom: 8px; }
.topico-card-formula {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.45;
}
.topico-card-formula strong { color: var(--text-primary); }

/* Card sparkline */
.topico-card-spark {
    padding: 10px 14px 12px;
    display: flex;
    flex-direction: column;
}
.topico-card-spark.empty {
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-align: center;
    padding: 18px 12px;
    background: var(--bg-soft);
}
.topico-card-spark.empty i { width: 22px; height: 22px; margin-bottom: 6px; color: var(--text-muted); }
.topico-spark-wrap {
    flex: 1;
    min-height: 110px;
    margin: 4px 0 6px;
    position: relative;
}
.topico-card-spark canvas { max-height: 130px; }

/* Descrição (full-width) */
.topico-descricao-panel { padding: 9px 14px 11px; margin-bottom: 0.65rem; }
.topico-descricao-panel .topico-descricao { margin-bottom: 0; }

/* Compare grid (3 colunas: distribuição | maiores | menores) */
.topico-compare-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
}
.topico-compare-grid .topico-sub {
    border-bottom: none;
    border-right: 1px solid var(--border);
}
.topico-compare-grid .topico-sub:last-child { border-right: none; }

@media (max-width: 1024px) {
    .topico-row-3 { grid-template-columns: 1fr 1fr; }
    .topico-card-spark { grid-column: 1 / -1; }
    .topico-compare-grid { grid-template-columns: 1fr; }
    .topico-compare-grid .topico-sub { border-right: none; border-bottom: 1px solid var(--border); }
}
@media (max-width: 720px) {
    .topico-row-3 { grid-template-columns: 1fr; }
}

/* ============================================
   AVISO de tópico (proxy / leitura consolidada / não verificado)
   ============================================ */
.topico-aviso {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.7rem 0.95rem;
    margin-bottom: 0.7rem;
    border-radius: 5px;
    border-left: 4px solid var(--warning);
    background: rgba(184, 117, 32, 0.08);
}
.topico-aviso.critico {
    border-left-color: var(--danger);
    background: rgba(143, 47, 43, 0.08);
}
.topico-aviso > i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--warning);
}
.topico-aviso.critico > i { color: var(--danger); }
.topico-aviso-titulo {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.82rem;
    margin-bottom: 2px;
}
.topico-aviso-texto {
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.topico-aviso-texto strong { color: var(--text-primary); }

/* ============================================
   SELO de confiabilidade
   ============================================ */
.selo-confiab {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.12rem 0.5rem;
    border-radius: 3px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    vertical-align: middle;
}
.selo-confiab.oficial {
    background: rgba(47, 138, 104, 0.14);
    color: var(--success);
    border: 1px solid rgba(47, 138, 104, 0.3);
}
.selo-confiab.proxy {
    background: rgba(184, 117, 32, 0.14);
    color: var(--warning);
    border: 1px solid rgba(184, 117, 32, 0.3);
}
.selo-confiab.leitura-consolidada {
    background: rgba(43, 113, 153, 0.14);
    color: var(--info);
    border: 1px solid rgba(43, 113, 153, 0.3);
}
.selo-confiab.nao-verificado {
    background: var(--bg-soft);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* ============================================
   BLOCO RASTREABILIDADE
   ============================================ */
.topico-rastr {
    margin-top: 0.65rem;
    padding: 0.85rem 1rem;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.topico-rastr-cap {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}
.topico-rastr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.45rem 1rem;
    font-size: 0.74rem;
}
.topico-rastr-grid > div {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.topico-rastr-grid > div.full { grid-column: 1 / -1; }
.topico-rastr-grid .rkey {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
}
.topico-rastr-grid .rval {
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.4;
}
.topico-rastr-grid .rval.mono {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    word-break: break-all;
}
.topico-rastr-obs {
    margin-top: 0.55rem;
    padding-top: 0.55rem;
    border-top: 1px dashed var(--border);
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.5;
    font-style: italic;
}

/* ============================================
   COBERTURA E LACUNAS
   ============================================ */
.cob-resumo {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.85rem 1.1rem;
    margin-bottom: 0.7rem;
    background: linear-gradient(90deg, rgba(31, 63, 115, 0.08), var(--bg-surface) 70%);
    border-left: 3px solid var(--primary);
}
.cob-resumo-num {
    font-family: var(--font-mono);
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}
.cob-resumo-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.cob-panel { margin-bottom: 0.65rem; }
.cob-row {
    display: grid;
    grid-template-columns: 1.4fr 2fr 0.8fr;
    gap: 0.7rem;
    align-items: center;
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.78rem;
}
.cob-row:last-child { border-bottom: none; }
.cob-anexo {
    color: var(--text-primary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.cob-tag {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    background: rgba(143, 47, 43, 0.14);
    color: var(--danger);
    border-radius: 3px;
    border: 1px solid rgba(143, 47, 43, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.cob-bar {
    background: var(--bg-soft);
    border-radius: 3px;
    height: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.cob-bar-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}
.cob-row.ok .cob-bar-fill       { background: var(--success); }
.cob-row.atencao .cob-bar-fill  { background: var(--info); }
.cob-row.parcial .cob-bar-fill  { background: var(--warning); }
.cob-row.critico .cob-bar-fill  { background: var(--danger); }
.cob-num {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    font-size: 0.74rem;
    text-align: right;
}
