/* ============================================================
   Observatório Brasileiro de Crédito — Design System v0.19
   "Pesquisa econômica com precisão editorial."
   Tokens → shell → tipografia → superfícies → gráficos → tabelas
   ============================================================ */

/* ---------- 0. Fontes (identidade Scrutiniums — variáveis, subsets latin/latin-ext) ---------- */
@font-face {
  font-family: "Playfair Display";
  src: url("fonts/playfair-display-ext.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1EFF, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Playfair Display";
  src: url("fonts/playfair-display.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/inter-ext.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1EFF, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/inter.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo Narrow";
  src: url("fonts/archivo-narrow-ext.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1EFF, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Archivo Narrow";
  src: url("fonts/archivo-narrow.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- 1. Tokens ---------- */
:root {
  
  /* ---- escala tipográfica ----
     Dez degraus, todos usados. Antes existiam 36 tamanhos, com valores como 9,4px,
     10,3px, 11,2px e 12,6px que não vinham de nenhuma regra — apenas de ajustes
     pontuais acumulados. O piso subiu para 10,5px: abaixo disso o texto deixa de ser
     legível em tela de notebook, e nada nesta plataforma é acessório o bastante para
     merecer corpo menor. */
  --fs-2xs: 10.5px;   /* selo, rótulo em caixa alta */
  --fs-xs: 12px;      /* legenda, nota de rodapé de gráfico */
  --fs-sm: 13px;      /* texto auxiliar, fonte, célula de tabela densa */
  --fs-base: 14px;    /* corpo de leitura */
  --fs-md: 15px;      /* título de cartão, corpo destacado */
  --fs-lg: 17px;      /* título de seção */
  --fs-xl: 20px;      /* indicador secundário */
  --fs-2xl: 24px;     /* indicador */
  --fs-3xl: 30px;     /* indicador principal */
  --fs-4xl: 34px;     /* título de página */
  --fs-5xl: 42px;     /* abertura */

  /* ---- pesos: cinco degraus no lugar de vinte e dois ---- */
  --fw-light: 350;
  --fw-normal: 420;
  --fw-medium: 500;
  --fw-semibold: 570;
  --fw-bold: 650;

  /* ---- entrelinha ---- */
  --lh-tight: 1.12;    /* números grandes e títulos */
  --lh-snug: 1.35;     /* títulos de seção, rótulos */
  --lh-normal: 1.55;   /* corpo */
  --lh-relaxed: 1.7;   /* nota metodológica, texto auxiliar longo */

  /* ---- tracking ---- */
  --tr-tight: -0.018em;   /* títulos e números grandes */
  --tr-normal: -0.008em;  /* corpo */
  --tr-wide: 0.03em;
  --tr-caps: 0.06em;      /* caixa alta */

  /* ---- espaçamento: grade de 4px ----
     Antes havia 124 combinações de padding e margin, 106 delas fora de qualquer
     múltiplo. A grade elimina o desalinhamento de meio pixel entre componentes
     vizinhos, que era a causa da sensação de "quase alinhado". */
  --sp-0: 0;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* Os raios NÃO entram aqui. O projeto já decidiu, antes deste sistema, por cantos
     praticamente retos — a declaração original está mais abaixo, junto da geometria, com
     o comentário "sombras viram linha". É uma escolha editorial correta: canto reto lê
     como impresso institucional, canto arredondado lê como produto de consumo. Mantida. */

  /* cor — modo claro (marfim/carvão/bronze Scrutiniums) */
  --bg: #f3efe5;
  --surface: #faf8f2;
  --surface-2: #efeadd;
  --surface-3: #e7e1d1;
  --text: #1a1d21;
  --text-2: #3d4147;
  --text-3: #636562;   /* AA: 4,63 sobre --accent-soft, 4,90 sobre --surface-2 */
  --border: #d8d2c6;
  --border-2: #c8c0b0;
  --accent: #8f6644;   /* AA: 4,76 sobre --surface (era 4,40 em .guiamais) */
  --accent-soft: #ede3d3;
  --accent-ink: #7c5638;
  --positive: #177245;
  --positive-soft: #e3efe4;
  --negative: #b32626;
  --negative-soft: #f6e6e0;
  --warning: #925d0b;  /* AA: 4,63 sobre --warning-soft (era 3,91 nos selos) */
  --warning-soft: #f4ead3;
  --forecast: #6d51a8;
  --forecast-soft: #ece5f2;
  --teal: #0e707f;     /* AA: 4,60 sobre a própria tinta 12% (era 3,94) */
  --unavail: #6e6f69;  /* AA: 4,61 sobre --surface (era 3,16 em .lvl) */

  /* gráficos */
  --c-line1: #1a1d21;
  --c-line2: #0e707f;
  --c-line3: #925d0b;
  --c-forecast: #6d51a8;
  --c-pos: #177245;
  --c-neg: #b32626;
  --c-gray: #6e6f69;
  --c-grid: #e9e3d4;
  --c-axis: #8a867a65;
  --c-axis-text: #7c7970;
  --c-band: rgba(26, 29, 33, 0.10);
  --c-halo: rgba(250, 248, 242, 0.85);

  /* tipografia */
  --serif: "Playfair Display", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --label: "Archivo Narrow", "Arial Narrow", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* geometria — cantos praticamente retos, sombras viram linha */
  --r-xs: 2px;
  --r-sm: 2px;
  --r-md: 3px;
  --r-lg: 3px;
  --r-full: 999px;   /* só para pílulas: selo, chip, indicador de faixa */
  --radius: 3px;
  --sh-subtle: none;
  --sh-elevated: 0 2px 10px rgba(26, 29, 33, 0.07);
  --sh-overlay: 0 4px 18px rgba(26, 29, 33, 0.12);
  --sidebar-w: 236px;

  /* movimento */
  --t-fast: 140ms;
  --t-normal: 210ms;
  --t-slow: 300ms;
  --ease: cubic-bezier(0.3, 0.7, 0.3, 1);
}

[data-theme="dark"] {
  --bg: #14171a;
  --surface: #1e2226;
  --surface-2: #262b30;
  --surface-3: #2f353b;
  --text: #ece7db;
  --text-2: #c0bbad;
  --text-3: #979382;  /* AA: 4,63 sobre --surface-2 escuro (era 4,45) */
  --border: #32373c;
  --border-2: #454a50;
  --accent: #b08a67;
  --accent-soft: #33291f;
  --accent-ink: #cbaa88;
  --positive: #56b384;
  --positive-soft: #1d3229;
  --negative: #d98080;
  --negative-soft: #3a2426;
  --warning: #d3a55a;
  --warning-soft: #392f1c;
  --forecast: #a893d4;
  --forecast-soft: #2e2740;
  --teal: #5cb3c2;
  --unavail: #969387;  /* AA: 4,64 sobre --surface escuro (era 3,97) */
  --c-line1: #ece7db;
  --c-line2: #5cb3c2;
  --c-line3: #d3a55a;
  --c-forecast: #a893d4;
  --c-pos: #56b384;
  --c-neg: #d98080;
  --c-gray: #969387;
  --c-grid: #23282c;
  --c-axis: #3c4147;
  --c-axis-text: #9a958a;
  --c-band: rgba(236, 231, 219, 0.13);
  --c-halo: rgba(20, 23, 26, 0.85);
  --sh-subtle: none;
  --sh-elevated: 0 2px 10px rgba(0, 0, 0, 0.35);
  --sh-overlay: 0 4px 18px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* ---------- 2. Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent-ink); text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--accent); }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs); }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 200; background: var(--surface); color: var(--accent-ink); padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--border-2); box-shadow: var(--sh-elevated); }
.skip:focus { left: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- 3. Shell: sidebar + conteúdo ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 12px 14px;
  z-index: 60;
}
.brand { display: flex; gap: 9px; align-items: flex-start; padding: 2px 10px 18px; }
.brand .mark { color: var(--accent); font-size: var(--fs-lg); line-height: var(--lh-normal); }
.brandtext { display: flex; flex-direction: column; gap: 3px; }
#brandName { font-size: var(--fs-md); font-weight: var(--fw-bold); letter-spacing: var(--tr-normal); line-height: var(--lh-snug); }
.tagline { color: var(--text-3); font-size: var(--fs-2xs); letter-spacing: var(--tr-wide); }

nav.tabs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; padding: 4px 0; }
.navgroup { display: flex; flex-direction: column; gap: 1px; }
.navlabel {
  font-size: var(--fs-2xs); font-weight: var(--fw-bold); letter-spacing: var(--tr-caps); text-transform: uppercase;
  color: var(--text-3); padding: 0 10px 6px;
}
nav.tabs button {
  display: flex; align-items: center; gap: 8px;
  background: transparent; border: none; text-align: left; width: 100%;
  color: var(--text-2); padding: 7px 10px; font-size: var(--fs-base); font-weight: var(--fw-medium);
  font-family: var(--sans); cursor: pointer; border-radius: var(--r-sm);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
nav.tabs button:hover { background: var(--surface-2); color: var(--text); }
nav.tabs button.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: var(--fw-semibold); }
.navbadge {
  margin-left: auto; background: var(--negative); color: #fff;
  font-size: var(--fs-2xs); font-weight: var(--fw-bold); min-width: 17px; height: 17px; border-radius: var(--r-xs);
  display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
}
.sidefoot {
  border-top: 1px solid var(--border); padding: 12px 10px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.updated { color: var(--text-3); font-size: var(--fs-2xs); line-height: var(--lh-snug); }
#themeToggle {
  background: transparent; border: 1px solid var(--border-2); color: var(--text-2);
  width: 30px; height: 30px; border-radius: var(--r-xs); cursor: pointer; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--t-fast) var(--ease);
}
#themeToggle:hover { background: var(--surface-2); color: var(--text); }
#themeToggle .ic-sun { display: none; }
[data-theme="dark"] #themeToggle .ic-sun { display: block; }
[data-theme="dark"] #themeToggle .ic-moon { display: none; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-x: clip; }
main { width: 100%; max-width: 1720px; margin: 0 auto; padding: 30px 44px 80px; flex: 1; }
footer {
  border-top: 1px solid var(--border); color: var(--text-3); font-size: var(--fs-xs);
  padding: 18px 44px 28px; line-height: var(--lh-normal); max-width: 1720px; margin: 0 auto; width: 100%;
}
@media (min-width: 1700px) { body { font-size: var(--fs-lg); } }

/* barra móvel */
.mobilebar { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(20, 23, 28, 0.45); z-index: 55; }
@media (max-width: 960px) {
  .mobilebar {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 50; width: 100%;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border); padding: 10px 16px;
  }
  .mobilebar button { background: transparent; border: none; color: var(--text); padding: 6px; cursor: pointer; border-radius: var(--r-xs); display: inline-flex; }
  .mobilebrand { font-size: var(--fs-base); font-weight: var(--fw-bold); letter-spacing: var(--tr-normal); }
  .shell { display: block; }
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100dvh; transform: translateX(-104%);
    transition: transform var(--t-normal) var(--ease); box-shadow: var(--sh-overlay);
  }
  .sidebar.open { transform: translateX(0); }
  main { padding: 18px 16px 56px; }
  footer { padding: 16px 16px 24px; }
}

section.view { display: none; }
section.view.active { display: block; animation: viewin var(--t-normal) var(--ease); }
@keyframes viewin { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ---------- 4. Tipografia ---------- */
/* títulos e frases editoriais em serifa; rótulos em caixa alta em condensada */
h2, h3, h4, #brandName, .mobilebrand,
.diag-frase, .diagcard .frase, .pan-sintese { font-family: var(--serif); }
.navlabel, h5, .seal, .qbadge, .navbadge, table.data th,
.alert .lvl, .tempchip, .hcell.hgroup { font-family: var(--label); }
h2 {
  font-size: var(--fs-4xl); font-weight: var(--fw-bold); letter-spacing: var(--tr-tight); line-height: var(--lh-tight);
  margin: 6px 0 6px;
}
h3 { font-size: var(--fs-xl); font-weight: var(--fw-bold); letter-spacing: var(--tr-normal); margin: 34px 0 8px; }
h4 { letter-spacing: var(--tr-normal); }
h5 {
  margin: 12px 0 6px; font-size: var(--fs-xs); font-weight: var(--fw-bold); text-transform: uppercase;
  letter-spacing: var(--tr-caps); color: var(--text-2);
}
p.viewdesc { color: var(--text-2); margin: 0 0 20px; max-width: 860px; font-size: var(--fs-md); overflow-wrap: anywhere; }

/* ---------- 5. Grids e superfícies ---------- */
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(225px, 1fr)); }
@media (max-width: 640px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 18px 20px; position: relative; box-shadow: var(--sh-subtle);
}
.card h4 { margin: 0 0 4px; font-size: var(--fs-base); font-weight: var(--fw-semibold); color: var(--text-2); }
.card .big {
  font-size: var(--fs-3xl); font-weight: var(--fw-bold); letter-spacing: var(--tr-tight); line-height: var(--lh-tight);
  margin: 4px 0 2px; color: var(--text);
}
.card .delta { font-size: var(--fs-sm); }
.card.kpi h4 { font-size: var(--fs-sm); }
.kpirow { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 14px; }

.up { color: var(--negative); }
.down { color: var(--positive); }
.neutral { color: var(--text-2); }
.up.good { color: var(--positive); }
.down.bad { color: var(--negative); }

/* ---------- 6. Selos epistemológicos e qualidade ---------- */
.seal {
  display: inline-block; font-size: var(--fs-2xs); font-weight: var(--fw-bold); letter-spacing: var(--tr-caps);
  padding: 2.5px 7px; border-radius: var(--r-xs); vertical-align: 1px; text-transform: uppercase;
}
.seal.obs { background: var(--positive-soft); color: var(--positive); }
.seal.calc { background: color-mix(in srgb, var(--teal) 12%, var(--surface)); color: var(--teal); }
.seal.est { background: var(--warning-soft); color: var(--warning); }
.seal.prev { background: var(--accent-soft); color: var(--accent-ink); }
.seal.cen { background: var(--forecast-soft); color: var(--forecast); }
.seal.exp { background: var(--forecast-soft); color: var(--forecast); border: 1px dashed color-mix(in srgb, var(--forecast) 45%, transparent); }
.seal.demo { background: var(--warning-soft); color: var(--warning); border: 1px dashed color-mix(in srgb, var(--warning) 55%, transparent); }
.seal.aprox { background: var(--surface-2); color: var(--text-2); }
.seal.desc { background: var(--surface-2); color: var(--text-3); text-decoration: line-through; }
.seal.ctx { background: var(--surface-2); color: var(--text-3); }

.src { color: var(--text-3); font-size: var(--fs-xs); margin-top: 8px; line-height: var(--lh-normal); }
.src b { color: var(--text-2); font-weight: var(--fw-semibold); }
.qbadge { display: inline-block; font-size: var(--fs-2xs); padding: 1.5px 7px; border-radius: var(--r-xs); font-weight: var(--fw-bold); }
.q-high { background: var(--positive-soft); color: var(--positive); }
.q-mid { background: var(--warning-soft); color: var(--warning); }
.q-low { background: var(--negative-soft); color: var(--negative); }

/* ---------- 7. Controles ---------- */
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 14px 0 20px; }
.controls label { font-size: var(--fs-sm); color: var(--text-2); }
.controls .seg, .seg {
  display: inline-flex; border: 1px solid var(--border-2); border-radius: var(--r-xs);
  overflow: hidden; background: var(--surface); box-shadow: var(--sh-subtle);
}
.seg button {
  border: none; background: transparent; padding: 6px 14px; cursor: pointer;
  font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-2); font-family: var(--sans);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { color: var(--text); background: var(--surface-2); }
.seg button.active { background: var(--accent); color: #fff; }
[data-theme="dark"] .seg button.active { color: #10141a; }

button.btn, a.btn {
  background: var(--accent); color: #fff; border: none; border-radius: var(--r-xs);
  padding: 7px 15px; font-size: var(--fs-sm); font-weight: var(--fw-semibold); font-family: var(--sans);
  cursor: pointer; transition: background var(--t-fast) var(--ease);
}
[data-theme="dark"] button.btn, [data-theme="dark"] a.btn { color: #10141a; }
button.btn:hover, a.btn:hover { background: var(--accent-ink); }
[data-theme="dark"] button.btn:hover, [data-theme="dark"] a.btn:hover { background: var(--accent-ink); color: #10141a; }
button.btn.ghost, a.btn.ghost { background: transparent; color: var(--accent-ink); border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); }
button.btn.ghost:hover, a.btn.ghost:hover { background: var(--accent-soft); color: var(--accent-ink); }
button.btn.small, a.btn.small { padding: 3.5px 10px; font-size: var(--fs-xs); border-radius: var(--r-xs); }
/* âncoras que fazem papel de botão (RSS, relatório, navegação interna do Open
   Finance) herdavam nada: o seletor exigia <button>. Ficavam como link solto no
   meio de uma fila de botões. */
a.btn { display: inline-block; text-decoration: none; line-height: normal; }

select, input[type="text"], input[type="search"], textarea {
  border: 1px solid var(--border-2); border-radius: var(--r-xs); padding: 6px 10px;
  background: var(--surface); font-size: var(--fs-sm); color: var(--text);
  font-family: var(--sans); max-width: 340px;
}
select:hover { border-color: var(--text-3); }
textarea { max-width: 100%; width: 100%; min-height: 130px; resize: vertical; line-height: var(--lh-normal); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--accent-soft); color: var(--accent-ink);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: var(--r-full); padding: 3px 12px; font-size: var(--fs-xs); font-weight: var(--fw-semibold);
}

.star { background: none; border: none; cursor: pointer; font-size: var(--fs-md); color: var(--border-2); padding: 0 2px; }
.star.on { color: var(--warning); }

/* ---------- 8. Gráficos ---------- */
svg.chart { width: 100%; height: auto; display: block; touch-action: pan-y; }
svg.chart[data-ix] { cursor: crosshair; }
svg.chart:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: var(--r-xs); }
svg.chart .xhair { opacity: 0; transition: opacity var(--t-fast) var(--ease); }
svg.chart.hovering .xhair { opacity: 1; }
svg.chart .serie { transition: opacity var(--t-fast) var(--ease); }
svg.chart.hovering .serie.dim { opacity: 0.28; }
.axis text { font-size: var(--fs-2xs); fill: var(--c-axis-text); }
.axis line, .axis path { stroke: var(--border); }

.legend { display: flex; gap: 14px; font-size: var(--fs-xs); color: var(--text-2); flex-wrap: wrap; margin: 6px 0; }
.legend .sw { display: inline-block; width: 14px; height: 3px; border-radius: var(--r-xs); vertical-align: middle; margin-right: 5px; }

.chartfoot {
  border-top: 1px solid var(--border); margin-top: 10px; padding-top: 7px;
  font-size: var(--fs-2xs); color: var(--text-3); line-height: var(--lh-normal);
}

/* tooltip premium */
.tooltip {
  position: fixed; pointer-events: none; z-index: 120;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  color: var(--text); font-size: var(--fs-xs); line-height: var(--lh-normal);
  padding: 9px 12px; border-radius: var(--r-xs); max-width: 300px; display: none;
  border: 1px solid var(--border-2); box-shadow: var(--sh-elevated);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.tooltip .tt-date { font-weight: var(--fw-bold); font-size: var(--fs-xs); letter-spacing: var(--tr-wide); margin-bottom: 4px; color: var(--text); }
.tooltip .tt-row { display: flex; align-items: baseline; gap: 8px; justify-content: space-between; }
.tooltip .tt-row .sw { display: inline-block; width: 9px; height: 3px; border-radius: var(--r-xs); vertical-align: middle; margin-right: 4px; }
.tooltip .tt-lbl { color: var(--text-2); }
.tooltip .tt-val { font-weight: var(--fw-bold); white-space: nowrap; }
.tooltip .tt-delta { font-size: var(--fs-2xs); }
.tooltip .tt-meta { border-top: 1px solid var(--border); margin-top: 5px; padding-top: 4px; font-size: var(--fs-2xs); color: var(--text-3); }

/* ---------- 9. Tabelas ---------- */
.tblwrap { overflow: auto; max-height: min(74vh, 680px); border-radius: var(--r-sm); }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); background: var(--surface); }
table.data th {
  text-align: left; padding: 9px 11px; font-size: var(--fs-2xs); text-transform: uppercase;
  letter-spacing: var(--tr-caps); font-weight: var(--fw-bold); color: var(--text-2); cursor: pointer;
  white-space: nowrap; border-bottom: 1px solid var(--border-2);
  position: sticky; top: 0; background: var(--surface); z-index: 2;
}
table.data td { padding: 8px 11px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--surface-2); }
table.data.compact th, table.data.compact td { padding: 4px 8px; }
table.data.compact th { position: static; }

.scorebar {
  display: inline-block; height: 7px; border-radius: var(--r-xs); width: 90px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--positive) 32%, var(--surface-3)),
    color-mix(in srgb, var(--warning) 30%, var(--surface-3)),
    color-mix(in srgb, var(--negative) 34%, var(--surface-3)));
  position: relative; vertical-align: middle;
}
.scorebar i { position: absolute; top: -3.5px; width: 3px; height: 14px; background: var(--text); border-radius: var(--r-xs); }

/* ---------- 10. Alertas, notas, estados ---------- */
.alert {
  border-left: 3px solid var(--unavail); background: var(--surface);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  border-top: 1px solid var(--border); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 12px 16px; margin-bottom: 10px; box-shadow: var(--sh-subtle);
}
.alert.critico { border-left-color: var(--negative); }
.alert.relevante { border-left-color: #c2540a; }
.alert.atencao { border-left-color: var(--warning); }
.alert .lvl { font-size: var(--fs-2xs); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: var(--tr-caps); }
.alert.critico .lvl { color: var(--negative); }
.alert.relevante .lvl { color: #c2540a; }
.alert.atencao .lvl { color: var(--warning); }
.alert.informativo .lvl { color: var(--unavail); }
.alert .expl { color: var(--text-2); font-size: var(--fs-sm); margin-top: 4px; }

.note {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 11px 15px; font-size: var(--fs-sm); color: var(--text-2); margin: 14px 0;
}
.note.warn { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }

.shortcut {
  padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r-sm);
  margin-bottom: 8px; background: var(--surface);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.shortcut:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }

.clickable { cursor: pointer; }
.clickable:hover { outline: 2px solid color-mix(in srgb, var(--accent) 28%, transparent); outline-offset: -2px; border-radius: var(--r-sm); }

details.decomp { margin-top: 8px; }
details.decomp summary { cursor: pointer; font-size: var(--fs-sm); color: var(--accent-ink); font-weight: var(--fw-medium); }
details.decomp summary:hover { text-decoration: underline; }

.contrib { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); margin: 4px 0; }
.contrib .lbl { width: 190px; color: var(--text-2); }
.contrib .bar { height: 8px; border-radius: var(--r-xs); }
.contrib .bar.pos { background: var(--teal); }
.contrib .bar.neg { background: color-mix(in srgb, var(--negative) 68%, var(--surface)); }
.contrib .num { font-size: var(--fs-xs); font-weight: var(--fw-semibold); }

.sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.sliders .sl { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 15px; }
.sliders label { display: flex; justify-content: space-between; font-size: var(--fs-sm); color: var(--text-2); }
.sliders input[type="range"] { width: 100%; accent-color: var(--accent); }
.sliders .val { font-weight: var(--fw-bold); color: var(--text); }

.chain { border-left: 3px solid var(--forecast); padding-left: 16px; margin: 10px 0 16px; }
.chainstep { padding: 4px 0; font-size: var(--fs-base); color: var(--text-2); }

/* ---------- 11. Diagnóstico editorial (primeira dobra) ---------- */
.diag {
  background: transparent; border: none; border-bottom: 1px solid var(--border);
  border-radius: 0; padding: 10px 0 22px; margin: 10px 0 26px; color: var(--text);
}
.diag-frase {
  font-size: clamp(19px, 2.6vw, 26px); font-weight: var(--fw-semibold); letter-spacing: var(--tr-tight);
  line-height: var(--lh-snug); max-width: 1060px; color: var(--text);
}
.diag-meta { margin-top: 12px; font-size: var(--fs-sm); color: var(--text-3); }
.diag-meta a { color: var(--accent-ink); }
.diag details summary { color: var(--accent-ink); }
.diag .contrib .lbl { color: var(--text-2); }

.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .cols2 { grid-template-columns: 1fr; } }

/* ---------- 12. Hero Open Finance ---------- */
.hero-of {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 30px 28px 20px; margin: 14px 0 22px; box-shadow: var(--sh-subtle);
}
.hero-of h3.heroline { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); letter-spacing: var(--tr-tight); margin: 0 0 22px; color: var(--text); }
.hero-of h3.heroline b { color: var(--teal); }
.hero-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 20px; text-align: center; }
.hero-num { font-size: var(--fs-5xl); font-weight: var(--fw-light); letter-spacing: var(--tr-tight); color: var(--teal); line-height: var(--lh-tight); }
.hero-num small { font-size: var(--fs-2xl); font-weight: var(--fw-normal); }
.hero-lbl { font-size: var(--fs-base); color: var(--text-2); margin-top: 3px; }
.hero-chev { color: var(--text-3); font-size: var(--fs-md); margin: 8px 0 4px; }
.hero-sub { font-size: var(--fs-sm); color: var(--text-2); line-height: var(--lh-normal); }
.hero-sub b { color: var(--text); }
.hero-foot { margin-top: 16px; font-size: var(--fs-xs); color: var(--text-3); border-top: 1px solid var(--border); padding-top: 9px; }

/* ---------- 13. Impressão ---------- */
@media print {
  .sidebar, .mobilebar, .controls, button.btn, footer .noprint, #themeToggle { display: none !important; }
  body { background: #fff; }
  .shell { display: block; }
  .card, .alert { break-inside: avoid; box-shadow: none; }
  main { max-width: 100%; padding: 0; }
  .printonly { display: block !important; }
}
.printonly { display: none; }


/* ---------- 14. Visão geral v0.21 (capa editorial) ---------- */
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 6px; }
.pagehead .ph-left { max-width: 760px; }
.pagehead p.viewdesc { margin-bottom: 6px; }
.ph-meta { color: var(--text-3); font-size: var(--fs-sm); }
.ph-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.ov-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 22px; margin: 20px 0 10px; align-items: stretch; }
@media (min-width: 1181px) { .ov-hero { grid-template-columns: minmax(360px, 5fr) 7fr; } }
.diagcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 26px 28px; box-shadow: var(--sh-subtle); display: flex; flex-direction: column; gap: 12px;
}
.diagcard { min-width: 0; overflow-wrap: anywhere; }
.diagcard .frase { font-size: var(--fs-xl); font-weight: var(--fw-semibold); letter-spacing: var(--tr-tight); line-height: var(--lh-snug); }
.classif { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); font-weight: var(--fw-bold); letter-spacing: var(--tr-wide); padding: 4px 12px; border-radius: var(--r-full); }
.classif.restr { background: var(--negative-soft); color: var(--negative); }
.classif.neutra { background: var(--surface-2); color: var(--text-2); }
.classif.expan { background: var(--positive-soft); color: var(--positive); }
.fatores { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 6px 18px; font-size: var(--fs-sm); }
.fatores .fat { color: var(--text-2); display: flex; gap: 7px; align-items: baseline; }
.fatores .fat b { font-weight: var(--fw-bold); }

.hero-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(228px, 100%), 1fr)); gap: 14px; align-content: start; }
.mcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 16px 18px 12px; box-shadow: var(--sh-subtle); cursor: pointer; position: relative;
  transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  display: flex; flex-direction: column; gap: 3px;
}
.mcard:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.mcard:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mcard .lbl { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-2); }
.mcard .val { font-size: var(--fs-3xl); font-weight: var(--fw-bold); letter-spacing: var(--tr-tight); line-height: var(--lh-tight); }
.mcard .val small { font-size: var(--fs-md); font-weight: var(--fw-medium); color: var(--text-3); }
.mcard .var { font-size: var(--fs-sm); }
.mcard svg { margin-top: 4px; }

.sechead { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 34px 0 14px; }
.sechead h3 { margin: 0; }
.sechead .seesub { color: var(--text-3); font-size: var(--fs-sm); }

.ov-2col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(480px, 100%), 1fr)); gap: 22px; align-items: stretch; }
.ov-2col > .card:first-child { min-width: 0; }
@media (min-width: 1101px) { .ov-2col { grid-template-columns: 7fr 5fr; } }
.ov-2col-eq { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr)); gap: 22px; align-items: stretch; }
.ov-3col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 22px; align-items: stretch; }

.rankmini td, .rankmini th { padding: 6px 9px; }
.rankmini .inst { font-weight: var(--fw-semibold); }

.atrasorow { display: grid; grid-template-columns: minmax(150px, 210px) 1fr 108px; gap: 10px; align-items: center; padding: 5.5px 0; font-size: var(--fs-base); cursor: pointer; border-radius: var(--r-xs); }
.atrasorow:hover { background: var(--surface-2); }
.atrasorow .abarwrap { background: var(--surface-2); border-radius: var(--r-xs); height: 12px; position: relative; overflow: hidden; }
.atrasorow .abar { height: 100%; border-radius: var(--r-xs); background: color-mix(in srgb, var(--warning) 55%, var(--surface-2)); }
.atrasorow .anum { text-align: right; font-weight: var(--fw-bold); }
.atrasorow .aname { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.insight {
  background: color-mix(in srgb, var(--accent) 5%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: var(--r-lg); padding: 22px 24px; box-shadow: var(--sh-subtle);
}
.insight h4 { margin: 0 0 8px; font-size: var(--fs-base); font-weight: var(--fw-bold); color: var(--accent-ink); }
.insight .itexto { font-size: var(--fs-md); line-height: var(--lh-normal); }

.explore-strip { display: flex; gap: 8px; flex-wrap: wrap; margin: 26px 0 6px; }
@media print { .ph-actions, .explore-strip { display: none !important; } }


/* ---------- 15. sidebar recolhível ---------- */
#sbToggle { background: transparent; border: 1px solid var(--border-2); color: var(--text-2); width: 30px; height: 30px; border-radius: var(--r-xs); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
#sbToggle:hover { background: var(--surface-2); }
.sb-collapsed .sidebar { width: 68px; flex-basis: 68px; padding: 20px 8px 14px; }
.sb-collapsed .brandtext, .sb-collapsed .navlabel, .sb-collapsed .updated { display: none; }
.sb-collapsed .brand { justify-content: center; padding: 2px 0 14px; }
.sb-collapsed nav.tabs button { font-size: 0; justify-content: center; padding: 9px 4px; }
.sb-collapsed nav.tabs button::before { content: attr(data-initial); font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: var(--tr-wide); }
.sb-collapsed nav.tabs button .navbadge { position: absolute; margin: 0; transform: translate(14px, -10px); font-size: var(--fs-2xs); }
.sb-collapsed nav.tabs button { position: relative; }
.sb-collapsed .sidefoot { flex-direction: column; gap: 8px; }
.sb-collapsed #sbToggle svg { transform: rotate(180deg); }
@media (max-width: 960px) { #sbToggle { display: none; } .sb-collapsed .sidebar { width: var(--sidebar-w); padding: 20px 12px 14px; }
  .sb-collapsed .brandtext, .sb-collapsed .navlabel, .sb-collapsed .updated { display: initial; }
  .sb-collapsed nav.tabs button { font-size: var(--fs-base); justify-content: flex-start; }
  .sb-collapsed nav.tabs button::before { content: none; } }

.charttable { margin-top: 8px; }
.charttable summary { cursor: pointer; font-size: var(--fs-xs); color: var(--accent-ink); font-weight: var(--fw-medium); }

/* ---------- Tendências de Busca (Google Trends manual) ---------- */
.tr-hero { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 14px; margin-top: 14px; }
.tr-fam { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 8px; }
.tr-fam h4 { margin: 0; font-size: var(--fs-base); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tempchip { font-size: var(--fs-2xs); font-weight: var(--fw-bold); letter-spacing: var(--tr-caps); padding: 2px 8px; border-radius: var(--r-full); white-space: nowrap; }
.tempchip.hot { background: color-mix(in srgb, var(--c-neg) 14%, transparent); color: var(--c-neg); }
.tempchip.warm { background: var(--warning-soft); color: var(--warning); }
.tempchip.cool { background: color-mix(in srgb, var(--c-line1) 13%, transparent); color: var(--c-line1); }
.tr-big { font-size: var(--fs-3xl); font-weight: var(--fw-light); letter-spacing: var(--tr-tight); line-height: var(--lh-tight); }
.tr-big small { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-2); letter-spacing: 0; }
.dotstrip { display: flex; gap: 5px; }
.dotstrip i { width: 11px; height: 11px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border-2); }
.dotstrip i.hot { background: var(--c-neg); border-color: var(--c-neg); }
.dotstrip i.cool { background: var(--c-line1); border-color: var(--c-line1); }
.tr-leitura { font-size: var(--fs-xs); color: var(--text-2); line-height: var(--lh-normal); margin: 0; }
.heatwrap { overflow-x: auto; margin-top: 10px; }
.heatgrid { display: grid; gap: 2px; min-width: 640px; }
.hcell { height: 20px; border-radius: var(--r-xs); }
.hcell.hval { cursor: default; }
.hcell.hval:hover { outline: 2px solid var(--text); outline-offset: -1px; }
.hcell.hnull { background: repeating-linear-gradient(45deg, transparent, transparent 3px, var(--border) 3px, var(--border) 4px); }
.hcell.hpart { opacity: 0.55; outline: 1px dashed var(--text-3); outline-offset: -1px; }
.hcell.hlab { position: sticky; left: 0; background: var(--surface); font-size: var(--fs-xs); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; line-height: 20px; z-index: 1; }
.hcell.hhead { font-size: var(--fs-2xs); color: var(--text-3); line-height: 20px; white-space: nowrap; overflow: visible; height: 18px; }
.hcell.hgroup { font-size: var(--fs-2xs); font-weight: var(--fw-bold); letter-spacing: var(--tr-caps); text-transform: uppercase; color: var(--text-3); margin-top: 8px; line-height: 18px; height: 18px; }
.heatleg { display: flex; align-items: center; gap: 7px; font-size: var(--fs-xs); color: var(--text-3); margin-top: 8px; flex-wrap: wrap; }
.heatleg .lg { width: 15px; height: 11px; border-radius: var(--r-xs); display: inline-block; }
.tr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); gap: 14px; margin-top: 12px; }
.tr-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 12px 14px; }
.tr-card h5 { margin: 0 0 2px; font-size: var(--fs-sm); display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.tr-card .now { font-size: var(--fs-xl); font-weight: var(--fw-light); letter-spacing: var(--tr-normal); }
.tr-tags { display: flex; gap: 5px; flex-wrap: wrap; margin: 3px 0 4px; font-size: var(--fs-2xs); }
.tr-tags span { padding: 1px 7px; border-radius: var(--r-full); background: var(--surface-2); color: var(--text-2); }
.tr-tags span.up { background: color-mix(in srgb, var(--c-neg) 12%, transparent); color: var(--c-neg); }
.tr-tags span.down { background: color-mix(in srgb, var(--c-line1) 12%, transparent); color: var(--c-line1); }
.divrow { display: grid; grid-template-columns: minmax(140px, 200px) 1fr 128px; gap: 10px; align-items: center; padding: 4.5px 0; font-size: var(--fs-sm); }
.divtrack { position: relative; height: 13px; background: var(--surface-2); border-radius: var(--r-xs); overflow: hidden; }
.divtrack .zero { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border-2); }
.divtrack .bar { position: absolute; top: 1.5px; bottom: 1.5px; border-radius: var(--r-xs); }
.famchips { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 2px; }
.famchips button { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: var(--r-full); padding: 3.5px 11px; font-size: var(--fs-xs); cursor: pointer; }
.famchips button.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent-ink); font-weight: var(--fw-semibold); }
@media (max-width: 640px) {
  .divrow { grid-template-columns: minmax(92px, 128px) 1fr 100px; font-size: var(--fs-sm); gap: 7px; }
  .heatgrid { min-width: 560px; }
}

/* ---------- Panorama do Crédito (SCR.data) ---------- */
.pan-sintese { font-size: var(--fs-xl); font-weight: var(--fw-normal); letter-spacing: var(--tr-normal); line-height: var(--lh-normal); max-width: 1080px; margin: 18px 0 6px; color: var(--text); }
.pan-sintese b { font-weight: var(--fw-bold); }
.pan-2col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(430px, 100%), 1fr)); gap: 22px; align-items: start; margin-top: 12px; }
@media (min-width: 1180px) { .pan-2col { grid-template-columns: 7fr 5fr; } }
.panmap { width: 100%; height: auto; display: block; }
.panmap path { stroke: var(--surface); stroke-width: 1.1; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill 0.35s ease, filter 0.2s ease; }
.panmap path:hover { filter: brightness(0.88); stroke: var(--text); }
.panmap path.sel { stroke: var(--text); stroke-width: 2; }
.panmap path.dim2 { opacity: 0.35; }
.maplegend { display: flex; align-items: center; gap: 10px; font-size: var(--fs-xs); color: var(--text-3); margin-top: 10px; flex-wrap: wrap; }
.maplegend .grad { height: 10px; width: 180px; border-radius: var(--r-xs); border: 1px solid var(--border); }
.metsel { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
.metsel button { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: var(--r-full); padding: 4px 12px; font-size: var(--fs-xs); cursor: pointer; transition: all 0.15s ease; }
.metsel button.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent-ink); font-weight: var(--fw-semibold); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-xs); overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--text-2); padding: 5px 13px; font-size: var(--fs-sm); cursor: pointer; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--surface-2); color: var(--text); font-weight: var(--fw-bold); }
.pan-kpi { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(205px, 100%), 1fr)); gap: 14px; margin-top: 16px; }
.pan-kpi .card h4 { font-size: var(--fs-xs); margin-bottom: 4px; }
.pan-kpi .big { font-size: var(--fs-3xl); font-weight: var(--fw-light); letter-spacing: var(--tr-tight); line-height: var(--lh-tight); }
.pan-kpi .big small { font-size: var(--fs-base); font-weight: var(--fw-normal); color: var(--text-2); }
.panbar { display: grid; grid-template-columns: minmax(150px, 230px) 1fr 120px; gap: 10px; align-items: center; padding: 4px 0; font-size: var(--fs-sm); }
.panbar .track { position: relative; height: 14px; background: var(--surface-2); border-radius: var(--r-xs); overflow: hidden; }
.panbar .track .fill { position: absolute; top: 1.5px; bottom: 1.5px; left: 0; border-radius: var(--r-xs); }
.panbar .track .zero { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border-2); }
.ufpanel { position: sticky; top: 14px; }
.deltachip { font-size: var(--fs-2xs); padding: 1px 7px; border-radius: var(--r-full); background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.deltachip.up { background: color-mix(in srgb, var(--c-neg) 12%, transparent); color: var(--c-neg); }
.deltachip.down { background: color-mix(in srgb, var(--c-pos) 13%, transparent); color: var(--c-pos); }
.cmpchips { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; margin: 8px 0 12px; }
.cmpchips .unit { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: var(--r-full); padding: 3.5px 7px 3.5px 12px; font-size: var(--fs-sm); font-weight: var(--fw-semibold); background: var(--surface); }
.cmpchips .unit .x { cursor: pointer; color: var(--text-3); border: 0; background: none; font-size: var(--fs-base); padding: 0 3px; }
.alertgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 14px; margin-top: 12px; }
.alertcard { border: 1px solid var(--border); border-left: 3px solid var(--c-neg); border-radius: var(--radius); background: var(--surface); padding: 12px 14px; font-size: var(--fs-sm); }
.alertcard.melhora { border-left-color: var(--c-pos); }
.alertcard h5 { margin: 0 0 4px; font-size: var(--fs-sm); }
.alertcard .num { font-size: var(--fs-xl); font-weight: var(--fw-light); letter-spacing: var(--tr-normal); }

/* ---------- bloco 1 da auditoria ---------- */
.ichip { display: inline-flex; align-items: center; font-size: var(--fs-2xs); font-weight: var(--fw-bold); letter-spacing: var(--tr-wide); padding: 1.5px 8px; border-radius: var(--r-full); background: var(--accent-soft); color: var(--accent-ink); cursor: pointer; vertical-align: middle; white-space: nowrap; }
.ichip:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.filterbar { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-3); margin: 10px 0 2px; padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--r-xs); background: var(--surface-2); }
.filterbar .chip { background: var(--surface); border: 1px solid var(--border); }
.loadcard { display: flex; align-items: center; gap: 10px; }
.loadcard p { margin: 0; }
.spin { width: 14px; height: 14px; border: 2px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: obcspin 0.85s linear infinite; flex: none; vertical-align: -2px; }
@keyframes obcspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

/* Conta e saída (Scrutiniums) — mesmo tratamento visual dos toggles */
#logoutBtn, #accountBtn {
  background: transparent; border: 1px solid var(--border-2); color: var(--text-2);
  width: 30px; height: 30px; border-radius: var(--r-xs); cursor: pointer; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--t-fast) var(--ease);
}
#logoutBtn:hover, #accountBtn:hover { background: var(--surface-2); color: var(--text); }
.sb-collapsed #accountBtn, .sb-collapsed #logoutBtn { margin: 0 auto; }

/* ================= Bets e risco financeiro ================= */
.nivel { display: inline-block; padding: 1px 7px; border-radius: var(--r-full); font-size: var(--fs-2xs); font-weight: var(--fw-bold); letter-spacing: var(--tr-wide); white-space: nowrap; }
.nivel.na { background: color-mix(in srgb, var(--c-line1) 10%, var(--surface)); color: var(--c-line1); }
.nivel.nb { background: color-mix(in srgb, var(--teal) 12%, var(--surface)); color: var(--teal); }
.nivel.nc { background: color-mix(in srgb, var(--forecast) 12%, var(--surface)); color: var(--forecast); }
.nivel.nd { background: var(--warning-soft); color: var(--warning); }
.nivel.ne { background: var(--surface-2); color: var(--text-2); border: 1px dashed color-mix(in srgb, var(--c-gray) 55%, transparent); }
.bets-chain { display: flex; flex-wrap: wrap; gap: 6px; align-items: stretch; margin: 10px 0 4px; }
.bets-chain .node { flex: 1 1 120px; min-width: 118px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); padding: 8px 9px; font-size: var(--fs-sm); line-height: var(--lh-snug); position: relative; }
.bets-chain .node .st { display: block; margin-top: 5px; font-size: var(--fs-2xs); font-weight: var(--fw-bold); }
.bets-chain .arrow { align-self: center; color: var(--text-2); font-size: var(--fs-md); padding: 0 1px; }
.bets-chain .node.comprovado_brasil { border-color: color-mix(in srgb, var(--c-line1) 45%, var(--border)); }
.bets-chain .node.associacao { border-color: color-mix(in srgb, var(--teal) 45%, var(--border)); }
.bets-chain .node.internacional { border-color: color-mix(in srgb, var(--forecast) 45%, var(--border)); }
.bets-chain .node.hipotese { border-style: dashed; }
.elo-st { font-size: var(--fs-2xs); font-weight: var(--fw-bold); padding: 1px 7px; border-radius: var(--r-full); white-space: nowrap; }
.elo-st.comprovado_brasil { background: color-mix(in srgb, var(--c-line1) 10%, var(--surface)); color: var(--c-line1); }
.elo-st.associacao { background: color-mix(in srgb, var(--teal) 12%, var(--surface)); color: var(--teal); }
.elo-st.internacional { background: color-mix(in srgb, var(--forecast) 12%, var(--surface)); color: var(--forecast); }
.elo-st.hipotese { background: var(--surface-2); color: var(--text-2); border: 1px dashed color-mix(in srgb, var(--c-gray) 55%, transparent); }
.bets-tl { list-style: none; margin: 8px 0 0; padding: 0 0 0 16px; border-left: 2px solid var(--border); }
.bets-tl li { position: relative; padding: 0 0 14px 12px; }
.bets-tl li::before { content: ""; position: absolute; left: -21px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.bets-tl li.parcial::before { background: var(--c-gray); }
.bets-tl .tld { font-size: var(--fs-xs); color: var(--text-2); font-variant-numeric: tabular-nums; }
.bets-bar { display: flex; align-items: center; gap: 8px; margin: 3px 0; font-size: var(--fs-sm); }
.bets-bar .lbl { flex: 0 0 190px; color: var(--text-2); }
.bets-bar .track { flex: 1; height: 8px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; }
.bets-bar .fill { height: 100%; background: var(--c-line1); }
.bets-bar .fill.warn { background: var(--warning); }
.bets-bar .num { flex: 0 0 auto; font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .bets-bar .lbl { flex-basis: 120px; } .bets-chain .node { min-width: 100px; } }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 22px 0 18px; }

/* ---------- Pix e Meios de Pagamento ---------- */
:root { --pix: #0a6d61; --pix-soft: color-mix(in srgb, #0a6d61 12%, transparent); }  /* AA: 4,60 sobre a tinta do seletor (era 3,02) */
[data-theme=dark] { --pix: #4ecdc0; --pix-soft: color-mix(in srgb, #4ecdc0 14%, transparent); }
.pixnum { color: var(--pix); }
.stacklegend { display: flex; gap: 12px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-2); margin-top: 8px; }
.stacklegend .sw { width: 11px; height: 11px; border-radius: var(--r-xs); display: inline-block; margin-right: 4px; vertical-align: -1px; }
.instpick { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; }
.instpick button { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: var(--r-full); padding: 3px 11px; font-size: var(--fs-xs); cursor: pointer; }
.instpick button.on { background: var(--pix-soft); border-color: color-mix(in srgb, var(--pix) 45%, transparent); color: var(--pix); font-weight: var(--fw-bold); }
.pxstats { display: grid; gap: 10px; margin-top: 10px; }
.pxstats > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 1px solid var(--border); padding-bottom: 7px; }
.pxstats > div:last-child { border-bottom: 0; }
.pxstats b { font-size: var(--fs-lg); font-weight: var(--fw-normal); letter-spacing: var(--tr-normal); white-space: nowrap; }

/* ---------- Ações judiciais ---------- */
.judalerta { border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); background: var(--surface); padding: 16px 18px; margin: 16px 0 6px; }
.judalerta h4 { margin: 0 0 6px; font-size: var(--fs-base); }
.judalerta p { margin: 0; max-width: 1050px; font-size: var(--fs-base); line-height: var(--lh-relaxed); color: var(--text-2); }
.judcamadas { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 10px; margin-top: 12px; font-size: var(--fs-sm); color: var(--text-2); }
.judtag { font-size: var(--fs-2xs); font-weight: var(--fw-bold); letter-spacing: var(--tr-caps); padding: 2px 7px; border-radius: var(--r-full); margin-right: 6px; white-space: nowrap; }
.judtag.nac { background: color-mix(in srgb, var(--c-gray) 18%, transparent); color: var(--text-2); }
.judtag.nom { background: var(--accent-soft); color: var(--accent-ink); }
.judif { font-size: var(--fs-2xs); font-weight: var(--fw-bold); letter-spacing: var(--tr-caps); padding: 1px 6px; border-radius: var(--r-full); background: var(--accent-soft); color: var(--accent-ink); margin-left: 5px; }

/* ---------- guia didático por página ---------- */
.guia { margin: 14px 0 4px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.guia summary { cursor: pointer; padding: 11px 16px; display: flex; justify-content: space-between; align-items: center; gap: 14px; list-style: none; }
.guia summary::-webkit-details-marker { display: none; }
.guiaq { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--text); letter-spacing: var(--tr-normal); }
.guiamais { font-size: var(--fs-xs); color: var(--accent); white-space: nowrap; }
.guiamais::after { content: " ▾"; }
.guia[open] .guiamais::after { content: " ▴"; }
.guiabody { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 18px; padding: 4px 16px 16px; border-top: 1px solid var(--border); }
.guiabody h5 { margin: 12px 0 4px; font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: var(--tr-caps); text-transform: uppercase; color: var(--text-3); }
.guiabody p { margin: 0; font-size: var(--fs-sm); line-height: var(--lh-normal); color: var(--text-2); }

/* ---------- navegação: busca e acordeão ---------- */
.navbusca { padding: 0 14px 8px; }
.navbusca input { width: 100%; padding: 6px 10px; font-size: var(--fs-sm); border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); color: var(--text); font-family: inherit; }
.navbusca input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
nav.tabs .navlabel { cursor: pointer; display: flex; align-items: center; justify-content: space-between; user-select: none; }
nav.tabs .navlabel::after { content: "▾"; font-size: var(--fs-2xs); opacity: 0.5; transition: transform var(--t-fast) var(--ease); }
nav.tabs .navgroup.aberto .navlabel::after { transform: rotate(180deg); }
nav.tabs .navgroup:not(.aberto) button[data-view] { display: none; }
nav.tabs.buscando .navgroup button[data-view] { display: block !important; }
nav.tabs.buscando .navgroup .navlabel::after { content: none; }
.navvazio { font-size: var(--fs-xs); color: var(--text-3); padding: 4px 16px; margin: 0; }

/* central de alertas: o seletor de estado é um item do cabeçalho do cartão, não
   um float — flutuando, o texto do alerta se enrolava em volta dele. */
.alcab { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.alcab > div { min-width: 0; }
.alcab select { flex: 0 0 auto; font-size: var(--fs-xs); padding: 3px 8px; }
@media (max-width: 560px) {
  .alcab { flex-direction: column; gap: 6px; }
  .alcab select { width: 100%; }
}

/* WCAG 2.1.1 — região rolável precisa ser alcançável pelo teclado. As tabelas
   largas e os mapas de calor rolam na horizontal; sem foco, quem navega por
   teclado não chega às colunas da direita. O tabindex é posto em tempo de
   execução, só onde há rolagem de fato (ver acessibilizaRolagem). */
[data-rolavel="1"] { outline-offset: 2px; }
[data-rolavel="1"]:focus-visible { outline: 2px solid var(--accent-ink); }

/* ---------- Desenrola Brasil ----------
   A página alterna gráfico e lacuna o tempo todo: o bloco de lacuna precisa parecer
   conteúdo deliberado, não erro de carregamento. */
.deslacuna { border: 1px dashed color-mix(in srgb, var(--unavail) 55%, transparent);
  border-radius: var(--r-xs); padding: 12px 16px; margin: 12px 0; background: var(--surface-2); }
.deslacuna h5 { margin: 0 0 6px; font-family: var(--label); font-size: var(--fs-xs); letter-spacing: var(--tr-caps);
  text-transform: uppercase; color: var(--text-3); }
.deslacuna ul { margin: 0; padding-left: 18px; font-size: var(--fs-sm); line-height: var(--lh-relaxed); }
.deslacuna li { margin-bottom: 5px; }

.destl { list-style: none; margin: 0; padding: 0; }
.destl li { display: flex; gap: 14px; padding: 9px 0 9px 14px; border-left: 2px solid var(--border);
  position: relative; }
.destl li::before { content: ""; position: absolute; left: -5px; top: 15px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--unavail); }
.destl li.tl-norma::before { background: var(--teal); }
.destl li.tl-marco::before { background: var(--accent); }
.destl li.tl-ajuste::before { background: var(--warning); }
.destl li.tl-avaliacao::before { background: var(--forecast); }
.destl .tldata { font-family: var(--label); font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap;
  min-width: 78px; padding-top: 2px; }

.descomoler { margin: 6px 0 0; font-size: var(--fs-base); }
.descomoler dt { font-weight: var(--fw-bold); margin-top: 8px; }
.descomoler dd { margin: 2px 0 0; color: var(--text-2); line-height: var(--lh-relaxed); }

.card.semdado { background: var(--surface-2); }
@media (max-width: 560px) {
  .destl li { flex-direction: column; gap: 2px; }
}

/* ---------- Desenrola: refinamento tipográfico e de ritmo ----------
   O painel tinha 187 caracteres por linha e 35 cartões. O problema não era
   conteúdo, era medida e ruído de borda: prosa correndo a largura inteira,
   caixa dentro de caixa e oito KPIs indistintos. */

/* medida de leitura: nenhuma prosa passa de ~70 caracteres por linha */
.desprosa { max-width: 68ch; }
.desprosa p { margin: 0 0 10px; line-height: var(--lh-relaxed); }
.desprosa p:last-child { margin-bottom: 0; }

/* sumário de seções: 14 mil px de rolagem precisam de orientação */
.desindex { display: flex; flex-wrap: wrap; gap: 2px 0; margin: 18px 0 4px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 7px 0; }
.desindex a { font-size: var(--fs-xs); color: var(--text-2); text-decoration: none; padding: 3px 11px;
  border-right: 1px solid var(--border); line-height: var(--lh-normal); }
.desindex a:last-child { border-right: 0; }
.desindex a:hover { color: var(--accent-ink); background: var(--accent-soft); }

/* nota lateral: substitui a caixa pesada onde o aviso é contextual, não estrutural */
.desnota { border-left: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  padding: 2px 0 2px 13px; margin: 10px 0; font-size: var(--fs-sm); line-height: var(--lh-relaxed); color: var(--text-2);
  max-width: 72ch; }
.desnota b { color: var(--text); }

/* grupo de indicadores: rótulo que separa universos diferentes sem mais uma borda */
.desgrupo { margin-top: 22px; }
.desgrupo > .rot { font-family: var(--label); font-size: var(--fs-2xs); letter-spacing: var(--tr-caps);
  text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; display: block; }
.desgrupo .pan-kpi { margin-top: 0; }
.desgrupo .card.kpi { display: flex; flex-direction: column; }
.desgrupo .card.kpi .big { margin: 2px 0 6px; }
.desgrupo .card.kpi .src { margin-top: auto; }

/* comparação da arquitetura: tabela em vez de três cartões de alturas desiguais */
.desarq { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.desarq th, .desarq td { text-align: left; vertical-align: top; padding: 9px 14px 9px 0;
  border-bottom: 1px solid var(--border); line-height: var(--lh-normal); }
.desarq thead th { border-bottom: 1px solid var(--border-2); padding-bottom: 7px; }
.desarq thead th .n { font-family: var(--serif, var(--sans)); font-size: var(--fs-xl); font-weight: var(--fw-semibold);
  display: block; line-height: var(--lh-snug); }
.desarq thead th .u { font-size: var(--fs-2xs); color: var(--text-3); font-weight: var(--fw-normal); }
.desarq tbody th { font-family: var(--label); font-size: var(--fs-2xs); letter-spacing: var(--tr-caps);
  text-transform: uppercase; color: var(--text-3); font-weight: var(--fw-medium); white-space: nowrap;
  padding-right: 18px; width: 1%; }
.desarq td.vazio { color: var(--text-3); font-style: italic; }

/* matriz de viabilidade: 91 linhas viravam parede — agora resume e expande por área */
.desmatriz { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px;
  margin: 12px 0 4px; }
.desmz { border: 1px solid var(--border); border-radius: var(--r-xs); padding: 10px 13px; }
.desmz h6 { margin: 0 0 6px; font-size: var(--fs-sm); font-weight: var(--fw-bold); }
.desmz .barra { display: flex; height: 5px; border-radius: var(--r-xs); overflow: hidden; margin-bottom: 6px; }
.desmz .barra i { display: block; }
.desmz .v { background: var(--positive); }
.desmz .p { background: var(--warning); }
.desmz .i { background: color-mix(in srgb, var(--unavail) 55%, transparent); }
.desmz .leg { font-size: var(--fs-xs); color: var(--text-3); }

/* ritmo vertical: seções longas precisam de respiro entre si */
#view-desenrola .sechead { margin-top: 34px; }
#view-desenrola > section:first-of-type .sechead { margin-top: 22px; }

@media (max-width: 700px) {
  .desarq, .desarq thead, .desarq tbody, .desarq tr, .desarq th, .desarq td { display: block; }
  .desarq thead { margin-bottom: 6px; }
  .desarq tbody th { border: 0; padding-bottom: 0; }
  .desarq tbody td { padding-top: 2px; }
  .desindex { gap: 0; }
  .desindex a { border-right: 0; padding: 4px 9px 4px 0; }
}

/* Medida de leitura no escopo da página: qualquer texto corrido para de crescer
   com a janela. Seletores de filho direto — tabelas, gráficos e mapas ficam de
   fora, porque neles a largura é informação. */
#view-desenrola .card > p,
#view-desenrola .card > .src,
#view-desenrola .card > ul,
#view-desenrola .card > ol,
#view-desenrola .card > dl,
#view-desenrola .note,
#view-desenrola .judalerta > div,
#view-desenrola .deslacuna ul,
#view-desenrola .destl li > div,
#view-desenrola .descomoler dd { max-width: 74ch; }

/* a lista da metodologia e as lacunas ganham entrelinha um pouco maior:
   são leitura densa e sequencial, não varredura */
#view-desenrola .card > ul.src li { margin-bottom: 4px; }

/* dicionário: verbete em bloco. Em tabela de oito colunas cada célula virava
   uma coluna de uma palavra por linha. */
.desdic article { padding: 13px 0; border-bottom: 1px solid var(--border); max-width: 82ch; }
.desdic article:last-child { border-bottom: 0; padding-bottom: 0; }
.desdic h5 { margin: 0 0 5px; font-size: var(--fs-base); font-weight: var(--fw-bold); display: flex; align-items: center;
  gap: 8px; flex-wrap: wrap; }
.desdic p { margin: 0 0 5px; font-size: var(--fs-sm); line-height: var(--lh-relaxed); color: var(--text-2); }
.desdic p:last-child { margin-bottom: 0; }
.desdic .meta, .desdic .lim { font-size: var(--fs-xs); color: var(--text-3); line-height: var(--lh-relaxed); }
.desdic .meta b, .desdic .lim b { color: var(--text-2); font-weight: var(--fw-semibold); }
.desdic code { font-size: var(--fs-xs); background: var(--surface-2); padding: 1px 5px; border-radius: var(--r-xs); }

/* ---------- Penetração e gap de crédito ---------- */
.penlayout { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; align-items: start; }
.penmapa { width: 100%; height: auto; display: block; }
.penmapa path { stroke: none; transition: fill .25s ease; }
.penmapa path.penmun { cursor: pointer; }
.penmapa path.penmun:hover { filter: brightness(0.86); }
.penmapa path.sel { stroke: var(--text); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.penmapa path.fora { pointer-events: none; }

.penrank .penlista { list-style: none; margin: 0; padding: 0; max-height: 460px; overflow-y: auto; }
.penlista li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 8px; cursor: pointer;
  border-radius: var(--r-xs); font-size: var(--fs-sm); align-items: baseline; }
.penlista li:hover { background: var(--surface-2); }
.penlista li.sel { background: var(--accent-soft); }
.penlista .n small { color: var(--text-3); margin-left: 5px; font-size: var(--fs-2xs); }
.penlista .v { font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }

.penperfil { margin-top: 14px; }
.pp-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.pp-cab h4 { margin: 0 0 2px; }
.ppgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 9px 18px; }
.ppgrid dt { font-family: var(--label); font-size: var(--fs-2xs); letter-spacing: var(--tr-caps); text-transform: uppercase;
  color: var(--text-3); margin-bottom: 1px; }
.ppgrid dd { margin: 0; font-size: var(--fs-base); font-weight: var(--fw-semibold); }

.pconf { font-family: var(--label); font-size: var(--fs-2xs); letter-spacing: var(--tr-caps); text-transform: uppercase;
  padding: 1px 6px; border-radius: var(--r-xs); }
.pconf.alta { background: var(--positive-soft); color: var(--positive); }
.pconf.media { background: var(--warning-soft); color: var(--warning); }
.pconf.baixa { background: var(--surface-2); color: var(--text-3); }
tr.selrow { background: var(--accent-soft); }

.penachados { display: grid; gap: 2px; }
.penachados article { padding: 12px 0; border-bottom: 1px solid var(--border); max-width: 80ch; }
.penachados article:last-child { border-bottom: 0; }
.penachados p { margin: 0 0 4px; line-height: var(--lh-relaxed); }
.penachados .meta, .penachados .lim { font-size: var(--fs-xs); color: var(--text-3); }
.penachados .meta b, .penachados .lim b { color: var(--text-2); font-weight: var(--fw-semibold); }

.pen2col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.pen2col h5 { margin: 0 0 5px; font-size: var(--fs-base); display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
#view-penetracao .card > p, #view-penetracao .card > .src, #view-penetracao .card > ul,
#view-penetracao .note, #view-penetracao .judalerta > div { max-width: 74ch; }
#view-penetracao .sechead { margin-top: 34px; }

@media (max-width: 900px) {
  .penlayout, .pen2col { grid-template-columns: 1fr; }
  .penrank .penlista { max-height: 320px; }
}
/* o item da lista guarda o papel de listitem; o botão fica dentro dele */
.penlista li { padding: 0; }
.penlista li button { display: flex; justify-content: space-between; gap: 10px; width: 100%;
  padding: 5px 8px; background: none; border: 0; cursor: pointer; border-radius: var(--r-xs);
  font: inherit; font-size: var(--fs-sm); color: inherit; text-align: left; align-items: baseline; }
.penlista li button:hover { background: var(--surface-2); }
.penlista li.sel button { background: var(--accent-soft); }
.ppserie, .ppinst { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.ppserie h5, .ppinst h5 { margin: 0 0 7px; font-size: var(--fs-sm); font-weight: var(--fw-bold);
  display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ppinst { max-width: 78ch; }
/* ranking: números não quebram, e a coluna do nome absorve a folga */
.penrankt td, .penrankt th { white-space: nowrap; }
.penrankt td:nth-child(2) { white-space: normal; min-width: 190px; }
.penrankt td:nth-child(2) .pconf { margin-left: 3px; }

/* medida de leitura: os parágrafos dentro de .pen2col e de <details> escapavam da
   regra de filho direto e chegavam a 159 caracteres por linha */
#view-penetracao .pen2col p, #view-penetracao .pen2col .src,
#view-penetracao .charttable > p, #view-penetracao .charttable > .src,
#view-penetracao .desnota, #view-penetracao .ppinst > p { max-width: 74ch; }
#view-penetracao .card > ul.src li { margin-bottom: 4px; }
#view-penetracao > section:first-of-type .sechead { margin-top: 22px; }

/* o ranking é o conteúdo principal da seção: não deve rolar dentro de uma página
   que já rola. O teto continua valendo para as tabelas dentro de <details>. */
#view-penetracao .card > .tblwrap { max-height: none; }

/* mapa e ranking lado a lado terminavam em alturas muito diferentes */
.penlayout { grid-template-columns: 1.3fr 1fr; }
.penlayout .penmapa { max-height: 620px; width: auto; margin: 0 auto; display: block; }
.penrank .penlista { max-height: none; }

/* 18 campos do perfil em 5 colunas deixavam três órfãos na última linha */
@media (min-width: 1100px) { .ppgrid { grid-template-columns: repeat(6, 1fr); } }

/* max-width em `ch` no pai não constrange filho de fonte menor: a ressalva em 11,6 px
   cabia ~120 caracteres dentro de um article limitado a 80ch calculados em 13 px.
   A medida vai para o próprio elemento, na sua unidade. */
.penachados article { max-width: none; }
.penachados article > p { max-width: 74ch; }
.penachados article > .meta, .penachados article > .lim { max-width: 88ch; }
#view-penetracao .card > ul.src { max-width: 88ch; }

/* o ranking passou a ser mais alto que o mapa quando tirei o teto da lista */
.penrank .penlista { max-height: 520px; overflow-y: auto; }

/* a regra de colunas acima foi declarada depois da media query e a anulava:
   no celular o mapa e o ranking voltaram a ficar lado a lado. Reafirmado por último. */
@media (max-width: 900px) {
  .penlayout, .pen2col { grid-template-columns: 1fr; }
  .penlayout .penmapa { max-height: none; width: 100%; }
  .penrank .penlista { max-height: 340px; }
}

/* ---------- MORADIA E CRÉDITO HABITACIONAL ----------
   A régua de leitura mora no próprio elemento de texto, não no pai: max-width em `ch`
   num contêiner não constrange filho de fonte menor, porque a caixa é a mesma e cabem
   mais caracteres nela. */


.morbarras { display: flex; flex-direction: column; gap: 10px; }
.morbar { display: grid; grid-template-columns: minmax(0, 20ch) 1fr auto; gap: 12px; align-items: center; }
.morbar .rot { font-size: var(--fs-base); color: var(--text-2); }
.morbar .tr { display: block; height: 22px; background: var(--surface-2); border-radius: var(--r-sm); overflow: hidden; }
.morbar .fill { display: block; height: 100%; background: color-mix(in srgb, var(--teal) 55%, var(--surface)); border-radius: var(--r-sm); }
.morbar .fill.destaque { background: var(--accent); }
.morbar .v { text-align: right; min-width: 12ch; }
.morbar .v b { font-variant-numeric: tabular-nums; }
.morbar .v small { display: block; color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }

.morfalta ul { margin: 6px 0 10px; padding-left: 20px; }
.morfalta li { margin: 3px 0; color: var(--text-2); }
.morverb { padding: 4px 2px; }
.morverb .desprosa { max-width: 74ch; }
tr.morfora td, td.morfora { color: var(--text-3); }
tr.morfora code { opacity: .75; }

.morrec td:last-child, .morinst td, .morseg td { vertical-align: top; }
.mor2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.morach h4 { font-size: var(--fs-md); margin-bottom: 6px; }
.morach p { margin: 0 0 8px; }

.morsim { gap: 14px; align-items: flex-end; }
.morsim label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); color: var(--text-2); }
.morsim input { width: 13ch; padding: 6px 8px; font-variant-numeric: tabular-nums; }
.morsimtab td { font-variant-numeric: tabular-nums; }

.morselo { display: inline-block; padding: 1px 8px; border-radius: var(--r-full); font-size: var(--fs-xs);
  letter-spacing: var(--tr-wide); text-transform: uppercase; color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, var(--surface)); white-space: nowrap; }
.morst { display: inline-block; padding: 1px 8px; border-radius: var(--r-sm); font-size: var(--fs-xs); white-space: nowrap; }
.morst.viavel { background: var(--positive-soft); color: var(--positive); }
.morst.parcial { background: var(--warning-soft); color: var(--warning); }
.morst.indisponivel { background: var(--surface-2); color: var(--text-3); }
.mormatriz td:first-child { max-width: 34ch; }

.morperfil { margin-top: 16px; }
.morperfil table th[scope="row"] { text-align: left; font-weight: var(--fw-normal); color: var(--text-2); }
.morperfil table td:last-child { width: 1%; white-space: nowrap; }
.morperfil .sechead small { font-weight: var(--fw-normal); color: var(--text-3); }
.moruf td, .morinst td { font-variant-numeric: tabular-nums; }
button.linkish { background: none; border: 0; padding: 0; color: var(--accent-ink); cursor: pointer;
  font: inherit; text-align: left; text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 900px) {
  .mor2col { grid-template-columns: 1fr; }
  .morbar { grid-template-columns: 1fr; gap: 3px; }
  .morbar .v { text-align: left; }
  .morbar .v small { display: inline; margin-left: 8px; }
  .morsim input { width: 100%; }
}

/* ---------- CONSIGNADO, PREVIDÊNCIA E ENVELHECIMENTO ----------
   Mesma disciplina de medida da aba de moradia: a régua vale para todo texto corrido,
   inclusive as notas `.src`, e sai de onde largura é informação. */


.cg2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.cgpir { display: flex; flex-direction: column; gap: 2px; }
.cgpirl { display: grid; grid-template-columns: 8ch 1fr 5ch; gap: 8px; align-items: center; font-size: var(--fs-xs); }
.cgpirl .g { color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }
.cgpirl .b { display: block; height: 12px; background: var(--surface-2); border-radius: var(--r-xs); overflow: hidden; }
.cgpirl .b > span { display: block; height: 100%; background: color-mix(in srgb, var(--accent) 45%, var(--surface)); }
.cgpirl .v { color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; }

.cgfaixas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.cgfx { text-align: center; padding: 10px 4px; background: var(--surface-2); border-radius: var(--r-md); }
.cgfx .n { display: block; font-size: var(--fs-2xl); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.cgfx .r { display: block; font-size: var(--fs-xs); color: var(--text-2); margin-top: 2px; }

.cgdisp { width: 100%; height: auto; }
.cgdisp circle { transition: fill-opacity .15s; }
.cgdisp circle:hover { fill-opacity: .8; }

.cgseg td, .cgtaxa td, .cgrec td, .cgrisco td, .cgperfil td { font-variant-numeric: tabular-nums; }
.cgdestaque { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.cgtot th, .cgtot td { border-top: 1px solid var(--border); font-weight: var(--fw-semibold); }
.cgmelhor { color: var(--positive); }
.cgpior { color: var(--negative); }

.cgtl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cgtl li { display: grid; grid-template-columns: 10ch 1fr; gap: 12px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border); }
.cgtl li:last-child { border-bottom: 0; }
.cgtl .d { color: var(--text-3); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.cgtl .c { display: flex; flex-direction: column; gap: 3px; }
.cgtl .o { color: var(--text-2); font-size: var(--fs-sm); max-width: 80ch; }
.cgtl .tp { display: inline-block; padding: 0 7px; border-radius: var(--r-full); font-size: var(--fs-2xs);
  letter-spacing: var(--tr-wide); text-transform: uppercase; margin-left: 6px; }
.tp-margem { background: var(--accent-soft); color: var(--accent-ink); }
.tp-teto { background: color-mix(in srgb, var(--teal) 14%, var(--surface)); color: var(--teal); }
.tp-prazo { background: var(--surface-2); color: var(--text-2); }
.tp-fraude { background: var(--warning-soft); color: var(--warning); }
.tp-sancao { background: var(--negative-soft, var(--surface-2)); color: var(--negative); }

.cgchip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px;
  background: var(--surface-2); border-radius: var(--r-full); font-size: var(--fs-sm); }
.cgchip small { color: var(--text-3); }
.cgchip button { background: none; border: 0; color: var(--text-3); cursor: pointer;
  font-size: var(--fs-lg); line-height: var(--lh-tight); padding: 0 2px; }
.cgchip button:hover { color: var(--negative); }
.cgperfil table th[scope="row"] { text-align: left; font-weight: var(--fw-normal); color: var(--text-2); }
.cgperfil table thead small { display: block; color: var(--text-3); font-weight: var(--fw-normal); }
.cgperfil table td:last-child { width: 1%; white-space: nowrap; }

@media (max-width: 900px) {
  .cg2col { grid-template-columns: 1fr; }
  .cgfaixas { grid-template-columns: repeat(2, 1fr); }
  .cgtl li { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- ABERTURA DE PÁGINA: indicadores centrais ----------
   Substitui as fileiras de cartões idênticos. Sem borda em volta de cada indicador —
   a separação é feita por uma régua vertical fina, que é o que a imprensa econômica usa
   e que reduz a contagem de caixas na tela sem perder a leitura de grupo. */


/* ---------- ABERTURA DE PÁGINA: indicadores centrais ----------
   Substitui as fileiras de cartões idênticos. Sem caixa em volta de cada indicador — a
   separação é uma régua vertical fina, que é o recurso da imprensa econômica e reduz a
   contagem de bordas na tela sem perder a leitura de grupo. Serve a qualquer página:
   a classe é genérica de propósito. */
.pgkpi { display: grid; grid-template-columns: repeat(5, 1fr);
  margin: var(--sp-5) 0 var(--sp-6);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.pgkpi .mk { display: flex; flex-direction: column; gap: var(--sp-1);
  padding: var(--sp-4); border-left: 1px solid var(--border); min-width: 0; }
.pgkpi .mk:first-child { border-left: 0; padding-left: 0; }
.pgkpi .mk .r { font-family: var(--label); font-size: var(--fs-2xs);
  letter-spacing: var(--tr-caps); text-transform: uppercase; color: var(--text-3); }
.pgkpi .mk .v { font-size: var(--fs-2xl); font-weight: var(--fw-light);
  letter-spacing: var(--tr-tight); line-height: var(--lh-tight);
  font-variant-numeric: tabular-nums; color: var(--text); }
.pgkpi .mk .v small { font-size: var(--fs-md); font-weight: var(--fw-normal); color: var(--text-2); }
.pgkpi .mk.destaque .v { color: var(--accent-ink); }
.pgkpi .mk .n { font-size: var(--fs-xs); color: var(--text-3); line-height: var(--lh-snug); }

@media (max-width: 1100px) {
  .pgkpi { grid-template-columns: repeat(3, 1fr); }
  .pgkpi .mk:nth-child(3n+1) { border-left: 0; padding-left: 0; }
  .pgkpi .mk:nth-child(n+4) { border-top: 1px solid var(--border); }
}
@media (max-width: 700px) {
  .pgkpi { grid-template-columns: repeat(2, 1fr); }
  .pgkpi .mk:nth-child(odd) { border-left: 0; padding-left: 0; }
  .pgkpi .mk:nth-child(n+3) { border-top: 1px solid var(--border); }
  .pgkpi .mk .v { font-size: var(--fs-xl); }
}

/* ---------- MEDIDA DE LEITURA, GLOBAL ----------
   Uma regra só, para todas as páginas. Antes existiam duas cópias quase idênticas, uma
   por aba, e as páginas anteriores não tinham nenhuma — o Pix chegava a 92 caracteres por
   linha a 1024px.

   O limite é 74ch para texto de leitura e 84ch para nota auxiliar, que é menor de corpo e
   portanto cabe mais caractere na mesma caixa. A medida vai no PRÓPRIO elemento e não no
   contêiner: `max-width` em `ch` num pai não constrange filho de corpo menor, porque a
   caixa é a mesma e a unidade muda.

   Ficam de fora os lugares em que largura é informação: célula e legenda de tabela,
   cabeçalho de seção, controles, listas laterais do mapa e rótulos de gráfico. */
.view .desprosa,
.view p.lead { max-width: 74ch !important; }
.view p.src,
.view div.src,
.view .seesub,
.view p.meta,
.view p.lim,
.view .chartfoot,
.view .judalerta,
.view .ph-meta,
.view .desnota li,
.view .morfalta li { max-width: 84ch !important; }
.view table .src,
.view .controls .src,
.view .sechead .src,
.view .penrank .src,
.view .morbar .src,
.view .cgtl .src,
.view caption.src,
.view .pgkpi .n,
.view figcaption.src { max-width: none; }

/* ---------- ÁREA DE TOQUE (WCAG 2.2 AA, critério 2.5.8) ----------
   A medição a 390px encontrou 155 controles com menos de 24px de altura. A falha é só
   de altura: as larguras já passavam.

   A correção usa pseudo-elemento em vez de padding. Aumentar o padding empurraria a
   densidade de tabelas e barras de controle para cima em toda a plataforma; o
   pseudo-elemento amplia a área clicável mantendo o desenho. O critério mede a área do
   alvo, e a área do pseudo-elemento faz parte dela porque herda o clique do pai.

   Links dentro de frase corrida ficam de fora: o critério tem exceção explícita para
   alvo em linha ("Inline"), e forçá-los quebraria o fluxo do texto. */
button.btn,
.controls .seg button,
.instpick button,
button.linkish,
.penlista button,
.cgchip button,
a.seeall,
a.src:not(:has(+ *)):where([onclick], [href]) {
  position: relative;
}
button.btn::after,
.controls .seg button::after,
.instpick button::after,
button.linkish::after,
.penlista button::after,
.cgchip button::after,
a.seeall::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 24px;
  transform: translateY(-50%);
  min-width: 24px;
}
/* Links de bloco isolados — "dispensar", "ver pulso do crédito" — não estão dentro de
   frase e por isso não têm a exceção. Ganham altura mínima direta, que aqui não
   compromete densidade nenhuma. */
a.src[onclick], a.seeall { display: inline-flex; align-items: center; min-height: 24px; }

/* Onde o controle já tem folga, o pseudo-elemento não deve criar sobreposição entre
   vizinhos: a barra de controles ganha o espaçamento mínimo que o separa. */
.controls { row-gap: var(--sp-2); }
.controls .seg { gap: 1px; }

/* ---------- TABELAS EM CELULAR: apresentação empilhada ----------
   Ativa só abaixo de 700px e só para tabelas anotadas com t-stack (cinco ou mais
   colunas). Cada linha vira um bloco; cada célula mostra o rótulo da sua coluna. A
   primeira célula da linha é o título do bloco. Tabelas estreitas continuam tabelas. */
@media (max-width: 700px) {
  table.t-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); }
  table.t-stack, table.t-stack tbody { display: block; width: 100%; }
  table.t-stack tbody tr { display: block; padding: var(--sp-2) 0 var(--sp-3);
    border-bottom: 1px solid var(--border); }
  table.t-stack tbody tr:last-child { border-bottom: 0; }
  table.t-stack tbody td, table.t-stack tbody th {
    display: flex; justify-content: space-between; gap: var(--sp-4);
    border: 0; padding: 2px 0; text-align: right; }
  table.t-stack tbody td::before, table.t-stack tbody th[data-rotulo]::before {
    content: attr(data-rotulo); color: var(--text-3); font-size: var(--fs-xs);
    text-align: left; flex-shrink: 0; }
  table.t-stack tbody td:first-child, table.t-stack tbody th[scope="row"]:first-child {
    font-weight: var(--fw-semibold); justify-content: flex-start; text-align: left;
    padding-bottom: var(--sp-1); }
  table.t-stack tbody td:first-child::before { content: none; }
}

/* ---------- conceitos didáticos ---------- */
.termo { border-bottom: 1px dotted var(--accent, #966b48); cursor: help; text-decoration: none; color: inherit; }
.termo:hover, .termo:focus-visible { background: var(--warn-bg, rgba(150, 107, 72, .12)); }
#conceitoDlg { border: 1px solid var(--border, #c9c2b4); border-radius: 12px; max-width: 680px;
  width: min(94vw, 680px); max-height: min(88vh, 760px); padding: 0; background: var(--bg, #fdfbf5);
  color: var(--ink, #222); overflow-y: auto; }
#conceitoDlg::backdrop { background: rgba(10, 10, 10, .5); }
.cdlg { padding: 18px 22px 20px; }
.cdlg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  position: sticky; top: 0; background: inherit; padding-top: 2px; }
.cdlg h3 { margin: 0 0 4px; font-size: 20px; }
.cdlg h5 { margin: 15px 0 4px; font-size: 13.5px; letter-spacing: .01em; }
.cdlg p { margin: 4px 0; font-size: 13.5px; line-height: 1.6; }
.cdlg-resumo { font-size: 14.5px; font-weight: 600; }
.cdlg-ig { width: 100%; max-width: 430px; display: block; margin: 12px auto 4px;
  border: 1px solid var(--border, #ddd); border-radius: 8px; padding: 8px; background: var(--card, #fff); }

/* ---------- citação por gráfico: permalink e embed (P2 da auditoria) ---------- */
.chartfoot a { color: inherit; text-decoration: underline dotted; }
.sec-alvo { outline: 2px solid var(--accent, #b45309); outline-offset: 6px; border-radius: 8px;
  transition: outline-color 1.2s ease; }
body.embed { padding: 10px 14px 46px; background: var(--bg, #fff); }
body.embed header, body.embed nav.tabs, body.embed .sidebar, body.embed .subnav,
body.embed #reportHeader, body.embed .pagehead .ph-actions { display: none !important; }
body.embed main { max-width: none; margin: 0; padding: 0; }
body.embed section.view { display: none; }
body.embed section.view.active { display: block; }
#embAttr { position: fixed; left: 0; right: 0; bottom: 0; padding: 7px 14px; font-size: 12px;
  background: var(--card, #fff); border-top: 1px solid var(--border, #ddd); color: var(--text-2, #556);
  z-index: 50; }
#embAttr a { color: var(--accent, #b45309); }
