:root {
  --bg: #f5f4ef;
  --card: #ffffff;
  --text: #1f2a24;
  --muted: #5f6b62;
  --accent: #2f6b3f;
  --border: #d9ddd5;
  --green: #1f9d55;
  --orange: #f0a202;
  --yellow: #f5d742;
  --red: #d9382e;
}

* { box-sizing: border-box; }

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--accent);
  color: white;
}

.topbar h1 {
  margin: 0 0 4px;
  font-size: 1.35rem;
}

.topbar p {
  margin: 0;
  opacity: 0.95;
}

.reload-btn {
  border: 1px solid rgba(255,255,255,0.45);
  border-radius: 10px;
  background: rgba(255,255,255,0.12);
  color: white;
  padding: 10px 13px;
  font-weight: 700;
  cursor: pointer;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 430px;
  gap: 18px;
  padding: 18px;
  min-height: calc(100vh - 86px);
}

.map-card,
.side-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  overflow: hidden;
}

.map-card {
  align-self: start;
}

#map {
  width: 100%;
  height: calc(100vh - 160px);
  min-height: 520px;
}

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 13px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.95rem;
}

.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: -1px;
}

.green { background: var(--green); }
.orange { background: var(--orange); }
.red { background: var(--red); }

.side-card {
  padding: 16px;
  overflow: auto;
}

.side-card h2 {
  margin: 0 0 12px;
  font-size: 1.15rem;
}

.filters {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.filter {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  padding: 9px;
  cursor: pointer;
  font-weight: 700;
}

.filter.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.status {
  margin: 8px 0 12px;
  color: var(--muted);
  font-weight: 650;
}

.list {
  display: grid;
  gap: 10px;
}

.item {
  border: 1px solid var(--border);
  border-left-width: 7px;
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
  cursor: pointer;
}

.item:hover { background: #fbfbf7; }
.item.heute { border-left-color: var(--red); }
.item.morgen { border-left-color: var(--orange); }
.item.spaeter { border-left-color: var(--green); }


.item-title {
  font-weight: 800;
  margin-bottom: 4px;
}

.item-meta {
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.35;
}

.popup-title {
  font-weight: 800;
  margin-bottom: 6px;
}

.popup-body {
  line-height: 1.4;
}

.popup-body a {
  color: var(--accent);
  font-weight: 700;
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .layout {
    display: flex;
    flex-direction: column;
    padding: 10px;
    min-height: auto;
  }

  .map-card {
    width: 100%;
  }

  #map {
    width: 100%;
    height: 65vh;
    min-height: 420px;
  }

  .side-card {
    width: 100%;
    max-height: none;
    overflow: visible;
  }
}