:root {
  --teal: #0e7c86;
  --teal-dark: #0a5c64;
  --teal-soft: #e3f3f4;
  --ink: #1d2a2f;
  --muted: #5f6f75;
  --line: #e4e9eb;
  --bg: #f7f9fa;
  --pmr: #2563eb;
  --warn: #b45309;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
#app { display: flex; height: 100dvh; }
#map { flex: 1; height: 100%; background: #e9eef0; }

/* ---------- Panel ---------- */
#panel {
  width: 360px; max-width: 100%;
  display: flex; flex-direction: column;
  background: #fff; border-right: 1px solid var(--line);
  z-index: 1000;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; }
.logo {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  background: var(--teal) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Crect x='5' y='3' width='6' height='8' rx='1'/%3E%3Cpath d='M3.5 12h17c0 3.6-2.7 6.2-6.4 6.6L14.5 21h-7l.6-2.6C5.6 17.6 3.5 15.2 3.5 12Z'/%3E%3C/svg%3E") center/26px no-repeat;
}
h1 { font-size: 18px; margin: 0; line-height: 1.2; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.toggle { display: none; margin-left: auto; border: 0; background: var(--bg); width: 40px; height: 40px; border-radius: 10px; font-size: 18px; cursor: pointer; }

.tools { padding: 0 18px 12px; display: grid; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 11px 14px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); }
.btn:disabled { opacity: .6; cursor: progress; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 6px 11px; border-radius: 999px; font-size: 13px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; user-select: none;
  transition: background .15s, border-color .15s, color .15s;
}
.chip input:checked + span { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-dark); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 2px; }

.status { margin: 0; padding: 8px 18px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }

.list { list-style: none; margin: 0; padding: 0 8px 8px; overflow-y: auto; flex: 1; }
.item {
  display: flex; gap: 12px; align-items: flex-start; padding: 10px; border-radius: 10px; cursor: pointer;
}
.item:hover, .item.active { background: var(--bg); }
.item .ico { width: 34px; height: 34px; flex: none; border-radius: 9px; background: var(--teal-soft); display: grid; place-items: center; }
.item .ico svg { width: 20px; height: 20px; fill: var(--teal); }
.item.classic .ico { background: #eef0f7; }
.item.classic .ico svg { fill: #4b5a8f; }
.item h3 { font-size: 14px; margin: 1px 0 3px; font-weight: 600; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; color: var(--muted); }
.dist { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--teal-dark); white-space: nowrap; padding-top: 2px; }
.tag-pmr { color: var(--pmr); font-weight: 600; }
.note { font-size: 12px; color: var(--warn); margin-top: 3px; }

.foot { padding: 10px 18px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); }
.foot a { color: var(--teal-dark); }

/* ---------- Markers ---------- */
.wc-marker { background: none; border: 0; }
.pin {
  width: 38px; height: 38px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--teal); border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.3);
  display: grid; place-items: center; transition: transform .15s;
}
.pin svg { width: 20px; height: 20px; fill: #fff; transform: rotate(45deg); }
.pin.classic { background: #4b5a8f; }
.wc-marker.active .pin { transform: rotate(-45deg) scale(1.2); background: #f59e0b; }
.wc-marker { position: relative; }
.pmr-badge {
  position: absolute; top: -5px; right: -7px;
  width: 16px; height: 16px; border-radius: 50%; background: var(--pmr); color: #fff;
  font-size: 10px; line-height: 16px; text-align: center; border: 2px solid #fff;
}
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(37,99,235,.25); }

/* ---------- Popup ---------- */
.leaflet-popup-content-wrapper { border-radius: var(--radius); }
.leaflet-popup-content { margin: 14px 16px; font: 14px/1.4 system-ui, sans-serif; }
.pop h3 { margin: 0 0 6px; font-size: 15px; }
.pop dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0 0 10px; font-size: 13px; }
.pop dt { color: var(--muted); }
.pop dd { margin: 0; font-weight: 500; }
.pop .note { margin: 0 0 10px; }
.pop a.go { display: inline-block; background: var(--teal); color: #fff !important; text-decoration: none; padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  #app { flex-direction: column-reverse; }
  #panel { width: 100%; height: auto; max-height: 55dvh; border-right: 0; border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(0,0,0,.08); }
  #panel.collapsed .list, #panel.collapsed .status, #panel.collapsed .foot { display: none; }
  .brand { padding: 12px 14px 10px; }
  .tools { padding: 0 14px 10px; }
  .toggle { display: block; }
}
