:root {
  --cream: #FAF4EA;
  --ink: #2B2420;
  --teal: #1F6F8B;
  --terracotta: #C4622D;
  --green: #3F7D53;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
header {
  position: relative;
  padding: 18px 24px 12px;
  border-bottom: 1px solid rgba(43,36,32,0.12);
}
.overview-link {
  position: absolute; top: 18px; right: 24px;
  font-size: 1rem; font-weight: 600; color: #2a7db8; text-decoration: none;
  letter-spacing: 0.01em;
}
.overview-link:hover { color: #2a7db8; text-decoration: underline; }
@media (max-width: 640px) {
  header { display: flex; flex-direction: column; }
  .overview-link {
    position: static;
    order: -1;            /* sits above the h1 */
    align-self: flex-end; /* stays on the right */
    margin-bottom: 6px;
  }
}
header h1 {
  margin: 0 0 4px;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}
header .subtitle {
  margin: 0;
  font-size: 0.92rem;
  color: rgba(43,36,32,0.72);
  line-height: 1.4;
}
.legend {
  display: flex; flex-wrap: wrap; gap: 10px 18px;
  margin-top: 10px;
  font-size: 0.82rem;
}
.legend .swatch {
  display: inline-flex; align-items: center; gap: 6px;
}
.legend .dot {
  width: 11px; height: 11px; border-radius: 50%;
  display: inline-block;
}
.layout {
  display: flex;
  height: calc(100% - 108px);
}
#map { flex: 1 1 auto; height: 100%; background: var(--cream); }
#sidebar {
  width: 340px; flex: 0 0 340px;
  overflow-y: auto;
  border-left: 1px solid rgba(43,36,32,0.12);
  background: var(--cream);
}
.route-group { padding: 10px 16px 4px; }
.route-title {
  font-weight: 600;
  font-size: 0.88rem;
  padding: 6px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.route-title .toggle-label {
  display: flex; align-items: center; gap: 6px;
}
.route-title input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: white;
  cursor: pointer;
}
.route-group.hidden .stop-row,
.route-group.hidden .connector {
  opacity: 0.35;
}
.route-title.hidden-route {
  opacity: 0.5;
}
.legend .swatch {
  cursor: pointer;
  user-select: none;
  padding: 2px 6px;
  border-radius: 4px;
}
.legend .swatch:hover { background: rgba(43,36,32,0.08); }
.legend .swatch.hidden-route { opacity: 0.4; text-decoration: line-through; }
.stop-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.stop-row:hover { background: rgba(43,36,32,0.06); }
.badge {
  flex: 0 0 auto;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 0.75rem; font-weight: 700;
}
.badge.hotel {
  border-radius: 4px;
  background: #7A7268 !important;
}
.stop-name { font-size: 0.88rem; line-height: 1.25; }
.stop-name a { color: inherit; text-decoration: underline; text-decoration-color: rgba(43,36,32,0.35); }
.connector {
  font-size: 0.72rem;
  color: rgba(43,36,32,0.55);
  padding: 2px 8px 2px 40px;
  font-style: italic;
}
.locate-btn {
  background: white; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; box-shadow: 0 1px 5px rgba(0,0,0,0.4);
  cursor: pointer; font-size: 16px;
}
.leaflet-popup-content-wrapper { border-radius: 8px; }
.leaflet-popup-content { margin: 10px 32px 10px 14px; font-size: 0.88rem; }
.leaflet-popup-close-button {
  width: 28px !important; height: 28px !important;
  font-size: 22px !important;
  line-height: 28px !important;
  right: 2px !important; top: 2px !important;
}
@media (max-width: 640px) {
  .layout { flex-direction: column; height: auto; }
  #map { height: 60vh; }
  #sidebar { width: 100%; flex-basis: auto; border-left: none; border-top: 1px solid rgba(43,36,32,0.12); max-height: 40vh; }
}
