* { margin: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: #0e1117; color: #dbe2ea; }
body { display: flex; flex-direction: column; }
a { color: #74c0fc; }

#topnav { display: flex; align-items: center; gap: 18px; padding: 0 18px; background: #10131a; border-bottom: 1px solid #232936; flex-wrap: wrap; }
#topnav .brand { font-size: 17px; font-weight: 700; padding: 12px 0; white-space: nowrap; }
#topnav .brand span { font-size: 11.5px; font-weight: 500; color: #8fa0b3; margin-left: 6px; }
#topnav .tabs { display: flex; gap: 2px; flex-wrap: wrap; }
#topnav .tabs a { color: #aab6c4; text-decoration: none; padding: 14px 14px; font-size: 13.5px; border-bottom: 2px solid transparent; }
#topnav .tabs a.active { color: #fff; border-bottom-color: #f06595; }
#topnav .tabs a:hover { color: #fff; }

main { flex: 1; overflow: hidden; position: relative; }
.tab { display: none; height: 100%; overflow-y: auto; padding: 22px 26px; }
.tab.active { display: block; }
#tab-map, #tab-candidates, #tab-properties, #tab-energy { padding: 0; }
#tab-map.active, #tab-energy.active, #tab-candidates.active, #tab-properties.active { display: flex; }

h1 { font-size: 21px; margin-bottom: 6px; }
h2 { font-size: 14px; margin-bottom: 8px; color: #c6d0dc; }
.lede { color: #93a1b0; font-size: 13.5px; margin-bottom: 16px; max-width: 760px; }
.hint { color: #7d8a99; font-size: 12px; margin-top: 8px; }

.statgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 14px 0 20px; max-width: 900px; }
.statgrid .tile { background: #1a1f2b; border-radius: 10px; padding: 12px 14px; }
.statgrid .tile b { display: block; font-size: 22px; color: #fff; }
.statgrid .tile span { font-size: 11.5px; color: #93a1b0; }
.statgrid .tile.gap { background: #2b2410; } .statgrid .tile.gap b { color: #ffd43b; }
.statgrid .tile.cand { background: #2b1520; } .statgrid .tile.cand b { color: #f06595; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 1100px; }
.card { background: #151a24; border: 1px solid #232936; border-radius: 12px; padding: 16px 18px; }
.card p { font-size: 13px; line-height: 1.55; color: #b9c4d0; margin-bottom: 8px; }

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { text-align: left; color: #8fa0b3; font-weight: 600; padding: 7px 8px; border-bottom: 1px solid #2a3140; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
td { padding: 7px 8px; border-bottom: 1px solid #1d2330; }
table.rowclick tbody tr { cursor: pointer; }
table.rowclick tbody tr:hover { background: #1c2330; }
tr.sel { background: #22304a !important; }
.scorepill { display: inline-block; min-width: 34px; text-align: center; padding: 2px 7px; border-radius: 20px; font-weight: 700; font-size: 12px; }

.split { display: flex; gap: 0; width: 100%; height: 100%; }
.split .pane { flex: 1.3; overflow-y: auto; padding: 22px 24px; }
.split .pane.detail { flex: 1; border-left: 1px solid #232936; background: #11151d; }
.split .pane h1 { margin-top: 0; }

.bigmap { flex: 1; height: 100%; min-height: 400px; background: #e9edf1; }
#map-energy { border-left: 1px solid #232936; }
.minimap { height: 260px; border-radius: 10px; margin: 12px 0; background: #e9edf1; }

#prop-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; font-size: 12.5px; color: #aab6c4; }
#prop-filters select, #prop-filters input[type=number], #prop-filters input[type=text] {
  background: #1a1f2b; color: #dbe2ea; border: 1px solid #2a3140; border-radius: 7px; padding: 6px 9px; font-size: 12.5px; }
#prop-filters input[type=number] { width: 90px; } #prop-filters input[type=text] { width: 150px; }

.kv { font-size: 13px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid #1d2330; }
.kv div span:first-child { color: #8fa0b3; }
.kv div span:last-child { text-align: right; }
.bars { margin: 12px 0; }
.bars .brow { display: grid; grid-template-columns: 130px 1fr 34px; gap: 8px; align-items: center; font-size: 12px; color: #aab6c4; padding: 3px 0; }
.bars .track { background: #1a2030; border-radius: 4px; height: 8px; }
.bars .fill { background: linear-gradient(90deg, #4dabf7, #74c0fc); height: 8px; border-radius: 4px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; margin-right: 6px; }
.badge.vac { background: #3d1c08; color: #ffa94d; }
.badge.pv { background: #0b2e1a; color: #69db7c; }

.place-label { background: none; border: none; box-shadow: none; }
.place-label span { font-size: 11px; font-weight: 600; color: #14343d; text-shadow: 0 0 3px #fff, 0 0 3px #fff; white-space: nowrap; }
.place-label.city span { font-size: 13.5px; }
.place-label.village span { font-size: 10px; font-weight: 500; color: #3d5a63; }
.leaflet-popup-content { font-size: 12.5px; color: #222; }

#src-table { max-width: 980px; }

@media (max-width: 860px) {
  .split { flex-direction: column; }
  .split .pane.detail { border-left: none; border-top: 1px solid #232936; }
  .cols { grid-template-columns: 1fr; }
  .tab { padding: 14px; }
}
