/* =============================================================================
   Painel APAE · São Paulo — design system
   Referências: IBM Carbon Design System, Observable Plot, Stripe Dashboard,
   Linear (contenção cromática).
   Princípios:
     - fundo neutro sólido, nunca gradiente
     - dado é a única cor; UI em cinzas
     - paleta categórica restrita (Observable 10) para séries; sequencial azul
       para o choropleth (variável contínua)
     - tipografia Inter + tabular-nums obrigatório em números/tabelas
     - densidade contida, bordas de 1px, radius <= 6px, sem sombra
     - hierarquia por estrutura, não decoração
   ============================================================================= */

:root {
  --bi-space-1: 4px;
  --bi-space-2: 8px;
  --bi-space-3: 12px;
  --bi-space-4: 16px;
  --bi-space-6: 24px;
  --bi-space-8: 32px;
  --bi-space-10: 40px;
  --bi-radius-sm: 4px;
  --bi-radius-md: 6px;

  --bi-cat-1: rgb(66 105 208);
  --bi-cat-2: rgb(239 177 24);
  --bi-cat-3: rgb(255 114 92);
  --bi-cat-4: rgb(108 197 176);
  --bi-cat-5: rgb(60 169 81);
  --bi-cat-6: rgb(255 138 183);
  --bi-cat-7: rgb(164 99 242);
  --bi-cat-8: rgb(151 187 245);
  --bi-cat-9: rgb(156 107 78);
  --bi-cat-10: rgb(148 152 160);

  --radius: var(--bi-radius-md);
  --radius-sm: var(--bi-radius-sm);
  --pad-cell: var(--bi-space-2);
  --cat-0: var(--bi-cat-1);
  --cat-1: var(--bi-cat-2);
  --cat-2: var(--bi-cat-3);
  --cat-3: var(--bi-cat-4);
  --cat-4: var(--bi-cat-5);
  --cat-5: var(--bi-cat-6);
  --cat-6: var(--bi-cat-7);
  --cat-7: var(--bi-cat-8);
  --cat-8: var(--bi-cat-9);
  --cat-9: var(--bi-cat-10);
  --seq-0: var(--bi-seq-0);
  --seq-1: var(--bi-seq-1);
  --seq-2: var(--bi-seq-2);
  --seq-3: var(--bi-seq-3);
  --seq-4: var(--bi-seq-4);
  --seq-5: var(--bi-seq-5);
  font-variant-numeric: tabular-nums;
}

html[data-theme="dark"] {
  --bi-bg-base: rgb(8 9 10);
  --bi-bg-layer-1: rgb(15 16 17);
  --bi-bg-layer-2: rgb(22 23 24);
  --bi-bg-layer-3: rgb(35 37 42);
  --bi-text-primary: rgb(229 229 230);
  --bi-text-secondary: rgb(172 176 184);
  --bi-text-tertiary: rgb(141 146 154);
  --bi-border-subtle: rgb(35 37 42);
  --bi-border-strong: rgb(63 66 72);
  --bi-color-interactive: rgb(151 187 245);
  --bi-color-on-interactive: rgb(8 9 10);
  --bi-color-success: rgb(66 190 101);
  --bi-color-warning: rgb(241 194 27);
  --bi-color-danger: rgb(250 77 86);
  --bi-seq-0: rgb(216 232 255);
  --bi-seq-1: rgb(80 123 192);
  --bi-seq-2: rgb(191 229 255);
  --bi-seq-3: rgb(50 119 143);
  --bi-seq-4: rgb(170 216 255);
  --bi-seq-5: rgb(89 109 175);
  --bi-map-no-data: rgb(35 37 42);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bi-bg-base: rgb(250 250 250);
  --bi-bg-layer-1: rgb(255 255 255);
  --bi-bg-layer-2: rgb(244 244 244);
  --bi-bg-layer-3: rgb(229 231 235);
  --bi-text-primary: rgb(17 24 39);
  --bi-text-secondary: rgb(75 85 99);
  --bi-text-tertiary: rgb(107 114 128);
  --bi-border-subtle: rgb(229 231 235);
  --bi-border-strong: rgb(209 213 219);
  --bi-color-interactive: rgb(38 71 160);
  --bi-color-on-interactive: rgb(255 255 255);
  --bi-color-success: rgb(25 128 56);
  --bi-color-warning: rgb(138 100 8);
  --bi-color-danger: rgb(186 24 27);
  --bi-seq-0: rgb(14 39 78);
  --bi-seq-1: rgb(94 135 178);
  --bi-seq-2: rgb(9 56 93);
  --bi-seq-3: rgb(82 143 174);
  --bi-seq-4: rgb(20 33 79);
  --bi-seq-5: rgb(108 126 179);
  --bi-map-no-data: rgb(243 244 246);
  color-scheme: light;
}

html[data-theme] {
  --bg: var(--bi-bg-base);
  --surface: var(--bi-bg-layer-1);
  --text: var(--bi-text-primary);
  --text-secondary: var(--bi-text-secondary);
  --text-tertiary: var(--bi-text-tertiary);
  --border: var(--bi-border-subtle);
  --border-strong: var(--bi-border-strong);
  --success: var(--bi-color-success);
  --warning: var(--bi-color-warning);
  --danger: var(--bi-color-danger);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.num, .tabular, td.num, th.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.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;
}

:where(a, button, input, [tabindex]):focus-visible {
  outline: 2px solid var(--bi-color-interactive);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
   Top bar
   ------------------------------------------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--bi-space-4);
  padding: var(--bi-space-3) var(--bi-space-6);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-left { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  flex: 0 0 auto;
}

.brand-text h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 1px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.topbar-right { display: flex; align-items: center; gap: var(--bi-space-4); }

.theme-toggle {
  min-height: 32px;
  padding: var(--bi-space-2) var(--bi-space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); background: var(--bi-bg-layer-2); }
.theme-toggle[aria-pressed="true"] { color: var(--bi-color-interactive); border-color: var(--bi-color-interactive); }

.search-wrap input {
  width: min(340px, 100%);
  padding: var(--bi-space-2) var(--bi-space-3);
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.search-wrap input:focus-visible {
  border-color: var(--bi-color-interactive);
  background: var(--surface);
}
.search-wrap input::placeholder { color: var(--text-tertiary); }

.updated-at { text-align: right; line-height: 1.3; }
.updated-at .label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}
.updated-at .value {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------------------
   Layout
   ------------------------------------------------------------------------- */
.layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--bi-space-4) var(--bi-space-6) var(--bi-space-10);
  display: flex;
  flex-direction: column;
  gap: var(--bi-space-4);
}

.trust-disclosure {
  padding: var(--bi-space-3) var(--bi-space-4);
  border-color: var(--border-strong);
}

.trust-disclosure p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
}

/* ---------------------------------------------------------------------------
   KPI grid
   ------------------------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

#kpi-grid { min-height: 202px; }

.kpi-card {
  background: var(--surface);
  padding: var(--bi-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--bi-space-2);
  min-width: 0;
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  color: var(--text-secondary);
  white-space: normal;
  line-height: 1.35;
  min-height: 28px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.1;
}

.kpi-value .unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-left: 2px;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.kpi-sub.pos { color: var(--success); }
.kpi-sub.warn { color: var(--warning); }

/* ---------------------------------------------------------------------------
   Panels (cards)
   ------------------------------------------------------------------------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--bi-space-3);
  padding: var(--bi-space-3) var(--bi-space-4);
  border-bottom: 1px solid var(--border);
}

.panel-header-tight { padding: 12px 14px; border-bottom: 1px solid var(--border); }

.panel-header h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.panel-header h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.panel-sub {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ---------------------------------------------------------------------------
   Main grid: map + side stack
   ------------------------------------------------------------------------- */
.grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 1fr);
  gap: var(--bi-space-4);
  align-items: start;
}

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

/* ---------------------------------------------------------------------------
   Secondary grid: distribution charts (esfera / instrumento / qualidade)
   ------------------------------------------------------------------------- */
.grid-secondary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 860px) {
  .grid-secondary { grid-template-columns: 1fr; }
}

.panel-map { overflow: hidden; display: flex; flex-direction: column; height: 100%; min-height: 0; }

.legend {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}
.legend-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.legend-swatch {
  width: 14px;
  height: 8px;
  border: 1px solid var(--border);
}
.legend-label {
  font-size: 12px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.map-wrap {
  position: relative;
  background: var(--bg);
  padding: 4px;
  flex: 1 1 auto;
  min-height: 360px;
  display: flex;
}

#map-svg { width: 100%; height: 100%; display: block; }

.mun-path {
  stroke: var(--surface);
  stroke-width: 0.5;
  cursor: pointer;
  transition: opacity 120ms ease;
}
.mun-path:hover, .mun-path:focus-visible { stroke: var(--bi-color-interactive); stroke-width: 1.1; outline: none; }
.mun-path.is-dim { opacity: 0.25; }
.mun-path.is-highlighted { stroke: var(--text); stroke-width: 1.4; }

.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bi-bg-layer-3);
  color: var(--text);
  padding: var(--bi-space-2) var(--bi-space-3);
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.5;
  max-width: 240px;
  z-index: 30;
  transform: translate(-50%, calc(-100% - 10px));
}
.tooltip .t-title { font-weight: 600; margin-bottom: 3px; }
.tooltip .t-row { display: flex; justify-content: space-between; gap: var(--bi-space-3); color: var(--text-secondary); }
.tooltip .t-row b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 500; }

.map-footnote {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}
.dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 3px; }
.dot-neutral { background: var(--bg); border: 1px solid var(--border-strong); }
.dot-zero { background: var(--seq-0); border: 1px solid var(--border); }

/* ---------------------------------------------------------------------------
   Side stack: top list + split donut/bars
   ------------------------------------------------------------------------- */
.panel-stack { display: flex; flex-direction: column; gap: 16px; }

.bar-list { padding: 6px 16px 14px; }
.bar-row {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
}
.bar-row:hover { background: var(--bi-bg-layer-2); }
.bar-row:last-child { border-bottom: none; }
.bar-rank {
  font-size: 12px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}
.bar-track {
  position: relative;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}
.bar-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: var(--cat-0);
  border-radius: 3px;
}
.bar-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bar-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.panel-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.split-col { min-width: 0; }
.split-col:first-child { border-right: 1px solid var(--border); }

.donut-wrap, .hbar-wrap, .quality-wrap { padding: 10px 14px 14px; }

.legend-list { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}
.legend-item .sw { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 auto; }
.legend-item b { color: var(--text); font-weight: 600; margin-left: auto; font-variant-numeric: tabular-nums; }

.hbar-row { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.hbar-row:last-child { margin-bottom: 0; }
.hbar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}
.hbar-label b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.legend-pct { color: var(--text-tertiary); font-weight: 500; }
.hbar-track { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 3px; }

/* ---------------------------------------------------------------------------
   Table
   ------------------------------------------------------------------------- */
.panel-table { display: flex; flex-direction: column; }

.table-scroll { overflow-x: auto; overflow-y: auto; max-height: 600px; }
.table-scroll-hint { display: none; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  padding: var(--pad-cell) 12px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

thead th.num { text-align: right; }

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: var(--bi-space-1);
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.sort-button::after { content: '\2195'; opacity: 0.45; font-size: 12px; }
th.is-sorted-asc .sort-button::after { content: '\2191'; opacity: 1; color: var(--bi-color-interactive); }
th.is-sorted-desc .sort-button::after { content: '\2193'; opacity: 1; color: var(--bi-color-interactive); }

tbody td {
  padding: var(--pad-cell) 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* primeira coluna (nome principal): mais espaco, sem truncar tao agressivo */
#data-table td:first-child,
#authors-table td:first-child {
  max-width: 380px;
  white-space: normal;
  font-weight: 500;
}
#data-table th:first-child { min-width: 260px; }
#authors-table th:first-child { min-width: 220px; }

tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: var(--bg); }
tbody tr.is-highlighted td { background: var(--bi-bg-layer-2); }

td.cell-muted { color: var(--text-tertiary); }
td a { color: var(--bi-color-interactive); text-decoration: none; }
td a:hover { text-decoration: underline; }
.row-link { color: var(--text); font-weight: 600; }

.status-chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  text-transform: none;
}

/* ---------------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------------- */
.footnote {
  padding: 4px 4px 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 980px;
}
.footnote code {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1px 4px;
  border-radius: 3px;
}

/* =============================================================================
   Painel v2 — filtro por tipo, toggle de mapa, badges, influenciadores,
   tabela de autores, pagina de detalhe de instituicao
   ============================================================================= */

/* ---- filtro por tipo (chips) ------------------------------------------- */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--bi-space-2);
  min-height: 96px;
}
.filter-chip {
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--bi-space-2) var(--bi-space-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--bi-space-2);
}
.filter-chip:hover { border-color: var(--border-strong); color: var(--text); }
.filter-chip.active {
  background: var(--bi-color-interactive);
  border-color: var(--bi-color-interactive);
  color: var(--bi-color-on-interactive);
}
.filter-chip .chip-n {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text);
}
.filter-chip.active .chip-n { color: inherit; }

.select-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--bi-space-3);
}
.select-filter-field {
  display: flex;
  flex-direction: column;
  gap: var(--bi-space-1);
  min-width: 0;
}
.select-filter-field label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}
.select-filter-field select {
  width: 100%;
  min-height: 36px;
  padding: var(--bi-space-2) var(--bi-space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.select-filter-field select:focus-visible {
  border-color: var(--bi-color-interactive);
  background: var(--surface);
}

/* ---- map metric toggle -------------------------------------------------- */
.map-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex: 0 0 auto;
}
.map-toggle button {
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  border: none;
  padding: var(--bi-space-2) var(--bi-space-3);
  cursor: pointer;
}
.map-toggle button + button { border-left: 1px solid var(--border); }
.map-toggle button.active { background: var(--bi-color-interactive); color: var(--bi-color-on-interactive); }

.legend-step-inline {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-right: 8px;
  font-variant-numeric: tabular-nums;
}
.legend-step-inline .legend-swatch { width: 9px; height: 9px; border: 1px solid var(--border); }

/* ---- type badges (table) ------------------------------------------------ */
.type-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  white-space: nowrap;
}
.type-apae { border-color: var(--bi-cat-1); color: var(--bi-cat-1); }
.type-nonprofit { border-color: var(--bi-cat-5); color: var(--bi-cat-5); }
.type-community_group { border-color: var(--bi-cat-7); color: var(--bi-cat-7); }
.type-public_municipal { border-color: var(--bi-cat-3); color: var(--bi-cat-3); }
.type-public_state { border-color: var(--bi-cat-2); color: var(--bi-cat-2); }
.type-public_federal { border-color: var(--bi-cat-6); color: var(--bi-cat-6); }

/* ---- influenciadores grid ------------------------------------------------ */
.influencer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
}
.influencer-card {
  background: var(--surface);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  cursor: pointer;
  transition: background 100ms ease;
}
.influencer-card:hover { background: var(--bg); }
.influencer-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.influencer-name { font-size: 13px; font-weight: 600; color: var(--text); }
.influencer-handle { font-size: 12px; color: var(--cat-0); text-decoration: none; }
.influencer-handle:hover { text-decoration: underline; }
.influencer-focus { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin: 0; }

.tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  white-space: nowrap;
}
.tag-named { border-color: var(--success); color: var(--success); }

/* ---- authors table (reusa .panel-table / table base) --------------------- */
.panel-authors .table-scroll { max-height: 480px; }
#authors-table td.cell-wrap { white-space: normal; max-width: 320px; }

/* ---- back link ------------------------------------------------------------ */
.back-link {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
}
.back-link:hover { color: var(--text); }
.back-link .arrow { display: inline-block; transition: transform 140ms cubic-bezier(0.16, 1, 0.3, 1); }
.back-link:hover .arrow { transform: translateX(-3px); }

/* ---- detail page ----------------------------------------------------------- */
.layout-detail { max-width: 1100px; }
.loading-msg { color: var(--text-secondary); font-size: 13px; padding: 40px 0; text-align: center; }

.detail-header { padding: 4px 0 4px; }
.detail-header-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.detail-header h1 { margin: 0 0 8px; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  background: var(--surface);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 860px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-main { display: flex; flex-direction: column; gap: 16px; }
.detail-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 80px; }

.detail-section-body { padding: 14px 16px; }

.kv-list { display: grid; grid-template-columns: 104px 1fr; gap: 8px 10px; margin: 0; font-size: 12.5px; }
.kv-list dt { display: flex; align-items: center; gap: 5px; color: var(--text-tertiary); font-weight: 500; }
.kv-list dt .icon { color: var(--text-tertiary); }
.kv-list dd { margin: 0; color: var(--text); word-break: break-word; }
.kv-list a { color: var(--bi-color-interactive); text-decoration: none; }

.contact-list { display: flex; flex-direction: column; gap: var(--bi-space-3); }
.contact-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--bi-space-3) var(--bi-space-4);
  background: var(--surface);
}
.contact-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--bi-space-2);
  margin-bottom: var(--bi-space-3);
}
.contact-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}
.contact-fields { margin-bottom: var(--bi-space-3); }
.contact-meta { margin-top: var(--bi-space-3); }
.contact-source {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--bi-space-2);
  padding-top: var(--bi-space-2);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}
.contact-source-label {
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.contact-source a { color: var(--bi-color-interactive); text-decoration: none; word-break: break-word; }
.contact-source a:hover { text-decoration: underline; }
.contact-evidence {
  margin: var(--bi-space-2) 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-tertiary);
}

.role-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.role-list b { color: var(--text); }

.profile-block { margin-bottom: 14px; }
.profile-block:last-child { margin-bottom: 0; }
.profile-block h4 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary); font-weight: 600; }
.profile-block p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--text); }

.chip-cloud { display: flex; flex-wrap: wrap; gap: 5px; }

.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.activity-list li { font-size: 13px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.activity-list li:last-child { border-bottom: none; padding-bottom: 0; }
.activity-list b { color: var(--text); margin-right: 6px; }
.activity-list p { margin: 4px 0; color: var(--text-secondary); font-size: 12.5px; }
.activity-list .audience { font-size: 12px; color: var(--text-tertiary); }

.empty-msg { color: var(--text-tertiary); font-size: 12.5px; font-style: normal; margin: 0; }

.detail-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.detail-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary); padding: 8px 12px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
.detail-table th.num { text-align: right; }
.detail-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.detail-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.detail-table td.cell-wrap { white-space: normal; max-width: 420px; min-width: 220px; color: var(--text-secondary); }

.source-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.source-list a { font-size: 12.5px; color: var(--bi-color-interactive); text-decoration: none; word-break: break-word; }
.source-list a:hover { text-decoration: underline; }

/* ---- funding cards (institution detail) --------------------------------- */
.funding-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.funding-card:last-child { margin-bottom: 0; }
.funding-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.funding-card-amount {
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  letter-spacing: -0.01em;
}
.funding-pct {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-left: 8px;
  vertical-align: middle;
}
.funding-card-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.funding-card-desc {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0 0 10px;
}
.funding-kv { grid-template-columns: 130px 1fr; font-size: 12px; }
.funding-kv dd a { color: var(--bi-color-interactive); text-decoration: none; }
.funding-kv dd a:hover { text-decoration: underline; }
.funding-authority-link {
  color: var(--bi-color-interactive);
  text-decoration: none;
  font-weight: 600;
}
.funding-authority-link:hover { text-decoration: underline; }

/* ---- influencer detail page ---------------------------------------------- */
.profile-block-text { font-size: 13px; line-height: 1.6; color: var(--text); margin: 0; }
.evidence-list .evidence-claim {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0 0 5px;
}
.evidence-list li { margin-bottom: 14px; }
.evidence-list li:last-child { margin-bottom: 0; }

/* =============================================================================
   Painel v4 — página de instituição: motion funcional, scrollspy, KPI hero,
   copy-to-clipboard, skeleton de carregamento.
   Princípios (product mode): transform/opacity apenas, sem bounce/spring,
   sem glow/gradiente, respeita prefers-reduced-motion sempre.
   ============================================================================= */

html { scroll-behavior: smooth; }

/* ---- barra de progresso de leitura ---- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 100%;
  background: var(--cat-0);
  transform: scaleX(0);
  transform-origin: 0 0;
  z-index: 40;
  transition: transform 80ms linear;
}

/* ---- entrada por scroll (aditivo — conteúdo já existe no DOM/leitor) ---- */
.reveal {
  opacity: 1;
  transform: none;
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---- status por indicador (sem pill acima do título) ---- */
.status-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.status-dot.st-verified { background: var(--success); }
.status-dot.st-partially_verified { background: var(--warning); }
.status-dot.st-unverified { background: var(--text-tertiary); }

.detail-header h1 { font-size: 25px; }

/* ---- KPI hero (reaproveita .kpi-grid/.kpi-card do painel principal) ---- */
.kpi-hero { margin-top: 14px; }

/* ---- navegação lateral por seção (scrollspy) ---- */
.detail-section-body-nav { padding: 6px 0; }
.section-nav { display: flex; flex-direction: column; }
.section-nav a {
  display: block;
  padding: 7px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 120ms ease, border-color 120ms ease, background-color 120ms ease;
}
.section-nav a:hover { color: var(--text); background: var(--bg); }
.section-nav a.is-active {
  color: var(--text);
  font-weight: 600;
  border-left-color: var(--bi-color-interactive);
  background: var(--bg);
}

/* ---- micro-interação de hover em cards de conteúdo ---- */
.funding-card { transition: border-color 120ms ease; }
.funding-card:hover { border-color: var(--border-strong); }

.funding-bar { margin: 2px 0 10px; }

/* ---- copiar valor de contato ---- */
.kv-list dd { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.kv-value-text { word-break: break-word; }
.copy-btn {
  display: inline-flex;
  align-items: center;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-tertiary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 0;
  flex: 0 0 auto;
  transition: color 120ms ease;
}
.copy-btn:hover { color: var(--bi-color-interactive); }
.copy-btn.is-copied { color: var(--success); }

/* ---- skeleton de carregamento ---- */
.skeleton { display: flex; flex-direction: column; gap: 16px; padding: 6px 0 20px; }
.skel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.skel-grid .skel-card { border: none; border-radius: 0; background-color: var(--surface); }
.skel-block {
  background: var(--bi-bg-layer-2);
  border-radius: var(--radius-sm);
  animation: skel-pulse 1.2s ease-in-out infinite;
}
.skel-title { height: 26px; width: 50%; }
.skel-line { height: 13px; width: 100%; }
.skel-line.short { width: 30%; }
.skel-card { height: 84px; border: 1px solid var(--border); border-radius: var(--radius); }
@keyframes skel-pulse {
  50% { opacity: 0.55; }
}

/* =============================================================================
   Painel v5 — arquitetura de navegação (Visão geral / Instituições /
   Influenciadores), sistema de ícones, avatares por tipo, breadcrumbs,
   cards de influenciador ricos, teasers da página inicial.
   ============================================================================= */

/* ---- icone utilitario (svg inline via icons.js) ---- */
.icon { width: 15px; height: 15px; display: inline-block; vertical-align: -3px; flex: 0 0 auto; }
.icon-sm { width: 13px; height: 13px; vertical-align: -2px; }
.icon-lg { width: 20px; height: 20px; vertical-align: -5px; }
.icon-xl { width: 26px; height: 26px; vertical-align: -6px; }

/* ---- navegação principal (abas persistentes entre páginas) ---- */
.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.main-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 2px;
  margin-right: 24px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 120ms ease, border-color 120ms ease;
  white-space: nowrap;
}
.main-nav a:hover { color: var(--text); }
.main-nav a .icon { opacity: 0.7; transition: opacity 120ms ease, color 120ms ease; }
.main-nav a:hover .icon { opacity: 1; }
.main-nav a.is-active { color: var(--text); font-weight: 600; border-bottom-color: var(--bi-color-interactive); }
.main-nav a.is-active .icon { opacity: 1; color: var(--bi-color-interactive); }

/* ---- avatar / marca colorida por tipo (reaproveita .brand-mark) ---- */
.avatar-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.avatar-mark.sz-lg { width: 56px; height: 56px; font-size: 19px; border-radius: var(--radius); }
.avatar-mark.sz-md { width: 40px; height: 40px; font-size: 14.5px; border-radius: var(--radius); }
.avatar-mark.sz-sm { width: 30px; height: 30px; font-size: 12px; border-radius: var(--radius); }

.avatar-mark.tone-apae { background: color-mix(in srgb, var(--bi-cat-1) 14%, var(--surface)); border-color: var(--bi-cat-1); color: var(--bi-cat-1); }
.avatar-mark.tone-nonprofit { background: color-mix(in srgb, var(--bi-cat-5) 14%, var(--surface)); border-color: var(--bi-cat-5); color: var(--bi-cat-5); }
.avatar-mark.tone-community_group { background: color-mix(in srgb, var(--bi-cat-7) 14%, var(--surface)); border-color: var(--bi-cat-7); color: var(--bi-cat-7); }
.avatar-mark.tone-public_municipal { background: color-mix(in srgb, var(--bi-cat-3) 14%, var(--surface)); border-color: var(--bi-cat-3); color: var(--bi-cat-3); }
.avatar-mark.tone-public_state { background: color-mix(in srgb, var(--bi-cat-2) 14%, var(--surface)); border-color: var(--bi-cat-2); color: var(--bi-cat-2); }
.avatar-mark.tone-public_federal { background: color-mix(in srgb, var(--bi-cat-6) 14%, var(--surface)); border-color: var(--bi-cat-6); color: var(--bi-cat-6); }
.avatar-mark.tone-influencer { background: color-mix(in srgb, var(--bi-cat-8) 14%, var(--surface)); border-color: var(--bi-cat-8); color: var(--bi-cat-8); }

.detail-header-id { display: flex; align-items: flex-start; gap: 14px; }
.detail-header-id-text { min-width: 0; flex: 1 1 auto; }

/* ---- breadcrumb ---- */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb a:hover { color: var(--bi-color-interactive); }
.breadcrumb .icon { width: 12px; height: 12px; opacity: 0.45; margin: 0 1px; }
.breadcrumb .crumb-current { color: var(--text); font-weight: 500; }

/* ---- página-listagem: hero + stat strip ---- */
.page-hero { padding: 4px 0 2px; }
.page-hero h1 { margin: 0 0 6px; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.page-hero p { margin: 0; font-size: 13px; color: var(--text-secondary); max-width: 640px; line-height: 1.55; }

/* ---- toggle de visualização (reaproveita .map-toggle) ---- */
.view-toggle { display: flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; flex: 0 0 auto; }
.view-toggle button {
  display: inline-flex; align-items: center; gap: 5px;
  font: inherit; font-size: 12px; font-weight: 500;
  color: var(--text-secondary); background: var(--surface); border: none;
  padding: 6px 11px; cursor: pointer;
}
.view-toggle button + button { border-left: 1px solid var(--border); }
.view-toggle button.active { background: var(--bi-color-interactive); color: var(--bi-color-on-interactive); }
.view-toggle button.active .icon { color: var(--bi-color-on-interactive); }

/* ---- toolbar de filtros (busca + chips + toggle, mesma linha) ---- */
.panel-header-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.list-toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-sub-inline { font-size: 12px; color: var(--text-secondary); }
.list-toolbar .search-wrap { position: relative; }
.list-toolbar .search-wrap .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); }
.list-toolbar .search-wrap input { padding-left: 30px; width: 340px; }

/* ---- grid de instituições (view=grid) ---- */
.institution-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.institution-card {
  background: var(--surface); padding: 14px 16px; display: flex; gap: 12px;
  text-decoration: none; transition: background 100ms ease;
}
.institution-card:hover { background: var(--bg); }
.institution-card-body { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.institution-card-name { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.35; min-height: 35px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.institution-card-meta { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.institution-card-fund { font-size: 12px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; margin-top: auto; }

/* ---- cards de influenciador (grid dedicado, mais ricos) ---- */
.influencer-grid-v2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: var(--bi-space-4); padding: var(--bi-space-4); }
.influencer-card-v2 {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 10px; text-decoration: none;
  transition: border-color 120ms ease, background-color 120ms ease;
}
.influencer-card-v2:hover { border-color: var(--border-strong); background: var(--bi-bg-layer-2); }
.influencer-card-v2-top { display: flex; align-items: center; gap: 10px; }
.influencer-card-v2-id { min-width: 0; }
.influencer-card-v2-name { font-size: 13.5px; font-weight: 600; color: var(--text); line-height: 1.3; }
.influencer-card-v2-handle { font-size: 12px; color: var(--text-secondary); }
.influencer-card-v2-focus {
  font-size: 12px; color: var(--text-secondary); line-height: 1.55; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.social-metric {
  display: flex;
  flex-direction: column;
  gap: var(--bi-space-1);
  padding-left: var(--bi-space-3);
  border-left: 2px solid var(--bi-color-interactive);
}
.detail-header .social-metric { margin-top: var(--bi-space-3); }
.social-metric-value {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.social-metric-meta { color: var(--text-secondary); font-size: 12px; line-height: 1.45; }
.social-metric-meta a { color: var(--bi-color-interactive); text-decoration: none; }
.social-metric-meta a:hover { text-decoration: underline; }
.influencer-card-v2-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }

.platform-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600;
  padding: var(--bi-space-1) var(--bi-space-2); border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  white-space: nowrap;
}
.platform-instagram { color: var(--bi-cat-6); border-color: var(--bi-cat-6); background: color-mix(in srgb, var(--bi-cat-6) 12%, var(--surface)); }
.platform-youtube { color: var(--bi-cat-3); border-color: var(--bi-cat-3); background: color-mix(in srgb, var(--bi-cat-3) 12%, var(--surface)); }
.platform-tiktok { color: var(--text); border-color: var(--border-strong); background: var(--bi-bg-layer-2); }
.platform-twitter { color: var(--text); border-color: var(--border-strong); background: var(--bi-bg-layer-2); }
.platform-facebook { color: var(--bi-cat-1); border-color: var(--bi-cat-1); background: color-mix(in srgb, var(--bi-cat-1) 12%, var(--surface)); }
.platform-blog { color: var(--bi-cat-5); border-color: var(--bi-cat-5); background: color-mix(in srgb, var(--bi-cat-5) 12%, var(--surface)); }
.platform-podcast { color: var(--bi-cat-2); border-color: var(--bi-cat-2); background: color-mix(in srgb, var(--bi-cat-2) 12%, var(--surface)); }
.platform-other { color: var(--text-secondary); border-color: var(--border-strong); background: var(--bi-bg-layer-2); }

.reach-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; color: var(--text-secondary);
}

/* ---- teasers (index -> paginas dedicadas) ---- */
.teaser-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .teaser-row { grid-template-columns: 1fr; } }
.teaser-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; text-decoration: none; display: flex; flex-direction: column; gap: 10px;
  transition: border-color 120ms ease, background-color 120ms ease;
}
.teaser-card:hover { border-color: var(--border-strong); background: var(--bi-bg-layer-2); }
.teaser-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.teaser-card h2 { margin: 0; font-size: 14.5px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.teaser-card h2 .icon { color: var(--text-secondary); }
.teaser-card p { margin: 0; font-size: 12.5px; color: var(--text-secondary); line-height: 1.55; }
.teaser-card-stat { font-size: 25px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.teaser-card-stat .unit { font-size: 12.5px; font-weight: 500; color: var(--text-secondary); margin-left: 4px; }
.teaser-arrow { color: var(--text-tertiary); transition: transform 140ms cubic-bezier(0.16, 1, 0.3, 1), color 140ms ease; }
.teaser-card:hover .teaser-arrow { transform: translateX(3px); color: var(--bi-color-interactive); }

/* ---- secao-icone (titulos de painel com icone) ---- */
.panel-header h2 .icon, .page-hero h1 .icon { color: var(--text-tertiary); margin-right: 2px; }

/* ---- botao de link com icone (perfil social / website em destaque) ---- */
.link-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 7px 12px; text-decoration: none; transition: border-color 120ms ease, background-color 120ms ease;
}
.link-btn:hover { background: var(--bg); border-color: var(--text-tertiary); }
.link-btn .icon { color: inherit; }
.link-btn-lg { margin-top: 14px; padding: 9px 16px; font-size: 13px; }

/* ---- panel-header com icone: alinhar h2 (flex + gap) ---- */
.panel-header h2, .page-hero h1 { display: flex; align-items: center; gap: 8px; }
.section-nav a { display: flex; align-items: center; gap: 7px; }
.status-line .icon { color: inherit; }
.detail-side .kv-list { grid-template-columns: 1fr; }

@media (max-width: 760px) {
  #kpi-grid { min-height: 778px; }
  .filter-row { min-height: 200px; }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: var(--bi-space-2);
    padding: var(--bi-space-3) var(--bi-space-4);
  }
  .topbar-left, .topbar-right, .brand-text, .search-wrap, .list-toolbar-left { min-width: 0; width: 100%; }
  .topbar-right { flex-wrap: wrap; gap: var(--bi-space-2); }
  .search-wrap { flex: 1 1 100%; }
  .search-wrap input, .list-toolbar .search-wrap input { width: 100%; max-width: 100%; }
  .search-wrap input, .theme-toggle, .filter-chip, .select-filter-field select, .map-toggle button, .view-toggle button, .main-nav a { min-height: 44px; }
  .sort-button, .copy-btn, .section-nav a, .back-link, .link-btn { min-height: 44px; }
  .copy-btn, .back-link, .link-btn { display: inline-flex; align-items: center; }
  .copy-btn { padding-inline: var(--bi-space-2); }
  .table-scroll-hint {
    display: block;
    margin: 0;
    padding: var(--bi-space-2) var(--bi-space-3);
    background: var(--bi-bg-layer-2);
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
  }
  .updated-at { margin-left: auto; }
  .main-nav { padding: 0 var(--bi-space-4); }
  .main-nav a { margin-right: var(--bi-space-4); }
  .layout { padding: var(--bi-space-4) var(--bi-space-4) var(--bi-space-8); }
  .panel-header, .list-toolbar { align-items: stretch; flex-direction: column; }
  .select-filter-grid { grid-template-columns: 1fr; }
  .map-toggle, .view-toggle { width: 100%; }
  .map-toggle button, .view-toggle button { flex: 1 1 0; justify-content: center; }
  .map-wrap { min-height: 280px; }
  .detail-header-id { flex-wrap: wrap; }
  .detail-side { position: static; }
  .kv-list, .funding-kv { grid-template-columns: 1fr; }
  .kv-list dd { margin-bottom: var(--bi-space-2); }
  .influencer-card-v2-footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 360px) {
  .main-nav {
    overflow-x: visible;
    padding: 0 var(--bi-space-2);
  }
  .main-nav a {
    flex: 1 1 0;
    justify-content: center;
    min-width: 0;
    margin-right: 0;
    padding-inline: var(--bi-space-1);
    font-size: 12px;
  }
  .main-nav a .icon { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .scroll-progress, .back-link .arrow, .teaser-arrow { transition: none; }
  .skel-block { animation: none; }
}
