:root {
  /* identidade Avança Chapada */
  --brand: #1d5e27;        /* verde-escuro do logotipo */
  --brand-2: #2d7a31;
  --brand-soft: #e8f2e4;
  --lime: #8cc63f;
  --yellow: #f6c431;
  --accent: #f29a1f;       /* laranja do sol */
  --coffee: #d7262c;
  --river: #2f9bd6;
  --ink: #1d2733;
  --muted: #5d6a78;
  --line: #e2e6eb;
  --soft: #f4f6f8;
  --card: #ffffff;
  --shadow: 0 2px 10px rgba(16, 32, 56, .12);
  --radius: 12px;
  --top: 64px;
  --foot: 44px;
  --panel-w: 360px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--soft); }
body { display: flex; flex-direction: column; overflow: hidden; font-size: 14px; }
button { font: inherit; color: inherit; cursor: pointer; }
:where(.topbar, .search, .tabs, .toolbar, .icon-btn, .topic-name, .report-btn, .modal) svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

/* ---------- topo ---------- */
.topbar {
  position: relative; height: var(--top); flex: none; display: flex; align-items: center; gap: 24px;
  padding: 0 24px 4px; background: var(--card); z-index: 1001;
}
/* faixa colorida inspirada no rodapé do convite */
.stripe { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; display: flex; }
.stripe i { flex: 1; }
.stripe i:nth-child(1) { background: var(--yellow); }
.stripe i:nth-child(2) { background: var(--accent); }
.stripe i:nth-child(3) { background: var(--brand-2); }
.stripe i:nth-child(4) { background: var(--lime); }
.stripe i:nth-child(5) { background: var(--brand); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--brand); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text small { font-size: 9.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.brand-text strong {
  font-family: "Barlow Semi Condensed", "Inter", sans-serif; font-style: italic; font-weight: 800;
  font-size: 21px; letter-spacing: .01em; text-transform: uppercase; color: var(--brand); line-height: 1;
}
.brand-text .uf { color: var(--accent); }

.nav { display: flex; gap: 6px; margin: 0 auto; height: 100%; }
.nav a {
  display: flex; align-items: center; padding: 0 18px; height: 100%;
  font-size: 12.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent;
}
.nav a:hover { color: var(--brand); }
.nav a.active { color: var(--brand); border-bottom-color: var(--brand); }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; padding: 8px; }
.partner { display: flex; align-items: center; height: 36px; padding-left: 20px; border-left: 1px solid var(--line); flex: none; }
.partner img { height: 30px; width: auto; display: block; }

/* ---------- mapa ---------- */
.stage { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; background: #e9eef2; }
.leaflet-container { font-family: inherit; }
.leaflet-pane > svg { pointer-events: none; }  /* só os traços interativos recebem clique */
.leaflet-pane > svg path.leaflet-interactive { cursor: pointer; }

/* busca */
.search {
  position: absolute; top: 14px; left: 14px; width: min(420px, calc(100% - 28px)); z-index: 1000;
  display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 48px;
  background: var(--card); border-radius: 999px; box-shadow: var(--shadow); color: var(--muted);
}
.search input { flex: 1; border: 0; outline: 0; font: inherit; color: var(--ink); background: none; min-width: 0; }
.search-results {
  position: absolute; top: 54px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 320px; overflow: auto;
}
.search-results li { padding: 9px 10px; border-radius: 8px; cursor: pointer; color: var(--ink); line-height: 1.3; }
.search-results li:hover, .search-results li:focus { background: var(--soft); outline: 0; }
.search-results li small { display: block; color: var(--muted); font-size: 12px; }

/* painel */
.panel {
  position: absolute; top: 74px; left: 14px; bottom: 14px; width: var(--panel-w); z-index: 999;
  display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .2s ease, opacity .2s ease;
}
.panel.closed { transform: translateX(calc(-100% - 20px)); opacity: 0; pointer-events: none; }
.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 8px; flex: none; }
.tab {
  display: flex; align-items: center; gap: 8px; padding: 14px 14px 12px; background: none; border: 0;
  border-bottom: 3px solid transparent; font-weight: 600; color: var(--muted);
}
.tab svg { width: 18px; height: 18px; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-body { overflow: auto; padding: 4px 16px 16px; flex: 1; }
.tab-body h2 { font-size: 18px; margin: 16px 0 10px; }

/* tópicos */
.topic { border-bottom: 1px solid var(--line); }
.topic:last-of-type { border-bottom: 0; }
.topic-head { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.topic-name {
  flex: 1; display: flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0;
  text-align: left; font-weight: 500; font-size: 14.5px;
}
.topic-name svg { width: 16px; height: 16px; transition: transform .15s; color: var(--muted); }
.topic.open .topic-name svg { transform: rotate(180deg); }
.badge { font-size: 11.5px; font-weight: 600; color: var(--brand); background: var(--brand-soft); border-radius: 999px; padding: 2px 8px; }
.badge:empty { display: none; }
.topic-layers { list-style: none; margin: 0 0 8px; padding: 0 0 0 28px; display: none; }
.topic.open .topic-layers { display: block; }
.sub { padding: 4px 0 2px; }
.sub-name {
  display: block; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--brand-2); padding: 4px 0 2px; border-top: 1px dashed var(--line);
}
.sub ul { list-style: none; margin: 0; padding: 0 0 0 4px; border-left: 2px solid var(--brand-soft); }
.sub .lyr { padding-left: 8px; }

.chk { display: inline-flex; position: relative; flex: none; }
.chk input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chk .box {
  width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid #b9c2cc; background: #fff;
  display: grid; place-items: center; transition: background .1s, border-color .1s;
}
.chk input:checked + .box, .chk input:indeterminate + .box { background: var(--brand); border-color: var(--brand); }
.chk input:checked + .box::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.chk input:indeterminate + .box::after { content: ""; width: 8px; height: 2px; background: #fff; }
.chk input:focus-visible + .box { outline: 2px solid var(--yellow); outline-offset: 2px; }

.lyr { display: flex; align-items: flex-start; gap: 9px; padding: 6px 0; }
.lyr > label { display: flex; align-items: flex-start; gap: 9px; flex: 1; cursor: pointer; line-height: 1.3; min-width: 0; }
.lyr .lname { flex: 1; }
.lyr .lname small { display: block; color: var(--muted); font-size: 11.5px; }
.swatch { width: 18px; height: 18px; flex: none; }
.lyr .actions { display: flex; gap: 2px; opacity: .55; }
.lyr:hover .actions { opacity: 1; }
.icon-btn { background: none; border: 0; padding: 2px; border-radius: 6px; color: var(--muted); display: grid; place-items: center; text-decoration: none; }
.icon-btn:hover { background: var(--soft); color: var(--brand); }
.icon-btn svg { width: 16px; height: 16px; }
.lyr.loading .swatch { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.legend { list-style: none; margin: 0 0 6px 27px; padding: 0; font-size: 12.5px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 7px; padding: 2px 0; }
.legend .swatch { width: 14px; height: 14px; }

.clear-btn { margin-top: 14px; width: 100%; padding: 9px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-weight: 500; color: var(--muted); }
.clear-btn:hover { border-color: var(--brand); color: var(--brand); }

/* mapas base */
.basemap { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 10px; cursor: pointer; border: 1.5px solid transparent; }
.basemap:hover { background: var(--soft); }
.basemap.active { border-color: var(--brand); background: var(--brand-soft); }
.basemap img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; background: var(--soft); }
.basemap input { display: none; }

/* barra de ferramentas */
.toolbar {
  position: absolute; top: 74px; left: calc(14px + var(--panel-w) + 10px); z-index: 999;
  display: flex; flex-direction: column; gap: 6px; transition: left .2s ease;
}
.panel.closed ~ .toolbar { left: 14px; }
.toolbar button {
  width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 8px;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow);
}
.toolbar button:hover { color: var(--brand); }
.toolbar button.primary { background: var(--brand); color: #fff; }
.toolbar button:nth-child(2) { margin-bottom: 8px; }

/* status */
.status {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 1000;
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow);
}

/* popup */
.leaflet-tooltip.map-label { background: none; border: 0; box-shadow: none; padding: 0; font-size: 11.5px; font-weight: 700; color: #12331a; white-space: nowrap; pointer-events: none;
  text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff, 0 0 3px #fff; }
.leaflet-tooltip.map-label::before { display: none; }
.leaflet-popup-content-wrapper { border-radius: 10px; }
.leaflet-popup-content { margin: 12px 14px; font-size: 13px; }
.pop h3 { margin: 0 0 8px; font-size: 13px; color: var(--brand-2); text-transform: uppercase; letter-spacing: .05em; }
.pop table { border-collapse: collapse; width: 100%; }
.pop th, .pop td { text-align: left; vertical-align: top; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.pop th { color: var(--muted); font-weight: 500; white-space: nowrap; }
.pop .scroll { max-height: 260px; overflow: auto; }
.pop .more { margin-top: 6px; font-size: 12px; color: var(--muted); }

.leaflet-control-scale-line { border-color: var(--brand); color: var(--brand); font-weight: 600; background: rgba(255,255,255,.85); }

/* páginas */
.page { position: absolute; inset: 0; z-index: 1002; background: var(--soft); overflow: auto; }
.page-inner { max-width: 860px; margin: 0 auto; padding: 40px 24px 60px; line-height: 1.6; }
.page-inner h1 {
  font-family: "Barlow Semi Condensed", "Inter", sans-serif; font-style: italic; font-weight: 800;
  font-size: 34px; text-transform: uppercase; color: var(--brand); margin: 0 0 8px;
}
.page-inner .lead { color: var(--muted); margin: 0 0 28px; }
.page-inner input[type=search] {
  width: 100%; padding: 12px 16px; border-radius: 999px; border: 1px solid var(--line); font: inherit; margin-bottom: 20px; background: #fff;
}
.gloss dt { font-weight: 600; margin-top: 18px; color: var(--ink); }
.gloss dd { margin: 4px 0 0; color: #3a4654; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 0 18px; margin-bottom: 10px; }
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 18px; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0 0 16px; color: #3a4654; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 14px; }
.card h2 { margin: 0 0 6px; font-size: 16px; }
.card a { color: var(--brand-2); }
.contact { border-left: 4px solid var(--brand); }
.contact-data { border-collapse: collapse; }
.contact-data th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 24px 6px 0; vertical-align: top; }
.contact-data td { padding: 6px 0; font-weight: 600; }
.contact-tag {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--brand); background: var(--brand-soft); border-radius: 999px; padding: 3px 10px; margin-bottom: 8px;
}
.btn {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; padding: 10px 18px; border-radius: 999px;
  background: var(--brand); color: #fff !important; font-weight: 600; text-decoration: none;
}
.btn:hover { background: var(--brand-2); }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* rodapé */
.footer {
  height: var(--foot); flex: none; display: flex; align-items: center; gap: 36px; padding: 0 24px;
  background: var(--card); border-top: 1px solid var(--line); font-size: 12.5px; overflow-x: auto; white-space: nowrap;
}
.footer .grp { display: flex; align-items: center; gap: 10px; }
.footer .lbl { font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.footer .org { color: var(--ink); font-weight: 500; text-decoration: none; display: flex; align-items: center; gap: 6px; }
.footer .org img { height: 26px; }
.footer .upd { margin-left: auto; color: var(--muted); }

/* ---------- celular ---------- */
@media (max-width: 860px) {
  :root { --top: 56px; --panel-w: calc(100vw - 28px); }
  .topbar { padding: 0 12px; }
  .nav-toggle { display: block; margin-left: 0; }
  .partner { margin-left: auto; padding-left: 12px; height: 28px; }
  .partner img { height: 20px; }
  .brand img { width: 48px; height: auto; }
  .brand-text strong { font-size: 16px; white-space: nowrap; }
  .nav {
    position: absolute; top: var(--top); left: 0; right: 0; height: auto; flex-direction: column; gap: 0;
    background: var(--card); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); display: none;
  }
  .nav.open { display: flex; }
  .nav a { height: 48px; border-bottom: 0; border-left: 3px solid transparent; }
  .nav a.active { border-left-color: var(--brand); }
  .search { height: 44px; top: 10px; left: 10px; width: calc(100% - 20px); }
  .panel { top: auto; left: 10px; right: 10px; bottom: 10px; width: auto; max-height: 58%; }
  .panel.closed { transform: translateY(calc(100% + 20px)); }
  .toolbar { top: 64px; left: auto !important; right: 10px; }
  .toolbar button { width: 38px; height: 38px; }
  .footer { gap: 20px; padding: 0 12px; }
  .footer .upd { display: none; }
}

/* ---------- relatório de vocação ---------- */
.report-btn {
  margin-top: 8px; width: 100%; padding: 10px; border-radius: 8px; border: 0; background: var(--brand); color: #fff;
  font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.report-btn:hover { background: var(--brand-2); }
.report-btn svg { width: 18px; height: 18px; }
.modal-back { position: fixed; inset: 0; z-index: 2000; background: rgba(16, 32, 24, .45); display: grid; place-items: center; padding: 16px; }
.modal { width: min(640px, 100%); max-height: min(86vh, 760px); display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.modal header { padding: 18px 22px 10px; border-bottom: 1px solid var(--line); }
.modal header h2 { margin: 0 0 4px; font-size: 18px; color: var(--brand); }
.modal header p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.modal .body { padding: 12px 22px; overflow: auto; }
.modal .tools { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.modal .tools input { flex: 1; min-width: 160px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; font: inherit; }
.modal .tools button { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-weight: 500; color: var(--muted); }
.modal .tools button:hover { border-color: var(--brand); color: var(--brand); }
.mun-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 14px; }
.mun-grid label { display: flex; align-items: center; gap: 9px; padding: 6px 4px; border-radius: 6px; cursor: pointer; }
.mun-grid label:hover { background: var(--soft); }
.mun-grid small { color: var(--muted); margin-left: auto; font-size: 11.5px; white-space: nowrap; }
.modal footer { padding: 12px 22px 16px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.modal footer .count { color: var(--muted); font-size: 13px; margin-right: auto; }
.modal footer button { padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-weight: 600; color: var(--muted); }
.modal footer button.go { background: var(--brand); border-color: var(--brand); color: #fff; }
.modal footer button.go:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 560px) { .mun-grid { grid-template-columns: 1fr; } }
