/* ============================================================
   Prestação de Contas DM LEO LC · AL 25/26
   Extensão interativa — identidade visual Lions Internacional
   ============================================================ */

:root {
  --navy: #0d2240;
  --navy-mid: #00338d;
  --navy-head: #095495;
  --navy-card: #16335a;
  --gold: #ffd000;
  --gold-bar: #ebb700;
  --green: #00af66;
  --coral: #f65126;
  --blue: #00a7dc;
  --white: #ffffff;
  --darktext: #33373b;
  --gray: #d9d9d9;
  --lightgray: #8a8f98;
  --offwhite: #f5f6f8;

  --header-h: 64px;
  --footer-h: 52px;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(13, 34, 64, 0.1);
  --shadow-sm: 0 2px 8px rgba(13, 34, 64, 0.08);

  --font-ui: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-ui);
  color: var(--darktext);
  background: var(--offwhite);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Skip link (a11y) ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--gold);
  color: var(--navy);
  padding: 8px 14px;
  z-index: 1000;
  border-radius: 0 0 8px 0;
  font-weight: 700;
}
.skip-link:focus {
  left: 0;
}

/* ---------- Layout shell ---------- */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}
@supports (height: 100dvh) {
  .app {
    height: 100dvh;
  }
}

.topbar {
  height: var(--header-h);
  flex: 0 0 auto;
  background: var(--navy);
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 0 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 20;
}

.topbar .logo {
  height: 40px;
  width: auto;
  flex: 0 0 auto;
}
.topbar .logo-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.topbar .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.topbar .brand-text .t1 {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar .brand-text .t2 {
  font-weight: 400;
  font-size: 11.5px;
  color: var(--gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar .spacer {
  flex: 1 1 auto;
}

.topbar .indicator {
  font-size: 12.5px;
  color: var(--gray);
  white-space: nowrap;
  margin-left: 14px;
}
.topbar .theme-btn {
  margin-left: 14px;
}

/* Theme toggle button */
.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--white);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
  white-space: nowrap;
  flex: 0 0 auto;
}
.theme-btn svg {
  width: 15px;
  height: 15px;
  display: block;
}
.theme-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}
.theme-btn:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}
.tab-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--white);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
  white-space: nowrap;
  flex: 0 0 auto;
}
.tab-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}
.tab-btn[aria-selected="true"] {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
}
.tab-btn:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* ---------- Stage / slides ---------- */
.stage {
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
  background: var(--offwhite);
}

.slide {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 22px 36px 40px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateX(28px);
  transition:
    opacity 0.45s ease,
    transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1),
    visibility 0.45s;
  will-change: opacity, transform;
}
.slide.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}
.slide.dark {
  background: var(--navy);
  color: var(--white);
}

/* Animações de entrada dos elementos do slide ativo */
@keyframes slideUpIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.slide.active .slide-header,
.slide.active .cards,
.slide.active .panorama,
.slide.active .grid-2,
.slide.active .grid-2-1,
.slide.active .grid-3,
.slide.active .observation,
.slide.active details.method,
.slide.active .note {
  animation: slideUpIn 0.5s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.slide.active .slide-header {
  animation-delay: 0.05s;
}
.slide.active .cards {
  animation-delay: 0.15s;
}
.slide.active .panorama {
  animation-delay: 0.15s;
}
.slide.active .grid-2 {
  animation-delay: 0.15s;
}
.slide.active .grid-2-1 {
  animation-delay: 0.15s;
}
.slide.active .grid-3 {
  animation-delay: 0.15s;
}
.slide.active .observation {
  animation-delay: 0.3s;
}
.slide.active details.method {
  animation-delay: 0.35s;
}
.slide.active .note {
  animation-delay: 0.35s;
}

/* Centraliza verticalmente o conteúdo quando sobra espaço */
.slide .slide-inner {
  margin: auto;
}
.slide.cover,
.slide.end {
  display: flex;
  padding: 0;
}

/* ---------- Cover (slide 1) ---------- */
.slide.cover {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at 85% 110%, rgba(0, 167, 220, 0.35), transparent 60%),
    radial-gradient(900px 520px at 8% 0%, rgba(255, 208, 0, 0.18), transparent 55%),
    linear-gradient(135deg, #0d2240 0%, #00338d 45%, #5a2d91 78%, #8a4daf 100%);
}
.slide.cover .cover-inner {
  width: 100%;
  max-width: 1180px;
  margin: 0;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}
.cover-header {
  max-width: 780px;
}

/* QR code da capa */
.cover-qr {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.cover-qr-box {
  width: 220px;
  height: 220px;
  background: var(--white);
  border-radius: 12px;
  color: var(--navy);
  padding: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cover-qr-box svg {
  width: 100%;
  height: 100%;
  display: block;
}
.cover-qr-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  max-width: 220px;
  line-height: 1.4;
  margin: 0;
}
.cover-logos {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 34px;
}
.cover-logos .logo {
  height: 52px;
  width: auto;
}
.cover-eyebrow {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 14px;
}
.cover-title {
  font-size: clamp(32px, 5vw, 58px);
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 22px;
  color: var(--white);
  white-space: nowrap;
}
.cover-rule {
  display: block;
  width: 96px;
  height: 5px;
  background: var(--gold);
  border-radius: 3px;
  margin-bottom: 24px;
}
.cover-sub {
  font-size: clamp(15px, 1.9vw, 20px);
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.88);
  margin: 0;
}

/* ---------- End (agradecimento) ---------- */
.slide.end {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    radial-gradient(1000px 560px at 90% 10%, rgba(0, 167, 220, 0.28), transparent 55%),
    radial-gradient(820px 520px at 10% 100%, rgba(255, 208, 0, 0.16), transparent 55%),
    linear-gradient(135deg, #0d2240 0%, #00338d 45%, #5a2d91 78%, #8a4daf 100%);
}
.slide.end .end-inner {
  width: 100%;
  max-width: 820px;
}
.end-header {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.end-header .cover-logos {
  justify-content: center;
  margin-bottom: 40px;
}
.end-title {
  font-size: clamp(34px, 5.5vw, 60px);
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 24px;
  color: var(--white);
}
.end-header .cover-rule {
  margin: 0 auto 26px;
}
.end-sub {
  font-size: clamp(14px, 1.7vw, 18px);
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.88);
  margin: 0;
  max-width: 640px;
}
.end-sign {
  font-size: clamp(14px, 1.6vw, 17px);
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.5px;
  margin: 26px 0 0;
}
.end-role {
  font-size: clamp(12.5px, 1.4vw, 15px);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.75);
  margin: 4px 0 0;
  max-width: 560px;
}

.slide-inner {
  max-width: 1180px;
  margin: 0 auto;
}

/* ---------- Slide header ---------- */
.slide-header {
  margin-bottom: 14px;
}
.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--lightgray);
  margin: 0 0 6px;
}
.slide.dark .eyebrow {
  color: var(--gold);
}
.slide-title {
  font-size: clamp(22px, 3.2vw, 34px);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 6px;
  color: var(--navy);
}
.slide.dark .slide-title {
  color: var(--white);
}
.slide-title::after {
  content: "";
  display: block;
  width: 96px;
  height: 4px;
  background: var(--gold-bar);
  border-radius: 2px;
  margin-top: 10px;
}
.slide.dark .slide-title::after {
  background: var(--gold);
}
.slide-sub {
  font-size: 15px;
  color: var(--lightgray);
  margin: 0;
}
.slide.dark .slide-sub {
  color: rgba(255, 255, 255, 0.75);
}

/* ---------- Cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  border-top: 5px solid var(--navy);
  position: relative;
  overflow: hidden;
}
.card .label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--lightgray);
  margin-bottom: 6px;
}
.card .value {
  font-size: clamp(20px, 2.6vw, 28px);
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.card .hint {
  font-size: 11.5px;
  color: var(--lightgray);
  margin-top: 5px;
}
.card.green {
  border-top-color: var(--green);
}
.card.coral {
  border-top-color: var(--coral);
}
.card.gold {
  border-top-color: var(--gold-bar);
}
.card.navy {
  border-top-color: var(--navy-mid);
}

/* dark slide cards */
.slide.dark .card {
  background: var(--navy-card);
  border-top-color: rgba(255, 255, 255, 0.2);
}
.slide.dark .card .label {
  color: var(--gray);
}
.slide.dark .card .value {
  color: var(--white);
}
.slide.dark .card.green {
  border-top-color: var(--green);
}
.slide.dark .card.coral {
  border-top-color: var(--coral);
}
.slide.dark .card.gold {
  border-top-color: var(--gold);
}

/* ---------- Chart panel ---------- */
.panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
}
.slide.dark .panel {
  background: var(--navy-card);
}
.panel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 10px;
}
.slide.dark .panel-title {
  color: var(--white);
}

.chart {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}
.chart text {
  font-family: var(--font-ui);
}
.chart .bar,
.chart .seg {
  cursor: pointer;
}
.chart .bar:focus,
.chart .seg:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

/* Animações dos gráficos (disparam ao renderizar) */
@keyframes barGrowY {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}
@keyframes barGrowX {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}
@keyframes donutIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes drawLine {
  from {
    stroke-dashoffset: 5000;
  }
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes dotPop {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Apenas retângulos (barras/segmentos empilhados) animam transform.
   Circles de donut NÃO recebem transform-box, para não quebrar o
   atributo transform="rotate(...)" de cada segmento. */
.slide.active .chart rect.bar,
.slide.active .chart rect.seg {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: barGrowY 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.slide.active .chart text {
  animation: fadeIn 0.6s ease both;
}
.slide.active #chart-waterfall .chart rect.bar,
.slide.active #chart-waterfall .chart rect.seg {
  animation-name: barGrowY;
}
.slide.active #chart-monthly .chart rect.bar {
  animation-name: barGrowY;
}
.slide.active #chart-taxas .chart rect.seg,
.slide.active #chart-entradas .chart rect.bar,
.slide.active #chart-entradas .chart rect.seg,
.slide.active #chart-saidas .chart rect.bar,
.slide.active #chart-saidas .chart rect.seg,
.slide.active #chart-budget .chart rect.bar {
  animation-name: barGrowX;
  transform-origin: center left;
}
.slide.active #chart-monthly .chart path {
  stroke-dasharray: 5000;
  animation: drawLine 5s ease 0.3s both;
}
.slide.active #chart-monthly .chart circle {
  animation: dotPop 0.35s ease both;
}
.slide.active #chart-taxas .chart circle,
.slide.active #chart-entradas .chart circle,
.slide.active #chart-saidas .chart circle,
.slide.active #chart-adimplencia .chart circle {
  animation: donutIn 0.8s ease 0.1s both;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}
.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
.grid-2 > *,
.grid-2-1 > *,
.grid-3 > * {
  min-width: 0;
}
.panel {
  max-width: 100%;
}
.slide-inner {
  max-width: 1180px;
  margin: 0 auto;
  min-width: 0;
  width: 100%;
}

/* Slide orçamento: cards se ajustam ao conteúdo, sem espaço vazio interno */
.slide-orcamento .grid-2 > .panel {
  display: flex;
  flex-direction: column;
}
.slide-orcamento .grid-2 > .panel .note {
  margin-top: auto;
  padding-top: 8px;
  text-align: justify;
}

/* Observação de planejamento: largura total, mesmo padrão dos cards */
.slide-orcamento .observation.obs-full {
  margin-top: 16px;
  padding: 14px 18px;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
  text-align: justify;
}
.slide-orcamento .observation.obs-full .obs-title {
  font-size: 14px;
}

/* Observation como card dentro de grid (tela 5) */
.observation.obs-card {
  display: flex;
  flex-direction: column;
  margin-top: 0;
  font-size: 12px;
}

/* Donut de adimplência: largura fixa centralizada */
#chart-adimplencia {
  width: 220px;
  margin: 0 auto;
}
#chart-adimplencia .chart {
  width: 100%;
  height: auto;
}

/* Painel da adimplência: conteúdo centralizado verticalmente */
.panel-adimplencia {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100%;
}

/* Painel combo (donut + barras): centraliza quando o chart é menor que o card */
.panel-combo {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.panel-combo > .panel-title {
  flex: 0 0 auto;
}
.panel-combo > div:last-child {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
}
.panel-combo .chart {
  width: 100%;
  height: auto;
}

/* Leitura do balanço: estica para igualar altura com o waterfall */
.leitura-wrap {
  display: flex;
  min-width: 0;
}
.leitura-wrap .leitura-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* Painel da tabela de taxas: sem folga vertical */
.taxas-table-panel {
  padding-top: 12px;
  padding-bottom: 12px;
}

/* Panorama: cards à esquerda do gráfico */
.panorama {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 16px;
  align-items: stretch;
}
.panorama .cards {
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 12px;
  height: 100%;
}
.panorama .card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
  padding: 14px 16px;
}
.panorama .card .label {
  font-size: 11px;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.panorama .card .value {
  font-size: clamp(16px, 1.6vw, 21px);
  line-height: 1.1;
  white-space: nowrap;
  letter-spacing: -0.2px;
}
.panorama .card .hint {
  font-size: 11px;
  margin-top: 10px;
  line-height: 1.35;
}
.panorama .chart-panel {
  min-width: 0;
}

/* Tooltip */
.tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--navy);
  color: var(--white);
  font-size: 12.5px;
  line-height: 1.35;
  padding: 9px 12px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  z-index: 500;
  max-width: 300px;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.tooltip.show {
  opacity: 1;
}
.tooltip .tt-label {
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 3px;
}
.tooltip .tt-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.tooltip .tt-row span:last-child {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.tooltip .tt-pos {
  color: #7fe0b2;
}
.tooltip .tt-neg {
  color: #ff9c8a;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
  font-size: 12.5px;
}
.legend .lg {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend .sw {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

/* ---------- Fact list ---------- */
.facts {
  list-style: none;
  margin: 0;
  padding: 0;
}
.facts li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--gray);
}
.facts li:last-child {
  border-bottom: 0;
}
.facts .fl {
  font-size: 12.5px;
  color: var(--lightgray);
  flex: 0 0 auto;
}
.facts .fv {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  text-align: right;
  overflow-wrap: anywhere;
  min-width: 0;
  flex: 1 1 auto;
}
.facts .fv.neg {
  color: var(--coral);
}
body.theme-dark .facts .fv.neg {
  color: #ff9c8a;
}

/* ---------- Selo / badge ---------- */
.selo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--green);
  color: var(--white);
  font-weight: 700;
  font-size: 12.5px;
  padding: 9px 14px;
  border-radius: 8px;
}
.selo svg {
  flex: 0 0 auto;
}

/* ---------- Observation box ---------- */
.observation {
  background: var(--gold);
  color: var(--navy);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.45;
  margin-top: 14px;
}
.observation .obs-title {
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
}

/* ---------- Note / methodology ---------- */
.note {
  font-size: 11.5px;
  color: var(--lightgray);
  line-height: 1.45;
  margin-top: 10px;
}
.note.note-italic {
  font-style: italic;
}
.slide.dark .note {
  color: rgba(255, 255, 255, 0.65);
}

details.method {
  margin-top: 16px;
  border: 1px solid var(--gray);
  border-radius: 10px;
  background: var(--white);
  padding: 0;
  min-width: 0;
  width: 100%;
}
details.method .method-body {
  min-width: 0;
}
.slide.dark details.method {
  background: var(--navy-card);
  border-color: rgba(255, 255, 255, 0.2);
}
details.method summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--navy);
  padding: 12px 16px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.slide.dark details.method summary {
  color: var(--white);
}
details.method summary::-webkit-details-marker {
  display: none;
}
details.method summary::before {
  content: "▸";
  transition: transform 0.15s;
  color: var(--gold-bar);
}
details.method[open] summary::before {
  transform: rotate(90deg);
}
details.method .method-body {
  padding: 4px 16px 16px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--darktext);
}
.slide.dark details.method .method-body {
  color: rgba(255, 255, 255, 0.85);
}

/* Tabela detalhada como dropdown expansível */
details.method.table-details summary {
  font-size: 14px;
  padding: 16px 18px;
}
details.method.table-details .method-body {
  padding: 0 18px 16px;
}
details.method.table-details .filters {
  padding-top: 14px;
}
details.method.table-details table.data-table th {
  position: static;
}
details.method.table-details {
  background: var(--white);
  box-shadow: var(--shadow-sm);
  border: none;
}
.slide.dark details.method.table-details {
  background: var(--navy-card);
}
details.method.table-details summary {
  color: var(--navy);
}
.slide.dark details.method.table-details summary {
  color: var(--white);
}
.method-dl-label {
  font-weight: 700;
  margin: 14px 0 6px;
  font-size: 13px;
}
ul.dl-links {
  list-style: none;
  margin: 0;
  padding: 0;
}
.dl-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--navy-mid);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 6px 0;
}
.dl-link:hover {
  color: var(--blue);
}
.slide.dark .dl-link {
  color: var(--gold);
}
.slide.dark .dl-link:hover {
  color: var(--white);
}

/* ---------- Table ---------- */
.table-wrap {
  overflow-x: auto;
  max-width: 100%;
}
.table-wrap table {
  min-width: 560px;
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
table.data-table th,
table.data-table td {
  text-align: right;
  padding: 5px 10px;
  border-bottom: 1px solid var(--gray);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
table.data-table th:first-child,
table.data-table td:first-child {
  text-align: left;
}
table.data-table thead th {
  background: var(--navy);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  position: sticky;
  top: 0;
}
table.data-table tbody tr:hover {
  background: rgba(0, 163, 220, 0.06);
}
table.data-table td.pos {
  color: var(--green);
  font-weight: 700;
}
table.data-table td.neg {
  color: var(--coral);
  font-weight: 700;
}
table.data-table .total-row td {
  font-weight: 700;
  background: rgba(255, 208, 0, 0.15);
  border-top: 2px solid var(--gold-bar);
}

/* ---------- Filters ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.filters label {
  font-size: 12px;
  font-weight: 700;
  color: var(--lightgray);
}
.filters select {
  font-family: inherit;
  font-size: 12px;
  padding: 5px 8px;
  border: 1px solid var(--gray);
  border-radius: 8px;
  background: var(--white);
  color: var(--darktext);
  cursor: pointer;
}
.filters select:focus-visible {
  outline: 2px solid var(--blue);
}

/* ---------- Footer / controls ---------- */
.footer {
  height: var(--footer-h);
  flex: 0 0 auto;
  background: var(--white);
  border-top: 1px solid var(--gray);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
}
.footer .src {
  font-size: 11.5px;
  color: var(--lightgray);
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-btns {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}
.btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: var(--white);
  transition:
    background 0.15s,
    transform 0.1s;
}
.btn:hover {
  background: var(--navy-mid);
}
.btn:active {
  transform: translateY(1px);
}
.btn.ghost {
  background: var(--white);
  color: var(--navy);
}
.btn.ghost:hover {
  background: var(--offwhite);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.dots {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gray);
  border: none;
  padding: 0;
  cursor: pointer;
}
.dot[aria-current="true"] {
  background: var(--gold-bar);
  transform: scale(1.25);
}
.dot:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

/* ---------- Dark theme (global toggle) ---------- */
body.theme-dark .stage {
  background: var(--navy);
}
body.theme-dark .slide {
  background: var(--navy);
  color: var(--white);
}
body.theme-dark .slide.cover {
  background: inherit;
}
body.theme-dark .slide.end {
  background: inherit;
}
body.theme-dark .eyebrow {
  color: var(--gold);
}
body.theme-dark .slide-title {
  color: var(--white);
}
body.theme-dark .slide-title::after {
  background: var(--gold);
}
body.theme-dark .slide-sub {
  color: rgba(255, 255, 255, 0.75);
}
body.theme-dark .card {
  background: var(--navy-card);
  border-top-color: rgba(255, 255, 255, 0.2);
}
body.theme-dark .card .label {
  color: var(--gray);
}
body.theme-dark .card .value {
  color: var(--white);
}
body.theme-dark .card.green {
  border-top-color: var(--green);
}
body.theme-dark .card.coral {
  border-top-color: var(--coral);
}
body.theme-dark .card.gold {
  border-top-color: var(--gold);
}
body.theme-dark .panel {
  background: var(--navy-card);
}
body.theme-dark .panel-title {
  color: var(--white);
}
body.theme-dark .note {
  color: rgba(255, 255, 255, 0.65);
}
body.theme-dark .facts .fl {
  color: var(--gray);
}
body.theme-dark .facts .fv {
  color: var(--white);
}
body.theme-dark details.method {
  background: var(--navy-card);
  border-color: rgba(255, 255, 255, 0.2);
}
body.theme-dark details.method summary {
  color: var(--white);
}
body.theme-dark details.method .method-body {
  color: rgba(255, 255, 255, 0.85);
}
body.theme-dark .legend {
  color: rgba(255, 255, 255, 0.85);
}
body.theme-dark .filters select {
  background: var(--navy-card);
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.45);
}
body.theme-dark .data-table th {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
}
body.theme-dark .data-table td {
  color: rgba(255, 255, 255, 0.9);
  border-bottom-color: rgba(255, 255, 255, 0.15);
}
body.theme-dark .data-table .total-row td {
  background: rgba(255, 208, 0, 0.12);
}
body.theme-dark .data-table tbody tr:hover {
  background: rgba(0, 163, 220, 0.12);
}
body.theme-dark .selo {
  color: var(--white);
}
body.theme-dark .observation {
  color: var(--navy);
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-2,
  .grid-2-1,
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .slide-orcamento .grid-2 {
    grid-template-columns: 1fr;
  }
  .panorama {
    grid-template-columns: 1fr;
  }
  .panorama .cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .slide.cover .cover-inner {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    text-align: center;
  }
  .cover-header {
    max-width: 100%;
  }
  .cover-title {
    white-space: normal;
    font-size: clamp(26px, 7.5vw, 40px);
  }
  .cover-qr-box {
    width: 180px;
    height: 180px;
  }
  .cover-qr-hint {
    max-width: 240px;
  }
  #chart-adimplencia {
    width: 180px;
  }
  .panel-adimplencia {
    min-height: 0;
    padding-top: 8px;
  }
  .grid-2-1 > .panel {
    min-height: 0;
  }
  .slide {
    padding: 20px 18px 26px;
  }
  .slide.cover,
  .slide.end {
    padding: 32px 18px;
  }
  .cover-logos .logo {
    height: 44px;
  }
  .cover-logos {
    margin-bottom: 26px;
  }
  .topbar {
    flex-wrap: wrap;
    height: auto;
    min-height: 84px;
    padding: 14px 16px;
    row-gap: 12px;
  }
  .topbar .indicator {
    display: none;
  }
  .topbar .logo-group {
    order: 1;
  }
  .topbar .brand-text {
    order: 2;
    flex: 1 1 auto;
    min-width: 0;
  }
  .topbar .spacer {
    order: 3;
    flex: 0 0 0;
  }
  .topbar .theme-btn {
    order: 4;
    margin-left: auto;
  }
  .tabs {
    order: 5;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    flex-wrap: nowrap;
    padding-top: 4px;
    padding-bottom: 4px;
    -webkit-mask-image: linear-gradient(to right, #000 92%, transparent 100%);
    mask-image: linear-gradient(to right, #000 92%, transparent 100%);
  }
  .slide-title {
    font-size: clamp(20px, 5.5vw, 28px);
  }
}
@media (max-width: 520px) {
  .cards {
    grid-template-columns: 1fr;
  }
  .slide {
    padding: 16px 12px 22px;
  }
  .footer {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 12px;
    gap: 8px;
  }
  .nav-btns {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .btn {
    text-align: center;
    padding: 9px 8px;
    font-size: 12px;
    min-width: 0;
    width: 100%;
  }
  #btn-print {
    display: none;
  }
  .footer .src {
    display: none;
  }
  .dots {
    order: -1;
    width: 100%;
    justify-content: center;
  }
  .facts .fl {
    font-size: 12px;
  }
  .facts .fv {
    font-size: 14px;
  }

  /* Filtros da tabela: um por linha no mobile */
  .filters {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .filters select {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
  }

  /* Textos dos gráficos maiores no mobile */
  .chart text {
    font-size: 16px !important;
  }
}

/* ---------- Print ---------- */
@media print {
  .topbar,
  .footer {
    display: none;
  }
  .stage {
    overflow: visible;
  }
  .slide {
    position: relative;
    opacity: 1;
    visibility: visible;
    transform: none;
    overflow: visible;
    page-break-after: always;
    height: auto;
    min-height: 100vh;
  }
  .tooltip {
    display: none;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .slide {
    transition: none;
  }
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Visually hidden (screen-reader only) */
.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;
}
