html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
#map {
  position: fixed;
  inset: 0;
  height: 100dvh;
  z-index: 1;
}
#banner {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: #f9a825;
  color: #1a1a1a;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
  max-width: 92vw;
  text-align: center;
}
#count {
  position: fixed;
  bottom: 8px;
  left: 8px;
  z-index: 1000;
  background: rgba(255,255,255,.9);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
#legend {
  position: fixed;
  bottom: 8px;
  right: 8px;
  z-index: 1000;
  background: rgba(255,255,255,.92);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin: 0 4px 0 8px;
  vertical-align: middle;
}
.dot.blue { background: #1976d2; }
.dot.red  { background: #d32f2f; }

#panelToggle {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1002;
  min-height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 8px;
  background: #1976d2;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
  cursor: pointer;
}

#panel {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1001;
  width: 340px;
  max-width: 100%;
  max-height: 100dvh;
  overflow-y: auto;
  background: #fff;
  padding: 64px 14px 14px;
  box-shadow: 2px 0 12px rgba(0,0,0,.25);
  box-sizing: border-box;
  font-size: 14px;
}
@media (max-width: 640px) {
  #panel { width: 100%; top: auto; bottom: 0; max-height: 75dvh; border-radius: 12px 12px 0 0; padding-top: 12px; }
}
#panel h2 { margin: 0 0 10px; font-size: 17px; }
#panel h3 { margin: 14px 0 6px; font-size: 14px; }
#panel label { display: block; font-size: 13px; color: #555; margin-bottom: 8px; }
#panel select, #panel input[type=search], #panel input[type=text] {
  width: 100%;
  min-height: 40px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 8px;
  font-size: 14px;
}
#rows { display: flex; flex-direction: column; gap: 6px; }
.trow { display: flex; gap: 6px; align-items: center; }
.trow input { flex: 1; min-width: 0; min-height: 40px; border: 1px solid #ccc; border-radius: 6px; padding: 8px; font-size: 14px; box-sizing: border-box; }
.trow button { min-height: 40px; width: 40px; border: none; border-radius: 6px; background: #eee; font-size: 16px; cursor: pointer; }
#panel button {
  min-height: 44px;
  border: none;
  border-radius: 8px;
  background: #1976d2;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 14px;
}
#panel button.danger { background: #d32f2f; }
#addRow { background: #eee !important; color: #1a1a1a !important; margin-top: 6px; width: 100%; }
#panel .row { display: flex; gap: 8px; margin-top: 8px; }
#panel .row button { flex: 1; }
.hint { font-size: 12px; color: #666; margin: 8px 0 0; }
.hint code { background: #f1f1f1; padding: 1px 4px; border-radius: 4px; }
#filterJson {
  background: #f6f6f6;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 4px 0 0;
}
#placeResults { margin-top: 6px; }
#placeResults div {
  padding: 8px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}
#placeResults div:hover { background: #f1f6ff; }
.hidden { display: none; }

.leaflet-popup-content { font-size: 13px; min-width: 220px; max-width: 260px; }
.leaflet-popup-content h3 { margin: 0 0 6px; font-size: 14px; }
.typechip {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  background: #e3f0fd;
  color: #1565c0;
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 4px;
  vertical-align: middle;
}
.leaflet-popup-content table { border-collapse: collapse; width: 100%; }
.leaflet-popup-content td { padding: 2px 4px; vertical-align: top; word-break: break-all; }
.leaflet-popup-content td.k { color: #777; font-weight: 600; white-space: nowrap; }
.btn {
  display: block;
  width: 100%;
  min-height: 42px;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  line-height: 42px;
  margin-top: 6px;
  cursor: pointer;
}
.btn.sv { background: #0d8a3f; color: #fff; }
.btn.vis { background: #1976d2; color: #fff; border: none; }
.btn.vis.red { background: #d32f2f; }
