:root {
  --bg: #0f1115;
  --panel: #161922;
  --panel-border: #262b38;
  --text: #e7e9ee;
  --text-muted: #8b92a5;
  --accent: #4f8cff;
  --row-hover: #1e2330;
  --row-active: #22304a;
}

* { box-sizing: border-box; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

#sidebar {
  width: 340px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 20px 18px 12px;
  border-bottom: 1px solid var(--panel-border);
}

.sidebar-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.stats {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--panel-border);
}

.stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 12px;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.legend {
  padding: 12px 18px;
  border-bottom: 1px solid var(--panel-border);
}

.legend-title {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.legend-scale {
  display: flex;
  border-radius: 6px;
  overflow: hidden;
  height: 14px;
}

.legend-swatch {
  flex: 1;
  position: relative;
}

.legend-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-muted);
}

.search-box {
  padding: 12px 18px;
  border-bottom: 1px solid var(--panel-border);
}

#searchInput {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

#searchInput:focus {
  border-color: var(--accent);
}

.bairro-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  overflow-y: auto;
  flex: 1;
}

.bairro-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  cursor: pointer;
  font-size: 13px;
}

.bairro-list li:hover {
  background: var(--row-hover);
}

.bairro-list li.active {
  background: var(--row-active);
}

.bairro-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.25);
}

.bairro-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bairro-area {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

#mapWrap {
  flex: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  background: #1a1d24;
}

.map-tooltip {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
  background: rgba(10, 12, 16, 0.92);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.map-tooltip strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.leaflet-container {
  background: #1a1d24;
  font-family: inherit;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--panel-border); border-radius: 4px; }
