:root {
  --bg: #0b1220;
  --bg2: #101827;
  --panel: #111c2f;
  --panel2: #16243a;
  --stroke: #2f405c;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --accent: #38bdf8;
  --accent2: #2563eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.topo {
  min-height: 132px;
  padding: 18px 26px;
  background:
    linear-gradient(90deg, rgba(2, 6, 23, .96), rgba(15, 23, 42, .94)),
    radial-gradient(circle at 20% 20%, rgba(56, 189, 248, .16), transparent 36%);
  border-bottom: 1px solid var(--stroke);
  display: grid;
  grid-template-columns: 190px 1fr 110px;
  gap: 22px;
  align-items: center;
}

.topo-logo img {
  max-width: 180px;
  width: 100%;
  display: block;
}

.topo-texto h1 {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.1;
}

.topo-texto p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 16px;
}

.topo-texto a {
  color: #7dd3fc;
  font-weight: 700;
  text-decoration: none;
}

.topo-texto a:hover {
  text-decoration: underline;
}

.topo-foto {
  width: 96px;
  height: 96px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 12px 28px rgba(0,0,0,.35);
}

.topo-foto img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.layout {
  padding: 18px;
}

.mapa-card {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,.25);
}

.mapa-header {
  padding: 16px 20px;
  background: #0f172a;
  border-bottom: 1px solid var(--stroke);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.mapa-header h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.mapa-header p {
  margin: 0;
  color: var(--muted);
}

.mapa-header button {
  background: #1e293b;
  color: var(--text);
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 9px 13px;
  cursor: pointer;
}

.mapa-header button:hover {
  background: #334155;
}

#map {
  height: calc(100vh - 210px);
  min-height: 560px;
  width: 100%;
  background: #f8fafc;
}

.leaflet-container {
  background: #f8fafc;
}

.label-municipio {
  color: #111827;
  font-weight: 700;
  font-size: 10px;
  text-align: center;
  text-shadow:
    -1px -1px 0 #fff,
     1px -1px 0 #fff,
    -1px  1px 0 #fff,
     1px  1px 0 #fff;
  pointer-events: none;
}

.legenda {
  background: rgba(255, 255, 255, .96);
  color: #111827;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(0,0,0,.22);
  border: 1px solid rgba(15, 23, 42, .12);
  line-height: 1.25;
}

.legenda h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.legenda-item {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 6px 0;
  font-size: 12px;
}

.legenda-cor {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(15, 23, 42, .35);
  flex: 0 0 auto;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, .58);
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 18px;
  backdrop-filter: blur(5px);
}

.modal.oculto {
  display: none;
}

.modal-card {
  width: min(520px, 100%);
  background: #111827;
  border: 1px solid #334155;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  padding: 22px;
  position: relative;
}

.modal-fechar {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #fff;
  cursor: pointer;
  font-size: 22px;
}

.modal-card h2 {
  margin: 0 42px 4px 0;
  font-size: 25px;
}

.modal-card p {
  margin: 0 0 16px;
  color: #cbd5e1;
}

form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: #e5e7eb;
  font-weight: 700;
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #334155;
  background: #020617;
  color: #f8fafc;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56,189,248,.14);
}

.botao-enviar {
  margin-top: 4px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: white;
  font-weight: 800;
  padding: 13px 16px;
  cursor: pointer;
  font-size: 16px;
}

.botao-enviar:hover {
  filter: brightness(1.08);
}

.mensagem-form {
  min-height: 20px;
  margin: 0;
  font-size: 14px;
  color: #93c5fd;
}

.campo-armadilha {
  display: none;
}


/* =====================================================
   LGPD - consentimento no formulário
   ===================================================== */

.termo-lgpd {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: start;
  gap: 10px;

  margin: 4px 0 2px;
  padding: 12px;

  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
}

.termo-lgpd input[type="checkbox"] {
  appearance: auto !important;
  -webkit-appearance: checkbox !important;

  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  max-width: 16px !important;

  margin: 2px 0 0 0 !important;
  padding: 0 !important;

  background: initial !important;
  border: initial !important;
  border-radius: 0 !important;
  box-shadow: none !important;

  cursor: pointer;
}

.termo-lgpd label {
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;

  color: #e5e7eb;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 600;
  cursor: pointer;
}

.termo-lgpd a {
  color: #7dd3fc;
  font-weight: 800;
  text-decoration: underline;
}

.termo-lgpd a:hover {
  color: #bae6fd;
}

.label-titulo {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1.2;
}

.obrigatorio {
  color: #f87171;
  font-weight: 900;
  line-height: 1;
}

.botao-enviar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.botao-enviar.enviando {
  opacity: 0.85;
  cursor: wait;
}

.botao-enviar.enviando .botao-spinner {
  display: inline-block;
}

.botao-spinner {
  display: none;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: #ffffff;
  border-radius: 999px;
  animation: girarSpinner .75s linear infinite;
}

@keyframes girarSpinner {
  to {
    transform: rotate(360deg);
  }
}

.mensagem-form.sucesso {
  color: #86efac;
  font-weight: 700;
}

.mensagem-form.erro {
  color: #fca5a5;
  font-weight: 700;
}

.mensagem-form.enviando {
  color: #93c5fd;
  font-weight: 700;
}



/* =====================================================
   MOBILE FINAL - Mapa de Migração 18 para 30h
   ===================================================== */

@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
    background: #0b1220;
  }

  body {
    display: flex;
    flex-direction: column;
  }

  /* TOPO COMPACTO */
  .topo {
    min-height: auto !important;
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px !important;
    display: grid !important;
    grid-template-columns: 70px 1fr;
    gap: 10px;
    align-items: center;
    text-align: left !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  }

  .topo-logo img {
    width: 70px !important;
    max-width: 70px !important;
    margin: 0 !important;
    display: block;
  }

  .topo-texto h1 {
    font-size: 18px !important;
    line-height: 1.08 !important;
    margin: 0 0 4px !important;
  }

  .topo-texto p {
    font-size: 12px !important;
    line-height: 1.25 !important;
    margin: 0 0 4px !important;
    color: #dbeafe;
  }

  .topo-texto a {
    display: inline-block;
    font-size: 12px !important;
    line-height: 1.2 !important;
    color: #7dd3fc;
  }

  .topo-foto {
    display: none !important;
  }

  /* ÁREA DO MAPA */
  .layout {
    flex: 1;
    padding: 0 !important;
    min-height: 0;
  }

  .mapa-card {
    height: calc(100dvh - 82px - env(safe-area-inset-top));
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    overflow: hidden !important;
    box-shadow: none !important;
  }

  .mapa-header {
    height: 54px;
    padding: 8px 10px !important;
    display: grid !important;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
  }

  .mapa-header h2 {
    font-size: 16px !important;
    line-height: 1.1 !important;
    margin: 0 !important;
  }

  .mapa-header p {
    font-size: 11px !important;
    line-height: 1.2 !important;
    margin: 2px 0 0 !important;
    color: #cbd5e1;
  }

  .mapa-header button {
    width: auto !important;
    min-height: 34px !important;
    height: 34px !important;
    padding: 0 10px !important;
    border-radius: 999px !important;
    font-size: 0 !important;
    white-space: nowrap;
  }

  .mapa-header button::after {
    content: "Centralizar";
    font-size: 12px;
  }

  #map {
    height: calc(100dvh - 136px - env(safe-area-inset-top)) !important;
    min-height: 0 !important;
    width: 100% !important;
  }

  .leaflet-bottom.leaflet-right {
    bottom: calc(72px + env(safe-area-inset-bottom)) !important;
    right: 10px !important;
  }

 .label-municipio {
    color: #111827 !important;
    font-size: 9px !important;
    font-weight: 800 !important;
    text-align: center !important;
    line-height: 1.05 !important;
    text-shadow:
      -1px -1px 0 #fff,
       1px -1px 0 #fff,
      -1px  1px 0 #fff,
       1px  1px 0 #fff,
       0 2px 4px rgba(0,0,0,.25) !important;
    pointer-events: none !important;
}

  .leaflet-control-zoom {
    margin-top: 10px !important;
    margin-left: 10px !important;
  }

  .leaflet-control-zoom a {
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    font-size: 21px !important;
  }

  /* LEGENDA MOBILE RECOLHIDA */
  .legenda {
    max-width: 190px !important;
    max-height: none !important;
    overflow: hidden !important;
    padding: 0 !important;
    border-radius: 14px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    color: #111827 !important;
    box-shadow: 0 10px 26px rgba(0,0,0,.22) !important;
  }

  .legenda h3 {
    margin: 0 !important;
    padding: 10px 12px !important;
    font-size: 13px !important;
    cursor: pointer;
    user-select: none;
  }

  .legenda h3::after {
    content: " ▾";
    font-weight: 900;
  }

  .legenda:not(.aberta) .legenda-item {
    display: none !important;
  }

  .legenda.aberta {
    max-height: 260px !important;
    overflow-y: auto !important;
  }

  .legenda.aberta h3::after {
    content: " ▴";
  }

  .legenda-item {
    font-size: 11px !important;
    margin: 0 !important;
    padding: 5px 12px !important;
    gap: 6px !important;
  }

  .legenda-item:last-child {
    padding-bottom: 10px !important;
  }

  .legenda-cor {
    width: 13px !important;
    height: 13px !important;
    border-radius: 4px !important;
  }

  /* MODAL COMO BOTTOM SHEET */
  .modal {
    align-items: end !important;
    justify-items: stretch !important;
    padding: 0 !important;
    background: rgba(2, 6, 23, .52) !important;
  }

  .modal-card {
    width: 100% !important;
    max-height: 88dvh !important;
    overflow-y: auto !important;
    border-radius: 22px 22px 0 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    padding: 18px 16px 22px !important;
    box-shadow: 0 -16px 40px rgba(0,0,0,.45) !important;
  }

  .modal-card::before {
    content: "";
    display: block;
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: rgba(203, 213, 225, 0.45);
    margin: 0 auto 14px;
  }

  .modal-fechar {
    top: 14px !important;
    right: 14px !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 999px !important;
  }

  .modal-card h2 {
    font-size: 22px !important;
    line-height: 1.1 !important;
    margin: 0 46px 4px 0 !important;
  }

  .modal-card p {
    font-size: 14px !important;
    line-height: 1.25 !important;
    margin: 0 0 14px !important;
  }

  form {
    gap: 10px !important;
  }

  label {
    font-size: 13px !important;
    gap: 5px !important;
  }

  input,
  select,
  textarea {
    min-height: 44px !important;
    font-size: 16px !important;
    padding: 10px 11px !important;
    border-radius: 10px !important;
  }

  textarea {
    min-height: 74px !important;
  }

  .termo-lgpd {
    padding: 10px !important;
    grid-template-columns: 18px 1fr !important;
    gap: 9px !important;
  }

  .termo-lgpd label {
    font-size: 12px !important;
    line-height: 1.3 !important;
  }

  .botao-enviar {
    min-height: 48px !important;
    font-size: 16px !important;
    border-radius: 13px !important;
  }

  .mensagem-form {
    font-size: 13px !important;
    line-height: 1.35 !important;
  }
}

.legenda small {
  color: #475569;
  font-size: 10px;
}