/* ============================================================
   ObIT-NE Dashboard – Design System
   Observatório do Turismo do Nordeste · BNB
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Syne:wght@700;800&display=swap');

/* ── Reset & Base ──────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Brand palette – oceano + areia + nordeste */
  --ocean: #0077B6;
  --sky: #00B4D8;
  --foam: #90E0EF;
  --sand: #F4A261;
  --sunset: #E76F51;
  --growth: #06D6A0;
  --purple: #845EC2;

  /* Dark UI */
  --bg-base: #0A0F1E;
  --bg-card: #111827;
  --bg-card2: #1A2235;
  --bg-panel: #0D1526;
  --border: rgba(0, 180, 216, .18);

  /* Text */
  --text-primary: #E8EDF7;
  --text-secondary: #8896B3;
  --text-muted: #4A5568;

  /* KPI colors */
  --kpi-a: #00B4D8;
  --kpi-b: #06D6A0;
  --kpi-c: #F4A261;
  --kpi-d: #845EC2;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 32px rgba(0, 0, 0, .45);
  --shadow-glow: 0 0 24px rgba(0, 180, 216, .18);
  --transition: .25s cubic-bezier(.4, 0, .2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--ocean), var(--sky));
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.sidebar-logo h1 {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  background: linear-gradient(135deg, #fff 30%, var(--sky));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-logo p {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 2px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: rgba(0, 180, 216, .1);
  color: var(--sky);
  border-color: rgba(0, 180, 216, .2);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(0, 119, 182, .3), rgba(0, 180, 216, .15));
  color: var(--sky);
  border-color: rgba(0, 180, 216, .35);
  box-shadow: 0 2px 12px rgba(0, 180, 216, .12);
}

.nav-item .nav-icon {
  font-size: 18px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Main Content ──────────────────────────────────────────── */
.main {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}

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

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  backdrop-filter: blur(4px);
}

.sidebar-overlay.show {
  opacity: 1;
  visibility: visible;
}

.topbar-left h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-left p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.last-updated {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--growth);
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(6, 214, 160, .4);
  }

  50% {
    opacity: .7;
    box-shadow: 0 0 0 5px rgba(6, 214, 160, 0);
  }
}

.export-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 50px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.3px;
}

.btn-csv {
  background: linear-gradient(135deg, #1d7f4e, #06D6A0);
  box-shadow: 0 3px 10px rgba(6, 214, 160, .3);
}

.btn-xls {
  background: linear-gradient(135deg, #0a5a8a, #0077B6);
  box-shadow: 0 3px 10px rgba(0, 119, 182, .3);
}

.btn-pdf {
  background: linear-gradient(135deg, #8b1a1a, #E63946);
  box-shadow: 0 3px 10px rgba(230, 57, 70, .3);
}

.btn-csv:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 16px rgba(6, 214, 160, .45);
}

.btn-xls:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 16px rgba(0, 180, 216, .45);
}

.btn-pdf:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 16px rgba(230, 57, 70, .45);
}

.btn-export:active {
  transform: scale(0.97);
}

/* ── Filter Bar ────────────────────────────────────────────── */
.filter-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
}

.filter-select {
  appearance: none;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 36px 8px 16px;
  cursor: pointer;
  transition: all var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238896B3' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  min-width: 170px;
}

.filter-select:focus {
  outline: none;
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, .15);
}

.filter-select:hover {
  border-color: var(--sky);
}

.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
  background: transparent;
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--sky);
  color: var(--sky);
}

.chip.active {
  border-color: var(--sky);
  color: var(--sky);
  background: rgba(0, 180, 216, .12);
}

/* ── Content Area ──────────────────────────────────────────── */
.content {
  padding: 28px 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── KPI Cards ─────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--transition);
  border-radius: var(--radius);
}

.kpi-card.a::before {
  background: linear-gradient(135deg, rgba(0, 180, 216, .08), transparent);
}

.kpi-card.b::before {
  background: linear-gradient(135deg, rgba(6, 214, 160, .08), transparent);
}

.kpi-card.c::before {
  background: linear-gradient(135deg, rgba(244, 162, 97, .08), transparent);
}

.kpi-card.d::before {
  background: linear-gradient(135deg, rgba(132, 94, 194, .08), transparent);
}

.kpi-card:hover {
  border-color: rgba(0, 180, 216, .4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.kpi-card:hover::before {
  opacity: 1;
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.kpi-card.a .kpi-icon {
  background: rgba(0, 180, 216, .15);
}

.kpi-card.b .kpi-icon {
  background: rgba(6, 214, 160, .15);
}

.kpi-card.c .kpi-icon {
  background: rgba(244, 162, 97, .15);
}

.kpi-card.d .kpi-icon {
  background: rgba(132, 94, 194, .15);
}

.kpi-body {
  flex: 1;
  min-width: 0;
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.kpi-value {
  font-family: 'Syne', sans-serif;
  font-size: clamp(18px, 2.5vw, 26px);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 6px;
  word-break: break-word;
}

.kpi-minmax {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: clamp(0.62rem, 1.1vw, 0.72rem);
  font-weight: 500;
  line-height: 1.3;
}

.kpi-best {
  color: #2ecc71;
}

.kpi-worst {
  color: #e74c3c;
}

.kpi-card.a .kpi-value {
  color: var(--kpi-a);
}

.kpi-card.b .kpi-value {
  color: var(--kpi-b);
}

.kpi-card.c .kpi-value {
  color: var(--kpi-c);
}

.kpi-card.d .kpi-value {
  color: var(--kpi-d);
}

.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 50px;
  background: rgba(6, 214, 160, .12);
  color: var(--growth);
}

.kpi-trend.down {
  background: rgba(231, 111, 81, .12);
  color: var(--sunset);
}

/* ── Charts Grid ───────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all var(--transition);
}

.chart-card:hover {
  border-color: rgba(0, 180, 216, .3);
  box-shadow: var(--shadow-glow);
}

.chart-card.full {
  grid-column: span 2;
}

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.chart-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.chart-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 50px;
  background: rgba(0, 180, 216, .12);
  color: var(--sky);
  border: 1px solid rgba(0, 180, 216, .25);
  flex-shrink: 0;
}

.chart-wrap {
  position: relative;
  width: 100%;
  min-height: 200px;
}

/* ── Ranking Table ─────────────────────────────────────────── */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-card2);
  border: 1px solid var(--border);
  transition: all var(--transition);
  cursor: default;
}

.ranking-item:hover {
  border-color: rgba(0, 180, 216, .3);
  transform: translateX(3px);
}

.rank-num {
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-muted);
  width: 22px;
  flex-shrink: 0;
  text-align: center;
}

.rank-num.top {
  color: var(--sand);
}

.rank-icon {
  font-size: 20px;
}

.rank-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.rank-bar-wrap {
  width: 120px;
}

.rank-bar-bg {
  height: 6px;
  background: var(--bg-base);
  border-radius: 3px;
  overflow: hidden;
}

.rank-bar {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--ocean), var(--sky));
  transition: width .8s cubic-bezier(.4, 0, .2, 1);
}

.rank-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--sky);
  width: 46px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Donut Legend ──────────────────────────────────────────── */
.donut-wrap {
  display: flex;
  gap: 20px;
  align-items: center;
}

.donut-chart-container {
  flex-shrink: 0;
  width: 180px;
  height: 180px;
}

.donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-pct {
  margin-left: auto;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 13px;
}

/* ── Map Panel ─────────────────────────────────────────────── */
.map-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 18px;
}

.map-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all var(--transition);
}

.map-card:hover {
  border-color: rgba(0, 180, 216, .3);
  box-shadow: var(--shadow-glow);
}

.svg-map-wrap {
  width: 100%;
}

.estado-shape {
  fill: var(--bg-card2);
  stroke: var(--ocean);
  stroke-width: 3;
  transition: all var(--transition);
  cursor: pointer;
}

.estado-shape:hover {
  fill: rgba(0, 180, 216, 0.4);
  stroke: var(--sky);
  stroke-width: 4;
}

.estado-shape.selected {
  fill: rgba(6, 214, 160, 0.35) !important;
  stroke: var(--growth) !important;
  stroke-width: 4;
}

text {
  pointer-events: none;
  font-family: 'Syne', sans-serif;
  opacity: 0.8;
}

/* ── Section Label ─────────────────────────────────────────── */
.section-title {
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--sky);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--sky);
}

/* ── Tooltip shared ────────────────────────────────────────── */
.chart-tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  z-index: 9999;
  display: none;
  min-width: 140px;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .charts-grid .chart-card.full {
    grid-column: span 1;
  }

  .map-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* ── Topbar mobile: compacto e limpo ── */
  .topbar {
    padding: 0 14px;
    height: 58px;
  }

  /* Esconde export e status — acessíveis pelo menu lateral */
  .export-group,
  .last-updated {
    display: none;
  }

  .topbar-right {
    display: none;
  }

  .topbar-left {
    gap: 10px;
    min-width: 0;
  }

  .topbar-left > div {
    min-width: 0;
    overflow: hidden;
  }

  .topbar-left h2 {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-left p {
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* KPI grid: 2 colunas no tablet/mobile médio */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Mobile pequeno (smartphones ≤ 500px) ── */
@media (max-width: 500px) {
  .topbar {
    padding: 0 12px;
    height: 54px;
  }

  .topbar-left h2 {
    font-size: 13px;
  }

  .topbar-left p {
    display: none; /* subtítulo oculto em telas muito pequenas */
  }

  /* KPI em coluna única em telas bem pequenas */
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 14px;
    gap: 14px;
  }
}

/* ── Relatório PDF (oculto por padrão) ──────────────────────── */
#relatorio-pdf { display: none; }

.print-footer { display: none; }

/* ── Print / PDF ────────────────────────────────────────────── */
@media print {
  @page { size: A4 landscape; margin: 0; }

  body { background: #fff !important; margin: 0; padding: 0; }

  /* Esconde o dashboard inteiro */
  .sidebar, .sidebar-overlay, .main,
  .chart-tooltip { display: none !important; }

  /* Mostra o relatório */
  #relatorio-pdf {
    display: block !important;
    position: static;
  }

  .rp-page {
    width: 297mm; height: 210mm;
    page-break-after: always;
    page-break-inside: avoid;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    font-family: 'Inter', Arial, sans-serif;
    color: #1a1a2e;
    background: #fff;
  }
  .rp-page:last-child { page-break-after: auto; }

  /* Header */
  .rp-hdr {
    display: flex; justify-content: space-between; align-items: center;
    background: #0a2540; color: #fff;
    padding: 8px 24px; font-size: 9pt; font-weight: 600;
    letter-spacing: 0.5px;
  }
  .rp-hdr-pg { font-weight: 400; opacity: 0.8; }

  /* Footer */
  .rp-ftr {
    position: absolute; bottom: 0; left: 0; right: 0;
    text-align: center; font-size: 7.5pt; color: #888;
    padding: 6px 24px; border-top: 1px solid #ddd;
    background: #fff;
  }

  /* Content area */
  .rp-body {
    padding: 16px 28px 36px;
  }

  /* ── Page 1: Capa ── */
  .rp-capa-title {
    text-align: center; margin-top: 12px;
    font-size: 22pt; font-weight: 800; color: #0a2540;
    letter-spacing: -0.5px;
  }
  .rp-capa-sub {
    text-align: center; font-size: 11pt; color: #555;
    margin: 4px 0 2px; font-weight: 400;
  }
  .rp-capa-comp {
    text-align: center; font-size: 10pt; color: #0077B6;
    font-weight: 600; margin-bottom: 18px;
  }

  .rp-kpi-row {
    display: flex; gap: 12px; justify-content: center; margin-bottom: 18px;
  }
  .rp-kpi-box {
    flex: 1; max-width: 200px;
    background: #f0f8ff; border: 1px solid #b0d4ea; border-radius: 8px;
    padding: 12px 14px; text-align: center;
  }
  .rp-kpi-label { font-size: 8.5pt; font-weight: 600; color: #555; text-transform: uppercase; letter-spacing: 0.5px; }
  .rp-kpi-val { font-size: 20pt; font-weight: 800; color: #0077B6; margin: 4px 0 2px; }
  .rp-kpi-desc { font-size: 7.5pt; color: #888; }

  .rp-tbl {
    width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 9pt;
  }
  .rp-tbl th {
    background: #0a2540; color: #fff; font-weight: 600;
    padding: 8px 12px; text-align: left;
  }
  .rp-tbl td {
    padding: 7px 12px; border-bottom: 1px solid #e0e8f0;
  }
  .rp-tbl tr:nth-child(even) td { background: #f7fbff; }
  .rp-tbl .best { color: #0a8754; font-weight: 600; }
  .rp-tbl .worst { color: #c0392b; font-weight: 600; }

  /* ── Pages 2-6: Chart pages ── */
  .rp-sec-title {
    font-size: 13pt; font-weight: 700; color: #0a2540;
    margin: 0 0 10px; padding-bottom: 6px;
    border-bottom: 2px solid #0077B6;
  }

  .rp-chart-area {
    display: flex; justify-content: center; align-items: center;
    margin: 8px 0;
  }
  .rp-chart-area canvas {
    max-width: 100%;
  }

  .rp-chart-row {
    display: flex; gap: 20px; align-items: flex-start; margin: 8px 0;
  }
  .rp-chart-main { flex: 2; display: flex; justify-content: center; }
  .rp-chart-side { flex: 1; display: flex; flex-direction: column; align-items: center; }

  .rp-insight {
    background: #f0f8ff; border-left: 4px solid #0077B6;
    border-radius: 0 6px 6px 0; padding: 10px 16px;
    font-size: 9pt; line-height: 1.6; color: #333;
    margin-top: 10px;
  }
  .rp-insight strong { color: #0077B6; }
  .rp-insight b { color: #0a2540; }

  /* ── Page 7: Decisões ── */
  .rp-tbl-dec th { font-size: 8.5pt; }
  .rp-tbl-dec td { font-size: 8.5pt; }

  .rp-pri-alta { background: #e74c3c; color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 7.5pt; font-weight: 700; }
  .rp-pri-media { background: #f39c12; color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 7.5pt; font-weight: 700; }
  .rp-pri-baixa { background: #27ae60; color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 7.5pt; font-weight: 700; }

  .rp-insights-cols {
    display: flex; gap: 20px; margin-top: 12px; font-size: 8.5pt; line-height: 1.7;
  }
  .rp-insights-cols > div { flex: 1; }
  .rp-insights-cols li { margin-bottom: 4px; color: #333; }
  .rp-insights-cols .hl { color: #0077B6; font-weight: 600; }

  .rp-desc-analitica {
    margin-top: 12px; font-size: 8.5pt; line-height: 1.7;
    color: #333; text-align: justify;
    border-top: 1px solid #ddd; padding-top: 10px;
  }
  .rp-desc-analitica h3 {
    font-size: 10pt; color: #0a2540; margin: 0 0 6px;
  }

  .rp-donut-legend {
    font-size: 8.5pt; margin-top: 8px;
  }
  .rp-donut-legend div {
    display: flex; align-items: center; gap: 6px; margin-bottom: 4px;
  }
  .rp-donut-legend .dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  }
  .rp-donut-legend .pct { font-weight: 700; color: #0077B6; margin-left: auto; }

  .rp-tipo-grid {
    display: flex; gap: 16px; margin-top: 8px;
  }
  .rp-tipo-card {
    flex: 1; background: #f7fbff; border: 1px solid #d0e4f0;
    border-radius: 8px; padding: 12px; text-align: center;
  }
  .rp-tipo-card h4 { font-size: 10pt; color: #0a2540; margin: 0 0 6px; }
  .rp-tipo-card .val { font-size: 14pt; font-weight: 800; color: #0077B6; }
  .rp-tipo-card .sub { font-size: 7.5pt; color: #888; margin-top: 2px; }
}

/* ── Simulador What-If ────────────────────────────────────── */
.sim-controls {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.sim-control-group {
  flex: 1;
  min-width: 200px;
}

.sim-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.sim-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sim-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--bg-card2);
  border-radius: 3px;
  outline: none;
}

.sim-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ocean), var(--sky));
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 180, 216, .5);
  border: 2px solid var(--sky);
}

.sim-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ocean), var(--sky));
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 180, 216, .5);
  border: 2px solid var(--sky);
}

.sim-input-number {
  width: 80px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--sky);
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 800;
  padding: 8px 12px;
  text-align: center;
}

.sim-input-number:focus {
  outline: none;
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, .15);
}

.sim-unit {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Bubble Chart Legend ──────────────────────────────────── */
.bubble-quadrant-legend {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  padding-top: 12px;
}

.bubble-quadrant-legend span {
  font-size: 10px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 50px;
  border: 1px solid var(--border);
}

/* ── Heatmap Legend ───────────────────────────────────────── */
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-secondary);
}

.heatmap-legend-bar {
  width: 140px;
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(90deg, #0D1526, #F4A261, #FF4757);
}

/* ── Radar Detail List ────────────────────────────────────── */
.radar-detail-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-card2);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  transition: all var(--transition);
}

.radar-detail-item:hover {
  border-color: rgba(0, 180, 216, .3);
  transform: translateX(3px);
}

.radar-detail-axis {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  min-width: 100px;
}

.radar-detail-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-base);
  border-radius: 3px;
  overflow: hidden;
}

.radar-detail-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--ocean), var(--sky));
  transition: width 0.6s ease;
}

.radar-detail-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--sky);
  width: 40px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Insights Cards ───────────────────────────────────────── */
.insights-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.insights-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: center;
}

.insights-summary-card .sum-value {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--sky);
}

.insights-summary-card .sum-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.insight-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all var(--transition);
  border-left: 4px solid var(--sky);
}

.insight-card:hover {
  border-color: rgba(0, 180, 216, .4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.insight-card.success {
  border-left-color: var(--growth);
}

.insight-card.warning {
  border-left-color: var(--sand);
}

.insight-card.alert {
  border-left-color: var(--sunset);
}

.insight-card.info {
  border-left-color: var(--sky);
}

.insight-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.insight-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.insight-body {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.insight-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 50px;
  margin-top: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.insight-tag.success {
  background: rgba(6, 214, 160, .12);
  color: var(--growth);
}

.insight-tag.warning {
  background: rgba(244, 162, 97, .12);
  color: var(--sand);
}

.insight-tag.alert {
  background: rgba(231, 111, 81, .12);
  color: var(--sunset);
}

.insight-tag.info {
  background: rgba(0, 180, 216, .12);
  color: var(--sky);
}

/* ── Report Button ────────────────────────────────────────── */
.btn-report {
  background: linear-gradient(135deg, #5b2c8a, #845EC2);
  box-shadow: 0 3px 10px rgba(132, 94, 194, .3);
}

.btn-report:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 16px rgba(132, 94, 194, .45);
}

/* ── Responsive: Novas features ───────────────────────────── */
@media (max-width: 1200px) {
  .insights-summary {
    grid-template-columns: repeat(3, 1fr);
  }

  .insights-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .sim-controls {
    flex-direction: column;
    gap: 16px;
  }

  .insights-summary {
    grid-template-columns: 1fr;
  }

  .bubble-quadrant-legend {
    flex-direction: column;
    align-items: center;
  }
}

/* ── Confidence Badges ────────────────────────────────────── */
.kpi-confidence {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 50px;
  margin-top: 4px;
  letter-spacing: 0.3px;
}

.conf-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 50px;
  white-space: nowrap;
}

.conf-verificado {
  background: rgba(6, 214, 160, .12);
  color: #06D6A0;
  border: 1px solid rgba(6, 214, 160, .25);
}

.conf-estimativa {
  background: rgba(244, 162, 97, .12);
  color: #F4A261;
  border: 1px solid rgba(244, 162, 97, .25);
}

.conf-projecao {
  background: rgba(132, 94, 194, .12);
  color: #845EC2;
  border: 1px solid rgba(132, 94, 194, .25);
}

/* ── Methodology Panel ────────────────────────────────────── */
.metodologia-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  color: #00B4D8;
  font-size: 15px;
  font-weight: 700;
  padding: 16px 24px;
  cursor: pointer;
  transition: all var(--transition);
}

.metodologia-toggle:hover {
  color: #90E0EF;
}

.metodologia-toggle:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: -2px;
  border-radius: var(--radius);
}

.metodologia-chevron {
  font-size: 18px;
  transition: transform var(--transition);
}

.metodologia-chevron.open {
  transform: rotate(90deg);
}

.metodologia-content {
  padding: 0 24px 20px;
  font-size: 0.82rem;
  color: #b0bec5;
  line-height: 1.7;
}

.metodologia-content h4 {
  color: #e0f0ff;
  font-size: 0.88rem;
  margin: 16px 0 6px;
}

.metodologia-content h4:first-child {
  margin-top: 0;
}

.metodologia-content ul {
  margin: 6px 0 6px 16px;
}

.metodologia-content li {
  margin-bottom: 4px;
}

.metodologia-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 12px;
  font-size: 0.8rem;
}

.metodologia-table th {
  background: rgba(0, 180, 216, 0.1);
  color: #e0f0ff;
  font-weight: 600;
  padding: 8px 12px;
  text-align: left;
  border: 1px solid rgba(0, 180, 216, 0.15);
}

.metodologia-table td {
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: #b0bec5;
}

.metodologia-table tbody tr:hover {
  background: rgba(0, 180, 216, 0.05);
}

.metodologia-disclaimer {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(231, 111, 81, 0.08);
  border: 1px solid rgba(231, 111, 81, 0.2);
  border-radius: 8px;
  color: #F4A261;
  font-size: 0.78rem;
  font-style: italic;
}

/* ── Principais Insights & Descrição Analítica ── */
#sec-analise {
  display: block !important;
}

.insights-list {
  list-style: none;
  padding: 20px 28px 28px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.insights-list li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  font-size: 0.92rem;
  color: #cfd8dc;
  line-height: 1.7;
}

.insight-text {
  flex: 1;
  text-align: justify;
}

.insight-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 7px;
}

.insight-dot.red { background: #e74c3c; }
.insight-dot.green { background: #2ecc71; }
.insight-dot.yellow { background: #f39c12; }
.insight-dot.purple { background: #9b59b6; }

.insights-list .hl {
  color: #00B4D8;
  font-weight: 600;
}

.insights-list .hl-num {
  color: #00B4D8;
  font-weight: 700;
}

.analise-text {
  padding: 20px 28px 28px;
}

.analise-text p {
  font-size: 0.92rem;
  color: #cfd8dc;
  line-height: 1.85;
  margin: 0;
  text-align: justify;
}

.analise-text .hl {
  color: #00B4D8;
  font-weight: 600;
}

.analise-text .hl-num {
  color: #00B4D8;
  font-weight: 700;
}