html, body { margin: 0; padding: 0; height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { display: flex; flex-direction: column; height: 100vh; }

header {
  background: #1f2937;
  color: #f9fafb;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.header-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
header h1 { font-size: 16px; margin: 0; font-weight: 600; flex: 1; min-width: 0; }
.collapse-btn {
  background: #374151;
  color: #f9fafb;
  border: 1px solid #4b5563;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.collapse-btn:hover { background: #4b5563; }
.controls { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.controls.collapsed { display: none; }
.controls label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.prijs-filter { display: flex; align-items: center; gap: 6px; }
.stats { margin-left: auto; opacity: 0.85; font-size: 12px; }

main { flex: 1; position: relative; }
#map { width: 100%; height: 100%; }

#legend {
  position: absolute;
  right: 12px;
  bottom: 12px;
  background: rgba(255, 255, 255, 0.95);
  padding: 10px 14px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  font-size: 12px;
  z-index: 1000;
  line-height: 1.7;
}
.legend-toggle {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}
.legend-toggle strong { margin: 0; }
.legend-toggle .chev { font-size: 11px; opacity: 0.6; }
.legend-body { margin-top: 4px; }
#legend.collapsed .legend-body { display: none; }
#legend.collapsed { line-height: 1.4; }
.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
  border: 1px solid rgba(0,0,0,0.2);
}
.dot-green { background: #16a34a; }
.dot-red { background: #dc2626; }
.dot-amber { background: #f59e0b; }
.dot-orange { background: #f97316; }
.dot-purple { background: #9333ea; }
.zone-swatch {
  display: inline-block;
  width: 14px;
  height: 10px;
  margin-right: 4px;
  vertical-align: middle;
}
.zone-red { background: rgba(220, 38, 38, 0.25); border: 1px solid #dc2626; }
.zone-orange { background: rgba(249, 115, 22, 0.25); border: 1px solid #f97316; }
.zone-purple { background: rgba(147, 51, 234, 0.20); border: 1px solid #9333ea; }

.popup-funda {
  font-size: 13px;
  min-width: 200px;
}
.popup-funda h3 { margin: 0 0 6px 0; font-size: 14px; }
.popup-funda .badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
}
.popup-funda .badge.ok { background: #dcfce7; color: #166534; }
.popup-funda .badge.warn { background: #fef3c7; color: #92400e; }
.popup-funda .badge.no { background: #fee2e2; color: #991b1b; }
.popup-funda dl { margin: 4px 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; }
.popup-funda dt { color: #6b7280; }
.popup-funda dd { margin: 0; }
.popup-funda a { color: #2563eb; }

/* WWS verhuur-indicatie */
.wws {
  margin: 8px 0 6px 0;
  padding: 6px 8px;
  border-radius: 6px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
}
.wws-head { font-weight: 600; font-size: 12.5px; }
.wws-band { color: #6b7280; font-weight: 400; }
.wws-sub { color: #4b5563; font-size: 11.5px; margin-top: 2px; }
.wws-grens { color: #92400e; font-size: 11.5px; margin-top: 3px; }
.wws-foot { color: #9ca3af; font-size: 10px; margin-top: 4px; font-style: italic; }
.wws-na { color: #6b7280; font-size: 11.5px; font-style: italic; }

/* Mobiel: compactere header, legenda neemt niet de halve kaart in beslag */
@media (max-width: 640px) {
  header { padding: 8px 12px; }
  header h1 { font-size: 15px; }
  .controls { gap: 10px 14px; font-size: 14px; }
  #legend { right: 8px; bottom: 8px; max-width: 70vw; }
  .collapse-btn { padding: 6px 12px; }
}
