:root {
      --terra-vermelha: #8a4f32;
      --ocre-solar: #d39a34;
      --verde-caatinga: #66764a;
      --carvao: #1f1f1f;
      --areia: #f3efe4;
      --vermelho-alerta: #a22f24;
      --painel-opacidade: 0.80;
    }
    html, body {
      margin: 0;
      width: 100%;
      height: 100%;
      font-family: "Open Sans", Arial, Helvetica, sans-serif;
      background: var(--carvao);
    }
    #mapa-usinas-ne {
      position: relative;
      width: 100%;
      height: 100vh;
      height: 100dvh;
      overflow: hidden;
    }
    #map {
      width: 100%;
      height: 100%;
    }
    .leaflet-control-attribution {
      font-size: 10px;
    }
    .rotulo-uf {
      background: transparent;
      border: 0;
      box-shadow: none;
      color: #323232;
      font-family: "Open Sans", Arial, sans-serif;
      font-size: 13.333px;
      line-height: 1;
      font-weight: 400;
      letter-spacing: 0;
      -webkit-text-stroke: 2px rgba(250, 250, 250, 0.98);
      paint-order: stroke fill;
      filter: drop-shadow(3.8px 3.8px 3px rgba(0, 0, 0, 0.30));
      pointer-events: none;
    }
    .rotulo-uf::before {
      display: none;
    }
    .uf-selecionavel {
      cursor: pointer;
      outline: none;
      transition: fill-opacity 160ms ease, stroke-width 160ms ease, filter 160ms ease;
    }
    .uf-selecionavel:focus {
      stroke: #d39a34 !important;
      stroke-width: 1px !important;
      fill: #8a4f32 !important;
      fill-opacity: 0.04 !important;
      filter: none;
    }
    #mapa-usinas-ne.modo-inicial .uf-selecionavel:hover {
      stroke: #d39a34 !important;
      stroke-width: 1px !important;
      fill: #8a4f32 !important;
      fill-opacity: 0.04 !important;
      filter: none;
    }
    .rotulo-municipio {
      background: transparent;
      border: 0;
      box-shadow: none;
      color: #ffffff;
      font-size: 10px;
      line-height: 1.1;
      font-weight: 700;
      letter-spacing: 0;
      text-shadow: 0 1px 4px rgba(15, 23, 42, 0.9);
      pointer-events: none;
      white-space: nowrap;
    }
    .rotulo-municipio-esquerda {
      text-align: right;
    }
    .rotulo-municipio-centro {
      text-align: center;
    }
    .rotulo-municipio::before {
      display: none;
    }
    .municipio-usina-brilho {
      filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.3));
    }
    .tooltip-usina {
      border: 1px solid rgba(15, 23, 42, 0.18);
      border-radius: 6px;
      padding: 6px 8px;
      background: rgba(255, 255, 255, 0.96);
      color: #0f172a;
      box-shadow: 0 8px 22px rgba(15, 23, 42, 0.2);
      font-size: 11px;
      line-height: 1.25;
      font-weight: 600;
    }
    .painel-story {
      position: absolute;
      z-index: 690;
      top: 14px;
      right: 14px;
      width: min(470px, 38vw);
      max-width: calc(100% - 28px);
      max-height: calc(100% - 28px);
      box-sizing: border-box;
      overflow: hidden;
      background: rgba(243, 239, 228, var(--painel-opacidade));
      border: 1px solid rgba(138, 79, 50, 0.56);
      border-radius: 4px;
      padding: 18px 24px;
      color: var(--carvao);
      box-shadow: 0 14px 34px rgba(31, 31, 31, 0.26);
    }
    .painel-story.oculto {
      display: none;
    }
    .story-cabecalho {
      font-size: 10px;
      line-height: 1.2;
      font-weight: 800;
      letter-spacing: 0;
      text-transform: uppercase;
      color: var(--verde-caatinga);
      margin-bottom: 14px;
    }
    .story-titulo {
      font-family: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
      font-size: 31px;
      line-height: 1.02;
      font-weight: 900;
      letter-spacing: 0;
      text-transform: uppercase;
      color: var(--terra-vermelha);
      margin: 0 0 16px;
    }
    .story-subtitulo {
      font-size: 15px;
      line-height: 1.35;
      font-weight: 800;
      margin: 0 0 22px;
      color: var(--carvao);
    }
    .story-corpo {
      font-size: 12px;
      line-height: 1.55;
      margin: 0;
      color: var(--carvao);
    }
    .story-corpo p {
      margin: 0 0 12px;
    }
    .story-corpo p:last-child {
      margin-bottom: 0;
    }
    .story-dashboard {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 14px;
      margin-top: 14px;
      padding-top: 12px;
      border-top: 2px solid rgba(138, 79, 50, 0.66);
    }
    .story-fonte-dados {
      margin: 12px 0 0;
      padding-top: 9px;
      border-top: 1px solid rgba(138, 79, 50, 0.28);
      font-size: 10px;
      line-height: 1.35;
      color: var(--carvao);
    }
    .story-fonte-dados a {
      color: inherit;
      text-decoration: underline;
      text-underline-offset: 2px;
    }
    .story-chart {
      min-width: 0;
      margin: 0;
    }
    .story-chart + .story-chart {
      border-left: 1px solid rgba(138, 79, 50, 0.30);
      padding-left: 13px;
    }
    .story-chart h2 {
      margin: 0 0 10px;
      font-family: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
      font-size: 15px;
      line-height: 1.05;
      font-weight: 900;
      letter-spacing: 0;
      text-transform: uppercase;
      color: var(--terra-vermelha);
    }
    .story-chart-list {
      display: grid;
      gap: 6px;
    }
    .story-chart-row {
      display: grid;
      gap: 4px;
    }
    .story-chart-label {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: baseline;
      gap: 10px;
      color: var(--carvao);
      font-size: 9px;
      line-height: 1.2;
    }
    .story-chart-label strong {
      min-width: 0;
      overflow-wrap: anywhere;
      font-weight: 800;
    }
    .story-chart-label span {
      color: var(--terra-vermelha);
      font-weight: 800;
      white-space: nowrap;
    }
    .story-chart-track {
      height: 6px;
      overflow: hidden;
      background: rgba(102, 118, 74, 0.20);
    }
    .story-chart-fill {
      display: block;
      height: 100%;
      background: var(--terra-vermelha);
    }
    .painel-usina {
      position: absolute;
      z-index: 700;
      top: 14px;
      right: 14px;
      width: min(410px, 36vw);
      max-width: calc(100% - 28px);
      max-height: calc(100% - 28px);
      overflow: auto;
      box-sizing: border-box;
      background: rgba(243, 239, 228, var(--painel-opacidade));
      border: 1px solid rgba(138, 79, 50, 0.56);
      border-radius: 4px;
      padding: 18px;
      display: none;
      color: var(--carvao);
      box-shadow: 0 14px 34px rgba(31, 31, 31, 0.28);
    }
    .painel-usina.visivel {
      display: block;
    }
    .painel-usina.detalhe {
      width: min(420px, calc(100% - 28px));
      height: min(620px, calc(100% - 28px));
      max-height: min(620px, calc(100% - 28px));
    }
    .painel-topo {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      margin-bottom: 12px;
    }
    .painel-topo h2 {
      flex: 1;
      margin: 0;
      font-family: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
      font-size: 27px;
      line-height: 1.02;
      font-weight: 900;
      letter-spacing: 0;
      color: var(--terra-vermelha);
    }
    .painel-usina button {
      border: 0;
      border-radius: 3px;
      width: 32px;
      height: 32px;
      flex: 0 0 32px;
      background: var(--vermelho-alerta);
      color: var(--areia);
      font-family: Arial, sans-serif;
      font-size: 23px;
      line-height: 1;
      font-weight: 400;
      padding: 0;
      cursor: pointer;
    }
    .painel-editorial-uf {
      display: none;
      margin: 0 0 16px;
      color: var(--carvao);
      font-size: 12px;
      line-height: 1.5;
    }
    .painel-usina.uf .painel-editorial-uf {
      display: block;
    }
    .painel-editorial-uf p {
      margin: 0 0 11px;
    }
    .painel-editorial-uf p:last-child {
      margin-bottom: 0;
    }
    .painel-usina.uf .painel-dados {
      border-top: 2px solid rgba(138, 79, 50, 0.60);
      padding-top: 14px;
    }
    .info-linha {
      display: grid;
      grid-template-columns: 82px 1fr;
      gap: 8px;
      margin: 8px 0;
      font-size: 12px;
    }
    .info-linha span:first-child {
      color: var(--verde-caatinga);
      font-size: 10px;
      font-weight: 800;
      text-transform: uppercase;
    }
    .info-linha strong {
      color: var(--terra-vermelha);
      font-weight: 800;
    }
    .midia-usina {
      margin: 12px 0 0;
    }
    .midia-usina img {
      display: block;
      width: 100%;
      aspect-ratio: 16 / 9;
      object-fit: cover;
      border-radius: 3px;
      border: 1px solid rgba(138, 79, 50, 0.42);
    }
    .midia-usina figcaption {
      margin-top: 5px;
      color: var(--verde-caatinga);
      font-size: 10px;
      line-height: 1.25;
    }
    .midia-usina figcaption a {
      color: inherit;
      text-decoration: underline;
      text-decoration-thickness: 1px;
      text-underline-offset: 2px;
    }
    .midia-usina figcaption span {
      display: block;
      margin-top: 3px;
    }
    .dashboard-grade {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      margin-top: 12px;
    }
    .dashboard-card {
      border-left: 3px solid var(--ocre-solar);
      padding: 4px 0 4px 9px;
      background: transparent;
    }
    .dashboard-card span {
      display: block;
      color: var(--verde-caatinga);
      font-size: 10px;
      line-height: 1.2;
      font-weight: 700;
      text-transform: uppercase;
    }
    .dashboard-card strong {
      display: block;
      margin-top: 4px;
      color: var(--terra-vermelha);
      font-family: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
      font-size: 20px;
      line-height: 1.15;
    }
    .ranking-titulo {
      margin: 14px 0 8px;
      font-size: 11px;
      line-height: 1.25;
      color: var(--verde-caatinga);
      text-transform: uppercase;
    }
    .ranking-lista {
      display: grid;
      gap: 8px;
    }
    .ranking-item {
      display: grid;
      gap: 4px;
      font-size: 11px;
      line-height: 1.25;
    }
    .ranking-label {
      display: flex;
      justify-content: space-between;
      gap: 8px;
      color: var(--carvao);
    }
    .ranking-label span {
      color: var(--terra-vermelha);
      font-weight: 800;
    }
    .ranking-barra {
      height: 7px;
      overflow: hidden;
      border-radius: 0;
      background: rgba(102, 118, 74, 0.20);
    }
    .ranking-barra span {
      display: block;
      height: 100%;
      border-radius: 0;
      background: var(--vermelho-alerta);
    }
    @media (max-width: 760px) {
      .painel-usina {
        width: min(390px, calc(100% - 24px));
        top: 12px;
        right: 12px;
        max-height: calc(100% - 24px);
      }
      .painel-usina.detalhe {
        width: calc(100% - 28px);
        height: 70%;
        max-height: 70%;
      }
      .painel-story {
        width: min(390px, calc(100% - 24px));
        top: 12px;
        right: 12px;
        max-width: calc(100% - 24px);
        max-height: calc(100% - 24px);
        padding: 20px;
        overflow: auto;
      }
      .story-dashboard {
        grid-template-columns: 1fr;
      }
      .story-chart + .story-chart {
        border-top: 1px solid rgba(138, 79, 50, 0.30);
        border-left: 0;
        padding-top: 14px;
        padding-left: 0;
      }
      .story-titulo {
        font-size: 27px;
      }
    }

.story-toggle,
.painel-toggle {
  display: none;
}

@media (max-width: 760px) {
  .rotulo-municipio {
    display: none !important;
  }
  html,
  body,
  #mapa-usinas-ne {
    width: 100%;
    height: 100%;
    min-height: 420px;
    overflow: hidden;
  }
  #mapa-usinas-ne {
    height: 100vh;
    height: 100svh;
  }
  .leaflet-control-zoom a {
    width: 40px;
    height: 40px;
    font-size: 22px;
    line-height: 40px;
  }
  .painel-story,
  .painel-usina {
    top: auto;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
    max-width: none;
    box-sizing: border-box;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .painel-story.tem-continuidade,
  .painel-usina.tem-continuidade {
    background-image:
      linear-gradient(to bottom, transparent, rgba(243, 239, 228, 0.98)),
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='38' height='28' viewBox='0 0 38 28'%3E%3Cpath d='M5 4l14 10L33 4M5 14l14 10 14-10' fill='none' stroke='%238a4f32' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat, no-repeat;
    background-position: center bottom, center calc(100% - 10px);
    background-size: 100% 78px, 38px 28px;
    box-shadow:
      0 14px 34px rgba(31, 31, 31, 0.28),
      inset 0 -30px 24px -26px rgba(138, 79, 50, 0.75);
  }
  .indicador-continuidade {
    position: absolute;
    z-index: 720;
    display: none;
    align-items: center;
    gap: 7px;
    transform: translate(-50%, -100%);
    padding: 6px 11px;
    border: 1px solid rgba(138, 79, 50, 0.72);
    border-radius: 18px;
    background: rgba(243, 239, 228, 0.96);
    color: var(--terra-vermelha);
    box-shadow: 0 4px 12px rgba(31, 31, 31, 0.24);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1;
    pointer-events: none;
  }
  .indicador-continuidade::after {
    content: '↓↓';
    font-size: 15px;
    letter-spacing: -3px;
    line-height: 0.8;
  }
  .indicador-continuidade.visivel {
    display: flex;
  }
  .painel-story {
    max-height: min(54dvh, 560px);
    padding: 18px;
    overflow: auto;
  }
  .painel-usina,
  .painel-usina.detalhe {
    width: auto;
    height: auto;
    max-height: calc(100svh - 24px - env(safe-area-inset-bottom));
    padding: 16px;
    overflow: auto;
  }
  .painel-usina.detalhe {
    max-height: calc(100svh - 24px - env(safe-area-inset-bottom));
  }
  .painel-usina.uf {
    max-height: min(56svh, 520px);
  }
  .painel-usina.uf.visivel {
    display: flex;
    flex-direction: column;
  }
  .painel-usina.uf .painel-topo {
    order: 0;
  }
  .painel-usina.uf .painel-dados {
    order: 1;
  }
  .painel-usina.uf .painel-dados > .info-linha {
    display: none;
  }
  .painel-usina.uf .painel-editorial-uf {
    order: 2;
    margin-top: 16px;
    margin-bottom: 0;
  }
  .story-toggle,
  .painel-toggle {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(31, 31, 31, 0.45) !important;
    border-radius: 0 !important;
    background: rgba(243, 239, 228, 0.94) !important;
    color: #1f1f1f !important;
    font: 700 22px/1 "Open Sans", Arial, sans-serif !important;
    cursor: pointer;
  }
  .story-toggle {
    position: absolute;
    z-index: 2;
    top: 8px;
    right: 8px;
  }
  .story-toggle:focus-visible,
  .painel-toggle:focus-visible {
    outline: 2px solid #d39a34;
    outline-offset: 2px;
  }
  .painel-usina button {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }
  .painel-topo h2 {
    font-size: 24px;
  }
  .story-titulo {
    padding-right: 34px;
    font-size: 26px;
  }
  .story-subtitulo {
    font-size: 14px;
    line-height: 1.3;
  }
  .story-corpo {
    font-size: 11px;
    line-height: 1.45;
  }
  .story-dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .story-chart + .story-chart {
    border-top: 0;
    border-left: 1px solid rgba(138, 79, 50, 0.30);
    padding-top: 0;
    padding-left: 10px;
  }
  .story-chart h2 {
    font-size: 12px;
  }
  .story-chart-row {
    font-size: 9px;
  }
  .painel-story.painel-story-recolhido {
    right: 12px;
    left: auto;
    width: min(280px, calc(100% - 24px));
    height: 58px;
    min-height: 58px;
    max-height: 58px;
    padding: 18px 58px 16px 20px;
    overflow: hidden;
  }
  .painel-story.painel-story-recolhido > :not(.story-toggle):not(.story-cabecalho) {
    display: none;
  }
  .painel-story.painel-story-recolhido .story-cabecalho {
    margin: 0;
    white-space: nowrap;
  }
  .painel-usina.painel-recolhido {
    right: 12px;
    left: auto;
    width: min(340px, calc(100% - 24px));
    height: 68px !important;
    min-height: 68px;
    max-height: 68px !important;
    padding: 14px;
    overflow: hidden;
  }
  .painel-usina.painel-recolhido .painel-topo {
    align-items: center;
    margin: 0;
  }
  .painel-usina.painel-recolhido .painel-topo h2 {
    overflow: hidden;
    font-size: 21px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .painel-usina.painel-recolhido .painel-editorial-uf,
  .painel-usina.painel-recolhido .painel-dados {
    display: none !important;
  }
  .midia-usina img {
    max-height: 30dvh;
  }
}

@media (max-width: 380px) {
  .painel-story,
  .painel-usina {
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 8px;
  }
  .story-titulo {
    font-size: 24px;
  }
  .story-chart h2 {
    font-size: 11px;
  }
  .painel-usina.painel-recolhido,
  .painel-story.painel-story-recolhido {
    right: 8px;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .story-toggle,
  .painel-toggle {
    display: grid;
    place-items: center;
  }
  .story-toggle {
    position: absolute;
    z-index: 2;
    top: 8px;
    right: 8px;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(31, 31, 31, 0.45);
    border-radius: 0;
    background: rgba(243, 239, 228, 0.94);
    color: #1f1f1f;
    font: 700 21px/1 "Open Sans", Arial, sans-serif;
  }
  .painel-toggle {
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(31, 31, 31, 0.45) !important;
    border-radius: 0 !important;
    background: rgba(243, 239, 228, 0.94) !important;
    color: #1f1f1f !important;
    font: 700 21px/1 "Open Sans", Arial, sans-serif !important;
  }
  .painel-story,
  .painel-usina,
  .painel-usina.detalhe {
    top: 10px;
    right: max(10px, env(safe-area-inset-right));
    bottom: 10px;
    left: auto;
    width: min(400px, 48vw);
    height: auto;
    max-width: 48vw;
    max-height: calc(100% - 20px);
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .painel-story {
    padding: 16px;
  }
  .painel-usina {
    padding: 14px;
  }
  .painel-usina button {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }
  .story-titulo,
  .painel-topo h2 {
    font-size: 23px;
  }
  .story-subtitulo {
    font-size: 13px;
  }
  .story-corpo {
    font-size: 10px;
    line-height: 1.4;
  }
  .story-dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .story-chart + .story-chart {
    border-top: 0;
    border-left: 1px solid rgba(138, 79, 50, 0.30);
    padding-top: 0;
    padding-left: 10px;
  }
  .painel-story.painel-story-recolhido,
  .painel-usina.painel-recolhido {
    top: 10px;
    right: max(10px, env(safe-area-inset-right));
    bottom: auto;
    left: auto;
    width: min(320px, 48vw);
    max-width: 48vw;
    height: 62px !important;
    min-height: 62px;
    max-height: 62px !important;
    overflow: hidden;
  }
  .painel-story.painel-story-recolhido {
    padding: 16px 54px 14px 18px;
  }
  .painel-story.painel-story-recolhido > :not(.story-toggle):not(.story-cabecalho) {
    display: none;
  }
  .painel-story.painel-story-recolhido .story-cabecalho {
    margin: 0;
    white-space: nowrap;
  }
  .painel-usina.painel-recolhido {
    padding: 12px;
  }
  .painel-usina.painel-recolhido .painel-topo {
    align-items: center;
    margin: 0;
  }
  .painel-usina.painel-recolhido .painel-topo h2 {
    overflow: hidden;
    font-size: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .painel-usina.painel-recolhido .painel-editorial-uf,
  .painel-usina.painel-recolhido .painel-dados {
    display: none !important;
  }
}
