/* ===================== Tokens ===================== */
:root {
  color-scheme: light;
  --bg: #f4f8fb;
  --surface: #ffffff;
  --surface-2: #eef4f8;
  --border: #d8e3ec;
  --text: #0f2333;
  --text-2: #3d5568;
  --muted: #627789;
  --primary: #0b65a8;
  --primary-ink: #ffffff;
  --primary-soft: #e3f0fa;
  --teal: #0b7a6c;
  --teal-soft: #dff3ef;
  --danger: #c62f2f;
  --danger-soft: #fdeaea;
  --focus: #f0a000;
  --shadow: 0 1px 2px rgba(15, 35, 51, .06), 0 4px 16px rgba(15, 35, 51, .06);
  --radius: 14px;
  /* categorical slots (validated reference palette, light) */
  --cat-1: #2a78d6; --cat-2: #eb6834; --cat-3: #1baf7a; --cat-4: #eda100;
  --cat-5: #e87ba4; --cat-6: #008300; --cat-7: #6250d6; --cat-8: #e34948;
  --m-red: #d03b3b; --m-orange: #ec835a; --m-yellow: #fab219; --m-green: #0ca30c; --m-blue: #2a78d6;
  --fs: 17px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1820; --surface: #13222d; --surface-2: #1a2d3a; --border: #2a4152;
    --text: #e8f1f7; --text-2: #b8cad7; --muted: #8fa5b5;
    --primary: #4ea3e8; --primary-ink: #06121b; --primary-soft: #16314a;
    --teal: #3cc2ad; --teal-soft: #123a35; --danger: #ff7b7b; --danger-soft: #3a1a1c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --cat-4: #c98500;
    --cat-5: #d55181; --cat-6: #008300; --cat-7: #9085e9; --cat-8: #e66767;
    --m-blue: #3987e5;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1820; --surface: #13222d; --surface-2: #1a2d3a; --border: #2a4152;
  --text: #e8f1f7; --text-2: #b8cad7; --muted: #8fa5b5;
  --primary: #4ea3e8; --primary-ink: #06121b; --primary-soft: #16314a;
  --teal: #3cc2ad; --teal-soft: #123a35; --danger: #ff7b7b; --danger-soft: #3a1a1c;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --cat-4: #c98500;
  --cat-5: #d55181; --cat-6: #008300; --cat-7: #9085e9; --cat-8: #e66767;
  --m-blue: #3987e5;
}
:root.fonte-grande { --fs: 20px; }

/* ===================== Base ===================== */
* { box-sizing: border-box; }
html { font-size: var(--fs); scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.55; -webkit-font-smoothing: antialiased;
  padding-bottom: 72px; /* bottom nav no celular */
}
@media (min-width: 1080px) { body { padding-bottom: 0; } }
img { max-width: 100%; display: block; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; text-wrap: balance; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--primary); color: var(--primary-ink); padding: 10px 16px; border-radius: 8px; z-index: 2000; }
.skip:focus { top: 8px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.icon { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ===================== Header ===================== */
.topbar { background: var(--danger); color: #fff; font-size: .9rem; }
.topbar .wrap { display: flex; gap: 12px; align-items: center; justify-content: center; padding-block: 6px; flex-wrap: wrap; text-align: center; }
.topbar a { color: #fff; font-weight: 700; }
header.site {
  position: sticky; top: 0; z-index: 1000; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
header.site .wrap { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); margin-right: auto; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--primary), var(--teal)); display: grid; place-items: center; color: #fff; }
.brand b { display: block; font-size: 1rem; }
.brand small { display: block; color: var(--muted); font-size: .75rem; }
nav.main { display: none; gap: 4px; }
nav.main a { text-decoration: none; color: var(--text-2); padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: .9rem; }
nav.main a:hover, nav.main a[aria-current="true"] { background: var(--primary-soft); color: var(--primary); }
@media (min-width: 1080px) { nav.main { display: flex; } }
.tools { display: flex; gap: 6px; }
.btn-icon { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; min-width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; font-weight: 700; font-size: .9rem; padding: 0 8px; }
.btn-icon:hover { background: var(--surface-2); }

/* bottom nav (celular) */
nav.bottom { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000; background: var(--surface); border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom); }
nav.bottom a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; text-decoration: none; color: var(--text-2); font-size: .68rem; font-weight: 600; min-height: 60px; justify-content: center; }
nav.bottom a[aria-current="true"] { color: var(--primary); }
nav.bottom a.sos { color: var(--danger); }
@media (min-width: 1080px) { nav.bottom { display: none; } }

/* ===================== Sections ===================== */
section.block { padding: 48px 0; }
section.block + section.block { border-top: 1px solid var(--border); }
.eyebrow { color: var(--teal); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; margin-bottom: .4em; }
.lead { color: var(--text-2); font-size: 1.05rem; max-width: 70ch; }

/* Hero */
.hero { background: linear-gradient(160deg, var(--primary-soft), var(--teal-soft)); padding: 40px 0 48px; }
.hero h1 { font-size: clamp(1.7rem, 4.5vw, 2.6rem); }
.hero .lead { margin-bottom: 1.3em; }
.search-big { display: flex; gap: 8px; background: var(--surface); border: 2px solid var(--border); border-radius: 16px; padding: 6px; box-shadow: var(--shadow); max-width: 720px; }
.search-big:focus-within { border-color: var(--primary); }
.search-big svg { margin: auto 4px auto 10px; color: var(--muted); }
.search-big input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 1.05rem; color: var(--text); padding: 10px 4px; }
.search-big input:focus { outline: none; }
.btn { border: 0; border-radius: 12px; background: var(--primary); color: var(--primary-ink); font: inherit; font-weight: 700; padding: 10px 18px; cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; justify-content: center; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--surface); color: var(--primary); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); color: #fff; }
.hint { color: var(--muted); font-size: .85rem; margin-top: 10px; }
.chips-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: .85rem; cursor: pointer; min-height: 36px; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 28px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--text-2); font-size: .88rem; }

/* Shortcut grid */
.shortcuts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .shortcuts { grid-template-columns: repeat(4, 1fr); } }
.shortcut { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); cursor: pointer; font: inherit; text-align: left; transition: transform .15s, border-color .15s; }
.shortcut:hover { transform: translateY(-2px); border-color: var(--primary); }
.shortcut .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.shortcut.red .ic { background: var(--danger-soft); color: var(--danger); }
.shortcut.teal .ic { background: var(--teal-soft); color: var(--teal); }
.shortcut b { font-size: 1rem; }
.shortcut small { color: var(--text-2); font-size: .82rem; line-height: 1.4; }

/* Guia "onde ir" */
.guide { display: grid; gap: 12px; margin-top: 16px; }
@media (min-width: 820px) { .guide { grid-template-columns: repeat(3, 1fr); } }
.guide-card { border-radius: var(--radius); padding: 18px; border: 1px solid var(--border); background: var(--surface); }
.guide-card.g1 { border-top: 6px solid var(--teal); }
.guide-card.g2 { border-top: 6px solid var(--m-orange); }
.guide-card.g3 { border-top: 6px solid var(--danger); }
.guide-card ul { margin: .4em 0 0; padding-left: 1.1em; color: var(--text-2); font-size: .92rem; }

/* ===================== Unidades ===================== */
.finder { display: grid; gap: 16px; }
.filters { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.filters .row { display: grid; gap: 12px; }
@media (min-width: 720px) { .filters .row { grid-template-columns: 2fr 1fr 1fr; } }
.field label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 4px; color: var(--text-2); }
.field input, .field select { width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-height: 44px; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.result-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; color: var(--text-2); font-size: .92rem; }
.cards { display: grid; gap: 12px; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); border-left: 6px solid var(--c, var(--primary)); }
.card h3 { margin: 0; font-size: 1.05rem; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); display: inline-flex; align-items: center; gap: 5px; }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.badge.h24 { background: var(--danger-soft); color: var(--danger); }
.badge.ok { background: var(--teal-soft); color: var(--teal); }
.meta { display: grid; gap: 4px; font-size: .88rem; color: var(--text-2); }
.meta div { display: flex; gap: 8px; align-items: flex-start; }
.meta svg { margin-top: 3px; color: var(--muted); width: 1.05em; height: 1.05em; }
.card .actions { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.card .actions .btn { padding: 8px 14px; font-size: .88rem; flex: 1; }
.match { font-size: .8rem; color: var(--teal); background: var(--teal-soft); padding: 4px 8px; border-radius: 8px; }
.empty { text-align: center; padding: 40px 16px; color: var(--text-2); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }

/* ===================== Mapa ===================== */
.map-layout { display: grid; gap: 16px; }
@media (min-width: 960px) { .map-layout { grid-template-columns: 1fr 320px; } }
#mapa { height: 62vh; min-height: 380px; max-height: 640px; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); z-index: 1; }
.map-side { display: grid; gap: 12px; align-content: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.panel h3 { font-size: .95rem; margin-bottom: 8px; }
.legend { display: grid; gap: 6px; font-size: .85rem; }
.legend button { all: unset; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 6px; border-radius: 8px; color: var(--text); }
.legend button:focus-visible { outline: 3px solid var(--focus); }
.legend button[aria-pressed="false"] { opacity: .4; text-decoration: line-through; }
.legend .pin { width: 22px; height: 22px; border-radius: 50%; background: var(--c); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); display: grid; place-items: center; color: #fff; }
.legend .pin svg { width: 12px; height: 12px; }
.prec-key { display: grid; gap: 6px; font-size: .82rem; color: var(--text-2); }
.prec-key span.k { display: inline-block; width: 16px; height: 16px; border-radius: 50%; vertical-align: -3px; margin-right: 6px; background: var(--muted); }
.prec-key span.k.aprox { background: transparent; border: 2px dashed var(--muted); }
.nolist { margin: 0; padding-left: 1.1em; font-size: .85rem; color: var(--text-2); }
.nolist button { all: unset; cursor: pointer; color: var(--primary); text-decoration: underline; }
.mk { width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); display: grid; place-items: center; }
.mk.aprox { border-style: dashed; }
.mk svg { transform: rotate(45deg); width: 16px; height: 16px; color: #fff; stroke: #fff; }
.mk .n { position: absolute; top: -8px; right: -8px; transform: rotate(45deg); background: #0f2333; color: #fff; font: 700 11px/18px system-ui; min-width: 18px; height: 18px; border-radius: 9px; text-align: center; }
.leaflet-popup-content { font-family: inherit; font-size: 14px; line-height: 1.45; margin: 12px 14px; }
.leaflet-popup-content h4 { margin: 0 0 4px; font-size: 15px; }
.pop-unit { padding: 8px 0; border-top: 1px solid #e3e9ee; }
.pop-unit:first-of-type { border-top: 0; padding-top: 4px; }
.pop-unit button { background: #0b65a8; color: #fff; border: 0; border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 13px; cursor: pointer; margin-top: 6px; }
.pop-prec { font-size: 12px; color: #627789; margin-top: 6px; }

/* ===================== Indicadores ===================== */
.viz-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .viz-grid { grid-template-columns: repeat(2, 1fr); } }
.viz { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.viz h3 { margin-bottom: 2px; }
.viz .sub { color: var(--muted); font-size: .85rem; margin-bottom: 14px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 6px 10px; align-items: center; font-size: .86rem; }
.hbar .lab { color: var(--text-2); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { position: relative; height: 22px; display: flex; align-items: center; gap: 6px; }
.hbar .bar { height: 18px; background: var(--c, var(--cat-1)); border-radius: 0 4px 4px 0; min-width: 2px; cursor: default; }
.hbar .bar:hover, .hbar .bar:focus { filter: brightness(1.1); outline: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c, var(--cat-1)); }
.hbar .val { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; font-size: .82rem; }
.split { display: flex; height: 36px; gap: 2px; border-radius: 6px; overflow: hidden; margin: 6px 0 10px; }
.split div { height: 100%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .85rem; }
.keys { display: flex; flex-wrap: wrap; gap: 14px; font-size: .85rem; color: var(--text-2); }
.keys i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi { background: var(--surface-2); border-radius: 12px; padding: 12px; }
.kpi b { display: block; font-size: 1.7rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi span { font-size: .8rem; color: var(--text-2); }
details.table { margin-top: 12px; font-size: .85rem; }
details.table summary { cursor: pointer; color: var(--primary); font-weight: 600; }
details.table table { width: 100%; border-collapse: collapse; margin-top: 8px; }
details.table th, details.table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
details.table td.n { text-align: right; font-variant-numeric: tabular-nums; }
.tip { position: fixed; z-index: 3000; pointer-events: none; background: var(--text); color: var(--bg); padding: 6px 10px; border-radius: 8px; font-size: .82rem; box-shadow: var(--shadow); opacity: 0; transition: opacity .1s; max-width: 260px; }
.tip.on { opacity: 1; }

/* ===================== Urgência ===================== */
.urg-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .urg-grid { grid-template-columns: 1fr 1fr; } }
.call { display: flex; align-items: center; gap: 16px; background: var(--danger); color: #fff; border-radius: var(--radius); padding: 20px; text-decoration: none; }
.call b { font-size: 2.6rem; line-height: 1; }
.call span { font-size: .95rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tags span { background: var(--danger-soft); color: var(--danger); font-size: .8rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.manch { display: grid; gap: 8px; }
.manch-row { display: grid; grid-template-columns: 120px 1fr; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.manch-row .sw { border-radius: 8px; padding: 8px; color: #fff; font-weight: 700; font-size: .85rem; text-align: center; }
.manch-row .sw.amarelo { color: #3a2a00; }
.manch-row small { color: var(--text-2); display: block; }
.steps { counter-reset: s; display: grid; gap: 10px; padding: 0; list-style: none; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: start; }
.steps li::before { content: counter(s); width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); display: grid; place-items: center; font-weight: 700; }
.steps b { display: block; }
.steps span { color: var(--text-2); font-size: .92rem; }

/* ===================== Como acessar ===================== */
.access-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .access-grid { grid-template-columns: repeat(2, 1fr); } }
.box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.box ul { padding-left: 1.1em; color: var(--text-2); margin: 0; }
.box li { margin-bottom: 4px; }
.infografico { border-radius: var(--radius); border: 1px solid var(--border); background: #fff; }

/* ===================== Modal ===================== */
dialog { border: 0; padding: 0; border-radius: 18px; width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(8, 20, 30, .55); }
.dlg-head { position: sticky; top: 0; background: var(--surface); padding: 18px 20px 12px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; z-index: 1; border-top: 6px solid var(--c, var(--primary)); }
.dlg-head h2 { font-size: 1.3rem; margin: 4px 0 6px; }
.dlg-body { padding: 16px 20px 22px; display: grid; gap: 16px; }
.dlg-body h3 { font-size: .95rem; margin-bottom: 6px; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.dlg-body ul { margin: 0; padding-left: 1.1em; }
.dlg-body li { margin-bottom: 3px; }
.info-grid { display: grid; gap: 10px; }
@media (min-width: 600px) { .info-grid { grid-template-columns: 1fr 1fr; } }
.info { background: var(--surface-2); border-radius: 12px; padding: 12px; font-size: .92rem; }
.info .k { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.na { color: var(--muted); font-style: italic; }
.team { display: grid; gap: 8px; }
.team div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: .92rem; }
.team b { display: block; font-size: .85rem; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills span { background: var(--teal-soft); color: var(--teal); border-radius: 999px; padding: 4px 10px; font-size: .82rem; font-weight: 600; }
.close { margin-left: auto; }

/* ===================== Footer ===================== */
footer { background: var(--surface); border-top: 1px solid var(--border); padding: 28px 0; color: var(--text-2); font-size: .85rem; }
footer .wrap { display: grid; gap: 14px; }
@media (min-width: 720px) { footer .wrap { grid-template-columns: auto 1fr; align-items: center; } }
footer img { height: 46px; width: auto; background: #fff; border-radius: 8px; padding: 4px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print { header.site, nav.bottom, .topbar, #mapa { display: none; } }

/* ===================== Minha comunidade ===================== */
.picker { max-width: 720px; background: var(--surface); border: 2px solid var(--primary); border-radius: 18px; padding: 14px 16px 16px; box-shadow: var(--shadow); }
.picker label { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.picker select { width: 100%; font: inherit; font-size: 1.15rem; font-weight: 600; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 14px 12px; min-height: 56px; cursor: pointer; }
.or { max-width: 720px; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .88rem; margin: 22px 0 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

section.comunidade { background: var(--surface); padding-top: 32px; }
.com-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.com-head h2 { margin: 2px 0 6px; font-size: 1.9rem; }
.com-head p { margin: 0; color: var(--text-2); }
.com-main { display: grid; gap: 16px; grid-template-columns: 1fr; margin-bottom: 16px; }
@media (min-width: 820px) { .com-main { grid-template-columns: 1.3fr 1fr; } }
.unit-hero { border-radius: var(--radius); padding: 18px; background: linear-gradient(150deg, var(--primary-soft), var(--teal-soft)); border: 1px solid var(--border); display: grid; gap: 10px; }
.unit-hero .tag { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; color: var(--teal); background: var(--surface); padding: 4px 10px; border-radius: 999px; width: fit-content; }
.unit-hero h3 { font-size: 1.35rem; margin: 0; }
.unit-hero .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sos-box { border-radius: var(--radius); padding: 18px; background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); display: grid; gap: 10px; align-content: start; }
.sos-box h3 { color: var(--danger); margin: 0; display: flex; gap: 8px; align-items: center; }
.sos-box p { margin: 0; font-size: .92rem; color: var(--text-2); }
.opts { display: grid; gap: 12px; }
@media (min-width: 640px) { .opts { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .opts { grid-template-columns: repeat(3, 1fr); } }
.opt { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: start; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.opt .ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.opt.good .ic { background: var(--teal-soft); color: var(--teal); }
.opt b { display: block; font-size: 1rem; }
.opt .where { font-weight: 600; color: var(--text); font-size: .92rem; }
.opt small { display: block; color: var(--text-2); font-size: .84rem; line-height: 1.4; margin-top: 2px; }
.opt .lk { all: unset; cursor: pointer; color: var(--primary); font-weight: 600; font-size: .85rem; text-decoration: underline; margin-top: 6px; display: inline-block; }
.opt .lk:focus-visible { outline: 3px solid var(--focus); }
.com-sug { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--teal-soft); border-radius: 12px; padding: 10px 14px; grid-column: 1 / -1; }

/* Mapa: comunidades */
.check { display: flex; align-items: center; gap: 8px; font-size: .88rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }
.com-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid #0b7a6c; }
.pop-com h4 { margin: 0 0 2px; font-size: 15px; }
.pop-com button { background: #0b7a6c; color: #fff; border: 0; border-radius: 8px; padding: 8px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; margin-top: 8px; width: 100%; }

/* ===================== Busca de unidades (versão simplificada) ===================== */
.finder-bar { display: grid; gap: 14px; }
.search-unid { max-width: none; }
.cat-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity; scrollbar-width: thin; }
@media (min-width: 900px) { .cat-scroll { flex-wrap: wrap; overflow: visible; } }
.pill { flex: none; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 6px 14px 6px 6px; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; min-height: 44px; }
.pill[data-cat="todas"] { padding: 6px 16px; }
.pill:hover { border-color: var(--primary); }
.pill-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; }
.pill-ic svg { width: 17px; height: 17px; }
.pill[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.pill[aria-pressed="true"] .pill-ic { box-shadow: 0 0 0 2px var(--primary-ink); }
details.more { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
details.more summary { cursor: pointer; padding: 10px 14px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 8px; list-style: none; min-height: 44px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: "▾"; margin-left: auto; transition: transform .15s; }
details.more[open] summary::after { transform: rotate(180deg); }
details.more #nAtivos { color: var(--primary); }
.more-body { display: grid; gap: 12px; padding: 0 14px 14px; }
@media (min-width: 720px) { .more-body { grid-template-columns: 1fr 1fr auto; align-items: end; } }
.toggles { display: flex; gap: 8px; flex-wrap: wrap; }
.result-bar { margin-top: 4px; }
.ativos { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-x { border: 0; background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; min-height: 34px; }
.tag-x.limpar { background: transparent; text-decoration: underline; }

#lista { display: grid; gap: 26px; }
.grp h3 { font-size: 1rem; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--text-2); }
.grp h3 span { background: var(--surface-2); color: var(--text-2); border-radius: 999px; padding: 1px 9px; font-size: .78rem; }
.rows { display: grid; gap: 8px; }
@media (min-width: 820px) { .rows { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .rows { grid-template-columns: repeat(3, 1fr); } }
.row { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 44px 1fr 20px; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 12px 12px 14px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.row:hover { border-color: var(--c); box-shadow: var(--shadow); transform: translateY(-1px); }
.row:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.row-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); align-self: start; }
.row-main { display: grid; gap: 2px; min-width: 0; }
.row-t { font-weight: 700; font-size: 1rem; color: var(--text); }
.row-s { display: flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-s .icon { width: .95em; height: .95em; color: var(--muted); flex: none; }
.row-s.h24 { color: var(--danger); font-weight: 600; }
.row-s.h24 .icon { color: var(--danger); }
.row-match { display: flex; gap: 6px; align-items: center; font-size: .8rem; color: var(--teal); font-weight: 600; margin-top: 2px; }
.row-match .icon { width: 1em; height: 1em; }
.row-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.mini { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.mini .icon { width: 1em; height: 1em; }
.mini.red { background: var(--danger-soft); color: var(--danger); }
.mini.teal { background: var(--teal-soft); color: var(--teal); }
.row-go { color: var(--muted); }
.row:hover .row-go { color: var(--c); }

/* ===================== Hero centralizado (v2) ===================== */
.hero { position: relative; overflow: hidden; text-align: center; padding: 56px 0 64px;
  background: linear-gradient(180deg, var(--primary-soft) 0%, var(--bg) 100%); }
.hero-bg { position: absolute; inset: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56'%3E%3Cpath d='M25 20h6v5h5v6h-5v5h-6v-5h-5v-6h5z' fill='%230b65a8' fill-opacity='.06'/%3E%3C/svg%3E");
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%); mask-image: linear-gradient(180deg, #000 0%, transparent 85%); }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; }
.blob.b1 { width: 420px; height: 420px; background: color-mix(in srgb, var(--teal) 35%, transparent); top: -140px; left: -120px; }
.blob.b2 { width: 360px; height: 360px; background: color-mix(in srgb, var(--primary) 30%, transparent); top: 40px; right: -140px; }
.blob.b3 { width: 280px; height: 280px; background: color-mix(in srgb, var(--teal) 22%, transparent); bottom: -120px; left: 40%; }
.hero-inner { position: relative; max-width: 860px; display: flex; flex-direction: column; align-items: center; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); color: var(--teal); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px 6px 8px; font-size: .8rem; font-weight: 700; letter-spacing: .02em; box-shadow: var(--shadow); margin-bottom: 18px; }
.hero-badge .icon { width: 22px; height: 22px; padding: 4px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--teal)); color: #fff; fill: #fff; stroke: none; }
.hero h1 { font-size: clamp(2.3rem, 7vw, 3.6rem); letter-spacing: -.025em; margin-bottom: .3em; }
.hl { background: linear-gradient(90deg, var(--primary), var(--teal)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { margin: 0 auto 28px; max-width: 54ch; font-size: 1.08rem; }

.hero-card { width: 100%; max-width: 680px; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 22px; text-align: left;
  box-shadow: 0 1px 2px rgba(15,35,51,.05), 0 18px 48px -12px color-mix(in srgb, var(--primary) 35%, transparent); }
@media (min-width: 640px) { .hero-card { padding: 28px; } }
.hero-card .picker { max-width: none; border: 0; box-shadow: none; padding: 0; background: transparent; }
.hero-card .picker label { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); margin-bottom: 8px; }
.select-wrap { position: relative; }
.select-wrap .pin { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--primary); width: 24px; height: 24px; pointer-events: none; }
.select-wrap .chev { position: absolute; right: 16px; top: 50%; transform: translateY(-50%) rotate(90deg); color: var(--muted); pointer-events: none; }
.hero-card .picker select { appearance: none; -webkit-appearance: none; padding: 16px 48px 16px 52px; min-height: 62px; font-size: 1.15rem; border: 2px solid var(--primary); border-radius: 14px; background: var(--surface); transition: box-shadow .15s; }
.hero-card .picker select:hover, .hero-card .picker select:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); outline: none; }
.hero-card .or { margin: 20px 0 14px; max-width: none; justify-content: center; }
.hero-card .search-big { max-width: none; box-shadow: none; border-radius: 14px; background: var(--bg); }
.hero-card .chips-quick { justify-content: center; align-items: center; margin-top: 16px; }
.chips-label { width: 100%; text-align: center; font-size: .8rem; color: var(--muted); font-weight: 600; }
.chips-quick .chip .icon { width: 1.05em; height: 1.05em; color: var(--teal); }
.chips-quick .chip:hover .icon { color: var(--primary); }

.hero .stats { width: 100%; margin-top: 32px; gap: 12px; }
.hero .stat { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 18px 12px; background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(6px); }
.stat-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); margin-bottom: 6px; }
.hero .stat b { font-size: 2rem; }
.hero .stat span { font-weight: 600; color: var(--text); font-size: .9rem; }
.hero .stat small { color: var(--muted); font-size: .76rem; line-height: 1.3; }
.topbar { background: #c62f2f; }
@media (max-width: 640px) { .topbar .tb-upa { display: none; } }

/* ===================== Animação 3D da rede ===================== */
.rede3d { margin-top: 36px; border-radius: 24px; overflow: hidden; border: 1px solid var(--border);
  background: radial-gradient(120% 90% at 50% 40%, var(--surface) 0%, var(--primary-soft) 60%, var(--teal-soft) 100%); box-shadow: var(--shadow); }
.r3-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; justify-content: space-between; padding: 22px 22px 0; }
.r3-head h3 { font-size: 1.35rem; margin: 0 0 6px; }
.r3-head p { margin: 0; color: var(--text-2); font-size: .92rem; max-width: 62ch; }
.r3-pause { padding: 8px 14px; font-size: .85rem; }
.r3-stage { position: relative; height: 560px; touch-action: pan-y; }
@media (max-width: 820px) { .r3-stage { height: 480px; } }
@media (max-width: 520px) { .r3-stage { height: 460px; } }
#r3canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.r3-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.r3-label { position: absolute; left: 0; top: 0; white-space: nowrap; font-size: .74rem; font-weight: 700; color: var(--text);
  background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px;
  box-shadow: 0 2px 8px rgba(15,35,51,.08); transition: opacity .2s, background .2s; will-change: transform; }
.r3-label.ativo { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); font-size: .82rem; }
.r3-label.centro { display: grid; text-align: center; gap: 1px; padding: 6px 14px; border-radius: 14px; background: #1a3a8f; color: #fff; border-color: #1a3a8f; font-size: .85rem; }
.r3-label.centro span { font-weight: 600; font-size: .72rem; opacity: .85; }
@media (max-width: 520px) { .r3-label { font-size: .64rem; padding: 2px 7px; } .r3-label.centro { font-size: .74rem; } }
.r3-tip { position: absolute; z-index: 300; max-width: 260px; pointer-events: none; background: var(--text); color: var(--bg); border-radius: 12px; padding: 10px 12px; font-size: .82rem; line-height: 1.4; box-shadow: 0 8px 24px rgba(0,0,0,.2); opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; }
.r3-tip.on { opacity: 1; transform: none; }
.r3-tip b { display: block; font-size: .9rem; }
.r3-tip span { display: block; opacity: .85; }
.r3-tip em { display: block; margin-top: 4px; font-style: normal; font-weight: 700; color: #7fd8c8; font-size: .76rem; }
.r3-fallback { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--text-2); }
.r3-legend { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; padding: 6px 18px 20px; }
.r3-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 5px 11px; font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; min-height: 32px; }
.r3-chip:hover, .r3-chip:focus-visible { border-color: var(--primary); color: var(--primary); }
.r3-chip span { width: 10px; height: 10px; border-radius: 3px; }
.r3-chip.centro { color: var(--text); }
.infodetails { margin-top: 16px; }
.infodetails summary { cursor: pointer; color: var(--primary); font-weight: 600; padding: 8px 0; }
.infodetails img { margin-top: 10px; }
.r3-fallback[hidden] { display: none; }

/* ===================== Infográfico em destaque ===================== */
.info-fig { margin: 24px 0 0; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 18px; box-shadow: var(--shadow); }
@media (min-width: 720px) { .info-fig { padding: 24px; } }
.info-fig.destaque { outline: 3px solid var(--primary); }
.info-fig-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.info-fig-head h3 { margin: 2px 0 0; font-size: 1.2rem; }
.info-fig-ic { width: 46px; height: 46px; flex: none; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--primary), var(--teal)); }
.info-zoom { margin-left: auto; padding: 8px 14px; font-size: .85rem; }
@media (max-width: 560px) { .info-zoom { display: none; } }
.info-frame { all: unset; box-sizing: border-box; display: block; position: relative; width: 100%; cursor: zoom-in; border-radius: 18px; padding: 10px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 22%, transparent), color-mix(in srgb, var(--teal) 22%, transparent)); }
.info-frame:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.info-frame img { width: 100%; height: auto; border-radius: 12px; border: 0; background: #fff; box-shadow: 0 12px 30px -10px rgba(15,35,51,.35); transition: transform .3s ease; }
.info-frame:hover img { transform: scale(1.01); }
.info-hint { position: absolute; right: 22px; bottom: 22px; display: inline-flex; align-items: center; gap: 6px; background: rgba(15,35,51,.78); color: #fff; font-size: .8rem; font-weight: 600; padding: 7px 12px; border-radius: 999px; backdrop-filter: blur(4px); opacity: .92; }
.info-hint .icon { width: 1em; height: 1em; }
.info-fig figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; color: var(--text-2); font-size: .92rem; }
.cap-pill { background: #1a3a8f; color: #fff; font-weight: 800; font-size: .82rem; padding: 5px 12px; border-radius: 999px; }
.lightbox { width: min(1400px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; background: #fff; border-radius: 16px; overflow: auto; }
.lightbox::backdrop { background: rgba(8, 20, 30, .85); }
.lightbox img { width: 100%; height: auto; display: block; }
.lb-close { position: sticky; top: 10px; float: right; margin: 10px 10px -54px 0; z-index: 2; background: #fff; color: #0f2333; box-shadow: var(--shadow); }
@media (hover: hover) and (min-width: 561px) {
  .info-hint { opacity: 0; transition: opacity .2s; }
  .info-frame:hover .info-hint, .info-frame:focus-visible .info-hint { opacity: .92; }
}
