:root {
  --free: #16a34a;
  --few: #d97706;
  --busy: #dc2626;
  --fast: #1d4ed8;
  --text: #111827;
  --muted: #6b7280;
  --surface: #ffffff;
  --shadow: 0 2px 10px rgb(0 0 0 / 0.15);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}

html, body, #map { height: 100%; margin: 0; }
body { background: #e5e7eb; }

/* Toolbar */
.toolbar {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  pointer-events: none;
}
.toolbar > * { pointer-events: auto; }
.filters { display: flex; gap: 8px; }

.chip {
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--text); color: #fff; }

.status {
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.status.error { color: var(--busy); }

.locate {
  position: absolute;
  right: 10px;
  bottom: calc(100px + env(safe-area-inset-bottom));
  z-index: 1000;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  font-size: 22px;
  background: var(--surface);
  color: var(--fast);
  box-shadow: var(--shadow);
  cursor: pointer;
}

/* Station pins: "free/total", coloured by whether anything is free */
.pin, .cluster {
  transform: translate(-50%, -50%);
  display: inline-block;
  white-space: nowrap;
  color: #fff;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.35);
  border: 2px solid #fff;
}
.pin { padding: 2px 7px; border-radius: 999px; font-size: 12px; }
.pin-fast::before { content: "⚡"; margin-right: 2px; }
.cluster { min-width: 34px; line-height: 34px; padding: 0 6px; border-radius: 999px; font-size: 13px; box-sizing: border-box; }

.pin-free, .cluster-free { background: var(--free); }
.pin-busy, .cluster-busy { background: var(--busy); }
.cluster-few { background: var(--few); }

.user-dot { transform: translate(-50%, -50%); width: 14px; height: 14px; border-radius: 50%;
  background: var(--fast); border: 3px solid #fff; box-shadow: 0 0 0 6px rgb(29 78 216 / 0.2); }

/* Popup */
.leaflet-popup-content { margin: 12px 14px; min-width: 240px; }
.popup-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.popup-meta { margin: 2px 0 10px; color: var(--muted); font-size: 13px; }
.popup-meta:empty { display: none; }
.badge { padding: 2px 8px; border-radius: 999px; color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-free { background: var(--free); }
.badge-busy { background: var(--busy); }
.popup-actions { display: flex; gap: 8px; }
.popup-actions .button {
  flex: 1;
  white-space: nowrap;
  padding: 9px 12px;
  border-radius: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  background: #f3f4f6;
}
.popup-actions .button-primary { color: #fff; background: var(--fast); }
