:root {
  --bg: #f3f5f2;
  --panel: #ffffff;
  --text: #172321;
  --accent: #0f4c81;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: "Source Sans 3", "Segoe UI", sans-serif; background: radial-gradient(circle at top, #dde9e1, var(--bg)); color: var(--text); }
.app-header { padding: 12px 16px; background: #fff; border-bottom: 1px solid #d8e0dc; }
.app-header h1 { margin: 0; font-size: 1.1rem; }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.legend-toggle { display: none; border: 1px solid #c8d7d0; background: #f8fbf9; color: #172321; border-radius: 8px; padding: 6px 10px; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.app-main { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 56px); }
#map { min-height: calc(100vh - 56px); }
.legend { padding: 12px; background: var(--panel); border-right: 1px solid #d8e0dc; overflow-y: auto; }
.legend h2 { margin-top: 0; font-size: 1rem; }
.legend-group { display: block; width: 100%; text-align: left; border: 1px solid #d1ddd8; background: #f7faf8; color: #172321; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; cursor: pointer; }
.legend-group:hover { background: #edf4f0; border-color: #b8cbc3; }
.legend-group { transition: background-color .18s ease, border-color .18s ease, transform .18s ease; }
.legend-group:active { transform: translateY(1px) scale(0.995); }
.legend-group.is-active { background: #e3eef8; border-color: #9db8cf; color: #0f4c81; font-weight: 700; }
.legend-feedback { min-height: 18px; margin-top: 6px; font-size: .86rem; color: #345b45; opacity: 0; transition: opacity .2s ease; }
.legend-feedback.is-visible { opacity: 1; }
.legend-feedback.is-error { color: #9f2020; }

.custom-marker span { display: block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2); }
.leaflet-marker-icon.sp-group-selected.fontello-marker [class^="icon-"]::before,
.leaflet-marker-icon.sp-group-selected.fontello-marker [class*=" icon-"]::before {
  border: 3px solid #ef8a00;
  transition: border-color 2s ease;
}
.leaflet-marker-icon.sp-group-selected.sp-group-fadeout.fontello-marker [class^="icon-"]::before,
.leaflet-marker-icon.sp-group-selected.sp-group-fadeout.fontello-marker [class*=" icon-"]::before {
  border-color: rgba(239, 138, 0, 0.12);
}
.marker-symbol .icon-wrap { display: grid; place-items: center; width: 100%; height: 100%; color: #0f4c81; }
.marker-symbol .icon-wrap svg { width: 90%; height: 90%; fill: currentColor; }
.fontello-marker { display: grid; place-items: center; color: #0f4c81; }
.fontello-marker i { font-size: 20px; line-height: 1; }
.text-label span { font-weight: 700; color: #10231e; text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff; }
.line-label { background: rgba(255,255,255,0.92); border: 1px solid #ccd8d2; color: #10231e; font-weight: 700; padding: 1px 6px; border-radius: 999px; box-shadow: none; }
.popup-route { margin-top: 8px; padding-top: 6px; border-top: 1px solid #d8e0dc; }
.popup-route a { display: inline-flex; align-items: center; gap: 6px; color: #0f4c81; text-decoration: none; font-weight: 700; }
.popup-route a:hover { text-decoration: underline; }
.sp-highlight-pulse { }
.leaflet-interactive,
.leaflet-marker-icon,
.leaflet-image-layer {
  transition: opacity 2s ease, stroke-opacity 2s ease, fill-opacity 2s ease, stroke 2s ease, fill 2s ease, stroke-width 2s ease, filter 2s ease;
}
.leaflet-control-layers-list input[type="radio"] { margin-right: 4px; }
.leaflet-control-layers-list label { margin-bottom: 2px; }
.leaflet-control-layers-base label { font-weight: 600; }
.leaflet-control-layers-base label:has(input:checked) { color: #0f4c81; }

@media (max-width: 768px) {
  .app-main { grid-template-columns: 1fr; }
  .legend-toggle { display: inline-block; }
  .legend {
    position: fixed;
    top: 56px;
    right: 0;
    width: min(84vw, 320px);
    max-height: calc(100vh - 56px);
    border-right: 0;
    border-left: 1px solid #d8e0dc;
    border-top: 0;
    transform: translateX(100%);
    transition: transform .22s ease;
    z-index: 1200;
    box-shadow: -8px 0 24px rgba(0,0,0,.12);
  }
  .legend.is-open { transform: translateX(0); }
  #map { min-height: 65vh; }
}

[class^="icon-"]::before, [class*=" icon-"]::before {
  border: 2px solid white;
  background: white;
  border-radius: 30px;
}
