/* Luftkarte — dunkle Oberfläche, weil die Karte ein Satellitenbild ist.
   Keine Webfonts, keine externen Stylesheets: die CSP erlaubt nur 'self'. */

:root {
  --bg: #11161c;
  --panel: #171e26;
  --panel-2: #1e2731;
  --line: #2b3744;
  --text: #e7edf3;
  --muted: #9aa9b8;
  --accent: #5ec4ff;
  /* Serienfarben: kategorial (Identitaet) fuer die zwei Emittenten-Ebenen,
     validiert gegen die Panel-Flaeche (dataviz: alle Pruefungen bestanden). */
  --industry: #d95926;
  --workshop: #199e70;
  /* Windstaerke ist eine geordnete Groesse -> EIN Blauton, ordinal gestuft
     (schwach dunkel, stark hell; hellstes Ende klar ueber der Flaeche). */
  --wind-1: #184f95;
  --wind-2: #256abf;
  --wind-3: #3987e5;
  --wind-4: #6da7ec;
  --wind-5: #b7d3f6;
  --planned: #9085e9;
  --shadow: 0 2px 14px rgba(0, 0, 0, .45);
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ Kopfzeile */
.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow); position: relative; z-index: 1200;
}
.brand { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: .2px; white-space: nowrap; }
.brand span { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 6px; }

.search { display: flex; flex: 1 1 320px; min-width: 240px; gap: 8px; }
.search input {
  flex: 1; min-width: 0; padding: 9px 12px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 15px;
}
.search input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
button, select {
  padding: 9px 13px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font-size: 14px; cursor: pointer;
}
button[type="submit"] { background: var(--accent); color: #06141f; border-color: transparent; font-weight: 600; }
button.ghost { background: transparent; }
.controls { display: flex; align-items: center; gap: 8px; }
.controls label { color: var(--muted); font-size: 13px; }

/* -------------------------------------------------------------------- Aufbau */
.layout { display: flex; height: calc(100% - 59px); min-height: 0; }
.panel {
  width: 390px; flex: 0 0 390px; overflow-y: auto; background: var(--panel);
  border-right: 1px solid var(--line); padding: 4px 0 40px;
}
.panel[hidden] { display: none; }
.map-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
#map { position: absolute; inset: 0; background: #0b1016; }

.block { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.block h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); margin: 0 0 10px; }
.badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: var(--panel-2); color: var(--text); font-size: 11px; letter-spacing: 0; text-transform: none;
}
.place { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.coords { font-variant-numeric: tabular-nums; margin: 2px 0 0; }
.hint, .muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hint { font-size: 12.5px; margin: 6px 0 0; }

/* ------------------------------------------------------------------ Schalter */
.toggles { display: flex; flex-direction: column; gap: 7px; }
.toggles label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.toggles select { width: 100%; font-size: 13px; padding: 6px 9px; }
.dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; }
.dot.industrie { background: var(--industry); }
.dot.werkstatt { background: var(--workshop); }
.dot.wind { background: var(--wind-3); }

/* ------------------------------------------------------------------- Tabellen */
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 8px 0 0; }
.tbl th, .tbl td { text-align: left; padding: 3px 6px 3px 0; border-bottom: 1px solid var(--line); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--accent); font-size: 12.5px; }
details ul { margin: 8px 0 0; padding-left: 18px; }
details li { margin-bottom: 4px; }

/* -------------------------------------------------------------- Emittentenliste */
.emit-list { list-style: none; margin: 0; padding: 0; }
.emit-list li {
  padding: 8px 0; border-bottom: 1px solid var(--line); cursor: pointer;
  display: grid; grid-template-columns: 12px 1fr; gap: 9px; align-items: start;
}
.emit-list li:hover, .emit-list li:focus-visible { background: var(--panel-2); }
.emit-list li.active { background: #233041; }
.emit-list .marker { width: 11px; height: 11px; border-radius: 50%; margin-top: 5px; }
.emit-list .name { font-size: 14px; }
.emit-list .dist { color: var(--text); font-weight: 650; white-space: nowrap;
                   font-variant-numeric: tabular-nums; }
.emit-list .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.tag {
  display: inline-block; padding: 0 5px; border-radius: 4px; background: var(--panel-2);
  color: var(--muted); font-size: 11px; margin: 2px 4px 0 0;
}
.tag.planned { background: #2a2743; color: #c6bffa; }

/* ------------------------------------------------------------- Karte, Overlays */
.status {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%);
  background: rgba(16, 22, 28, .92); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 7px 14px; font-size: 13px; z-index: 900; box-shadow: var(--shadow); display: none;
  /* Nur eine Meldung: sie darf einen Klick in die Karte nie abfangen. */
  pointer-events: none;
}
.status.on { display: block; }
.status.err { border-color: #7a3a2c; color: #ffb4a0; }

.results {
  position: absolute; left: 12px; top: 12px; width: min(420px, calc(100% - 24px));
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); z-index: 1000; max-height: 60%; overflow-y: auto;
}
.results h3 { margin: 0; padding: 9px 12px; font-size: 12px; color: var(--muted); text-transform: uppercase; }
.results button {
  display: block; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line);
  background: transparent; border-radius: 0; padding: 9px 12px; font-size: 13.5px;
}
.results button:hover { background: var(--panel-2); }
.results .kind { color: var(--muted); font-size: 11.5px; display: block; }

.emit-label {
  background: rgba(16, 22, 28, .82); border: 1px solid rgba(255, 255, 255, .18);
  color: var(--text); border-radius: 5px; padding: 1px 5px; font-size: 11.5px; white-space: nowrap;
  box-shadow: none;
}
.emit-label::before { display: none; }
.emit-label.industrie { border-color: var(--industry); }
.emit-label.werkstatt { border-color: var(--workshop); }
.wind-label {
  background: none; border: 0; box-shadow: none; color: #fff; font-size: 11.5px; font-weight: 650;
  text-shadow: 0 0 4px #000, 0 0 8px #000; white-space: nowrap;
}
.wind-label::before { display: none; }

.leaflet-container { background: #0b1016; font: inherit; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); }
.leaflet-popup-content { margin: 10px 12px; font-size: 13px; }
.leaflet-popup-content h4 { margin: 0 0 5px; font-size: 14px; }
.leaflet-control-attribution { background: rgba(16, 22, 28, .8) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: var(--accent) !important; }
.leaflet-bar a { background: var(--panel) !important; color: var(--text) !important; border-color: var(--line) !important; }

/* --------------------------------------------------------------- Windrose (SVG) */
#wind-rose svg { width: 100%; height: auto; display: block; }
#wind-rose text { fill: var(--muted); font-size: 9px; }
#wind-rose text.dir { fill: var(--text); font-size: 10px; font-weight: 600; }
#wind-rose .grid { stroke: var(--line); fill: none; }
/* Die Ringbeschriftung liegt ueber den Balken: ein Rand in Flaechenfarbe haelt sie lesbar. */
#wind-rose text.ring { fill: var(--text); font-size: 9.5px; paint-order: stroke;
                       stroke: var(--panel); stroke-width: 3px; stroke-linejoin: round; }

/* ------------------------------------------------------------------ schmaler Schirm */
@media (max-width: 860px) {
  .layout { flex-direction: column; height: auto; min-height: calc(100% - 59px); }
  .panel { width: 100%; flex: 0 0 auto; max-height: 48vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .map-wrap { position: relative; height: 52vh; flex: 0 0 auto; }
  .brand span { display: none; }
}
