* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
  color: #222;
}

header {
  padding: 10px 16px;
  background: #1b4332;
  color: #fff;
  display: flex;
  align-items: baseline;
  gap: 16px;
}

header h1 { font-size: 18px; font-weight: 600; }
header p { font-size: 13px; opacity: 0.85; }

main {
  flex: 1;
  display: flex;
  min-height: 0;
}

#map-wrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; }

#legend {
  position: absolute;
  left: 10px;
  bottom: 10px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  padding: 10px 12px;
  font-size: 13px;
  max-width: 230px;
}

#legend h2 { font-size: 14px; margin-bottom: 6px; }

#legend-items label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 2px 0;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.4);
}

.count { margin-left: auto; color: #666; font-size: 12px; }

#panel {
  width: 340px;
  flex-shrink: 0;
  border-left: 1px solid #ddd;
  background: #fafafa;
  overflow-y: auto;
  padding: 14px;
}

#panel.hidden { display: none; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.panel-head h2 { font-size: 16px; }

#panel-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  border-radius: 4px;
  padding: 2px 8px;
  margin-bottom: 4px;
}

#panel-close {
  border: none;
  background: #e0e0e0;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

#panel-sub { font-size: 13px; color: #555; margin: 8px 0; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th, td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid #e3e3e3;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th { background: #eee; width: 35%; font-weight: 600; }

@media (max-width: 800px) {
  main { flex-direction: column; }
  #map-wrap { min-height: 55vh; }
  #panel { width: 100%; border-left: none; border-top: 1px solid #ddd; }
}
