:root {
  --bg: #f5f2ec;
  --bg-2: #ebe7df;
  --bg-3: #e1dcd1;
  --ink: #1a1815;
  --ink-2: #3a342c;
  --ink-3: #6b6155;
  --ink-4: #9a9085;
  --rule: #d4cec1;
  --rule-2: #c4bdae;
  --accent: #c4593a;
  --accent-2: #a84727;
  --pos: #2e6b3d;
  --neg: #b03a2e;
  --warn: #b8851e;
  --code: "JetBrains Mono", "IBM Plex Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { background: var(--bg-3); }
body {
  margin: 0;
  min-width: 0;
  background: var(--bg-3);
  color: var(--ink);
  font-family: var(--sans);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}
button, select { font: inherit; }
.mono { font-family: var(--code); font-variant-numeric: tabular-nums; }
.cap { text-transform: uppercase; letter-spacing: .06em; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.muted { color: var(--ink-3); }
.faint { color: var(--ink-4); }

.app-shell {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 0 44px;
}
.dash {
  width: 100%;
  min-height: 100vh;
  background: var(--bg);
  border: 1px solid var(--rule-2);
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--ink);
  background: var(--bg);
}
.logo {
  width: 178px;
  padding: 14px 18px;
  border-right: 1px solid var(--ink);
}
.logo .mark {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
}
.logo .mark::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 1px;
  background: var(--accent);
}
.logo .sub {
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.nav {
  display: flex;
  align-items: stretch;
}
.nav button {
  border: 0;
  border-right: 1px solid var(--rule);
  padding: 0 13px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.nav button.active {
  background: var(--ink);
  color: var(--bg);
}
.top-right {
  margin-left: auto;
  display: flex;
  align-items: stretch;
  color: var(--ink-3);
  font-family: var(--code);
  font-size: 10.5px;
}
.top-right > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border-left: 1px solid var(--rule);
}
.live::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pos);
}

.ticker {
  display: flex;
  border-bottom: 1px solid var(--rule-2);
  background: var(--ink);
  color: var(--bg);
  font-family: var(--code);
  font-size: 11px;
  overflow: hidden;
  white-space: nowrap;
}
.ticker .item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-right: 1px solid rgba(245,242,236,.13);
}
.ticker .sym { font-weight: 700; }
.ticker .val { color: rgba(245,242,236,.86); }
.ticker .pos { color: #7ad189; }
.ticker .neg { color: #e07866; }

.filters {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--rule-2);
  background: var(--bg-2);
  font-family: var(--code);
  font-size: 10.5px;
}
.filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-right: 1px solid var(--rule);
  color: var(--ink-2);
}
.filter.grow { margin-left: auto; border-right: 0; border-left: 1px solid var(--rule); }
.label {
  color: var(--ink-3);
  font-size: 9.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.val { color: var(--ink); font-weight: 600; }
.seg {
  display: inline-flex;
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  overflow: hidden;
}
.seg button {
  border: 0;
  border-right: 1px solid var(--rule-2);
  padding: 3px 9px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}
.seg button:last-child { border-right: 0; }
.seg button.on {
  background: var(--ink);
  color: var(--bg);
}
.select {
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  background: var(--bg);
  color: var(--ink);
  padding: 3px 7px;
  font-family: var(--code);
  font-size: 10.5px;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border-bottom: 1px solid var(--rule-2);
}
.kpi {
  min-height: 96px;
  padding: 16px 18px;
  border-right: 1px solid var(--rule);
  position: relative;
}
.kpi:last-child { border-right: 0; }
.kpi .lbl {
  margin-bottom: 7px;
  color: var(--ink-3);
  font-family: var(--code);
  font-size: 9.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.kpi .num {
  color: var(--ink);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.kpi .delta {
  margin-top: 6px;
  font-family: var(--code);
  font-size: 11px;
}

.grid { display: grid; }
.g2 { grid-template-columns: 2fr 1fr; }
.g3 { grid-template-columns: 1fr 1fr 1fr; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.panel {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 14px 18px;
  background: var(--bg);
  position: relative;
  overflow-x: auto;
}
.panel.dark {
  background: var(--ink);
  color: var(--bg);
}
.panel.accent {
  background: var(--accent);
  color: #fff;
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.panel-title {
  color: var(--ink-3);
  font-family: var(--code);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.panel-sub {
  margin-top: 3px;
  color: var(--ink-4);
  font-family: var(--code);
  font-size: 9.5px;
}
.panel-actions {
  display: inline-flex;
  border: 1px solid var(--rule-2);
  font-family: var(--code);
  font-size: 9.5px;
}
.panel-actions button {
  border: 0;
  border-right: 1px solid var(--rule-2);
  padding: 3px 8px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}
.panel-actions button:last-child { border-right: 0; }
.panel-actions button.on { background: var(--ink); color: var(--bg); }

.hero {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  border-bottom: 1px solid var(--rule);
}
.hero-copy {
  padding: 30px 34px;
  border-right: 1px solid var(--rule);
}
.eyebrow {
  color: var(--accent);
  font-family: var(--code);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}
h1 {
  max-width: 780px;
  margin: 10px 0 14px;
  font-size: 55px;
  line-height: .94;
  letter-spacing: 0;
  overflow-wrap: break-word;
}
h1 span { display: block; }
.lead {
  max-width: 760px;
  margin: 0;
  color: var(--ink-2);
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.38;
}
.sim-box {
  padding: 22px 24px;
  background: var(--ink);
  color: var(--bg);
}
.sim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}
.sim-card {
  border: 1px solid rgba(245,242,236,.22);
  padding: 12px;
}
.sim-card .name {
  color: rgba(245,242,236,.66);
  font-family: var(--code);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.sim-card .money {
  margin-top: 7px;
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.sim-card .small {
  margin-top: 4px;
  font-family: var(--code);
  font-size: 10.5px;
}

svg.chart { display: block; width: 100%; height: auto; }
.axis, .gridline { stroke: var(--rule); }
.gridline { stroke-dasharray: 2 4; }
.chart-label {
  fill: var(--ink-3);
  font-family: var(--code);
  font-size: 10px;
}
.legend {
  display: flex;
  gap: 18px;
  align-items: center;
  font-family: var(--code);
  font-size: 10.5px;
}
.legend span::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 2px;
  margin-right: 6px;
  vertical-align: middle;
  background: currentColor;
}

table.dense {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--code);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
table.dense th {
  padding: 6px 8px;
  border-bottom: 1px solid var(--rule-2);
  background: var(--bg-2);
  color: var(--ink-3);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-align: left;
  text-transform: uppercase;
}
table.dense td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-2);
}
table.dense tr:hover td { background: var(--bg-2); }
table.dense .r, table.dense th.r { text-align: right; }
table.dense .ticker-name { color: var(--ink); font-weight: 700; }
.bar-track {
  width: 90px;
  height: 12px;
  background: var(--bg-2);
  position: relative;
}
.bar-track > i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}
.bairro-tile {
  min-height: 88px;
  padding: 8px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: rgba(196,89,58,.12);
  cursor: pointer;
}
.bairro-tile:hover, .bairro-tile.active {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}
.bairro-tile .name {
  font-family: var(--code);
  font-size: 9px;
  font-weight: 700;
}
.bairro-tile .big {
  margin-top: 18px;
  font-size: 18px;
  font-weight: 700;
}
.type-cards {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}
.type-card {
  min-height: 110px;
  padding: 12px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.type-card .code { font-family: var(--code); font-weight: 800; color: var(--accent); }
.type-card .count { margin-top: 8px; font-size: 22px; font-weight: 700; }

.scatter {
  position: relative;
  min-height: 300px;
  border: 1px solid var(--rule);
  background:
    linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 100% 25%, 12.5% 100%;
}
.dot {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
}
.dot.good { background: var(--pos); }
.dot.bad { background: var(--neg); }

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}
.method-card {
  min-height: 170px;
  padding: 16px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.method-card h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-family: var(--code);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.method-card p {
  margin: 0;
  color: var(--ink-2);
  font-family: var(--code);
  font-size: 10.5px;
  line-height: 1.55;
}

.method-footer {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding: 18px 24px;
  border-top: 2px solid var(--ink);
  background: var(--bg-2);
  color: var(--ink-2);
  font-family: var(--code);
  font-size: 10.5px;
}
.method-footer h4 {
  margin: 0 0 6px;
  color: var(--ink-3);
  font-size: 9.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.method-footer p { margin: 0; line-height: 1.45; }

.page-nav-info {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  font-family: var(--code);
  font-size: 10.5px;
}
.page-nav-info .nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

@media (max-width: 1180px) {
  .topbar { flex-wrap: wrap; }
  .logo { width: 168px; }
  .nav {
    flex: 1 1 calc(100% - 168px);
    overflow-x: auto;
  }
  .nav button {
    min-height: 58px;
    white-space: nowrap;
  }
  .top-right {
    flex: 1 1 100%;
    border-top: 1px solid var(--rule);
  }
  .top-right > span { flex: 1; }
  .ticker { overflow-x: auto; }
  .filters {
    flex-wrap: wrap;
  }
  .filter.grow {
    margin-left: 0;
    border-left: 0;
  }
  h1 { font-size: 42px; }
  .hero { grid-template-columns: 1fr; }
  .hero-copy { border-right: 0; }
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .type-cards { grid-template-columns: repeat(3, 1fr); }
  .tile-grid { grid-template-columns: repeat(3, 1fr); }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .method-footer { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .logo {
    width: 100%;
    border-right: 0;
  }
  .nav { flex-basis: 100%; }
  .top-right { display: none; }
  .filter { width: 100%; }
  .filter .select { max-width: 100%; }
  .kpi-row { grid-template-columns: 1fr; }
  .hero-copy { padding: 24px 20px; }
  h1 {
    font-size: 30px;
    line-height: 1;
  }
  .lead { font-size: 17px; }
  .sim-grid { grid-template-columns: 1fr; }
  .type-cards, .tile-grid, .cards, .method-footer {
    grid-template-columns: 1fr;
  }
  .page-nav-info {
    left: 10px;
    right: 10px;
    bottom: 10px;
    justify-content: center;
  }
}
