:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-subtle: #f1f5f9;
  --surface-hover: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #334155;
  --text-light: #64748b;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-dim: #e0f2fe;
  --green: #15803d;
  --green-dim: #dcfce7;
  --green-border: rgba(21, 128, 61, 0.25);
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 14px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.65;
  padding: 0 0 4rem;
}

/* ==========================================================================
   Header, Barra de Navegacao e Marca Canonica TecnoPopular
   ========================================================================== */
.site-header {
  width: 100%;
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  line-height: 1.2;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.brand-title:hover {
  color: var(--accent);
}

.brand-title:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

.subdomain-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  background: var(--surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  vertical-align: middle;
}

.nav-back {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.15s ease;
}

.nav-back:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Banner de Identificacao Civica Independente */
.civic-banner {
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border-strong);
  padding: 0.65rem 1.25rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.banner-inner {
  max-width: 1080px;
  margin: 0 auto;
}

.banner-text {
  margin: 0;
  line-height: 1.45;
}

.tracker-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: trackerFadeIn 0.15s ease-out;
}

.tracker-modal-backdrop[aria-hidden="false"] {
  display: flex !important;
}

.tracker-modal-backdrop[aria-hidden="true"] {
  display: none !important;
}

@keyframes trackerFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tracker-modal-dialog {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border-strong, #cbd5e1);
  border-radius: var(--radius-lg, 12px);
  max-width: 560px;
  width: 100%;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: trackerSlideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.tracker-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: var(--surface-subtle, #f8fafc);
}

.tracker-modal-title-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.tracker-modal-warn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #d97706;
  flex-shrink: 0;
}

.tracker-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text, #0f172a);
  margin: 0;
  line-height: 1.3;
}

.tracker-modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-light, #64748b);
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.tracker-modal-close:hover,
.tracker-modal-close:focus-visible {
  color: var(--text, #0f172a);
  background: var(--border, #e2e8f0);
}

.tracker-modal-body {
  padding: 1.25rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-muted, #334155);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  max-height: 70vh;
  overflow-y: auto;
}

.tracker-modal-lead {
  font-weight: 600;
  color: var(--text, #0f172a);
  border-left: 3px solid #d97706;
  padding-left: 0.75rem;
  margin: 0;
}

.tracker-modal-section h3 {
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text, #0f172a);
  margin-bottom: 0.35rem;
}

.tracker-modal-section p {
  margin: 0;
}

.tracker-modal-section p + p {
  margin-top: 0.5rem;
}

.tracker-modal-detail {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  color: #92400e;
  line-height: 1.5;
}

.tracker-modal-footer {
  padding: 0.9rem 1.25rem;
  border-top: 1px solid var(--border, #e2e8f0);
  background: var(--surface-subtle, #f8fafc);
  display: flex;
  justify-content: flex-end;
}

.tracker-modal-btn {
  background: var(--text, #0f172a);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.tracker-modal-btn:hover {
  opacity: 0.9;
}

.tracker-warning-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.35);
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.tracker-warning-btn:hover,
.tracker-warning-btn:focus-visible {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(245, 158, 11, 0.6);
  color: #78350f;
}

.tracker-warning-btn svg {
  color: #d97706;
  stroke: #d97706;
  flex-shrink: 0;
}

.tracker-modal-open-inline {
  background: none;
  border: none;
  color: #b45309;
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  font-weight: 600;
  padding: 0;
  display: inline;
}

.tracker-modal-open-inline:hover {
  color: #78350f;
}


.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Rodape e Treemap Institucional */
footer#transparencia {
  margin-top: 4rem;
  border-top: 1px solid var(--border-strong);
  padding-top: 2.5rem;
}

.footer-treemap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.treemap-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.treemap-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
}

.treemap-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.treemap-list a {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.treemap-list a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.sub-footer {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  font-size: 0.82rem;
  color: var(--text-light);
}

.sub-footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.sub-footer p {
  margin: 0;
}

.sub-footer a {
  color: var(--text-muted);
  text-decoration: underline;
}

/* Botao Flutuante: Pular de volta para o inicio */
.btn-back-to-top {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn-back-to-top.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.btn-back-to-top:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.28);
}

.btn-back-to-top:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Trilha estrutural de navegacao (breadcrumbs) */
.breadcrumb-trail {
  margin: 1.5rem 0 0.75rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.breadcrumb-trail ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 0.4rem;
}

.breadcrumb-trail a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb-trail a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.breadcrumb-trail .separator {
  color: var(--border-strong, var(--border));
  user-select: none;
}

.breadcrumb-trail [aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

.breadcrumb-trail + .article-header {
  margin-top: 0.75rem;
}


/* Cabecalho e Metadados Canonicos de Artigos e Estudos */
.article-header {
  margin: 2.25rem 0 2rem;
}

.article-title {
  font-size: clamp(2rem, 4.2vw, 2.85rem);
  font-weight: 850;
  color: var(--text);
  line-height: 1.18;
  letter-spacing: -0.03em;
  margin: 0 0 1.15rem;
}

/* Subtitulos e Leads Canonicos (Padronizacao Tipografica, Espacamento e Cor) */
.article-lead,
.page-lead,
.hero-lead,
.lead-text,
.subtitle {
  font-family: var(--font-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: clamp(1.05rem, 1.8vw, 1.2rem);
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.01em;
  color: var(--text-muted);
  margin-top: 0;
  margin-bottom: 1.5rem;
  max-width: 840px;
}

.article-lead strong,
.page-lead strong,
.hero-lead strong,
.lead-text strong,
.subtitle strong {
  color: var(--text);
  font-weight: 600;
}

.article-lead em,
.page-lead em,
.hero-lead em,
.lead-text em,
.subtitle em {
  color: var(--text);
  font-style: italic;
}

.article-lead a,
.page-lead a,
.hero-lead a,
.lead-text a,
.subtitle a {
  color: var(--accent);
  text-decoration: underline;
}

.article-lead a:hover,
.page-lead a:hover,
.hero-lead a:hover,
.lead-text a:hover,
.subtitle a:hover {
  color: var(--accent-hover);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  font-size: 0.86rem;
  color: var(--text-light);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 0;
  margin-bottom: 1.75rem;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.meta-item strong {
  color: var(--text);
  font-weight: 600;
}

.meta-item a {
  color: var(--accent);
  text-decoration: underline;
}

.meta-item a:hover {
  color: var(--accent-hover);
}

.meta-sep {
  color: var(--border-strong);
  user-select: none;
}

@media (max-width: 680px) {
  .article-header {
    margin: 1.5rem 0 1.5rem;
  }
  .article-title {
    font-size: 1.75rem;
    line-height: 1.22;
  }
  .article-lead,
  .page-lead,
  .hero-lead,
  .lead-text,
  .subtitle {
    font-size: 1rem;
    line-height: 1.55;
    margin-bottom: 1.25rem;
  }
  .article-meta {
    font-size: 0.82rem;
    gap: 0.5rem 0.75rem;
    padding: 0.75rem 0;
  }
}

/* Indicador de Proveniencia de IA e Midia Sintetica */
.banner-media-wrap {
  position: relative;
  width: 100%;
  display: block;
}

.ai-provenance-details {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10;
}

.ai-provenance-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-sm, 4px);
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.ai-provenance-badge::-webkit-details-marker {
  display: none;
}

.ai-provenance-badge:hover,
.ai-provenance-badge:focus-visible {
  background: rgba(15, 23, 42, 0.96);
  border-color: rgba(255, 255, 255, 0.4);
  outline: 2px solid var(--accent, #0284c7);
  outline-offset: 1px;
}

.ai-badge-icon {
  flex-shrink: 0;
  display: inline-block;
}

.ai-provenance-panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  width: 280px;
  max-width: 85vw;
  background: var(--surface, #ffffff);
  color: var(--text, #0f172a);
  border: 1px solid var(--border-strong, #cbd5e1);
  border-radius: var(--radius-sm, 4px);
  padding: 0.75rem 0.85rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  font-size: 0.76rem;
  line-height: 1.45;
}

.ai-panel-title {
  margin: 0 0 0.5rem;
  font-weight: 700;
  color: var(--text, #0f172a);
  border-bottom: 1px solid var(--border, #e2e8f0);
  padding-bottom: 0.3rem;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.ai-meta-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.5rem;
  margin: 0;
}

.ai-meta-list dt {
  color: var(--text-muted, #334155);
  font-weight: 600;
}

.ai-meta-list dd {
  margin: 0;
  color: var(--text, #0f172a);
}

.ai-meta-list a {
  color: var(--accent, #0284c7);
  text-decoration: underline;
}

@media (max-width: 600px) {
  .ai-provenance-details {
    top: 0.5rem;
    left: 0.5rem;
  }
  .ai-provenance-badge {
    width: 26px;
    height: 26px;
  }
  .ai-provenance-panel {
    width: 250px;
  }
}


@media (max-width: 680px) {
  .footer-treemap {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }
  .sub-footer-inner {
    flex-direction: column;
    text-align: center;
    gap: 0.4rem;
  }
}

@media (max-width: 600px) {
  .btn-back-to-top {
    bottom: 1.25rem;
    right: 1.25rem;
    width: 42px;
    height: 42px;
  }
}

/* ==========================================================================
   TecnoPopular Malha (BETA) — Folha de Estilos Mobile-First (WCAG AAA >= 7:1)
   Herda tokens de shared/base.css e impoe maximo de 1 nivel de card no mobile.
   ========================================================================== */

:root {
  /* Tokens de alto contraste (>= 7:1 sobre #ffffff e #f8fafc) */
  --malha-ink: #0f172a;
  --malha-ink-muted: #334155;
  --malha-link: #075985;
  --malha-link-hover: #0c4a6e;
  --malha-accent-bg: #e0f2fe;
  --malha-accent-ink: #0c4a6e;
  --malha-green-bg: #dcfce7;
  --malha-green-ink: #14532d;
  --malha-amber-bg: #fef3c7;
  --malha-amber-ink: #78350f;
  --malha-amber-border: #b45309;
  --malha-red-bg: #fee2e2;
  --malha-red-ink: #7f1d1d;
  --malha-red-border: #b91c1c;
  --malha-frontier-bg: #fffbeb;
  --malha-frontier-border: #92400e;
}

/* Acessibilidade e utilitarios base */
.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;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 1200;
  background: var(--malha-link);
  color: #ffffff;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
}

.skip-link:focus {
  top: 0.75rem;
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

.malha-body a {
  color: var(--malha-link);
}

.malha-body a:hover {
  color: var(--malha-link-hover);
}

.malha-body a:focus-visible,
.malha-body button:focus-visible,
.malha-body input:focus-visible,
.malha-body select:focus-visible,
.malha-body [tabindex]:focus-visible {
  outline: 2px solid var(--malha-link);
  outline-offset: 2px;
}

.malha-body.malha-drawer-open {
  overflow: hidden;
}

/* Contraste reforcado para elementos herdados de base.css */
.treemap-title {
  color: var(--malha-ink);
}

.treemap-list a {
  color: var(--malha-ink-muted);
}

.sub-footer {
  color: var(--malha-ink-muted);
}

.sub-footer a {
  color: var(--malha-link);
}

/* ==========================================================================
   Selo BETA & Aviso Legal Acima da Dobra
   ========================================================================== */
.malha-badge-beta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--malha-accent-bg);
  color: var(--malha-accent-ink);
  border: 1px solid var(--accent);
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.2;
}

.malha-epistemic-badge {
  display: inline-flex;
  align-items: center;
  background: var(--surface-subtle);
  color: var(--malha-ink-muted);
  border: 1px solid var(--border-strong);
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.malha-disclaimer,
.legal-notice-top {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--malha-amber-border);
  border-radius: var(--radius);
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--malha-ink-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.75rem;
}

.malha-disclaimer strong {
  color: var(--malha-ink);
}

.malha-disclaimer p {
  margin: 0;
  flex: 1 1 260px;
}

.malha-disclaimer a {
  font-weight: 600;
  text-decoration: underline;
}

/* ==========================================================================
   Entrada Busca-Primeiro (Home)
   ========================================================================== */
.malha-search-hero,
.search-hero {
  margin-top: 1.25rem;
  padding: 1.35rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.malha-hero-header {
  margin-bottom: 1rem;
}

.malha-hero-title {
  font-size: clamp(1.5rem, 3.4vw, 2.2rem);
  font-weight: 850;
  letter-spacing: -0.025em;
  line-height: 1.18;
  color: var(--malha-ink);
  margin: 0.55rem 0 0.5rem;
}

.malha-search-hero .hero-lead {
  font-size: clamp(0.95rem, 1.5vw, 1.06rem);
  margin-bottom: 0;
  color: var(--malha-ink-muted);
}

.malha-search-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.malha-search-input-wrap {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.malha-search-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  padding: 0.8rem 1rem;
  font-family: var(--font);
  font-size: 1rem;
  color: var(--malha-ink);
  background: var(--bg);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.malha-search-input:focus {
  border-color: var(--malha-link);
  background: var(--surface);
  outline: none;
}

.malha-search-input::placeholder {
  color: var(--malha-ink-muted);
  opacity: 0.85;
}

.malha-search-clear {
  padding: 0 0.9rem;
  font-family: var(--font);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--malha-ink);
  background: var(--surface-subtle);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
}

.malha-search-clear:hover {
  background: var(--border);
}

.malha-search-hint {
  font-size: 0.82rem;
  color: var(--malha-ink-muted);
  margin: 0;
}

.malha-search-hint code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-sm);
  color: var(--malha-ink);
}

.malha-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.malha-filter-pill {
  padding: 0.4rem 0.8rem;
  min-height: 36px;
  font-family: var(--font);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--malha-ink-muted);
  background: var(--surface-subtle);
  border: 1px solid var(--border-strong);
  border-radius: 9999px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.malha-filter-pill:hover {
  background: var(--malha-accent-bg);
  color: var(--malha-accent-ink);
  border-color: var(--accent);
}

.malha-filter-pill.is-active,
.malha-filter-pill[aria-pressed="true"] {
  background: var(--malha-link);
  color: #ffffff;
  border-color: var(--malha-link);
}

.malha-search-status {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--malha-ink-muted);
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}

.malha-search-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem;
  margin-top: 0.25rem;
}

/* ==========================================================================
   Secoes Neutras (Regra de 1 Nivel de Card Enclausurado)
   ========================================================================== */
.malha-section {
  margin-top: 2.25rem;
  border: none;
  padding: 0;
  background: transparent;
}

.malha-section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.45rem;
  border-bottom: 2px solid var(--border);
}

.malha-section-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--malha-ink);
  margin: 0;
}

.malha-section-link {
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: underline;
}

.malha-section-meta,
.malha-section-desc {
  font-size: 0.88rem;
  color: var(--malha-ink-muted);
  margin: 0 0 0.9rem;
}

.malha-entity-header {
  margin-top: 1.25rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--border-strong);
}

.malha-entity-kicker-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.malha-entity-title {
  font-size: clamp(1.55rem, 3.6vw, 2.3rem);
  font-weight: 850;
  letter-spacing: -0.025em;
  line-height: 1.18;
  color: var(--malha-ink);
  margin: 0 0 0.65rem;
  overflow-wrap: break-word;
}

.malha-entity-header .page-lead {
  margin-bottom: 0.75rem;
  color: var(--malha-ink-muted);
}

.malha-id-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 0.65rem;
}

.malha-id-label {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--malha-ink-muted);
}

.malha-id-code,
.hash-code {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  background: var(--surface-subtle);
  color: var(--malha-ink);
  border: 1px solid var(--border-strong);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.malha-section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.malha-section-nav a {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--malha-link);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.malha-section-nav a:hover {
  background: var(--malha-accent-bg);
  color: var(--malha-accent-ink);
  border-color: var(--accent);
}

/* ==========================================================================
   Separacao Epistemologica Estrita (Camada 1 vs Camada 2)
   ========================================================================== */
.epistemic-block,
.facts-block,
.analysis-block {
  margin-top: 2rem;
  padding: 1rem 0 0;
  background: transparent;
  border: none;
  border-top: 3px solid var(--border-strong);
}

.epistemic-block--primary,
.facts-block {
  border-top-color: var(--malha-link);
}

.epistemic-block--derived,
.analysis-block {
  border-top-color: var(--malha-amber-border);
}

.epistemic-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}

.epistemic-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.epistemic-tag--primary {
  background: var(--malha-accent-bg);
  color: var(--malha-accent-ink);
  border: 1px solid var(--accent);
}

.epistemic-tag--derived {
  background: var(--malha-amber-bg);
  color: var(--malha-amber-ink);
  border: 1px solid var(--malha-amber-border);
}

.epistemic-caption {
  font-size: 0.86rem;
  color: var(--malha-ink-muted);
  margin: 0 0 1rem;
}

.epistemic-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ==========================================================================
   Cards de Nivel Unico (Zero Aninhamento de Bordas/Paddings Cumulativos)
   ========================================================================== */
.kpi-grid,
.indicator-grid,
.shortcut-grid,
.malha-municipalities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.85rem;
}

.malha-card,
.kpi-card,
.indicator-card,
.fact-card,
.shortcut-card,
.search-result-card,
.municipality-card,
.verification-card,
.retification-contact-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1rem;
  color: var(--malha-ink);
}

.search-result-card,
.shortcut-card,
.municipality-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.search-result-card:hover,
.shortcut-card:hover,
.municipality-card:hover {
  border-color: var(--malha-link);
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--malha-ink-muted);
}

.kpi-value,
.money-value {
  font-variant-numeric: tabular-nums;
}

.kpi-value {
  font-size: 1.4rem;
  font-weight: 850;
  line-height: 1.2;
  color: var(--malha-ink);
  margin-top: 0.25rem;
}

.kpi-note {
  font-size: 0.82rem;
  color: var(--malha-ink-muted);
  margin-top: 0.35rem;
}

/* Sub-elementos internos dos cards: somente border-top ou border-left */
.card-divider,
.formula-box,
.provenance-strip,
.copy-keys-block,
.frontier-warning {
  margin-top: 0.75rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--malha-ink-muted);
}

.formula-box,
.frontier-warning {
  border-top: none;
  border-left: 3px solid var(--malha-amber-border);
  background: var(--malha-frontier-bg);
  padding: 0.55rem 0 0.55rem 0.75rem;
  color: var(--malha-ink);
}

.frontier-warning strong {
  color: var(--malha-amber-ink);
}

/* ==========================================================================
   Marcadores de Regime de Aresta (Solido vs Tracejado)
   ========================================================================== */
.edge-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.edge-chip,
.regime-solid,
.regime-dashed {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
}

.edge-chip--direct,
.regime-solid {
  background: var(--malha-green-bg);
  color: var(--malha-green-ink);
  border: 2px solid var(--green);
}

.edge-chip--frontier,
.regime-dashed {
  background: var(--malha-frontier-bg);
  color: var(--malha-amber-ink);
  border: 2px dashed var(--malha-frontier-border);
}

.badge-anulado {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--malha-red-bg);
  color: var(--malha-red-ink);
  border: 1px solid var(--malha-red-border);
}

.badge-sem-empenho {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--surface-subtle);
  color: var(--malha-ink);
  border: 1px solid var(--border-strong);
}

/* ==========================================================================
   Micro-Diagramas SVG Leves
   ========================================================================== */
.malha-svg-panel {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.malha-svg-panel svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.malha-svg-panel [role="button"],
.malha-svg-panel .btn-evidence {
  cursor: pointer;
}

/* ==========================================================================
   Linha Temporal Cadastral (state_history)
   ========================================================================== */
.state-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 3px solid var(--malha-link);
  padding-left: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.state-timeline-item {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

.state-timeline-period {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--malha-link);
  margin-bottom: 0.25rem;
}

.state-timeline-label {
  font-size: 1rem;
  font-weight: 800;
  color: var(--malha-ink);
  margin-bottom: 0.35rem;
}

.state-timeline-meta {
  font-size: 0.85rem;
  color: var(--malha-ink-muted);
}

/* ==========================================================================
   Tabelas Responsivas, Filtros e Destaque de Ancora
   ========================================================================== */
.malha-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.malha-table-filter,
.malha-table-select {
  padding: 0.5rem 0.75rem;
  min-height: 40px;
  font-family: var(--font);
  font-size: 0.88rem;
  color: var(--malha-ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.malha-table-filter {
  flex: 1 1 240px;
  min-width: 0;
}

.malha-table-select {
  flex: 0 1 auto;
}

.malha-table-count {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--malha-ink-muted);
  margin-left: auto;
}

.table-scroll,
.anchor-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}

.malha-table,
.table-scroll table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
  color: var(--malha-ink);
}

.malha-table th,
.table-scroll th {
  background: var(--surface-subtle);
  color: var(--malha-ink);
  font-weight: 800;
  padding: 0.75rem 0.85rem;
  border-bottom: 2px solid var(--border-strong);
  white-space: nowrap;
}

.malha-table td,
.table-scroll td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--malha-ink-muted);
  vertical-align: top;
}

.malha-table tr:last-child td,
.table-scroll tr:last-child td {
  border-bottom: none;
}

.is-targeted,
:target {
  scroll-margin-top: 1.25rem;
}

tr.is-targeted,
.malha-card.is-targeted,
article.is-targeted {
  background: var(--malha-accent-bg);
  outline: 2px solid var(--malha-link);
}

/* ==========================================================================
   Botoes de Evidencia, Copia em 1 Clique e Retificacao
   ========================================================================== */
.copy-btn,
.btn-evidence,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--malha-ink);
  background: var(--surface-subtle);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.copy-btn:hover,
.btn-evidence:hover,
.btn-secondary:hover {
  background: var(--malha-accent-bg);
  color: var(--malha-accent-ink);
  border-color: var(--accent);
}

.copy-btn.is-copied {
  background: var(--malha-green-bg);
  color: var(--malha-green-ink);
  border-color: var(--green);
}

.copy-keys-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.copy-key-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}

.copy-key-label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--malha-ink-muted);
}

.copy-key-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.retification-email-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.retification-email-link {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 800;
  color: var(--malha-link);
}

/* ==========================================================================
   Gaveta de Evidencias (Lateral no Desktop / Bottom Sheet no Mobile < 600px)
   ========================================================================== */
.evidence-backdrop {
  position: fixed;
  inset: 0;
  z-index: 990;
  background: rgba(15, 23, 42, 0.58);
}

.evidence-backdrop[hidden],
.evidence-drawer[hidden],
.evidence-drawer[aria-hidden="true"] {
  display: none;
}

.evidence-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  width: min(460px, 92vw);
  background: var(--surface);
  color: var(--malha-ink);
  border-left: 2px solid var(--border-strong);
  box-shadow: -8px 0 30px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
}

.evidence-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border-strong);
}

.evidence-drawer-kicker {
  display: block;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--malha-link);
  margin-bottom: 0.2rem;
}

.evidence-drawer-title {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--malha-ink);
  margin: 0;
}

.evidence-drawer-close {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--malha-ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.evidence-drawer-close:hover {
  background: var(--malha-accent-bg);
  color: var(--malha-accent-ink);
  border-color: var(--accent);
}

.evidence-drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  font-size: 0.9rem;
  line-height: 1.55;
}

.evidence-meta-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0;
}

.evidence-meta-row {
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}

.evidence-meta-row dt {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--malha-ink-muted);
  margin-bottom: 0.15rem;
}

.evidence-meta-row dd {
  margin: 0;
  color: var(--malha-ink);
  overflow-wrap: anywhere;
}

.evidence-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.evidence-drawer-footer {
  padding: 0.85rem 1.15rem;
  background: var(--surface-subtle);
  border-top: 1px solid var(--border-strong);
  display: flex;
  justify-content: flex-end;
}

/* ==========================================================================
   Regras Mobile (< 600px): Zero Aninhamento Duplo de Cards e Bottom Sheet
   ========================================================================== */
@media (max-width: 600px) {
  .container {
    padding: 0 0.85rem;
  }

  .civic-banner {
    padding: 0.5rem 0.85rem;
    font-size: 0.78rem;
  }

  .nav-bar {
    padding: 0.85rem 0;
  }

  .brand-title {
    font-size: 1.15rem;
  }

  .malha-disclaimer {
    margin-top: 0.75rem;
    padding: 0.65rem 0.75rem;
    font-size: 0.82rem;
  }

  .malha-search-hero {
    margin-top: 0.85rem;
    padding: 1rem 0.9rem;
  }

  .malha-hero-title {
    font-size: 1.45rem;
  }

  .malha-search-input-wrap {
    flex-direction: column;
  }

  .malha-search-clear {
    min-height: 40px;
  }

  /* Secoes e blocos epistemologicos neutros: nunca acumulam bordas/paddings */
  .malha-section,
  .epistemic-block,
  .facts-block,
  .analysis-block {
    padding-left: 0;
    padding-right: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    background: transparent;
  }

  .malha-card,
  .kpi-card,
  .indicator-card,
  .fact-card,
  .shortcut-card,
  .search-result-card,
  .municipality-card,
  .verification-card,
  .retification-contact-card,
  .state-timeline-item {
    padding: 0.85rem 0.9rem;
  }

  .malha-card *,
  .kpi-card *,
  .indicator-card *,
  .verification-card * {
    max-width: 100%;
  }

  .formula-box,
  .frontier-warning {
    padding: 0.5rem 0 0.5rem 0.65rem;
    margin-left: 0;
    margin-right: 0;
  }

  .malha-table-count {
    margin-left: 0;
    width: 100%;
  }

  .kpi-grid,
  .indicator-grid,
  .shortcut-grid,
  .malha-municipalities-grid,
  .malha-search-results,
  .copy-keys-grid {
    grid-template-columns: 1fr;
  }

  .evidence-drawer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 85vh;
    border-left: none;
    border-top: 2px solid var(--border-strong);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.25);
  }

  .evidence-drawer-header::before {
    content: "";
    position: absolute;
    top: 0.4rem;
    left: 50%;
    transform: translateX(-50%);
    width: 38px;
    height: 4px;
    border-radius: 9999px;
    background: var(--border-strong);
  }

  .evidence-drawer-header {
    position: relative;
    padding-top: 1.25rem;
  }
}

/* ==========================================================================
   Logo, Marca da Malha, Banner Legal Unico e Botao Mostrar Mais
   ========================================================================== */
.malha-top-disclaimer {
  border-left: 4px solid var(--malha-amber-border);
  background: var(--surface);
  color: var(--malha-ink-muted);
  font-size: 0.8rem;
  padding: 0.6rem 1.25rem;
}

.malha-top-disclaimer p {
  margin: 0;
}

.malha-top-disclaimer strong {
  color: var(--malha-ink);
}

.malha-top-disclaimer a {
  font-weight: 700;
  text-decoration: underline;
}

.malha-canvas {
  position: relative;
}

.malha-canvas > .site-header,
.malha-canvas > main,
.malha-canvas > footer {
  position: relative;
  z-index: 1;
}

.malha-watermark {
  position: absolute;
  top: 0.75rem;
  left: -1.5rem;
  width: clamp(220px, 28vw, 340px);
  pointer-events: none;
  user-select: none;
  z-index: 2;
  opacity: 0.055;
  mix-blend-mode: multiply;
  overflow: hidden;
}

.malha-watermark-img {
  display: block;
  width: 100%;
  height: auto;
}

.malha-brand-word {
  font-weight: 850;
  color: var(--malha-ink);
  letter-spacing: -0.02em;
}

.malha-brand-parent {
  font-weight: 600;
  color: var(--malha-ink-muted);
}

@media (max-width: 600px) {
  .malha-watermark {
    left: -1.25rem;
    width: 210px;
    opacity: 0.045;
  }
}

.malha-show-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 0.85rem;
}

.btn-show-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.45rem 1.1rem;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--malha-link);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-show-more:hover {
  background: var(--malha-accent-bg);
  color: var(--malha-accent-ink);
  border-color: var(--accent);
}
