:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #dfe3e8;
  --text: #1c2733;
  --muted: #66707b;
  --accent: #1a6ee0;
  --danger: #b30000;
  --warn: #e6550d;
  --ok: #2b8a3e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

body {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

#sidebar {
  width: 400px;
  min-width: 340px;
  height: 100%;
  overflow-y: auto;
  padding: 18px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}

#map {
  flex: 1;
  height: 100%;
}

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

header .sub {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}

.panel h2 {
  font-size: 0.95rem;
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

label {
  display: block;
  font-size: 0.85rem;
  margin: 10px 0 4px;
  font-weight: 600;
}

input[type="text"], select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.95rem;
}

input[type="range"] { width: 100%; }

.modes {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.mode {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px;
  text-align: center;
  cursor: pointer;
  font-weight: 500;
  margin: 0;
}

.mode input { display: none; }
.mode:has(input:checked) {
  border-color: var(--accent);
  background: #eaf2fd;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 400;
  font-size: 0.85rem;
  margin: 10px 0 0;
  cursor: pointer;
}
.check input { margin-top: 2px; }

button.primary {
  width: 100%;
  margin-top: 14px;
  padding: 11px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
button.primary:hover:not(:disabled) { background: #1258b8; }
button.primary:disabled { opacity: 0.55; cursor: wait; }

.status {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}

progress { width: 100%; margin-top: 6px; height: 8px; }

.error {
  margin-top: 10px;
  padding: 8px 10px;
  background: #fdecec;
  border: 1px solid #f5b5b5;
  border-radius: 7px;
  color: var(--danger);
  font-size: 0.85rem;
}

.hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 10px 0 0;
}

/* Ergebnisse */
.kpi-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.kpi {
  flex: 1;
  background: var(--bg);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
}

.kpi .num { font-size: 1.25rem; font-weight: 700; }
.kpi .lbl { font-size: 0.72rem; color: var(--muted); }

.verdict {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.4;
  margin-top: 6px;
}
.verdict.high   { background: #fdecec; border: 1px solid #f0b8b8; }
.verdict.medium { background: #fff4e5; border: 1px solid #f5d9a8; }
.verdict.low    { background: #e9f7ec; border: 1px solid #bfe3c8; }

.bars { font-size: 0.82rem; }
.bar-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.bar-row .name { width: 105px; flex-shrink: 0; color: var(--muted); }
.bar-row .track { flex: 1; background: #edf0f3; border-radius: 4px; height: 10px; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 4px; }
.bar-row .val { width: 42px; text-align: right; font-variant-numeric: tabular-nums; }

.hotspot {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.hotspot:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.12); }

.hotspot .top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.hotspot .rank { font-weight: 700; }
.hotspot .tag {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
  white-space: nowrap;
}
.hotspot .meta { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.hotspot .sev { font-size: 0.78rem; margin-top: 3px; }

.rec {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  margin-bottom: 8px;
  font-size: 0.87rem;
  line-height: 1.45;
}
.rec .icon { font-size: 1.15rem; flex-shrink: 0; }
.rec.warn { background: #fff4e5; border: 1px solid #f5d9a8; }
.rec.tip  { background: #eaf2fd; border: 1px solid #c4d9f5; }
.rec b { display: block; margin-bottom: 2px; }

footer {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 4px 0 20px;
}
footer a { color: var(--accent); }

/* Wegpunkt-Marker (Start/Ziel/Zwischenziel) */
.wp {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  cursor: grab;
}
.wp.start { background: #2b8a3e; }
.wp.ziel  { background: #b30000; }
.wp.via   { background: #1a6ee0; font-size: 9px; }

/* Leaflet-Anpassungen */
.leaflet-popup-content { font-size: 0.85rem; line-height: 1.4; margin: 10px 12px; }
.leaflet-popup-content h4 { margin: 0 0 6px; }
.leaflet-popup-content table { font-size: 0.8rem; border-collapse: collapse; }
.leaflet-popup-content td { padding: 1px 8px 1px 0; }
.legend {
  background: rgba(255,255,255,0.92);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1.7;
  box-shadow: 0 1px 5px rgba(0,0,0,0.2);
}
.legend .dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

@media (max-width: 900px) {
  body { flex-direction: column; }
  #sidebar { width: 100%; min-width: 0; height: 55%; border-right: 0; border-bottom: 1px solid var(--border); }
  #map { height: 45%; }
}
