* {
  box-sizing: border-box;
}
html, body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #1f2937;
  background: #f8fafc;
}
#app {
  display: grid;
  grid-template-rows: 56px 1fr 32px;
  height: 100dvh;
}
#topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: #065f46;
  color: white;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.brand {
  font-weight: 700;
  color: white;
  text-decoration: none;
}
.trip-title {
  font-size: 15px;
  opacity: 0.9;
}
.spacer { flex: 1; }
.ghost-btn {
  background: transparent;
  color: white;
  border: 1px solid rgba(255,255,255,0.35);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.ghost-btn:hover { background: rgba(255,255,255,0.1); }

#map-container {
  position: relative;
}
#map {
  position: absolute;
  inset: 0;
}
.legend {
  position: absolute;
  top: 12px;
  right: 12px;
  background: white;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 240px;
  max-width: 320px;
  z-index: 2;
}
.legend h2 {
  margin: 0 0 4px 0;
  font-size: 16px;
}
.meta {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 12px;
  line-height: 1.4;
}
.layer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  font-size: 14px;
}
.layer-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.count {
  color: #6b7280;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
#footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: #e5e7eb;
  font-size: 12px;
  color: #4b5563;
}
#footer a {
  color: #065f46;
  text-decoration: none;
  font-weight: 600;
}
.error-card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background: #fff;
  z-index: 3;
}
.error-card h2 { margin: 0 0 8px 0; color: #b91c1c; }
.error-card p { margin: 0; color: #6b7280; }

@media (max-width: 600px) {
  .legend {
    top: auto;
    right: 12px;
    left: 12px;
    bottom: 12px;
    max-width: none;
  }
}
