* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --gov-green: #007D3A;
  --gov-green-dark: #005e2a;
  --gov-green-light: #e6f4ec;
  --gov-blue: #1a365d;
  --gov-gray-100: #f8f9fa;
  --gov-gray-200: #e9ecef;
  --gov-gray-300: #dee2e6;
  --gov-gray-500: #6c757d;
  --gov-gray-700: #495057;
  --gov-gray-900: #212529;
  --gov-shadow: 0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
  --gov-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.10), 0 4px 6px -2px rgba(0,0,0,0.05);
  --gov-radius: 8px;
  --gov-radius-lg: 12px;
}

body {
  font-family: Inter, "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--gov-gray-100);
  color: var(--gov-gray-900);
  font-size: 14px;
  line-height: 1.5;
  min-width: 320px;
}

.header-gov {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: var(--gov-green);
  border-bottom: 3px solid var(--gov-green-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 1000;
  box-shadow: var(--gov-shadow);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
}

.header-left {
  gap: 16px;
  min-width: 0;
}

.header-right {
  gap: 20px;
}

.logo-gov {
  display: block;
  width: 180px;
  height: 48px;
  object-fit: contain;
  background: #ffffff;
  border-radius: 8px;
  padding: 6px 10px;
  box-shadow: 0 1px 4px rgba(0, 84, 39, 0.20);
  flex-shrink: 0;
}

.header-titles h1 {
  color: #ffffff;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.header-titles h2 {
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 400;
  margin-top: 2px;
}

.badge {
  background: #ffffff;
  color: var(--gov-green);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

.date {
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
}

.container-main {
  display: flex;
  padding-top: 72px;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: #ffffff;
  border-right: 1px solid var(--gov-gray-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 72px;
  bottom: 0;
  left: 0;
  overflow-y: auto;
  z-index: 900;
}

.nav-menu {
  padding: 24px 16px;
  flex: 1;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-title,
.tabs-title {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gov-green-dark);
  padding: 9px 12px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--gov-green-light), #ffffff);
  border: 1px solid #cfe6d8;
  border-left: 4px solid var(--gov-green);
  border-radius: var(--gov-radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.nav-item,
.tab {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: var(--gov-radius);
  background: transparent;
  color: var(--gov-gray-700);
  cursor: pointer;
  font: inherit;
  font-weight: 550;
  text-align: left;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-item:hover,
.tab:hover {
  background: var(--gov-gray-100);
  color: var(--gov-green);
}

.nav-item.active,
.tab.active {
  background: var(--gov-green);
  color: #ffffff;
}

.nav-icon,
.tab-icon {
  width: 24px;
  text-align: center;
  font-size: 18px;
  flex-shrink: 0;
}

.nav-text,
.tab-label {
  min-width: 0;
}

.nav-badge {
  margin-left: auto;
  background: #ffffff;
  color: var(--gov-green);
  border-radius: 10px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--gov-gray-200);
}

.institution {
  text-align: center;
}

.institution-name,
.institution-year {
  display: block;
}

.institution-name {
  color: var(--gov-gray-700);
  font-size: 12px;
  font-weight: 650;
}

.institution-year {
  color: var(--gov-gray-500);
  font-size: 11px;
  margin-top: 2px;
}

.main-content {
  margin-left: 260px;
  flex: 1;
  min-width: 0;
  padding: 32px 32px 100px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.dashboard {
  max-width: 1360px;
  margin: 0 auto;
}

.dashboard-intro {
  background: linear-gradient(135deg, #ffffff 0%, #eef8f2 100%);
  border: 1px solid #cfe6d8;
  border-left: 5px solid var(--gov-green);
  border-radius: var(--gov-radius-lg);
  box-shadow: var(--gov-shadow);
  padding: 22px 24px;
  margin-bottom: 24px;
}

.dashboard-intro.compact {
  margin-bottom: 24px;
}

.eyebrow {
  color: var(--gov-green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.dashboard-intro h1 {
  color: var(--gov-gray-900);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 6px;
}

.intro-text {
  color: var(--gov-gray-500);
  font-size: 14px;
  max-width: 760px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.kpi-card {
  background: linear-gradient(180deg, #ffffff 0%, #f1f8f4 100%);
  border: 1px solid #cfe6d8;
  border-radius: var(--gov-radius-lg);
  box-shadow: var(--gov-shadow);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
  padding: 20px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--gov-shadow-lg);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  background: var(--gov-green-light);
  border-radius: var(--gov-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.kpi-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.kpi-value {
  color: var(--gov-gray-900);
  font-size: 24px;
  font-weight: 750;
  line-height: 1.2;
}

.kpi-label {
  color: var(--gov-gray-500);
  font-size: 13px;
  margin-top: 4px;
}

.kpi-trend {
  color: var(--gov-gray-500);
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
}

.kpi-trend.positive {
  color: var(--gov-green);
}

.grid-2-cols,
.grid-1-col {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
}

.grid-2-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.card {
  background: linear-gradient(180deg, #ffffff 0%, #f3faf6 100%);
  border: 1px solid #cfe1d6;
  border-radius: var(--gov-radius-lg);
  box-shadow: 0 8px 20px rgba(20, 83, 45, 0.08), 0 1px 3px rgba(0,0,0,0.08);
  padding: 20px;
  min-width: 0;
  min-height: 360px;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--gov-green), #16a085);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

.chart-header {
  background: linear-gradient(135deg, #eef8f2 0%, #ffffff 100%);
  border: 1px solid #dbe9e1;
  border-left: 5px solid var(--gov-green);
  border-radius: var(--gov-radius);
  margin-bottom: 18px;
  padding: 14px 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.chart-header h3 {
  color: #183b2a;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.25;
  margin-bottom: 5px;
}

.chart-subtitle {
  color: #60756a;
  display: block;
  font-size: 12px;
  font-weight: 500;
}

.chart-title {
  display: none;
}

.card > div[id^="grafica"] {
  width: 100%;
  min-height: 300px;
  position: relative;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(219, 233, 225, 0.72);
  border-radius: var(--gov-radius);
  padding: 6px;
  overflow-x: auto;
  overflow-y: hidden;
}

.card > div[id="graficaDispersion2025"] {
  min-height: 460px;
}

.card > div[id^="grafica"] .apexcharts-canvas {
  position: relative !important;
}

.apexcharts-canvas {
  display: block !important;
}

.apexcharts-xaxis-label text,
.apexcharts-yaxis-label text,
.apexcharts-yaxis text {
  font-size: 11px !important;
}

.apexcharts-xaxis text {
  white-space: normal !important;
}

.custom-tooltip {
  display: grid;
  gap: 4px;
  min-width: 220px;
  padding: 10px 12px;
  color: #1f2d27;
  font-size: 12px;
  line-height: 1.35;
}

.custom-tooltip strong {
  color: var(--gov-green);
  font-size: 13px;
}

.custom-tooltip span {
  display: block;
}

@media (max-width: 1200px) {
  .kpi-grid,
  .grid-2-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .header-gov {
    height: 76px;
    padding: 0 16px;
  }

  .header-right {
    display: none;
  }

  .sidebar {
    position: static;
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--gov-gray-200);
  }

  .container-main {
    display: block;
    padding-top: 76px;
  }

  .main-content {
    margin-left: 0;
    padding: 20px 16px 80px;
  }

  .nav-menu {
    padding: 14px 16px;
  }

  .nav-section {
    margin-bottom: 0;
  }

  .nav-section {
    display: grid;
    gap: 10px;
  }

  .nav-item,
  .tab {
    min-height: 48px;
  }

  .nav-section .nav-title {
    margin-bottom: 10px;
  }

  .tab {
    max-width: none;
  }

  .sidebar-footer {
    display: none;
  }
}

@media (max-width: 680px) {
  .header-gov {
    height: 88px;
    align-items: center;
  }

  .container-main {
    padding-top: 88px;
  }

  .header-left {
    width: 100%;
    gap: 10px;
  }

  .header-titles h1 {
    font-size: 15px;
    line-height: 1.2;
  }

  .logo-gov {
    width: 128px;
    height: 40px;
    padding: 5px 8px;
  }

  .header-titles h2 {
    display: none;
  }

  .dashboard-intro h1 {
    font-size: 22px;
  }

  .kpi-grid,
  .grid-2-cols {
    grid-template-columns: 1fr;
  }

  .main-content {
    padding: 16px 12px 72px;
  }

  .dashboard-intro {
    margin-bottom: 16px;
  }

  .kpi-grid,
  .grid-2-cols,
  .grid-1-col {
    gap: 14px;
    margin-bottom: 14px;
  }

  .card,
  .dashboard-intro,
  .kpi-card {
    padding: 16px;
  }

  .kpi-card {
    align-items: center;
    gap: 12px;
  }

  .kpi-icon {
    width: 42px;
    height: 42px;
    font-size: 21px;
  }

  .kpi-value {
    font-size: 21px;
  }

  .chart-header {
    margin-bottom: 14px;
    padding: 12px 12px;
  }

  .chart-header h3 {
    font-size: 14px;
  }

  .chart-subtitle {
    font-size: 11px;
  }

  .card > div[id^="grafica"] {
    min-height: 280px;
    padding: 4px;
  }

  .card > div[id="graficaDispersion2025"] {
    min-height: 420px;
  }

  .apexcharts-yaxis-title,
  .apexcharts-xaxis-title {
    font-size: 10px !important;
  }
}

@media (max-width: 480px) {
  .header-gov {
    height: 102px;
    padding: 10px 12px;
  }

  .container-main {
    padding-top: 102px;
  }

  .header-left {
    align-items: flex-start;
    flex-direction: column;
  }

  .logo-gov {
    width: 150px;
    height: 38px;
  }

  .header-titles h1 {
    font-size: 14px;
  }

  .sidebar {
    background: #fdfefd;
  }

  .nav-menu {
    padding: 10px 12px;
  }

  .nav-section {
    grid-template-columns: 1fr 1fr;
  }

  .nav-title,
  .tabs-title {
    grid-column: 1 / -1;
    padding: 8px 10px;
  }

  .nav-item,
  .tab {
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    padding: 10px 8px;
    text-align: center;
  }

  .nav-icon,
  .tab-icon {
    width: auto;
    font-size: 16px;
  }

  .nav-badge {
    display: none;
  }

  .dashboard-intro h1 {
    font-size: 20px;
  }

  .intro-text {
    font-size: 13px;
  }

  .card {
    min-height: 330px;
  }

  .card > div[id^="grafica"] {
    min-width: 360px;
  }

  .card > div[id="graficaUrbanoRural"],
  .card > div[id="graficaAnual2024"],
  .card > div[id="graficaPie2024"] {
    min-width: 0;
  }

  .card > div[id="graficaDispersion2025"] {
    min-width: 520px;
  }
}
