@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,500;8..60,600;8..60,700&display=swap');

/* ============================================================
   Simuladores - Investimentos
   Sistema visual do mockup. Estático, sem build.
   Tokens em :root. Nada de cor solta nos componentes.
   ============================================================ */

:root {
  /* --- superfícies: papel quente, não OLED, não creme genérico --- */
  --paper:        #F3EEEA;
  --surface:      #FFFBFA;
  --surface-2:    #F7F1EE;
  --surface-3:    #F0E7E3;

  /* --- tinta --- */
  --ink-900:      #1A1214;
  --ink-700:      #433338;
  --ink-500:      #6B5A5F;
  --ink-400:      #7A686E;

  /* --- traço --- */
  --line:         #E4D6D3;
  --line-soft:    #EDE3E0;
  --line-strong:  #C9B4B0;

  /* --- acento: vermelho bordeaux --- */
  --accent:       #6B1C2A;
  --accent-700:   #4A121C;
  --accent-soft:  #F4E4E6;

  /* --- semântica de sinal. Déficit usa um vermelho distinto do bordeaux. --- */
  --pos:          #1B6B41;
  --pos-soft:     #E5F0E9;
  --neg:          #B42318;
  --neg-soft:     #FBECEA;
  --warn:         #855309;
  --warn-soft:    #F8F0DE;

  /* --- tipografia --- */
  --font-ui:      'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --font-num:     'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Source Serif 4', Georgia, serif;

  --fs-micro:  10px;
  --fs-label:  11px;
  --fs-xs:     12px;
  --fs-sm:     13px;
  --fs-base:   14px;
  --fs-md:     16px;
  --fs-lg:     19px;
  --fs-xl:     23px;
  --fs-figure: 40px;

  /* --- escala de espaço densa (dashboard) --- */
  --s-1: 2px;  --s-2: 4px;  --s-3: 6px;  --s-4: 8px;
  --s-5: 12px; --s-6: 16px; --s-7: 20px; --s-8: 28px; --s-9: 40px;

  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 8px 24px rgba(74, 18, 28, .06), 0 0 0 1px var(--line-soft);
}

/* ============================================================
   base
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

.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;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-900);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: 1.45;
  font-feature-settings: 'tnum' 1;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

button, summary, a, input, select, label.field-check { cursor: pointer; }

.icon { width: 14px; height: 14px; flex: none; display: block; }

/* Rótulo-canal: o vernáculo de planilha, em versalete.
   Nomeia todo bloco, coluna e grupo da Central. */
.chan {
  font-family: var(--font-num);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-500);
}

/* ============================================================
   números
   ============================================================ */

.num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'zero' 1;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.num--neg { color: var(--neg); }
.num--pos { color: var(--pos); }
.num--mute { color: var(--ink-500); }
.num--strong { font-weight: 600; }

/* ============================================================
   cabeçalho global
   ============================================================ */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--s-6);
  height: 52px; padding: 0 var(--s-7);
  background: var(--accent-700);
  color: #FFFFFF;
  border-bottom: 1px solid var(--accent-700);
}

.topbar__mark {
  display: flex; align-items: baseline; gap: var(--s-3);
  min-width: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-md);
  letter-spacing: -.01em;
  color: #FFFFFF; text-decoration: none;
}
.topbar__mark span {
  font-family: var(--font-num);
  font-size: var(--fs-micro);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #E3C4C8;
}

.topbar__crumb {
  display: flex; align-items: center; gap: var(--s-4);
  font-family: var(--font-num);
  font-size: var(--fs-label);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #E3C4C8;
}
.topbar__crumb a { color: #F0D8DB; text-decoration: none; }
.topbar__crumb a:hover { color: #FFFFFF; text-decoration: underline; }
.topbar__crumb b { color: #FFFFFF; font-weight: 500; }

.topbar__right {
  margin-left: auto;
  display: flex; align-items: center; gap: var(--s-5);
  font-family: var(--font-num);
  font-size: var(--fs-micro);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #E3C4C8;
}

.topbar__docs {
  color: #F0D8DB;
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px;
}
.topbar__docs:hover, .topbar__docs[aria-current="page"] {
  color: #FFFFFF;
  background: rgba(255,255,255,.08);
}

.live { display: inline-flex; align-items: center; gap: var(--s-3); }
.live::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: #56C08A; box-shadow: 0 0 0 3px rgba(86, 192, 138, .22);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(86, 192, 138, .10); } }

.topbar__autor {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: #E3C4C8;
  white-space: nowrap;
}

/* ============================================================
   HUB
   ============================================================ */

.hub {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--s-9) var(--s-7) var(--s-9);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-areas:
    "head head"
    "list side"
    "foot foot";
  column-gap: var(--s-8);
  align-items: start;
}
.hub__head { grid-area: head; }
.hub__list { grid-area: list; }
.hub__gross { grid-area: side; }
.hub__foot { grid-area: foot; }

.hub__head { border-bottom: 2px solid var(--accent); padding-bottom: var(--s-6); margin-bottom: var(--s-4); }
.hub__title {
  font-family: var(--font-display); font-weight: 600;
  font-size: 34px; line-height: 1.1; letter-spacing: -.02em;
  margin: var(--s-4) 0 var(--s-4);
}
.hub__lede { max-width: 62ch; color: var(--ink-700); font-size: var(--fs-md); margin: 0; }
.hub__note {
  max-width: 62ch;
  margin: var(--s-4) 0 0;
  padding: 8px 12px;
  font-size: var(--fs-sm);
  color: var(--ink-700);
  background: var(--warn-soft);
  border-left: 3px solid var(--warn);
}

.hub__list { list-style: none; margin: 0; padding: 0; }

.card {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 150px 20px;
  align-items: start;
  gap: var(--s-6);
  padding: var(--s-7) var(--s-5) var(--s-7) var(--s-4);
  margin: var(--s-4) 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: inherit; text-decoration: none;
  box-shadow: var(--shadow);
  transition: background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}
.card:hover, .card:focus-visible {
  background: var(--surface);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.card__id {
  font-family: var(--font-num); font-weight: 600;
  font-size: var(--fs-xl); line-height: 1;
  color: var(--ink-400);
  padding-top: 3px;
  font-variant-numeric: tabular-nums;
}
.card__spacer { display: block; min-height: 1px; }
.card:hover .card__id { color: var(--accent); }

.card__name {
  font-family: var(--font-display); font-weight: 600;
  font-size: var(--fs-lg); line-height: 1.2; letter-spacing: -.01em;
  margin: 0 0 var(--s-3);
}
.card__q { margin: 0; color: var(--ink-700); font-size: var(--fs-sm); max-width: 58ch; }

.card__meta { display: flex; flex-direction: column; gap: var(--s-2); padding-top: 3px; }
.card__verdict {
  font-family: var(--font-num); font-size: var(--fs-micro);
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-500);
}
.card__out { font-size: var(--fs-xs); color: var(--ink-700); }

.card__go { color: var(--ink-400); padding-top: 5px; }
.card:hover .card__go { color: var(--accent); }

.hub__foot {
  margin-top: var(--s-8); padding-top: var(--s-6);
  border-top: 1px solid var(--line-strong);
  display: flex; flex-wrap: wrap; gap: var(--s-7);
  font-size: var(--fs-xs); color: var(--ink-500);
}
.hub__foot p { margin: 0; max-width: 46ch; }

.hub__gross {
  position: sticky;
  top: 68px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--s-6);
}
.hub__gross h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-lg);
  letter-spacing: -.01em;
  margin: var(--s-2) 0 var(--s-3);
}
.hub__gross-lead {
  margin: 0 0 var(--s-5);
  color: var(--ink-700);
  font-size: var(--fs-sm);
}
.hub__gross .field { margin-bottom: var(--s-5); }
.hub__gross-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-xs);
}
.hub__gross-table th {
  text-align: left;
  font-family: var(--font-num);
  font-size: var(--fs-micro);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-500);
  font-weight: 500;
  padding: 0 0 var(--s-3);
  border-bottom: 1px solid var(--line-strong);
}
.hub__gross-table th.num, .hub__gross-table td.num { text-align: right; }
.hub__gross-table td {
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: baseline;
}
.hub__gross-eq { font-weight: 600; color: var(--ink-900); }
.hub__gross-wait { color: var(--ink-500); text-align: left; }
.hub__gross-more {
  display: inline-block;
  margin-top: var(--s-5);
  font-size: var(--fs-xs);
  font-weight: 600;
}

/* ============================================================
   layout da ferramenta: parâmetros fixos, resultado rolando
   ============================================================ */

.tool {
  display: grid;
  grid-template-columns: 348px minmax(0, 1fr);
  align-items: start;
  gap: 0;
  max-width: 1560px; margin: 0 auto;
}

.panel {
  position: sticky; top: 52px;
  height: calc(100vh - 52px);
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line-strong);
  padding: var(--s-6) var(--s-6) var(--s-9);
}

.result { padding: var(--s-6) var(--s-7) var(--s-9); min-width: 0; }

/* ============================================================
   painel de parâmetros
   ============================================================ */

.panel__head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding-bottom: var(--s-4); margin-bottom: var(--s-5);
  border-bottom: 2px solid var(--accent);
}
.panel__head h2 { font-size: var(--fs-sm); font-weight: 600; margin: 0; letter-spacing: -.005em; }
.panel__reset {
  font-family: var(--font-num); font-size: var(--fs-micro);
  letter-spacing: .08em; text-transform: uppercase;
  background: none; border: 0; padding: 4px 8px; color: var(--accent);
  border-radius: 999px;
}
.panel__reset:hover { background: var(--accent-soft); }

.group { margin-bottom: var(--s-7); }
.group__label {
  display: flex; align-items: center; gap: var(--s-4);
  margin-bottom: var(--s-5);
}
.group__label::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-5) var(--s-5); }
.fields--single { grid-template-columns: 1fr; }

.field { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.field--wide { grid-column: 1 / -1; }

.field > label {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3);
  font-size: var(--fs-xs); color: var(--ink-700); font-weight: 500;
}
.field .unit {
  font-family: var(--font-num); font-size: var(--fs-micro);
  color: var(--ink-500); letter-spacing: .04em; white-space: nowrap; flex: none;
}

.field input, .field select {
  width: 100%;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--ink-900);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-bottom: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: var(--s-3) var(--s-4);
  text-align: right;
}
.field select { text-align: left; font-family: var(--font-ui); font-size: var(--fs-sm); }
.field input:hover, .field select:hover { border-color: var(--line-strong); }
.field input:focus, .field select:focus {
  background: var(--surface);
  border-bottom-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.field--check .field-check {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--s-3);
  width: auto;
  align-self: flex-start;
}
.field--check input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  padding: 0;
  flex: none;
  text-align: left;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
}

.field__note { font-size: var(--fs-micro); color: var(--ink-500); }
.field--warn input { border-bottom-color: var(--warn); background: var(--warn-soft); }
.field--warn .field__note { color: var(--warn); }

.teto-pgbl {
  margin-top: var(--s-5);
  padding: var(--s-5);
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}
.teto-pgbl p { margin: 0 0 var(--s-3); font-size: var(--fs-sm); color: var(--ink-700); line-height: 1.45; }
.teto-pgbl .chan { margin-bottom: var(--s-2); }
.teto-pgbl button {
  font-family: var(--font-num);
  font-size: var(--fs-micro);
  letter-spacing: .08em;
  text-transform: uppercase;
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 6px 10px;
  border-radius: 999px;
}
.teto-pgbl button:hover { background: var(--accent); color: var(--surface); }
.teto-pgbl button:disabled { opacity: .45; cursor: not-allowed; }
.teto-pgbl--warn {
  background: var(--warn-soft);
  border-left-color: var(--warn);
}

.panel__note {
  margin-top: var(--s-7); padding-top: var(--s-5);
  border-top: 1px solid var(--line);
  font-size: var(--fs-micro); color: var(--ink-500); line-height: 1.5;
}

/* ============================================================
   ASSINATURA: régua de veredito
   ============================================================ */

.verdict {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-left: 5px solid var(--pos);
  border-radius: var(--radius-lg);
  padding: var(--s-6) var(--s-7) var(--s-5) var(--s-7);
  box-shadow: var(--shadow);
}
.verdict--neg { border-left-color: var(--neg); }
.verdict--warn { border-left-color: var(--warn); }

.verdict__top {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-5);
  padding-bottom: var(--s-4); margin-bottom: var(--s-5);
  border-bottom: 1px solid var(--line-soft);
}
.verdict__stamp {
  display: inline-flex; align-items: center; gap: var(--s-3);
  font-family: var(--font-num); font-size: var(--fs-micro);
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--pos); font-weight: 500;
}
.verdict__ts { font-family: var(--font-num); font-size: var(--fs-micro); color: var(--ink-500); letter-spacing: .06em; }

.verdict__body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-8); align-items: start; }

.verdict__sentence {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-xl);
  line-height: 1.3;
  letter-spacing: -.015em;
  margin: 0;
  max-width: 34ch;
  text-wrap: balance;
}
.verdict__sentence b { font-weight: 600; box-shadow: inset 0 -.32em 0 var(--pos-soft); }

.verdict__figure { text-align: right; border-left: 1px solid var(--line-soft); padding-left: var(--s-8); }
.verdict__figures { display: grid; gap: var(--s-5); min-width: min(22rem, 42vw); }
.verdict__figures .verdict__figure + .verdict__figure { padding-top: var(--s-5); border-top: 1px solid var(--line-soft); }
.verdict__figure .chan { display: block; margin-bottom: var(--s-2); }
.verdict__value {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-figure);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.035em;
  color: var(--pos);
  display: block;
}
.verdict--neg .verdict__value, .verdict--neg .verdict__stamp { color: var(--neg); }
.verdict__sub { font-family: var(--font-num); font-size: var(--fs-xs); color: var(--ink-700); margin-top: var(--s-3); }

.premise {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0 var(--s-5);
  margin-top: var(--s-6); padding-top: var(--s-4);
  border-top: 1px solid var(--line-soft);
}
.premise__item { display: inline-flex; align-items: baseline; gap: var(--s-3); font-size: var(--fs-xs); color: var(--ink-500); }
.premise__item + .premise__item { border-left: 1px solid var(--line); padding-left: var(--s-5); }
.premise__item b { font-family: var(--font-num); font-weight: 500; color: var(--ink-900); font-variant-numeric: tabular-nums; }

.verdict__scope {
  margin: var(--s-4) 0 0;
  font-size: var(--fs-micro);
  color: var(--ink-500);
}

/* ============================================================
   blocos de detalhamento
   ============================================================ */

.result__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-5);
  margin-bottom: var(--s-5);
}
.result__title { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-lg); margin: 0; letter-spacing: -.01em; }
.result__q { font-size: var(--fs-xs); color: var(--ink-500); max-width: 64ch; margin: var(--s-2) 0 0; }

.blocks { margin-top: var(--s-7); border-top: 1px solid var(--line-strong); }

.block { border-bottom: 1px solid var(--line); }

.block > summary {
  display: flex; align-items: center; gap: var(--s-5);
  padding: var(--s-5) var(--s-3);
  list-style: none;
  user-select: none;
  border-radius: var(--radius);
}
.block > summary::-webkit-details-marker { display: none; }
.block > summary:hover { background: var(--surface-3); }

.block__idx {
  font-family: var(--font-num); font-size: var(--fs-label); font-weight: 500;
  color: var(--ink-500); font-variant-numeric: tabular-nums;
}
.block__name { font-size: var(--fs-sm); font-weight: 600; }
.block__hint { font-size: var(--fs-xs); color: var(--ink-500); margin-left: auto; text-align: right; }
.block__chev { color: var(--ink-400); transition: transform 160ms ease; }
.block[open] > summary .block__chev { transform: rotate(90deg); }
.block[open] > summary { background: var(--surface-3); border-bottom: 1px solid var(--line); }

.block__body { padding: var(--s-6) var(--s-3) var(--s-8); }

/* ============================================================
   variáveis derivadas
   ============================================================ */

.derived { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.derived__cell { background: var(--surface); padding: var(--s-5) var(--s-5); min-width: 0; }
.derived__cell .chan { display: block; font-size: var(--fs-micro); margin-bottom: var(--s-3); overflow-wrap: anywhere; }
.derived__val { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--fs-lg); font-weight: 500; overflow-wrap: anywhere; line-height: 1.2; }
.derived__cell--warn { background: var(--warn-soft); }
.derived__flag {
  display: inline-flex; align-items: center; gap: var(--s-2);
  margin-top: var(--s-3);
  font-family: var(--font-num); font-size: var(--fs-micro);
  letter-spacing: .06em; text-transform: uppercase; color: var(--warn);
}
.derived-group + .derived-group { margin-top: var(--s-6); }
.derived-group__title {
  margin: 0 0 var(--s-4);
  font-size: var(--fs-label);
  color: var(--ink-700);
}

/* ============================================================
   tabela de ranking
   ============================================================ */

.tablewrap { overflow-x: auto; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }

table.rank { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.rank thead th:first-child,
table.rank tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--line);
}
table.rank thead th:first-child { background: var(--surface-3); z-index: 4; }
table.rank tbody tr.win td:first-child { background: var(--pos-soft); }

table.rank thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-3);
  border-bottom: 1px solid var(--line-strong);
  padding: var(--s-4) var(--s-5);
  text-align: right;
  font-family: var(--font-num);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-700);
  white-space: nowrap;
  vertical-align: bottom;
}
table.rank thead th.al { text-align: left; }
table.rank thead th small { display: block; font-weight: 400; letter-spacing: .04em; color: var(--ink-500); text-transform: none; }

table.rank tbody td {
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--line-soft);
  text-align: right;
  white-space: nowrap;
}
table.rank tbody td.al { text-align: left; }
table.rank tbody tr:nth-child(even) { background: var(--surface-2); }
table.rank tbody tr:hover { background: var(--accent-soft); }
table.rank tbody tr:last-child td { border-bottom: 0; }

.pos { font-family: var(--font-num); font-weight: 500; color: var(--ink-500); font-variant-numeric: tabular-nums; }
.asset { font-weight: 500; }
.asset small { display: block; font-family: var(--font-num); font-size: var(--fs-micro); color: var(--ink-500); font-weight: 400; letter-spacing: .03em; }

/* linha vencedora */
tr.win { background: var(--pos-soft) !important; }
tr.win:hover { background: #DCEBE2 !important; }
tr.win td { border-bottom-color: #C3DCCE; }
tr.win .pos { color: var(--pos); font-weight: 600; }
tr.win .asset { font-weight: 600; }
tr.win td:first-child { box-shadow: inset 3px 0 0 var(--pos); }

/* empate técnico */
tr.tie .pos::after { content: '='; margin-left: 1px; color: var(--ink-500); }
tr.tie td:first-child { box-shadow: inset 3px 0 0 var(--line-strong); }

.tag {
  display: inline-block;
  font-family: var(--font-num);
  font-size: var(--fs-micro);
  letter-spacing: .06em;
  padding: 1px var(--s-3);
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink-700);
  background: var(--surface);
}
.tag--exempt { color: var(--pos); border-color: #B9D3C4; background: var(--pos-soft); }

/* marca a assimetria da coluna de taxa bruta equivalente */
.eq { display: inline-flex; align-items: baseline; gap: var(--s-3); justify-content: flex-end; }
.eq__kind { font-family: var(--font-num); font-size: var(--fs-micro); letter-spacing: .04em; color: var(--ink-500); }
.eq--gross .eq__kind { color: var(--accent); }

.legend { display: flex; flex-wrap: wrap; gap: var(--s-4) var(--s-7); margin-top: var(--s-5); font-size: var(--fs-xs); color: var(--ink-500); }
.legend__item { display: inline-flex; align-items: baseline; gap: var(--s-3); }
.legend b { font-family: var(--font-num); font-weight: 500; color: var(--ink-700); }

/* ============================================================
   matriz de sensibilidade
   ============================================================ */

table.matrix { border-collapse: collapse; font-size: var(--fs-xs); background: var(--surface); }
table.matrix th, table.matrix td {
  border: 1px solid var(--line);
  padding: var(--s-3) var(--s-5);
  text-align: right;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.matrix thead th { background: var(--surface-3); font-weight: 500; font-size: var(--fs-micro); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-700); }
table.matrix tbody th { background: var(--surface-2); font-weight: 500; text-align: left; color: var(--ink-700); }
table.matrix td.cell-neg { background: var(--neg-soft); color: var(--neg); }
table.matrix td.cell-pos { background: var(--pos-soft); color: var(--pos); font-weight: 600; }
table.matrix td .num--mute { color: var(--ink-500); }
/* matriz de texto+número (troca de liderança) alinha à esquerda */
table.matrix--lead td, table.matrix--lead thead th { text-align: left; }
table.matrix--lead td .num--mute { margin-left: var(--s-2); }
.matrix__axis { font-size: var(--fs-xs); color: var(--ink-500); margin: 0 0 var(--s-4); }

/* ============================================================
   notas metodológicas
   ============================================================ */

.notes { margin: 0; font-size: var(--fs-sm); color: var(--ink-700); max-width: 88ch; }
.notes dt { font-family: var(--font-num); font-size: var(--fs-micro); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-500); margin-top: var(--s-5); }
.notes dt:first-child { margin-top: 0; }
.notes dd { margin: var(--s-2) 0 0; }

.key-values {
  display: grid;
  grid-template-columns: minmax(10ch, 1fr) auto;
  column-gap: var(--s-5);
  row-gap: var(--s-3);
  max-width: none;
  align-items: baseline;
}
.key-values dt {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  color: var(--ink-500);
}
.key-values dd {
  margin: 0;
  text-align: right;
  font-size: var(--fs-sm);
  font-weight: 500;
}

.duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-6);
  align-items: start;
}
.duo__col {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s-5);
  min-width: 0;
}
.duo__title {
  margin: 0 0 var(--s-5);
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: -.01em;
}

.foot-conv {
  margin-top: var(--s-7);
  font-size: var(--fs-micro); color: var(--ink-500);
  display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-5);
}
.foot-conv span { display: inline-flex; align-items: center; gap: var(--s-3); }
.foot-conv span + span { border-left: 1px solid var(--line); padding-left: var(--s-5); }

/* ============================================================
   gráficos SVG nativos
   ============================================================ */

.chart { margin: 0; break-inside: avoid; min-width: 0; }
.chart svg { display: block; width: 100%; max-width: 100%; height: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.chart__grid { stroke: var(--line-soft); stroke-width: 1; }
.chart__line--pos { stroke: var(--pos); }
.chart__line--neg { stroke: var(--neg); }
.chart__line--dashed { stroke-dasharray: 4 3; }
.chart__marker { stroke: var(--warn); stroke-width: 1; stroke-dasharray: 2 3; }
.chart__axis-label { fill: var(--ink-500); font: 10px var(--font-num); text-anchor: middle; }
.chart__legend { display: flex; flex-wrap: wrap; gap: var(--s-4) var(--s-7); margin-top: var(--s-4); font-size: var(--fs-xs); color: var(--ink-700); }
.chart__legend-item { display: inline-flex; align-items: center; gap: var(--s-3); }
.chart__legend-item::before { content: ''; width: 22px; border-top: 2px solid currentColor; }
.chart__legend-item--pos { color: var(--pos); }
.chart__legend-item--neg { color: var(--neg); }
.chart__legend-item--dashed::before { border-top-style: dashed; }
.chart__data { margin-top: var(--s-5); }
.chart__data > summary { color: var(--accent); font-size: var(--fs-xs); font-weight: 600; }
.chart__data .tablewrap { margin-top: var(--s-4); max-height: 340px; overflow: auto; }
.chart__bar { fill: var(--ink-400); }
.chart__bar--win { fill: var(--pos); }
.chart__bar-label { fill: var(--ink-700); font: 11px var(--font-num); text-anchor: end; }
.chart__bar-value { fill: var(--ink-700); font: 11px var(--font-num); text-anchor: start; font-variant-numeric: tabular-nums; }
.field[hidden] { display: none !important; }
.group[hidden] { display: none !important; }
.field input:disabled, .field select:disabled { cursor: default; opacity: .6; }

/* ============================================================
   reflow. Desktop é o uso previsto; abaixo disso não quebra.
   ============================================================ */

@media (max-width: 1180px) {
  .verdict__body { grid-template-columns: 1fr; gap: var(--s-6); }
  .verdict__figures { min-width: 0; }
  .verdict__figure { text-align: left; border-left: 0; padding-left: 0; border-top: 1px solid var(--line-soft); padding-top: var(--s-5); }
  .derived { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hub {
    grid-template-columns: 1fr;
    grid-template-areas:
      "head"
      "side"
      "list"
      "foot";
  }
  .hub__gross { position: static; max-width: 420px; }
}

@media (max-width: 900px) {
  .tool { grid-template-columns: 1fr; }
  .panel { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line-strong); }
  .card { grid-template-columns: 44px minmax(0, 1fr) 20px; }
  .card__meta { display: none; }
  .duo { grid-template-columns: 1fr; }
  .docs--grid {
    grid-template-columns: 1fr;
  }
  .docs table.rank thead th,
  .docs table.rank tbody td {
    white-space: normal;
  }
}

@media (max-width: 560px) {
  .topbar { height: auto; min-height: 52px; padding: 8px var(--s-5); gap: var(--s-4); flex-wrap: wrap; }
  .topbar__mark { font-size: var(--fs-sm); }
  .topbar__docs, .live, .topbar__crumb { display: none; }
  .topbar__right { display: flex; }
  .derived { grid-template-columns: 1fr; }
  .hub__title { font-size: 26px; }
  .verdict__value { font-size: 30px; }
  .result { padding: var(--s-6) var(--s-5) var(--s-8); }
  .result__head { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ============================================================
   botão de PDF e guia
   ============================================================ */

.btn-pdf {
  flex: none;
  font-family: var(--font-num);
  font-size: var(--fs-micro);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #FFFFFF;
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  box-shadow: 0 1px 0 rgba(255,255,255,.12) inset;
}
.btn-pdf:hover { background: var(--accent-700); }
.btn-pdf[aria-invalid="true"] { background: var(--warn); }

.docs { max-width: 760px; margin: 0 auto; padding: var(--s-9) var(--s-7) var(--s-9); }
.docs--grid {
  max-width: 1280px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-6);
  align-items: start;
}
.docs--grid .docs__head,
.docs--grid .docs__toc,
.docs--grid .docs__card--wide {
  grid-column: 1 / -1;
}
.docs__head { margin-bottom: var(--s-7); }
.docs__head h1 {
  font-family: var(--font-display); font-weight: 600;
  font-size: 32px; line-height: 1.15; letter-spacing: -.02em;
  margin: var(--s-4) 0 var(--s-4);
}
.docs__head p { color: var(--ink-700); max-width: 62ch; }
.docs__toc {
  display: flex; flex-wrap: wrap; gap: var(--s-3);
  margin: 0 0 var(--s-8);
}
.docs__toc a {
  font-family: var(--font-num); font-size: var(--fs-micro);
  letter-spacing: .06em; text-transform: uppercase;
  text-decoration: none; color: var(--accent);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 12px;
}
.docs__toc a:hover { background: var(--accent-soft); }
.docs__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--s-7);
  margin-bottom: var(--s-6);
}
.docs--grid .docs__card { margin-bottom: 0; min-width: 0; }
.docs__card h2 { font-family: var(--font-display); font-size: var(--fs-xl); margin: var(--s-2) 0 var(--s-4); }
.docs__card h3 { font-size: var(--fs-sm); margin: var(--s-6) 0 var(--s-3); }
.docs__card p, .docs__card li { color: var(--ink-700); }
.docs__card ol, .docs__card ul { padding-left: 1.2em; }
.docs__card li { margin: var(--s-2) 0; }
.docs__card a { font-weight: 600; }

/* ============================================================
   rodapé de versão, presente em todas as páginas
   ============================================================ */

.rodape {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: var(--s-3) var(--s-5);
  max-width: 1560px;
  margin: var(--s-8) auto 0;
  padding: var(--s-4) var(--s-6) var(--s-6);
  border-top: 1px solid var(--line);
  font-size: var(--fs-micro);
  color: var(--ink-400);
}
.rodape__marca { font-weight: 600; color: var(--ink-500); }
.rodape__versao {
  font-family: var(--font-num);
  letter-spacing: .04em;
  color: var(--ink-500);
}
.rodape__autor { color: var(--ink-400); }
.rodape__escopo { margin-left: auto; }

@media (max-width: 720px) {
  .rodape__escopo { margin-left: 0; }
}

@page {
  size: A4 landscape;
  margin: 10mm;
}

@media print {
  .topbar, .panel, .btn-pdf, .panel__reset, .live, .topbar__docs { display: none !important; }
  .tool { display: block; }
  .result { padding: 0; }
  .verdict { box-shadow: none; }

  /* causa raiz do corte: sem rolagem no papel, overflow auto vira corte */
  .tablewrap {
    overflow: visible;
    border-radius: 0;
    max-height: none;
  }
  .chart__data .tablewrap { max-height: none; overflow: visible; }

  table {
    table-layout: auto;
    width: 100%;
  }
  table.rank,
  table.matrix {
    font-size: 7.5pt;
  }
  table.rank thead th,
  table.rank tbody td {
    padding: 2pt 3pt;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  table.rank thead th {
    position: static;
    letter-spacing: .02em;
  }
  table.rank thead th:first-child,
  table.rank tbody td:first-child {
    position: static;
    box-shadow: none;
  }
  table.rank thead th small { font-size: 6.5pt; }

  thead { display: table-header-group; }
  tr, .derived__cell, .derived-group, .chart, figure { break-inside: avoid; }
  .block { break-inside: auto; }
  .block__body { break-inside: auto; }

  .print-hide { display: none !important; }

  body::after {
    content: 'Uso interno. Não é recomendação de investimento. Gerado em ' attr(data-print-at) '.';
    display: block;
    margin-top: 24px;
    font-size: 10px;
    color: #6B5A5F;
  }
}
