:root {
  --bg: #0d0f14; --panel: #151922; --line: #252b38; --text: #e7eaf0; --muted: #8a93a6;
  --red: #ff4d4f; --yellow: #f5c542; --green: #3ecf8e; --accent: #7c9cff; --fire: #ff8a3d;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.45 Inter, system-ui, -apple-system, sans-serif; }
body { display: grid; grid-template-columns: 340px 1fr; }
#panel { overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 16px; }
header h1 { margin: 0; font-size: 20px; letter-spacing: .5px; }
header h1 span { font-size: 12px; font-weight: 500; color: var(--accent); text-transform: uppercase; margin-left: 6px; }
section { border-top: 1px solid var(--line); padding: 12px 0; }
h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 0 0 8px; }
h2 + .chips + h2 { margin-top: 12px; }
.muted { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.hint { color: var(--muted); font-size: 11px; margin: 6px 0 0; }
.row { display: flex; gap: 8px; }
select, button { background: #0f1219; color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font: inherit; }
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; user-select: none; }
.chip input { display: none; }
.chip:has(input:checked) { border-color: var(--accent); background: rgba(124,156,255,.14); }
.chip small { color: var(--muted); }
.slider { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.slider input[type=range] { flex: 1; accent-color: var(--accent); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot.red { background: var(--red); } .dot.yellow { background: var(--yellow); } .dot.green { background: var(--green); }
#stats .big { font-size: 28px; font-weight: 700; }
.bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin: 8px 0; background: var(--line); }
.bar i { display: block; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; }
.kv span:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }
.exports { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.exports button { font-weight: 600; }
#top { margin: 0; padding-left: 18px; }
#top li { padding: 4px 0; cursor: pointer; border-bottom: 1px dashed var(--line); }
#top li:hover { color: var(--accent); }
#top .score { float: right; font-weight: 700; }
main { position: relative; }
#map { position: absolute; inset: 0; }
#legend { position: absolute; left: 12px; bottom: 28px; background: rgba(21,25,34,.92); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; flex-wrap: wrap; gap: 10px; max-width: 70%; }
#legend span, #legend label { display: inline-flex; align-items: center; gap: 5px; }
.ring { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid; }
.ring.fire { border-color: var(--fire); } .ring.enriched { border-color: #fff; }
.crime { display: inline-block; width: 8px; height: 8px; background: #c77dff; transform: rotate(45deg); }
#detail { position: absolute; top: 12px; right: 12px; width: 360px; max-height: calc(100% - 24px); overflow-y: auto; background: rgba(21,25,34,.97); border: 1px solid var(--line); border-radius: 10px; padding: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
#detail h3 { margin: 0 0 2px; font-size: 16px; }
#detail .close { float: right; }
#detail .tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #222838; margin: 2px 4px 2px 0; }
#detail .tag.red { background: rgba(255,77,79,.2); color: var(--red); }
#detail .tag.yellow { background: rgba(245,197,66,.18); color: var(--yellow); }
#detail .tag.green { background: rgba(62,207,142,.18); color: var(--green); }
#detail h4 { font-size: 11px; text-transform: uppercase; color: var(--muted); margin: 12px 0 4px; }
#detail ul { margin: 0; padding-left: 16px; }
#detail .opener { border-left: 3px solid var(--accent); padding: 6px 10px; background: #10141d; margin-top: 8px; }
.maplibregl-popup-content { background: var(--panel); color: var(--text); }

#drawer { position: absolute; top: 12px; right: 12px; bottom: 12px; width: 420px; display: flex; flex-direction: column; background: rgba(21,25,34,.97); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
#drawer[hidden] { display: none; }
#drawer header { padding: 14px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
#drawer header h3 { margin: 0; font-size: 16px; }
#drawer header .close { position: absolute; top: 10px; right: 10px; }
#drawer header .row { display: flex; gap: 8px; }
#drawer .status { font-size: 12px; color: var(--accent); }
#drawer .homes { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
#drawer .homes li { padding: 10px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 3px; font-size: 12.5px; }
#drawer .addr a { color: var(--text); font-weight: 600; text-decoration: none; }
#drawer .addr .dot { vertical-align: middle; }
#drawer .phones { margin: 2px 0; padding-left: 16px; }
#drawer .phones li { padding: 0; border: 0; display: list-item; }
#drawer .phones li.bad a { color: var(--muted); text-decoration: line-through; }
#drawer a { color: var(--accent); }
#drawer .tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: #222838; }
#drawer .tag.red { background: rgba(255,77,79,.2); color: var(--red); }
#drawer button.trace { justify-self: start; }
#detail { z-index: 2; }
