:root {
  color-scheme: light;
  --bg: #f4f7f2;
  --panel: #ffffff;
  --ink: #18211d;
  --muted: #65716b;
  --line: #dfe7df;
  --green: #1f9d55;
  --red: #e5484d;
  --gray: #848b8a;
  --orange: #f08a24;
  --blue: #2477bf;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button, input, select { font: inherit; }
button { cursor: pointer; border: 0; }
input, select { min-width: 0; }

.shell {
  display: grid;
  grid-template-columns: 390px 1fr;
  min-height: 100vh;
}

.sidebar {
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 22px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: 0 10px 40px rgba(25, 43, 33, 0.12);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 30px; line-height: 1.05; }
h2 { font-size: 17px; }
p { margin: 0; color: var(--muted); line-height: 1.45; }

.search-row {
  display: flex;
  gap: 8px;
}

input, select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.search-row input {
  flex: 1 1 0;
  width: auto;
}

input:focus, select:focus {
  outline: 2px solid rgba(31, 157, 85, .25);
  border-color: var(--green);
}

.search-row button,
.map-actions button {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 750;
}

.search-row button {
  flex: 0 0 46px;
  width: 46px;
  padding: 0;
}

.filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.filters label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #26332d;
  font-size: 14px;
}

.filters input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--green);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.dot.active { background: var(--green); }
.dot.ending { background: var(--red); }
.dot.planned { background: var(--gray); }
.dot.additional { background: var(--orange); }

.map-wrap {
  position: relative;
  min-width: 0;
}

#map {
  width: 100%;
  height: 100vh;
  background: #dfe8dd;
}

.map-actions {
  position: absolute;
  z-index: 1000;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
}

.updated {
  position: absolute;
  z-index: 1000;
  left: 16px;
  bottom: 16px;
  max-width: min(420px, calc(100vw - 32px));
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(255,255,255,.92);
  color: var(--muted);
  font-size: 13px;
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
}

.updated-label {
  color: var(--green);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.updated strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}

.data-source {
  margin-top: 5px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.35;
}

.container-marker {
  position: relative;
  width: 44px;
  height: 52px;
  transform: translate(-22px, -48px);
  color: var(--green);
}

.marker-pin {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 3px solid #fff;
  border-radius: 999px 999px 999px 8px;
  background: currentColor;
  box-shadow: 0 10px 20px rgba(0,0,0,.26);
  transform: rotate(-45deg);
}

.marker-bin {
  position: relative;
  width: 24px;
  height: 15px;
  border: 2px solid #fff;
  border-top-width: 4px;
  border-radius: 2px 2px 4px 4px;
  background:
    linear-gradient(90deg, transparent 29%, rgba(255,255,255,.95) 29% 39%, transparent 39% 61%, rgba(255,255,255,.95) 61% 71%, transparent 71%),
    rgba(255,255,255,.18);
  transform: rotate(45deg);
}

.marker-bin::before,
.marker-bin::after {
  content: "";
  position: absolute;
  bottom: -5px;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #fff;
}

.marker-bin::before { left: 3px; }
.marker-bin::after { right: 3px; }

.marker-bin::before,
.marker-bin::after,
.marker-bin {
  box-shadow: 0 1px 0 rgba(0,0,0,.16);
}

.container-marker.active { color: var(--green); }
.container-marker.ending { animation: pulse 1s infinite; }
.container-marker.ending { color: var(--red); }
.container-marker.planned { color: var(--gray); opacity: .72; }
.container-marker.additional { color: var(--orange); }
.container-marker.pszok { color: var(--blue); }

@keyframes pulse {
  0%, 100% { transform: translate(-22px, -48px) scale(1); }
  50% { transform: translate(-22px, -48px) scale(1.12); }
}

.popup h3 { margin: 0 0 6px; font-size: 16px; }
.popup-row { margin: 3px 0; color: #536058; font-size: 13px; }
.pill { display: inline-block; padding: 3px 7px; border-radius: 999px; color: #fff; font-size: 12px; font-weight: 800; }
.pill.active { background: var(--green); }
.pill.ending { background: var(--red); }
.pill.planned { background: var(--gray); }
.bar { height: 8px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: #e8eee9; }
.bar > span { display: block; height: 100%; background: var(--green); }
.bar.ending > span { background: var(--red); }
.bar.planned > span { background: var(--gray); }

.cluster-count {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: #22352b;
  color: #fff;
  font-weight: 850;
  box-shadow: 0 8px 28px rgba(0,0,0,.22);
}

@media (max-width: 860px) {
  .shell {
    display: block;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .sidebar {
    width: 100%;
    max-width: 100vw;
    max-height: 45vh;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: hidden;
  }

  h1 { font-size: 24px; }
  .brand,
  .search-row,
  .filters,
  .legend {
    max-width: 100%;
  }
  #map { height: 55vh; min-height: 440px; }
  .map-actions { top: 10px; right: 10px; flex-direction: column; }
  .updated { bottom: 10px; left: 10px; }
}
