:root {
  --sky: #92cded;
  --sky-light: #e8f5fc;
  --ink: #0f3b57;
  --ink-soft: #33607d;
  --ink-muted: #4d6f86;
  --white: #ffffff;
  --line: #e3eef5;
  --track: #edf5fa;

  /* esferas — validated categorical set on white */
  --federal: #2563a6;
  --estadual: #4db1e3;
  --municipal: #c97a1e;

  /* map — one hue, light → dark */
  --q1: #dcf0fb;
  --q2: #a9d7f1;
  --q3: #6bb8e3;
  --q4: #3489c4;
  --q5: #1a5a93;

  --font: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }

/* iOS Safari tints its toolbar/status bar from the page background, so the page itself is sky blue
   and only the area below the hero is light. */
html { background: var(--sky); }

body {
  background: var(--sky);
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; }
button { font-family: inherit; }

/* ── sky band ─────────────────────────────────────────────────────────── */
.sky {
  background: var(--sky);
  padding: env(safe-area-inset-top) 0 72px;
}

.top {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px;
}
.avatar { border-radius: 50%; border: 2px solid var(--white); flex: none; }
.who { min-width: 0; }
.brand-link { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.who { display: flex; flex-direction: column; }
.brand { font-size: 20px; font-weight: 700; line-height: 1.1; color: var(--white); text-shadow: 0 1px 2px rgba(15, 59, 87, 0.2); }
.handle { font-size: 14px; color: var(--ink); text-decoration: none; }
.install {
  margin-left: auto;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: var(--white);
  border: 0;
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 59, 87, 0.12);
}

.hero { text-align: center; padding: 24px 16px 0; max-width: 1040px; margin: 0 auto; }
h1.label, .label { margin: 0; line-height: 1.3; color: var(--white); font-size: clamp(17px, 2.4vw, 22px); font-weight: 600; letter-spacing: 0.01em; text-shadow: 0 1px 2px rgba(15, 59, 87, 0.25); }
.bio { margin: 6px auto 0; max-width: 30em; color: var(--ink); font-size: clamp(15px, 1.8vw, 17px); line-height: 1.45; }
.readout {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 10px;
  font-size: clamp(16px, 2vw, 19px);
  font-weight: 600;
  color: var(--ink);
}
.var { font-size: 13px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--white); }
.var[hidden] { display: none; }
.var.up { color: #1e6b3a; }
.var.down { color: #9b2c2c; }
.fonte { margin: 14px 0 0; font-size: 12px; color: var(--ink); }
.fonte a { color: inherit; }

/* federal | estadual | municipal at a glance; a white pill so the light estadual segment reads on sky */
.esferas-hero {
  display: block;
  width: 100%;
  max-width: 560px;
  margin: 18px auto 0;
  padding: 8px 10px 7px;
  background: var(--white);
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(15, 59, 87, 0.08);
}
.esferas-hero:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.hero-stack { display: flex; gap: 2px; height: 12px; }
.hero-stack i { min-width: 3px; }
.hero-stack i:first-child { border-radius: 4px 0 0 4px; }
.hero-stack i:last-child { border-radius: 0 4px 4px 0; }
.hero-leg { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 12px; font-weight: 600; }
.hero-leg span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.hero-leg b { width: 8px; height: 8px; border-radius: 2px; }

.share {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 16px auto 0;
  padding: 11px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(15, 59, 87, 0.2);
}
.share:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }

.status { margin: 16px 0 0; font-size: 13px; color: var(--ink); background: rgba(255, 255, 255, 0.55); display: inline-block; padding: 5px 12px; border-radius: 999px; }
.status[hidden] { display: none; }

/* Rolling-digit counter, after the bot's banner: white digits with the neighbours ghosting above and below. */
.odometer {
  --row: 1.25em;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: clamp(20px, 7.3vw, 84px);
  line-height: 1;
  height: calc(var(--row) * 1.9);
  overflow: hidden;
  margin: 2px 0;
  text-shadow: 0 1px 3px rgba(15, 59, 87, 0.16);
  -webkit-mask-image: linear-gradient(transparent, rgba(0, 0, 0, 0.22) 16%, #000 32%, #000 68%, rgba(0, 0, 0, 0.22) 84%, transparent);
          mask-image: linear-gradient(transparent, rgba(0, 0, 0, 0.22) 16%, #000 32%, #000 68%, rgba(0, 0, 0, 0.22) 84%, transparent);
}
.odometer .sym { padding-right: 0.22em; }
.odometer .sep { width: 0.26em; text-align: center; }
.digit {
  display: block;
  flex: none;
  width: 0.57em;
  height: calc(var(--row) * 3);
  overflow: hidden;
}
.strip {
  display: flex;
  flex-direction: column;
  transition: transform 0.5s cubic-bezier(0.25, 0.8, 0.3, 1);
  will-change: transform;
}
.strip span { flex: none; height: var(--row); line-height: var(--row); text-align: center; }
.digit.fast .strip { transition: none; filter: blur(0.6px); opacity: 0.92; }

.stats {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 10px auto 0;
  max-width: 560px;
  padding: 0;
}
.stats div {
  flex: 1 1 0;
  min-width: 0;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 14px;
  padding: 10px 8px;
}
.stats dt { font-size: 12px; color: var(--ink); }
.stats dd { margin: 2px 0 0; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── cards ────────────────────────────────────────────────────────────── */
.below {
  flex: 1;
  display: flow-root;
  background: var(--sky-light);
}

main {
  max-width: 1040px;
  margin: -48px auto 0;
  padding: 0 16px;
  display: grid;
  gap: 16px;
}
.card {
  background: var(--white);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(15, 59, 87, 0.06), 0 8px 24px rgba(15, 59, 87, 0.06);
  min-width: 0;
}
.hint { margin: 0; font-size: 13px; color: var(--ink-muted); line-height: 1.4; }

/* segmented control: por estado | por tributo */
.views {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  background: var(--track);
  border-radius: 14px;
}
.views button {
  border: 0;
  border-radius: 10px;
  padding: 10px 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.views button[aria-selected="true"] {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(15, 59, 87, 0.12);
}
.views button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
[role="tabpanel"][hidden] { display: none; }

/* ── map ──────────────────────────────────────────────────────────────── */
.split {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.split[hidden] { display: none; }
.split-a { display: grid; gap: 20px; position: sticky; top: 16px; }
.list-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--ink); }
.map-wrap { width: 100%; max-width: 380px; }
.br { display: block; width: 100%; height: auto; overflow: visible; }
.br .uf { cursor: pointer; outline: none; }
.br .uf path { stroke: var(--white); stroke-width: 1.5; stroke-linejoin: round; transition: filter 0.12s; }
.br .uf:hover path { filter: brightness(1.08); }
.br-sel { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; pointer-events: none; }
.br .uf:focus-visible path { stroke: var(--ink); stroke-width: 3; stroke-dasharray: 6 3; }
.br .hit { fill: transparent; }
.br .q1 path { fill: var(--q1); } .br .q2 path { fill: var(--q2); } .br .q3 path { fill: var(--q3); }
.br .q4 path { fill: var(--q4); } .br .q5 path { fill: var(--q5); }
.br-labels { pointer-events: none; }
/* a white halo keeps every label legible over light and dark fills alike */
.br .lbl {
  font: 700 22px var(--font);
  fill: var(--ink);
  text-anchor: middle;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 4px;
  stroke-linejoin: round;
  paint-order: stroke;
}
.br .lbl.out { text-anchor: start; font-size: 21px; }
.br .lbl.sel { text-decoration: underline; }
.br .leader { stroke: var(--ink-muted); stroke-width: 1.5; }

.scale { display: flex; align-items: center; gap: 3px; margin-top: 10px; font-size: 11px; color: var(--ink-muted); }
.scale span:first-child { margin-right: 4px; }
.scale span:last-child { margin-left: 4px; }
.scale i { width: 18px; height: 8px; border-radius: 2px; }
.scale i:nth-of-type(1) { background: var(--q1); } .scale i:nth-of-type(2) { background: var(--q2); }
.scale i:nth-of-type(3) { background: var(--q3); } .scale i:nth-of-type(4) { background: var(--q4); }
.scale i:nth-of-type(5) { background: var(--q5); }

.uf-detail { min-width: 0; background: var(--sky-light); border-radius: 14px; padding: 14px 16px; }
.uf-detail .uf-nome { font-size: 15px; color: var(--ink-soft); margin: 0; }
.uf-detail .uf-nome b { color: var(--ink); font-size: 20px; display: block; margin-bottom: 2px; }
.uf-detail .uf-valor { font-size: clamp(22px, 3vw, 28px); font-weight: 600; font-variant-numeric: tabular-nums; margin: 10px 0 2px; overflow-wrap: anywhere; }
.uf-detail .uf-meta { font-size: 14px; color: var(--ink-soft); margin: 0; font-variant-numeric: tabular-nums; }
.uf-detail .uf-bar { height: 8px; background: var(--white); border-radius: 4px; margin: 14px 0 6px; overflow: hidden; }
.uf-detail .uf-bar i { display: block; height: 100%; background: var(--q4); border-radius: 4px; }

/* ── esfera chooser ─────────────────────────────────────────────────── */
.legend { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 12px; }
.legend button {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--line);
  background: var(--white);
  color: var(--ink);
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  text-align: left;
}
.legend button[aria-selected="true"] { border-color: var(--ink); }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend .t { font-size: 15px; font-weight: 600; display: block; }
.legend .v { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; display: block; white-space: pre-line; margin-top: 2px; }
.legend button { align-items: flex-start; min-width: 0; }
.legend .sw { margin-top: 4px; }

/* ── ranked lists ─────────────────────────────────────────────────────── */
.rank { list-style: none; margin: 8px 0 0; padding: 0; counter-reset: r; }
.rank li {
  counter-increment: r;
  display: grid;
  grid-template-columns: 1.8em minmax(0, 1fr) auto;
  grid-template-rows: auto 6px;
  column-gap: 8px;
  row-gap: 6px;
  align-items: baseline;
  padding: 9px 4px;
  border-top: 1px solid var(--line);
}
.rank li::before { content: counter(r); color: var(--ink-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.rank li.sel .nome { font-weight: 600; }
.rank .nome { font-size: 15px; overflow-wrap: anywhere; }
.rank .nome small { color: var(--ink-muted); font-size: 12px; margin-left: 4px; white-space: nowrap; }
.rank .valor { font-size: 15px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.rank .valor small { font-size: 12px; color: var(--ink-muted); margin-left: 8px; display: inline-block; min-width: 3.4em; text-align: right; }
.rank .bar { grid-column: 2 / 4; height: 5px; background: var(--track); border-radius: 3px; overflow: hidden; }
.rank .bar i { display: block; width: 0; height: 100%; border-radius: 3px; background: var(--q4); }
.rank .empty { display: block; color: var(--ink-muted); font-size: 14px; }
.rank .empty::before { content: none; }

.more {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.more[hidden] { display: none; }

footer {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 16px calc(32px + env(safe-area-inset-bottom));
  font-size: 12px;
  color: var(--ink-muted);
  text-align: center;
}

@media (max-width: 760px) {
  .split { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .split-a { position: static; }
  .map-wrap { max-width: 440px; margin: 0 auto; }
  .legend { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .legend button { padding: 8px; gap: 6px; }
  .card { padding: 18px 16px; }
}

@media (max-width: 480px) {
  .stats { display: grid; grid-template-columns: 1fr 1fr; }
  .rank .valor, .rank .nome { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .strip, .br .uf path { transition: none; }
}

/* ── install ──────────────────────────────────────────────────────────── */
.cta {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 520px;
  margin: 0 auto;
  padding: 10px 8px 10px 12px;
  background: var(--white);
  border-radius: 16px;
  text-align: left;
  box-shadow: 0 8px 30px rgba(15, 59, 87, 0.25);
  transform: translateY(140%);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.cta.in { transform: none; }
.cta[hidden] { display: none; }
.cta img { border-radius: 10px; flex: none; }
.cta-text { flex: 1; min-width: 0; line-height: 1.3; }
.cta-text b { display: block; font-size: 14px; }
.cta-text span { font-size: 12px; color: var(--ink-muted); }
.cta-btn {
  flex: none;
  border: 0;
  border-radius: 999px;
  padding: 9px 16px;
  background: var(--federal);
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.cta-x {
  flex: none;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.install[hidden] { display: none; }

.sheet {
  border: 0;
  padding: 0;
  width: min(440px, 100%);
  max-width: 100%;
  margin: auto auto 0;
  border-radius: 24px 24px 0 0;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 -8px 40px rgba(15, 59, 87, 0.2);
}
.sheet::backdrop { background: rgba(15, 59, 87, 0.45); }
.sheet[open] { animation: subir 0.25s ease-out; }
@keyframes subir { from { transform: translateY(40px); opacity: 0; } }
.sheet form { padding: 24px 20px calc(20px + env(safe-area-inset-bottom)); text-align: center; }
.sheet-icon { border-radius: 14px; }
.sheet h2 { margin: 10px 0 16px; font-size: 20px; }
.steps { list-style: none; counter-reset: s; margin: 0 0 20px; padding: 0; text-align: left; }
.steps li {
  counter-increment: s;
  padding: 12px 0 12px 40px;
  position: relative;
  font-size: 15px;
  line-height: 1.4;
  border-top: 1px solid var(--line);
}
.steps li::before {
  content: counter(s);
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--sky-light);
  color: var(--federal);
  font-weight: 700;
  display: grid;
  place-items: center;
  font-size: 14px;
}
.steps svg { color: var(--federal); vertical-align: -4px; margin: 0 2px; }
.steps .kbd { vertical-align: middle; margin: 0 2px; display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 6px; background: var(--track); color: var(--federal); }
.sheet-ok {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 14px;
  background: var(--ink);
  color: var(--white);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

@media (min-width: 600px) {
  .sheet { margin: auto; border-radius: 24px; }
}

/* ── links in lists, landing pages ───────────────────────────────────── */
.rank .nome a { color: inherit; text-decoration: none; }
.rank .nome a:hover { text-decoration: underline; }
.rank li.sel { background: var(--sky-light); border-radius: 8px; }
.rank li.clicavel { cursor: pointer; border-radius: 8px; transition: background 0.12s; }
@media (hover: hover) { .rank li.clicavel:hover { background: var(--sky-light); } }
.rank li.clicavel:hover .nome a { text-decoration: underline; }
.uf-link { display: inline-block; margin-top: 12px; font-size: 14px; font-weight: 600; color: var(--federal); text-decoration: none; }
.uf-link:hover { text-decoration: underline; }

.hero.sub { padding-top: 8px; }
.crumbs { font-size: 13px; color: var(--ink); margin: 0 0 16px; }
.crumbs a { color: var(--ink); }
.crumbs [aria-current] { font-weight: 600; }
.big {
  margin: 12px 0 0;
  color: var(--white);
  font-size: clamp(30px, 8vw, 64px);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px rgba(15, 59, 87, 0.16);
  overflow-wrap: anywhere;
}

.prose h2 { margin: 0 0 12px; font-size: 20px; }
.prose h3 { margin: 20px 0 6px; font-size: 16px; }
.prose p { margin: 0 0 12px; font-size: 15px; line-height: 1.6; }
.prose a, footer a { color: var(--federal); }
.card > h2 { margin: 0 0 8px; font-size: 20px; }

/* ── FAQ as accordions ───────────────────────────────────────────────── */
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 28px 14px 0;
  font-size: 16px;
  font-weight: 600;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  font-weight: 400;
  color: var(--federal);
}
.faq details[open] summary::after { content: "−"; }
.faq summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.faq details p { margin: 0 0 14px; }

@media (prefers-reduced-motion: reduce) {
  .cta { transition: none; }
}


/* ── state page: proportion facts and city counters ───────────────────── */
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 14px 0 16px; }
.facts div { background: var(--sky-light); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.facts dt { font-size: 12px; color: var(--ink-soft); }
.facts dd { margin: 2px 0; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.facts span { font-size: 12px; color: var(--ink-muted); line-height: 1.35; display: block; }
@media (max-width: 760px) { .facts { grid-template-columns: 1fr 1fr; } }

.cidades h2 { margin: 0 0 4px; font-size: 20px; }
.cidade { margin: 12px 0 0; padding: 16px; background: var(--sky-light); border-radius: 14px; transition: opacity 0.15s; }
.cidade[hidden] { display: none; }
.cidade.loading { opacity: 0.5; }
.cidade-nome { margin: 0; font-size: 18px; font-weight: 700; }
.cidade-nome small { font-size: 12px; font-weight: 600; color: var(--federal); text-transform: uppercase; letter-spacing: 0.04em; margin-left: 6px; }
.cidade-valor { margin: 6px 0 2px; font-size: clamp(24px, 4vw, 32px); font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cidade-meta { margin: 0; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.cidade-label { display: block; font-size: 13px; font-weight: 600; margin: 16px 0 6px; }
#cidade-sel {
  width: 100%;
  max-width: 420px;
  padding: 11px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  font: 15px var(--font);
}
#cidade-sel:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.prose .fonte-nota { margin: 4px 0 0; font-size: 12px; color: var(--ink-muted); }
