:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #203846;
  background: #f1f5f6;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  position: relative;
  height: 100vh;
  overflow: hidden;
}

body > aside {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 310px;
  background: #fff;
  box-shadow: 2px 0 18px #183c4c1c;
  z-index: 2;
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease;
}

body > aside.collapsed {
  width: 58px;
}

aside.collapsed .panel-content {
  display: none;
}

body > main {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 310px;
  right: 0;
  transition: left 0.2s ease;
}

body > aside.collapsed + main {
  left: 58px;
}

.sidebar-top {
  height: 55px;
  min-height: 55px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px;
  border-bottom: 1px solid #e8eef0;
}

.brand-mark {
  display: grid;
  place-items: center;
  background: #087f8c;
  color: #fff;
  border-radius: 8px;
  font-weight: 800;
  font-size: 13px;
  width: 32px;
  height: 32px;
}

.sidebar-top button {
  border: 0;
  background: #eaf4f4;
  color: #126d76;
  border-radius: 6px;
  font-size: 25px;
  width: 30px;
  height: 32px;
  cursor: pointer;
  line-height: 1;
}

.collapsed .sidebar-top {
  padding: 0 13px;
  flex-direction: column;
  height: 95px;
  justify-content: space-evenly;
}

.panel-content {
  padding: 18px 18px 24px;
  overflow-y: auto;
  overflow-x: hidden;
}

.eyebrow,
.label {
  font-size: 10px;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: #5c7a88;
}

.eyebrow {
  color: #07818a;
  margin: 0 0 7px;
}

h1 {
  font-size: 21px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
  color: #143844;
}

h2 {
  font-size: 14px;
  margin: 0;
  font-weight: 700;
  color: #173c49;
}

.intro {
  font-size: 12px;
  line-height: 1.45;
  color: #5a727d;
  margin: 8px 0 14px;
}

section {
  margin-bottom: 16px;
}

#legend small,
footer {
  font-size: 11px;
  color: #536c77;
  line-height: 1.4;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.text-button {
  border: 0;
  background: transparent;
  color: #087f8c;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

label:not(.layer-toggle) {
  font-size: 12px;
  font-weight: 600;
  color: #47616d;
}

input[type="search"],
select {
  display: block;
  width: 100%;
  height: 36px;
  margin: 5px 0 11px;
  border: 1px solid #cedbd4;
  border-radius: 6px;
  background: #fff;
  padding: 0 9px;
  color: #294852;
  font: 12px "Segoe UI", system-ui, sans-serif;
}

.panel-content select {
  appearance: none;
  padding-right: 28px;
  background-image:
    linear-gradient(45deg, transparent 50%, #567367 50%),
    linear-gradient(135deg, #567367 50%, transparent 50%);
  background-position: calc(100% - 14px) 15px, calc(100% - 10px) 15px;
  background-size: 4px 4px;
  background-repeat: no-repeat;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 2px solid #23a0a5;
  outline-offset: 2px;
}

.filter-group {
  margin: 10px 0;
  padding: 11px 12px;
  border: 1px solid;
  border-left-width: 4px;
  border-radius: 7px;
}

.group-header,
.legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.filter-group h3 {
  margin: 0;
  font-size: 13px;
  color: #294852;
}

.group-stat {
  font-size: 12px;
  line-height: 1.45;
  margin: 10px 0 0;
  padding-top: 8px;
  border-top: 1px solid rgba(41, 72, 82, 0.12);
}

.group-stat strong {
  font-size: 15px;
  font-weight: 700;
}

.school-group .group-stat strong {
  color: #125e65;
}

.health-group .group-stat {
  border-top-color: rgba(113, 48, 68, 0.14);
}

.health-group .group-stat strong {
  color: #ad5b70;
}

.group-substat {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  color: #536c77;
}

.info-disclosure {
  position: relative;
  flex: none;
}

.info-disclosure > summary {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid currentColor;
  display: grid;
  place-items: center;
  font: 700 11px/1 Georgia, serif;
  font-style: italic;
  cursor: pointer;
  list-style: none;
  opacity: 0.72;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.info-disclosure > summary::-webkit-details-marker {
  display: none;
}

.info-disclosure > summary:hover,
.info-disclosure[open] > summary {
  opacity: 1;
  background: rgba(255, 255, 255, 0.75);
}

.info-disclosure > summary:focus-visible {
  outline: 2px solid #23a0a5;
  outline-offset: 2px;
}

.info-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 12;
  width: 244px;
  padding: 9px 11px;
  border-radius: 7px;
  background: #173642;
  color: #f4f9fa;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.45;
  box-shadow: 0 10px 26px rgba(15, 38, 48, 0.28);
}

.school-group {
  background: #f3f9fa;
  border-color: #cfe3e6;
  border-left-color: #218894;
  color: #294852;
}

.school-group h3,
.school-group label:not(.layer-toggle),
.school-group .school-dependency > span {
  color: #294852;
}

.health-group {
  background: #fff1f3;
  border-color: #f1d1d9;
  border-left-color: #ad5b70;
  color: #713044;
}

.health-group h3,
.health-group label:not(.layer-toggle) {
  color: #713044;
}

.school-dependency > span {
  font-size: 12px;
  font-weight: 600;
}

.multi {
  position: relative;
  margin-top: 5px;
}

.multi > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  width: 100%;
  min-height: 36px;
  padding: 0 9px;
  border: 1px solid #cedbd4;
  border-radius: 6px;
  background: #fff;
  color: #294852;
  font-size: 12px;
  cursor: pointer;
  list-style: none;
}

.multi > summary::-webkit-details-marker {
  display: none;
}

.multi > summary:focus-visible {
  outline: 2px solid #23a0a5;
  outline-offset: 2px;
}

.filter-chevron {
  width: 7px;
  height: 7px;
  border-bottom: 1.6px solid #567367;
  border-right: 1.6px solid #567367;
  transform: translateY(-2px) rotate(45deg);
  flex: none;
}

.multi[open] > summary .filter-chevron {
  transform: translateY(2px) rotate(225deg);
}

.choice-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 5;
  padding: 8px;
  background: #fff;
  border: 1px solid #cddbd2;
  border-radius: 8px;
  box-shadow: 0 9px 25px #112d2440;
}

.choice-menu fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}

.checks {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.checks label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 400 !important;
  color: #294852 !important;
  padding: 2px;
  cursor: pointer;
}

.checks input,
.layer-toggle input {
  accent-color: #078b8e;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
}

.estadual { background: #009929; }
.municipal { background: #4472ae; }
.privada { background: #ca9b45; }
.federal { background: #845da8; }

.pilot-select {
  position: relative;
  margin: 5px 0 11px;
}

.pilot-select-button {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  padding: 0 10px;
  border: 1px solid #cedbd4;
  border-radius: 6px;
  background: #fff;
  color: #294852;
  font: 12px "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
}

.pilot-select-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pilot-select-button[aria-expanded="true"] .filter-chevron {
  transform: translateY(2px) rotate(225deg);
}

.pilot-select-menu {
  position: absolute;
  z-index: 8;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid #cddbd2;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 9px 25px #112d2430;
}

.pilot-select-menu[hidden] {
  display: none;
}

.pilot-select-option {
  display: block;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #294852;
  font: 12px "Segoe UI", system-ui, sans-serif;
  text-align: left;
  cursor: pointer;
}

.pilot-select-option:hover,
.pilot-select-option:focus-visible {
  outline: none;
  background: #eaf5f4;
}

.pilot-select-option[aria-selected="true"] {
  background: #dff0ef;
  color: #125e65;
  font-weight: 700;
}

.pilot-select-option[hidden] {
  display: none;
}

.pilot-select-menu input.pilot-select-search {
  position: sticky;
  top: 0;
  z-index: 1;
  width: 100%;
  height: 34px;
  margin: 0 0 5px;
  padding: 0 8px;
  background: #fff;
  border: 1px solid #cedbd4;
  border-radius: 5px;
  font-size: 12px;
}

.layer-toggle {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

#legend {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #e6eef0;
}

.legend-header {
  margin: 4px 0 8px;
  color: #47616d;
}

.legend-title {
  font-size: 11px;
  font-weight: 700;
  margin: 0;
}

.legend-row {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 5px 0;
}

.legend-row i {
  height: 11px;
  width: 18px;
  border-radius: 2px;
}

#legend small {
  display: block;
  margin-top: 8px;
}

footer {
  font-size: 10px;
  line-height: 1.5;
  border-top: 1px solid #e6eef0;
  padding-top: 12px;
}

#map {
  position: absolute;
  inset: 0;
}

.map-heading {
  position: absolute;
  top: 20px;
  left: 20px;
  background: #fffffff2;
  box-shadow: 0 3px 18px #203c4a20;
  border-radius: 7px;
  padding: 11px 16px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.map-heading span {
  font-size: 9px;
  color: #16858c;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.map-heading strong {
  font-size: 15px;
  color: #183d49;
}

.map-layer-bar {
  position: absolute;
  top: 20px;
  right: 56px;
  z-index: 1;
  max-width: calc(100% - 76px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px 11px;
  background: #fff;
  border-top: 3px solid #078b8e;
  border-radius: 8px;
  box-shadow: 0 6px 22px rgba(20, 56, 68, 0.14), 0 1px 3px rgba(20, 56, 68, 0.08);
}

.map-layer-bar-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.map-layer-bar-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.11em;
  color: #08767d;
}

.map-layer-bar-hint {
  font-size: 10px;
  font-weight: 600;
  color: #627b86;
}

.map-layer-bar-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.map-layer-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 7px;
  border: 1px solid #cddbe0;
  background: #f4f7f8;
  color: #334f5b;
  font: 600 12.5px/1 "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.map-layer-chip:hover {
  background: #eaf1f3;
  border-color: #9eb5be;
}

.map-layer-chip:focus-visible {
  outline: 2px solid #078b8e;
  outline-offset: 2px;
}

.chip-state {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1.5px solid #8ea7b2;
  background: #fff;
  display: inline-grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  color: transparent;
  flex: none;
}

.chip-state::before {
  content: "✓";
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  opacity: 0.85;
}

.map-layer-chip.is-active .chip-dot {
  opacity: 1;
}

.chip-school .chip-dot { background: #218894; }
.chip-school:hover { border-color: #218894; }
.chip-school.is-active {
  background: #eaf6f7;
  border-color: #218894;
  color: #13525a;
}
.chip-school.is-active .chip-state {
  background: #218894;
  border-color: #218894;
  color: #fff;
}

.chip-health .chip-dot { background: #ad5b70; }
.chip-health:hover { border-color: #ad5b70; }
.chip-health.is-active {
  background: #ffeff2;
  border-color: #ad5b70;
  color: #6e2a3e;
}
.chip-health.is-active .chip-state {
  background: #ad5b70;
  border-color: #ad5b70;
  color: #fff;
}

#notice {
  position: absolute;
  left: 20px;
  bottom: 35px;
  max-width: 420px;
  background: #fff3d5;
  color: #5e4b20;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 12px;
  z-index: 3;
}

.municipal-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 0;
  border-radius: 50%;
  background: #176c76;
  color: #fff;
  font: 700 9px "Segoe UI", system-ui, sans-serif;
  min-width: 19px;
  height: 19px;
  padding: 0 3px;
  box-shadow: 0 2px 5px #14384466;
  cursor: pointer;
}

.municipal-marker:focus-visible {
  outline: 3px solid #193d6c;
  outline-offset: 2px;
}

.maplibregl-popup-content {
  font-family: "Segoe UI", system-ui, sans-serif;
  border-radius: 8px;
  line-height: 1.45;
  max-width: min(370px, 80vw);
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  padding: 17px 18px;
  color: #294751;
  border-top: 4px solid #078b8e;
  box-shadow: 0 8px 30px #183c4c33;
}

.maplibregl-popup.municipal-popup {
  left: auto !important;
  right: 56px;
  top: 108px !important;
  transform: none !important;
  max-width: min(370px, calc(100% - 72px)) !important;
}

.municipal-popup .maplibregl-popup-content {
  max-height: calc(100vh - 128px);
}

.municipal-popup .maplibregl-popup-tip {
  display: none;
}

.popup-kicker {
  font-size: 10px;
  color: #08767d;
  font-weight: 800;
  letter-spacing: 0.1em;
  margin: 0 0 4px;
}

.popup-title {
  font-weight: 700;
  font-size: 17px;
  line-height: 1.25;
  color: #143f4c;
  margin: 0 14px 10px 0;
}

.popup-meta {
  font-size: 12px;
  line-height: 1.55;
  margin: 6px 0;
}

.popup-source {
  font-size: 10px;
  color: #496975;
  line-height: 1.45;
  margin-top: 8px;
}

.popup-note {
  font-size: 11px;
  line-height: 1.45;
  color: #49616a;
  margin: 8px 0 0;
}

.popup-divider {
  height: 1px;
  background: #dce8ea;
  margin: 10px 0;
}

.maplibregl-popup-close-button {
  font-size: 22px;
  padding: 3px 8px;
  color: #24545a;
}

.maplibregl-popup-close-button:focus-visible {
  outline: 2px solid #078b8e;
  outline-offset: -3px;
}

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
}

.metric {
  min-width: 0;
  background: #eef7f6;
  border-radius: 7px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric span {
  font-size: 11px;
  color: #365a65;
  font-weight: 700;
  line-height: 1.25;
}

.metric strong {
  font-size: 20px;
  color: #145e65;
  line-height: 1.1;
}

.metric small {
  font-size: 10px;
  line-height: 1.35;
  color: #486974;
}

.metric.metric-elderly {
  background: #f5eff9;
  border: 1px solid #e4d4ef;
}

.metric.metric-elderly span {
  color: #5b3473;
}

.metric.metric-elderly strong {
  color: #714287;
}

.metric.metric-elderly small {
  color: #634475;
}

.ratio {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 3px 10px;
  padding: 10px 11px;
  border: 1px solid #cfe5e4;
  border-radius: 7px;
  background: #f8fbfb;
}

.ratio span {
  font-size: 11px;
  font-weight: 700;
  color: #365a65;
}

.ratio strong {
  font-size: 19px;
  color: #145e65;
}

.ratio small {
  grid-column: 1 / -1;
  color: #486974;
  font-size: 10px;
  line-height: 1.4;
}

.employment {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px;
  align-items: baseline;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid #dae4e1;
  border-radius: 7px;
  background: #f6f9f7;
}

.employment span {
  font-size: 11px;
  font-weight: 700;
  color: #365a65;
}

.employment strong {
  font-size: 18px;
  color: #255f4a;
}

.employment small {
  grid-column: 1 / -1;
  font-size: 10px;
  line-height: 1.35;
  color: #486974;
}

.health-card {
  margin-top: 8px;
  padding: 10px;
  border-radius: 7px;
  background: #fff1f3;
  border: 1px solid #f1d1d9;
  color: #713044;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.health-card span {
  font-size: 11px;
  font-weight: 700;
}

.health-card strong {
  font-size: 19px;
  line-height: 1.15;
  color: #8d4558;
}

.health-card small {
  font-size: 10px;
  line-height: 1.4;
  color: #713044;
}

.health-warning {
  margin-top: 4px;
  padding-top: 5px;
  border-top: 1px solid #f1d1d9;
  font-weight: 600;
}

.maplibregl-ctrl-attrib {
  font-size: 10px !important;
}

@media (max-width: 760px) {
  body > aside {
    width: 270px;
  }
  body > main {
    left: 270px;
  }
  .map-heading {
    display: none;
  }
}
