/* ============================================================
   ESTILOS MODERNOS - MATRIZ INSUMO-PRODUTO (MIP RJ)
   Template Reformulado, Limpo e Responsivo
   ============================================================ */

:root {
  --primary: #005a92;
  --primary-hover: #004570;
  --primary-light: #e0f2fe;
  --accent-green: #10b981;
  --accent-green-dark: #059669;
  --dark-slate: #0f172a;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-focus: #38bdf8;
  --font-family: 'Plus Jakarta Sans', 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* overflow: hidden !important; */
  height: max-content !important;
  margin: 0;
  padding: 0;
}

body.portal-body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   CABEÇALHO SUPERIOR MODERNO E LIMPO (Sem barra antiga)
   ============================================================ */
.main-header {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary) 0%, #0284c7 100%);
  color: #ffffff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 2px 6px rgba(0, 90, 146, 0.25);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--dark-slate);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Links de Navegação */
.main-nav .nav-links {
  list-style: none;
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.nav-btn {
  background: none;
  border: none;
  padding: 0.5rem 0.9rem;
  font-family: var(--font-family);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn:hover {
  color: var(--primary);
  background-color: #f1f5f9;
}

.nav-btn.active {
  color: var(--primary);
  background-color: var(--primary-light);
  font-weight: 700;
}

.btn-admin-access {
  display: inline-flex;
  align-items: center;
  background-color: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-admin-access:hover {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   CONTAINER PRINCIPAL & ABAS
   ============================================================ */
.page-main {
  padding: 2.2rem 0 4.5rem 0;
}

.main-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.pane-content {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.pane-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   HERO CARD DE APRESENTAÇÃO
   ============================================================ */
.hero-card {
  background: linear-gradient(135deg, #00375e 0%, #005a92 100%);
  color: #ffffff;
  border-radius: 12px;
  padding: 2.8rem 2.2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #e0f2fe;
  margin-bottom: 1rem;
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 0.8rem;
  line-height: 1.2;
}

.hero-lead {
  font-size: 1.05rem;
  color: #e2e8f0;
  max-width: 800px;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.hero-tags {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.tag-item {
  font-size: 0.82rem;
  color: #bae6fd;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.15);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
}

/* ============================================================
   CARD DE CONTEÚDO METODOLÓGICO
   ============================================================ */
.content-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.2rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2.5rem;
}

.card-section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--dark-slate);
  margin-bottom: 1.4rem;
  display: flex;
  align-items: center;
}

.article-body {
  font-size: 0.98rem;
  color: #334155;
  line-height: 1.8;
  text-align: justify;
}

.article-body p {
  margin-bottom: 1.2rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
  margin: 1.8rem 0;
  text-align: left;
}

@media (max-width: 992px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.feature-item {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.95rem;
  box-shadow: 0 2px 6px rgba(0, 90, 146, 0.04);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left !important;
}

.feature-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 90, 146, 0.09);
  border-left-color: #0284c7;
  border-color: #cbd5e1;
}

.feature-letter {
  background: linear-gradient(135deg, var(--primary) 0%, #0284c7 100%);
  color: #ffffff;
  font-weight: 800;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  margin-top: 2px;
  box-shadow: 0 2px 6px rgba(0, 90, 146, 0.22);
  text-transform: lowercase;
}

.feature-item span:not(.feature-letter) {
  font-size: 0.93rem;
  color: #1e293b;
  font-weight: 500;
  line-height: 1.5;
  text-align: left !important;
  text-justify: auto !important;
  display: block;
}

.quick-modals-bar {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.8rem;
  padding-top: 1.5rem;
  border-top: 1px solid #f1f5f9;
  flex-wrap: wrap;
}

.btn-clean-action {
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 0.6rem 1.1rem;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-clean-action:hover {
  background-color: #ffffff;
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.btn-green-action:hover {
  border-color: var(--accent-green);
  color: var(--accent-green-dark);
}

/* ============================================================
   SELETOR DE NÍVEL DE AGREGAÇÃO (CARDS)
   ============================================================ */
.aggregation-choice-section {
  margin-bottom: 2rem;
}

.choice-header {
  text-align: center;
  margin-bottom: 1.8rem;
}

.choice-header h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--dark-slate);
  margin-bottom: 0.4rem;
}

.choice-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.calc-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.calc-card-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem 1.6rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}

.calc-card-item:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.calc-card-item.featured {
  border-color: #bae6fd;
  background: linear-gradient(180deg, #ffffff 0%, #f0f9ff 100%);
}

.card-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  background-color: #f1f5f9;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.card-badge.highlight {
  color: #0369a1;
  background-color: #e0f2fe;
}

.calc-card-icon {
  font-size: 2.2rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.calc-card-item h4 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dark-slate);
  margin-bottom: 0.5rem;
}

.calc-card-item p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.btn-card-launch {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  padding: 0;
}

/* ============================================================
   PAINEL DA CALCULADORA (12x12, 16x16, 56x56)
   ============================================================ */
.calc-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.8rem;
  flex-wrap: wrap;
  gap: 1.2rem;
}

.calc-breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  display: flex;
  gap: 0.4rem;
}

.calc-breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.calc-active-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--dark-slate);
  letter-spacing: -0.5px;
  margin-bottom: 0.4rem;
}

.calc-lead-text {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 700px;
}

.calc-header-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.level-switch {
  background-color: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
  display: inline-flex;
}

.level-btn {
  background: none;
  border: none;
  font-family: var(--font-family);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
}

.level-btn.active {
  background-color: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.btn-reset-calc {
  background-color: #ffffff;
  border: 1px solid var(--border);
  color: #334155;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s;
}

.btn-reset-calc:hover {
  background-color: #f8fafc;
  border-color: #94a3b8;
}

/* ============================================================
   HUD DO IMPACTO ECONÔMICO (CARD RESULTADO)
   ============================================================ */
.impact-dashboard-card {
  background: linear-gradient(135deg, #002f54 0%, #005a92 100%);
  color: #ffffff;
  border-radius: 12px;
  padding: 2rem 2.2rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.impact-col-primary {
  display: flex;
  flex-direction: column;
}

.hud-label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #93c5fd;
  margin-bottom: 0.4rem;
}

.hud-big-metric {
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1;
  color: #ffffff;
  margin-bottom: 0.3rem;
  transition: color 0.2s ease;
}

.hud-status {
  font-size: 0.85rem;
  color: #bfdbfe;
}

.impact-col-secondary {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.hud-stat-box {
  display: flex;
  flex-direction: column;
}

.hud-stat-label {
  font-size: 0.78rem;
  color: #93c5fd;
  margin-bottom: 0.2rem;
}

.hud-stat-num {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
}

/* Filtro e Tabela de Setores */
.sectors-filter-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
}

.search-sector-input {
  position: relative;
  max-width: 380px;
  width: 100%;
  display: flex;
  align-items: center;
}

.search-sector-input i {
  position: absolute;
  left: 12px;
  color: #94a3b8;
}

.search-sector-input input {
  width: 100%;
  padding: 0.6rem 0.8rem 0.6rem 2.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  outline: none;
  background-color: #ffffff;
}

.search-sector-input input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 90, 146, 0.15);
}

.counter-badge {
  background-color: #f1f5f9;
  color: #475569;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: 20px;
}

.table-card-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.sectors-calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.sectors-calc-table th {
  background-color: #f8fafc;
  color: #1e293b;
  font-weight: 700;
  padding: 0.85rem 1.1rem;
  border-bottom: 2px solid var(--border);
}

.sectors-calc-table td {
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.sectors-calc-table tbody tr:hover {
  background-color: #f8fafc;
}

.input-delta-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.delta-input {
  width: 120px;
  padding: 0.5rem 0.6rem;
  text-align: center;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.95rem;
  outline: none;
  background-color: #fcfcfc;
  transition: all 0.2s;
}

.delta-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 90, 146, 0.2);
  background-color: #ffffff;
}

.delta-input.pos {
  color: #15803d;
  background-color: #f0fdf4;
  border-color: #86efac;
}

.delta-input.neg {
  color: #b91c1c;
  background-color: #fef2f2;
  border-color: #fca5a5;
}

/* ============================================================
   MODAIS
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background-color: #ffffff;
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 0.2s ease-out;
}

.modal-box.modal-lg {
  max-width: 780px;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(-15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-box-header {
  padding: 1.2rem 1.6rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-box-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 1.6rem;
  color: #94a3b8;
  cursor: pointer;
}

.modal-box-body {
  padding: 1.6rem;
  max-height: 65vh;
  overflow-y: auto;
  font-size: 0.95rem;
  line-height: 1.7;
}

.modal-box-footer {
  padding: 1rem 1.6rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.btn-modal-ok {
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  padding: 0.55rem 1.3rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.modal-search-wrapper input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.codigos-flow-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.codigo-row {
  display: flex;
  gap: 0.8rem;
  padding: 0.5rem 0.8rem;
  background-color: #f8fafc;
  border-radius: 6px;
  font-size: 0.88rem;
}

.codigo-badge-pub {
  font-weight: 800;
  color: var(--primary);
  min-width: 48px;
}

/* ============================================================
   RODAPÉ MODERNO
   ============================================================ */
.main-footer {
  background-color: #ffffff;
  border-top: 1px solid var(--border);
  padding: 1.8rem 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.footer-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-credits {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 0.2rem;
}

.footer-admin-link {
  color: #475569;
  text-decoration: none;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
}

.footer-admin-link:hover {
  background-color: #f1f5f9;
  color: var(--primary);
}

/* ============================================================
   RESPONSIVIDADE COMPLETA PARA DISPOSITIVOS MÓVEIS (MOBILE & TABLET)
   ============================================================ */

.mobile-menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  font-size: 1.4rem;
  color: var(--text-main);
  cursor: pointer;
  line-height: 1;
}

@media (max-width: 768px) {
  .header-container {
    padding: 0.75rem 1rem;
  }

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

  .main-nav {
    display: none;
    width: 100%;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
  }

  .main-nav.open {
    display: block;
  }

  .main-nav .nav-links {
    flex-direction: column;
    gap: 0.35rem;
    width: 100%;
  }

  .nav-btn {
    width: 100%;
    text-align: left;
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
  }

  .page-main {
    padding: 1.2rem 0 3rem 0;
  }

  .main-container {
    padding: 0 1rem;
  }

  /* Hero Section */
  .hero-card {
    padding: 1.8rem 1.2rem;
    border-radius: 10px;
    margin-bottom: 1.4rem;
  }

  .hero-title {
    font-size: 1.65rem;
  }

  .hero-lead {
    font-size: 0.92rem;
    line-height: 1.55;
  }

  .hero-tags {
    gap: 0.6rem;
  }

  .tag-item {
    font-size: 0.75rem;
  }

  /* Content Card */
  .content-card {
    padding: 1.4rem 1.1rem;
    border-radius: 10px;
    margin-bottom: 1.8rem;
  }

  .card-section-title {
    font-size: 1.2rem;
  }

  .article-body {
    font-size: 0.92rem;
    text-align: left;
    line-height: 1.7;
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .quick-modals-bar {
    flex-direction: column;
  }

  .btn-clean-action {
    width: 100%;
    justify-content: center;
    padding: 0.7rem 1rem;
  }

  /* Cards Grid */
  .calc-cards-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .calc-card-item {
    padding: 1.5rem 1.2rem;
  }

  /* Calculadora Panel */
  .calc-panel-header {
    flex-direction: column;
    gap: 1rem;
  }

  .calc-active-title {
    font-size: 1.5rem;
  }

  .calc-header-controls {
    width: 100%;
    flex-direction: column;
    gap: 0.6rem;
  }

  .level-switch {
    width: 100%;
    justify-content: space-between;
  }

  .level-btn {
    flex: 1;
    text-align: center;
    padding: 0.55rem;
  }

  .btn-reset-calc {
    width: 100%;
    justify-content: center;
    padding: 0.65rem;
  }

  /* HUD Impacto */
  .impact-dashboard-card {
    padding: 1.5rem 1.2rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.2rem;
  }

  .hud-big-metric {
    font-size: 2.4rem;
  }

  .impact-col-secondary {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .hud-stat-box:nth-child(3) {
    grid-column: span 2;
  }

  .hud-stat-num {
    font-size: 1.05rem;
  }

  /* Tabela da Calculadora */
  .sectors-filter-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .search-sector-input {
    max-width: 100%;
  }

  .counter-badge {
    align-self: flex-start;
  }

  .sectors-calc-table {
    font-size: 0.85rem;
  }

  .sectors-calc-table th,
  .sectors-calc-table td {
    padding: 0.65rem 0.75rem;
  }

  .delta-input {
    width: 85px;
    padding: 0.45rem 0.3rem;
    font-size: 0.9rem;
    min-height: 40px;
    /* Touch target amigável */
  }

  /* Footer */
  .footer-inner {
    flex-direction: column;
    text-align: center;
    gap: 0.8rem;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.4rem;
  }

  .hud-big-metric {
    font-size: 2.1rem;
  }

  .impact-col-secondary {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .hud-stat-box:nth-child(3) {
    grid-column: span 1;
  }
}

/* ============================================================
   ESTILOS DAS MATRIZES OFICIAIS, BOTÕES DE SETORES E GRÁFICOS
   ============================================================ */

.btn-top-graficos-container {
  display: flex;
  justify-content: center;
  margin: 1rem 0 1.5rem;
}

.btn-top-graficos {
  background-color: #004b87;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 0.65rem 1.6rem;
  font-size: 0.95rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 75, 135, 0.25);
  transition: all 0.2s ease;
}

.btn-top-graficos:hover {
  background-color: #003661;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 75, 135, 0.35);
}

/* Abas de Navegação Interna da Dimensão */
.matrix-mode-tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.matrix-mode-tab {
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.55rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.matrix-mode-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.matrix-mode-tab.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Caixa de Instrução dos Setores */
.instruction-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.5rem 1.2rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  color: #334155;
  max-width: 580px;
  margin: 0 auto 0.85rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

/* Container dos Botões de Setores (Chips) */
.sector-chips-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 1.8rem;
}

.sector-chip {
  background-color: #004b87;
  color: #ffffff;
  border: none;
  border-radius: 5px;
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.sector-chip:hover {
  background-color: #003661;
}

.sector-chip.hidden-col {
  background-color: #cbd5e1;
  color: #64748b;
  text-decoration: line-through;
}

.sector-chip-all {
  background-color: #0f172a;
  color: #ffffff;
  border: none;
  border-radius: 5px;
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.sector-chip-all:hover {
  background-color: #1e293b;
}

/* Card das Matrizes Oficiais */
.matrix-viewer-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.matrix-header-center {
  text-align: center;
  margin-bottom: 1rem;
}

.matrix-title-main {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.matrix-downloads-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 0.6rem;
}

.matrix-dl-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #005a92;
  text-decoration: none;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  background-color: #f1f5f9;
  transition: all 0.2s ease;
}

.matrix-dl-link:hover {
  background-color: #e2e8f0;
  color: #003d63;
}

.matrix-desc-text {
  font-size: 0.85rem;
  color: #475569;
  max-width: 900px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Tabela da Matriz - sem barra de rolagem interna; usa apenas a rolagem da página */
.matrix-table-scroll {
  height: auto !important;
  /* Permite que o elemento cresça naturalmente */
  max-height: none !important;
  /* Remove limite de altura */
  overflow: visible !important;
  width: 100%;
  overflow-x: hidden !important;
  overflow-y: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  position: relative;
}

.table-matrix-grid {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 0.8rem;
}

.table-matrix-grid th,
.table-matrix-grid td {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid #f1f5f9;
  border-right: 1px solid #f1f5f9;
  white-space: nowrap;
}

.table-matrix-grid thead th {
  background-color: #ffffff;
  color: #0f172a;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  text-align: right;
}

.table-matrix-grid thead th.col-corner {
  left: 0;
  z-index: 20;
  text-align: center;
  background-color: #f8fafc;
}

.table-matrix-grid tbody td.row-header {
  position: sticky;
  left: 0;
  background-color: #ffffff;
  color: #0f172a;
  font-weight: 700;
  z-index: 5;
  text-align: left;
  border-right: 2px solid #e2e8f0;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.03);
}

.table-matrix-grid tbody td.num-cell {
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #334155;
  transition: background 0.15s ease;
}

.table-matrix-grid tbody tr:hover td {
  background-color: #f8fafc;
}

.table-matrix-grid tbody tr:hover td.row-header {
  background-color: #f1f5f9;
}

.table-matrix-grid td.col-hidden,
.table-matrix-grid th.col-hidden {
  display: none !important;
}

/* Gráficos Interativos */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
}

.chart-card-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.chart-card-header {
  margin-bottom: 1.2rem;
}

.chart-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark-slate);
}

.chart-card-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.chart-canvas-container {
  position: relative;
  height: 420px;
  width: 100%;
}