:root {
  --paper: #f2eee4;
  --paper-2: #eae4d6;
  --paper-3: #e1dac8;
  --white: #fbf8f0;
  --ink: #121619;
  --ink-2: #1b2224;
  --ink-3: #283133;
  --muted: #6d6a60;
  --muted-2: #8b877b;
  --line: rgba(18, 22, 25, 0.14);
  --line-strong: rgba(18, 22, 25, 0.3);
  --accent: #e5431f;
  --accent-dark: #b92f11;
  --teal: #0d5b53;
  --lime: #d8ef73;
  --shadow: 0 24px 70px rgba(18, 22, 25, 0.16);
  --font-display: "Fraunces", "Georgia", serif;
  --font-body: "Sora", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "Consolas", monospace;
  --topbar-h: 76px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-image:
    linear-gradient(rgba(18, 22, 25, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 22, 25, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 82% 12%, rgba(229, 67, 31, 0.09), transparent 34%),
    radial-gradient(circle at 4% 86%, rgba(13, 91, 83, 0.08), transparent 30%);
  background-size: 32px 32px, 32px 32px, auto, auto;
  background-attachment: fixed;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent); color: var(--white); }

.mono { font-family: var(--font-mono); }

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--topbar-h);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--ink);
  color: var(--paper);
  border-bottom: 1px solid rgba(242, 238, 228, 0.16);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 34%;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; color: var(--paper); flex: 0 0 auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong {
  font-family: var(--font-mono);
  font-size: 19px;
  letter-spacing: 0.19em;
  font-weight: 600;
}
.brand-text small {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(242, 238, 228, 0.55);
}

.topbar-meta { display: flex; align-items: center; gap: 12px; }
.stamp {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: rgba(242, 238, 228, 0.68);
  white-space: nowrap;
}
.stamp-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 4px rgba(216, 239, 115, 0.12);
  animation: blink 2.8s ease-in-out infinite;
}
.stamp.is-stale .stamp-dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(229, 67, 31, 0.16); }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.btn {
  border: 1px solid transparent;
  border-radius: 2px;
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.btn-primary:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-ghost { background: transparent; color: inherit; border-color: currentColor; opacity: 0.85; }
.btn-ghost:hover { opacity: 1; background: rgba(242, 238, 228, 0.08); }
.topbar .btn-ghost { color: var(--paper); border-color: rgba(242, 238, 228, 0.28); }
.btn-icon { font-size: 14px; line-height: 1; }

.icon-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(242, 238, 228, 0.28);
  background: transparent;
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 16px;
  transition: background 0.18s ease, color 0.18s ease;
}
.icon-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--ink); }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  max-width: 1640px;
  margin: 0 auto;
}

.filters {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 28px 24px 32px;
  border-right: 1px solid var(--line);
  background: rgba(242, 238, 228, 0.55);
  backdrop-filter: blur(6px);
  scrollbar-width: thin;
}

.filter-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-strong);
  margin-bottom: 18px;
}
.filter-head h2 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.text-btn {
  background: none; border: 0; padding: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.text-btn:hover { color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 17px; min-width: 0; }
.field > span, .field legend {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
fieldset.field { border: 0; padding: 0; margin-inline: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row .field { margin-bottom: 17px; }

.field input, .field select {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 7px 0 8px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.field input::placeholder { color: var(--muted-2); }
.field input:focus, .field select:focus { border-color: var(--accent); background: rgba(229, 67, 31, 0.03); }
.field select {
  appearance: none;
  padding-right: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236d6a60' stroke-width='1.2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
  cursor: pointer;
}
.search-field input { font-size: 15px; }
.hint { font-size: 10px; color: var(--muted-2); line-height: 1.35; min-height: 13px; }
.hint.is-warn { color: var(--accent-dark); }

.range { display: flex; align-items: center; gap: 8px; }
.range input { width: 100%; }
.range span { color: var(--muted-2); font-size: 11px; }

.checks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.check {
  position: relative;
  display: inline-flex;
}
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check span {
  display: inline-block;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.02em;
  color: var(--muted);
  transition: all 0.16s ease;
  cursor: pointer;
  white-space: nowrap;
}
.check span:hover { border-color: var(--ink); color: var(--ink); }
.check input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--muted);
  cursor: pointer;
  margin: 4px 0 22px;
  line-height: 1.3;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  width: 28px; height: 15px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  position: relative;
  flex: 0 0 auto;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.switch-track::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted);
  transition: transform 0.18s ease, background 0.18s ease;
}
.switch input:checked + .switch-track { background: var(--ink); border-color: var(--ink); }
.switch input:checked + .switch-track::after { transform: translateX(13px); background: var(--lime); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.filter-foot {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.filter-foot p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  text-transform: uppercase;
}

/* ---------- main / hero ---------- */
.main { padding: 34px 40px 20px; min-width: 0; }

.hero {
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(360px, 1fr);
  gap: 48px;
  align-items: end;
  padding: 6px 0 34px;
  border-bottom: 1px solid var(--line-strong);
  position: relative;
}
.hero::before {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 320px;
  height: 320px;
  border: 1px solid rgba(18, 22, 25, 0.08);
  border-radius: 50%;
  box-shadow: 0 0 0 44px rgba(18, 22, 25, 0.025), 0 0 0 88px rgba(18, 22, 25, 0.018);
  pointer-events: none;
}
.eyebrow {
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-dark);
}
.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(48px, 5.6vw, 82px);
  line-height: 0.94;
  letter-spacing: -0.035em;
}
.hero h1 em { font-style: italic; color: var(--accent); }
.hero-sub {
  max-width: 470px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}
.hero-foot {
  display: flex; align-items: center; gap: 12px;
  margin-top: 26px;
  font-size: 8.5px;
  letter-spacing: 0.14em;
  color: var(--muted-2);
}
.hero-rule { width: 48px; height: 1px; background: var(--line-strong); }

.hero-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line-strong);
  border: 1px solid var(--line-strong);
}
.stat {
  background: var(--paper);
  padding: 18px 18px 15px;
  min-height: 134px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px);
  animation: rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
.stat:nth-child(1) { animation-delay: 0.05s; }
.stat:nth-child(2) { animation-delay: 0.12s; }
.stat:nth-child(3) { animation-delay: 0.19s; }
.stat:nth-child(4) { animation-delay: 0.26s; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }
.stat-accent { background: var(--ink); color: var(--paper); }
.stat-label {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: auto;
}
.stat-accent .stat-label { color: rgba(242, 238, 228, 0.55); }
.stat-value {
  font-family: var(--font-display);
  font-size: clamp(27px, 2.5vw, 38px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-detail {
  margin-top: 7px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.03em;
  color: var(--muted-2);
}
.stat-accent .stat-detail { color: rgba(242, 238, 228, 0.6); }
.spark {
  position: absolute;
  right: 12px; top: 14px;
  width: 46%; height: 44px;
  opacity: 0.9;
}
.meter { margin-top: 9px; height: 4px; background: rgba(18, 22, 25, 0.12); width: 100%; }
.meter span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.7s ease; }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 0 16px;
  border-bottom: 1px solid var(--line-strong);
}
.view-tabs { display: flex; gap: 22px; align-items: center; }
.tab {
  background: none; border: 0; padding: 0 0 8px;
  position: relative;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}
.tab::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: transparent; transition: background 0.18s ease;
}
.tab.is-active { color: var(--ink); }
.tab.is-active::after { background: var(--accent); }
.tab-count {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  background: var(--paper-3);
  font-size: 9px;
  color: var(--ink);
  border-radius: 10px;
}
.toolbar-actions { display: flex; align-items: center; gap: 18px; }
.result-note {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: right;
}
.result-note strong { color: var(--ink); font-weight: 600; }

/* ---------- table ---------- */
.panel { padding-top: 0; }
.is-hidden { display: none !important; }
.table-meta {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 12px 0;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.legend { color: var(--muted-2); }
.table-wrap {
  max-height: min(62vh, 760px);
  overflow: auto;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  scrollbar-width: thin;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--paper-2);
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.data-table thead th.num { text-align: right; }
.data-table th.col-rank { width: 34px; text-align: center; }
.data-table th.col-arrow { width: 28px; }
.sort {
  background: none; border: 0; padding: 0;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit;
  display: inline-flex; align-items: center; gap: 5px;
}
.sort:hover { color: var(--ink); }
.sort-mark { font-size: 8px; opacity: 0.35; }
.sort.is-active { color: var(--ink); }
.sort.is-active .sort-mark { opacity: 1; color: var(--accent); }

.data-table tbody td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table tbody tr {
  cursor: pointer;
  transition: background 0.14s ease, box-shadow 0.14s ease;
}
.data-table tbody tr:hover { background: var(--white); box-shadow: inset 3px 0 0 var(--accent); }
.data-table tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.data-table tbody tr.is-inactive { opacity: 0.62; }
.data-table td.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.data-table td.col-rank { text-align: center; font-family: var(--font-mono); font-size: 9.5px; color: var(--muted-2); }

.company { display: flex; flex-direction: column; gap: 2px; min-width: 170px; }
.company strong { font-size: 12.5px; font-weight: 600; letter-spacing: -0.01em; }
.company small { font-family: var(--font-mono); font-size: 8.5px; color: var(--muted-2); letter-spacing: 0.02em; }
.place { display: flex; flex-wrap: wrap; gap: 4px; max-width: 170px; }
.uf-pill {
  display: inline-block; padding: 2px 5px;
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.05em;
}
.place-more { font-family: var(--font-mono); font-size: 8.5px; color: var(--muted); padding: 3px 2px; }
.access-main { font-size: 13px; font-weight: 500; }
.access-sub { display: block; font-size: 8.5px; color: var(--muted-2); margin-top: 2px; }
.var {
  display: inline-flex; align-items: center; gap: 3px;
  font-family: var(--font-mono); font-size: 9.5px;
  padding: 3px 5px;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.var.up { color: var(--teal); border-color: rgba(13, 91, 83, 0.3); background: rgba(13, 91, 83, 0.06); }
.var.down { color: var(--accent-dark); border-color: rgba(229, 67, 31, 0.3); background: rgba(229, 67, 31, 0.06); }
.var.flat { color: var(--muted); }
.var.none { color: var(--muted-2); border-style: dashed; }
.tier {
  display: inline-block; padding: 3px 6px;
  font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.04em;
  white-space: nowrap; border: 1px solid transparent;
}
.tier-top { background: var(--ink); color: var(--paper); }
.tier-regional { background: var(--teal); color: var(--white); }
.tier-medio { color: var(--accent-dark); border-color: rgba(229, 67, 31, 0.45); }
.tier-pequeno { color: #715300; border-color: rgba(113, 83, 0, 0.35); background: rgba(216, 239, 115, 0.28); }
.tier-cauda { color: var(--muted); border-color: var(--line); }
.tier-sem { color: var(--muted-2); border-color: var(--line); border-style: dashed; }
.network { display: flex; flex-direction: column; gap: 2px; min-width: 100px; }
.network strong { font-family: var(--font-mono); font-size: 8.5px; font-weight: 500; letter-spacing: 0.02em; }
.network small { font-family: var(--font-mono); font-size: 8px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.row-arrow { color: var(--muted-2); font-size: 14px; transition: transform 0.15s ease, color 0.15s ease; }
.data-table tbody tr:hover .row-arrow { color: var(--accent); transform: translateX(2px); }

.empty-cell {
  text-align: center !important;
  padding: 54px 20px !important;
  color: var(--muted);
  font-size: 13px;
  cursor: default !important;
}
.empty-cell strong { display: block; font-family: var(--font-display); font-size: 22px; color: var(--ink); margin-bottom: 6px; }
.data-table tbody tr:hover .empty-cell { background: transparent; box-shadow: none; }

.pagination {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 0 4px;
  font-family: var(--font-mono); font-size: 9px; color: var(--muted);
}
.page-controls { display: flex; gap: 4px; align-items: center; }
.page-btn {
  min-width: 26px; height: 26px; padding: 0 5px;
  background: transparent; border: 1px solid var(--line-strong);
  font-family: var(--font-mono); font-size: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.page-btn:hover:not(:disabled) { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.page-btn.is-current { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.page-btn:disabled { opacity: 0.3; cursor: default; }
.page-size { display: flex; align-items: center; gap: 6px; }
.page-size select { background: transparent; border: 0; border-bottom: 1px solid var(--line-strong); font-family: var(--font-mono); font-size: 9px; padding: 2px 2px; }

/* ---------- footer ---------- */
.footer {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 22px 0 10px;
  font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.08em;
  color: var(--muted-2); text-transform: uppercase;
}

/* ---------- drawer ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(18, 22, 25, 0.45);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.overlay.is-visible { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 100;
  width: min(570px, 94vw);
  background: var(--ink);
  color: var(--paper);
  transform: translateX(102%);
  transition: transform 0.34s cubic-bezier(0.22, 0.8, 0.24, 1);
  overflow-y: auto;
  box-shadow: -30px 0 80px rgba(18, 22, 25, 0.25);
  scrollbar-width: thin;
}
.drawer.is-open { transform: translateX(0); }
.drawer-close {
  position: sticky; top: 0; float: right; z-index: 2;
  width: 40px; height: 40px; margin: 14px 14px 0 0;
  background: rgba(242, 238, 228, 0.08); border: 1px solid rgba(242, 238, 228, 0.2);
  color: var(--paper); font-size: 22px; line-height: 1;
}
.drawer-close:hover { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.drawer-body { padding: 34px 34px 44px; }
.drawer .eyebrow { color: var(--lime); }
.drawer h2 {
  font-family: var(--font-display); font-weight: 500;
  font-size: 34px; line-height: 1.02; letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.drawer .cnpj { font-family: var(--font-mono); font-size: 10px; color: rgba(242, 238, 228, 0.55); letter-spacing: 0.04em; }
.drawer .tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 24px; }
.drawer .tag {
  font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 0.04em;
  padding: 4px 7px; border: 1px solid rgba(242, 238, 228, 0.24); color: rgba(242, 238, 228, 0.75);
}
.drawer .metric-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: rgba(242, 238, 228, 0.14);
  border: 1px solid rgba(242, 238, 228, 0.14);
  margin-bottom: 28px;
}
.drawer .metric { background: var(--ink-2); padding: 14px; }
.drawer .metric span { font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(242, 238, 228, 0.48); display: block; }
.drawer .metric strong { font-family: var(--font-display); font-size: 25px; font-weight: 500; display: block; margin-top: 4px; }
.drawer .metric small { font-family: var(--font-mono); font-size: 8.5px; color: rgba(242, 238, 228, 0.55); }
.drawer .metric.hero-metric { background: var(--accent); color: var(--ink); }
.drawer .metric.hero-metric span, .drawer .metric.hero-metric small { color: rgba(18, 22, 25, 0.65); }

.drawer-section { margin-top: 28px; }
.drawer-section h3 {
  font-family: var(--font-mono); font-size: 9px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; color: rgba(242, 238, 228, 0.5);
  margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid rgba(242, 238, 228, 0.14);
}
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.kv div { min-width: 0; }
.kv dt { font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(242, 238, 228, 0.45); }
.kv dd { margin: 3px 0 0; font-size: 11.5px; color: rgba(242, 238, 228, 0.86); overflow-wrap: anywhere; }

.history-chart { display: flex; align-items: flex-end; gap: 5px; height: 104px; margin-top: 4px; }
.history-bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; height: 100%; min-width: 0; }
.history-bar .bar { width: 100%; background: rgba(242, 238, 228, 0.22); min-height: 2px; transition: height 0.5s ease, background 0.2s ease; }
.history-bar.is-current .bar { background: var(--accent); }
.history-bar span { font-family: var(--font-mono); font-size: 7.5px; color: rgba(242, 238, 228, 0.45); white-space: nowrap; }
.history-axis { display: flex; justify-content: space-between; margin-top: 7px; font-family: var(--font-mono); font-size: 8px; color: rgba(242, 238, 228, 0.4); }

.city-list { display: flex; flex-direction: column; gap: 1px; }
.city-row { display: grid; grid-template-columns: minmax(0, 1fr) 70px 52px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(242, 238, 228, 0.1); }
.city-row .city-name { font-size: 11.5px; }
.city-row .city-name small { display: block; font-family: var(--font-mono); font-size: 8px; color: rgba(242, 238, 228, 0.45); }
.city-row .city-access { font-family: var(--font-mono); font-size: 10px; text-align: right; }
.city-row .city-share { font-family: var(--font-mono); font-size: 8.5px; color: var(--lime); text-align: right; }
.city-row .share-track { grid-column: 1 / -1; height: 2px; background: rgba(242, 238, 228, 0.12); }
.city-row .share-track span { display: block; height: 100%; background: var(--lime); }

.drawer-empty { color: rgba(242, 238, 228, 0.6); font-size: 12px; padding: 20px 0; }

/* ---------- dialogs ---------- */
.modal {
  width: min(620px, 92vw);
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  padding: 34px 36px 30px;
  box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(18, 22, 25, 0.5); backdrop-filter: blur(3px); }
.modal h2 { font-family: var(--font-display); font-weight: 500; font-size: 32px; line-height: 1.05; margin: 0 0 14px; letter-spacing: -0.02em; }
.modal .eyebrow { margin-bottom: 10px; }
.modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px; border: 1px solid var(--line-strong);
  background: transparent; font-size: 20px; line-height: 1;
}
.modal-close:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.prose { font-size: 12.5px; line-height: 1.7; color: #3f403b; }
.prose p { margin: 0 0 12px; }
.prose strong { color: var(--ink); }
.source-line { margin-top: 18px; font-size: 8.5px; letter-spacing: 0.06em; color: var(--muted-2); text-transform: uppercase; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }

.update-status {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--ink); color: var(--paper);
  font-family: var(--font-mono); font-size: 10px;
}
.pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--lime);
  animation: blink 1.4s ease-in-out infinite;
  flex: 0 0 auto;
}
.update-log {
  margin: 12px 0 0;
  padding: 12px 14px;
  background: var(--ink-2); color: rgba(242, 238, 228, 0.8);
  font-family: var(--font-mono); font-size: 9px; line-height: 1.7;
  max-height: 190px; overflow: auto; white-space: pre-wrap;
}
.update-log:empty { display: none; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 300;
  transform: translate(-50%, 20px);
  background: var(--ink); color: var(--paper);
  border-left: 3px solid var(--accent);
  padding: 11px 18px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.03em;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: min(520px, 90vw);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { border-left-color: var(--accent); }
.toast.is-ok { border-left-color: var(--lime); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 1fr; }
  .filters {
    position: static; height: auto; overflow: visible;
    border-right: 0; border-bottom: 1px solid var(--line-strong);
    padding: 22px 28px 18px;
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 20px;
  }
  .filter-head, .filter-foot { grid-column: 1 / -1; }
  .filter-head { margin-bottom: 12px; }
  .filter-foot { margin-top: 8px; }
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .main { padding: 28px 28px 20px; }
}
@media (max-width: 820px) {
  :root { --topbar-h: 66px; }
  .topbar { padding: 0 18px; gap: 12px; }
  .topbar-meta { gap: 8px; }
  .topbar .btn-label { display: none; }
  .topbar .btn-ghost {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
  .brand-text small { display: none; }
  .stamp { display: none; }
  .filters { grid-template-columns: 1fr 1fr; padding: 18px; }
  .main { padding: 22px 18px 16px; }
  .hero h1 { font-size: clamp(42px, 11vw, 64px); }
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .stat { min-height: 116px; padding: 14px; }
  .toolbar { flex-direction: column; align-items: flex-start; gap: 14px; }
  .toolbar-actions { width: 100%; justify-content: space-between; }
  .result-note { text-align: left; }
  .table-wrap { max-height: none; }
  .data-table th.col-place, .data-table td.col-place, .data-table th.col-network, .data-table td.col-network { display: none; }
  .footer { flex-direction: column; gap: 6px; }
}
@media (max-width: 520px) {
  .filters { grid-template-columns: 1fr; }
  .tab-count { display: none; }
  .result-note { display: none; }
  .company { min-width: 130px; }
  .drawer-body { padding: 28px 20px 36px; }
  .kv { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- states ---------- */
body.no-scroll { overflow: hidden; }
.skeleton {
  display: block;
  height: 10px;
  width: 100%;
  background: linear-gradient(90deg, rgba(18, 22, 25, 0.06), rgba(18, 22, 25, 0.12), rgba(18, 22, 25, 0.06));
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
.skeleton-row { pointer-events: none; }
.skeleton-row:hover { background: transparent !important; box-shadow: none !important; }
.skeleton-row td { padding-top: 14px !important; padding-bottom: 14px !important; }
@keyframes shimmer { to { background-position: -200% 0; } }
.page-ellipsis { font-family: var(--font-mono); font-size: 9px; color: var(--muted-2); padding: 0 2px; }
.field select:disabled { opacity: 0.42; cursor: not-allowed; }
.modal { position: relative; }
.drawer-body .btn-ghost { color: var(--paper); border-color: rgba(242, 238, 228, 0.3); }

.data-table { table-layout: fixed; }
.data-table th:nth-child(2), .data-table td:nth-child(2) { width: 25%; }
.data-table th.col-place, .data-table td.col-place { width: 132px; }
.data-table th:nth-child(4), .data-table td:nth-child(4) { width: 122px; }
.data-table th:nth-child(5), .data-table td:nth-child(5) { width: 84px; }
.data-table th:nth-child(6), .data-table td:nth-child(6) { width: 88px; }
.data-table th.col-network, .data-table td.col-network { width: 118px; }
.data-table th.col-arrow, .data-table td.col-arrow { width: 30px; min-width: 30px; }
.company strong, .company small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.network strong, .network small { display: block; }

body[data-view="municipalities"] .provider-only { display: none; }

/* ---------- mobile filters ---------- */
.filter-toggle { display: none; }
.filters-apply { display: none; }
@media (max-width: 820px) {
  .filter-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .filters { display: none; scroll-margin-top: calc(var(--topbar-h) + 10px); }
  .filters.is-open { display: grid; }
  .filters-apply { display: inline-flex; grid-column: 1 / -1; justify-content: center; margin-top: 10px; }
  .table-wrap { overflow: visible; }
  #providersTable, #providersTable tbody, #municipalitiesTable, #municipalitiesTable tbody {
    display: block; width: 100%; table-layout: auto;
  }
  #providersTable thead, #municipalitiesTable thead { display: none; }
  #providersTable tr, #municipalitiesTable tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 12px;
    padding: 13px 10px;
    border-bottom: 1px solid var(--line);
  }
  #providersTable td, #municipalitiesTable td { display: block; border: 0; padding: 0; }
  #providersTable td.col-rank, #providersTable td.col-place,
  #providersTable td.col-network, #providersTable td.col-arrow { display: none; }
  #providersTable td:nth-child(2) { grid-column: 1; grid-row: 1; min-width: 0; }
  #providersTable td:nth-child(4) { grid-column: 2; grid-row: 1; text-align: right; }
  #providersTable td:nth-child(5) { grid-column: 2; grid-row: 2; text-align: right; }
  #providersTable td:nth-child(6) { grid-column: 1; grid-row: 2; }
  #providersTable tbody tr:hover { background: var(--white); box-shadow: inset 3px 0 0 var(--accent); }

  #municipalitiesTable td:nth-child(1) { grid-column: 1; grid-row: 1; min-width: 0; }
  #municipalitiesTable td:nth-child(2) { grid-column: 1; grid-row: 2; }
  #municipalitiesTable td:nth-child(3) { grid-column: 2; grid-row: 1; text-align: right; }
  #municipalitiesTable td:nth-child(4) { grid-column: 2; grid-row: 2; text-align: right; }
  #municipalitiesTable td:nth-child(5),
  #municipalitiesTable td:nth-child(6),
  #municipalitiesTable td:nth-child(7) { display: none; }
  #municipalitiesTable td:nth-child(4)::before {
    content: "provedores ";
    font-size: 7.5px;
    color: var(--muted-2);
    text-transform: uppercase;
  }
  #providersTable .skeleton-row td:nth-child(n+3),
  #municipalitiesTable .skeleton-row td:nth-child(n+3) { display: none; }
  .tier { font-size: 7px; padding: 2px 4px; }
  .access-main { font-size: 12px; }
  .var { font-size: 8.5px; padding: 2px 3px; }
}

@media (max-width: 820px) {
  .pagination { flex-direction: column; align-items: flex-start; gap: 8px; }
  .page-controls { flex-wrap: wrap; }
  .table-meta { flex-direction: column; gap: 4px; }
}

@media (max-width: 520px) {
  .topbar { padding: 0 14px; gap: 10px; }
  .brand { gap: 10px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-text strong { font-size: 17px; letter-spacing: 0.14em; }
  .icon-btn { width: 32px; height: 32px; }
  .topbar .btn-ghost { width: 32px; height: 32px; }
  .spark { display: none; }
  .stat { min-height: 128px; }
  .stat-value { font-size: 26px; }
}

/* ---------- enriquecimento ---------- */
.enrich-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--lime);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  vertical-align: 1px;
}

body[data-view="enrichments"] .filters { display: none; }
body[data-view="enrichments"] .layout { grid-template-columns: minmax(0, 1fr); }
body[data-view="enrichments"] .filter-toggle,
body[data-view="enrichments"] #exportBtn,
body[data-view="enrichments"] #enrichBtn,
body[data-view="enrichments"] #resultNote { display: none; }

.toolbar-actions { flex-wrap: wrap; }
.toolbar-actions .btn-ghost { color: var(--ink); border-color: var(--line-strong); }
.toolbar-actions .btn-ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.enrichment-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0 22px;
  border-bottom: 1px solid var(--line-strong);
}

.enrichment-head h2 {
  margin: 6px 0 8px;
  font-family: var(--font-display);
  font-size: clamp(32px, 3.6vw, 46px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
}

.enrichment-intro {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.enrichment-summary {
  min-width: 210px;
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.7;
  color: var(--muted);
  text-align: right;
}

.enrichment-summary strong {
  display: block;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
  color: var(--ink);
}

.enrichment-summary span { display: block; }

.enrichment-block { margin-top: 28px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-pill.is-running { background: var(--lime); color: var(--ink); }
.status-pill.is-completed { background: var(--teal); color: var(--white); }
.status-pill.is-failed { background: var(--accent); color: var(--ink); }
.status-pill.is-interrupted { background: var(--paper-3); color: var(--muted); }

.progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-3);
}

.progress-track > span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.35s ease;
}

.progress-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.progress-cell .progress-track { flex: 1; min-width: 70px; }
.progress-cell small {
  min-width: 38px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
  text-align: right;
}

.enrichment-block .data-table td { vertical-align: middle; }

.enrich-dialog-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 14px 0 4px;
}

.enrich-dialog-stats span {
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
}

.enrich-progress { height: 8px; margin-top: 14px; }
.enrich-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
}

.enrich-dialog-message {
  min-height: 18px;
  margin: 12px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

.enrich-dialog-message.is-error { color: var(--accent-dark); }

.enrich-card {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid rgba(242, 238, 228, 0.14);
  background: rgba(242, 238, 228, 0.035);
}

.enrich-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.enrich-card-head strong {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.15;
}

.enrich-meta {
  font-family: var(--font-mono);
  font-size: 8.5px;
  line-height: 1.7;
  color: rgba(242, 238, 228, 0.5);
}

.enrich-meta span { display: block; }

.enrich-company-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin: 14px 0 0;
}

.enrich-company-grid div { min-width: 0; }

.enrich-company-grid dt {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(242, 238, 228, 0.42);
}

.enrich-company-grid dd {
  margin: 3px 0 0;
  font-size: 11.5px;
  line-height: 1.4;
  color: rgba(242, 238, 228, 0.88);
  overflow-wrap: anywhere;
}

.enrich-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.contact-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid rgba(242, 238, 228, 0.16);
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(242, 238, 228, 0.82);
}

.contact-chip.is-whatsapp {
  border-color: rgba(216, 239, 115, 0.45);
  color: var(--lime);
}

.contact-chip small {
  color: rgba(242, 238, 228, 0.42);
  font-size: 8px;
}

.enrich-partner {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(242, 238, 228, 0.12);
}

.enrich-partner-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.enrich-partner-head strong {
  display: block;
  font-size: 12px;
  line-height: 1.3;
}

.enrich-partner-head small {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 8px;
  color: rgba(242, 238, 228, 0.45);
}

.enrich-partner-head .partner-share {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--lime);
  white-space: nowrap;
}

.enrich-person-line {
  margin: 10px 0 0;
  font-size: 10.5px;
  line-height: 1.6;
  color: rgba(242, 238, 228, 0.62);
}

.enrich-person-line strong { color: rgba(242, 238, 228, 0.9); font-weight: 500; }

.enrich-empty {
  margin-top: 10px;
  padding: 14px;
  border: 1px dashed rgba(242, 238, 228, 0.2);
  font-size: 11px;
  line-height: 1.6;
  color: rgba(242, 238, 228, 0.6);
}

.enrich-empty .btn { margin-top: 10px; }

@media (max-width: 820px) {
  .enrichment-head { flex-direction: column; align-items: flex-start; gap: 16px; }
  .enrichment-summary { text-align: left; }
  .enrichment-block .data-table { min-width: 720px; }
  .enrich-company-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .enrichment-head h2 { font-size: 34px; }
  .enrichment-block .data-table { min-width: 680px; }
  .enrich-progress-meta { flex-direction: column; gap: 4px; }
  .enrich-card { padding: 13px; }
}
