/* mallorqa — Oberfläche.
 *
 * Typografie trägt, Farbe akzentuiert. Instrument Sans für alles Laufende,
 * Instrument Serif kursiv für die editorialen Momente, Fragment Mono für
 * jede Zahl — Ziffern in einem Datenprodukt sollen tabellarisch stehen.
 * Ein einziger Akzent: Limette. Alles andere ist Schwarz, Weiß, Grau.
 */

:root {
  /* Hell und ruhig. Die Seite zeigt amtliche Zahlen; sie soll aussehen
     wie ein Kursblatt, nicht wie eine Produktseite. Farbe traegt hier
     Bedeutung — Rot faellt, Gruen steigt, Blau ist ein Link — und wird
     sonst nirgends dekorativ eingesetzt. */
  --bg:       #ffffff;
  --bg-lift:  #f5f8fd;
  --bg-raise: #e6edf9;
  --line:     rgba(0,0,0,.17);
  --line-dim: rgba(0,0,0,.09);
  --text:     #111111;
  --dim:      #4a4a4a;
  --mute:     #6e6e6e;
  --accent:   #0a46c8;
  --accent-d: #06308c;
  --cyan:     #0b6b8a;
  --warn:     #a81f16;
  --pos:      #14622f;

  --sans:  "Archivo", ui-sans-serif, -apple-system, "Segoe UI", sans-serif;
  /* Source Serif 4 statt einer Display-Serif: robuste Serifen, keine
     Haarlinien, optische Groessen von 8 bis 60. Sie traegt eine
     Ueberschrift genauso wie eine Bildunterschrift und liest sich wie
     eine Fachpublikation — nicht wie ein Startup-Aufmacher. */
  --serif: "Newsreader", ui-serif, Georgia, serif;
  --mono:  "Fragment Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --sidebar: 340px;
  --detail:  400px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 15px; line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Nur die Karte ist eine Vollbildanwendung. Die Sperre stand vorher
   pauschal auf html und body — damit liessen sich die Portalseiten, die
   dasselbe Stylesheet fuer Farben und Schriften einbinden, nicht scrollen. */
html.app, body.app { height: 100%; overflow: hidden; }

#app { display: flex; height: 100%; }

em, .it { font-family: var(--serif); font-style: italic; font-weight: 400; }
.num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- Sidebar */
#sidebar {
  width: var(--sidebar); flex: 0 0 var(--sidebar);
  background: var(--bg); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}

.brand { padding: 26px 26px 22px; }
.brand-mark {
  font-size: 27px; font-weight: 400; letter-spacing: -0.045em;
  line-height: 1; color: var(--text);
}
.brand-mark .dot { color: var(--accent); }
.brand-sub {
  font-family: var(--serif); font-style: italic;
  font-size: 15px; color: var(--dim); margin-top: 7px; line-height: 1.35;
}

.panel-scroll {
  flex: 1; overflow-y: auto; padding-bottom: 20px; min-height: 0;
  /* Ausblendung an der Unterkante, solange noch etwas folgt.
     Ohne sie endet der Text an einer harten Kante, direkt ueber der
     Trennlinie der Statuszeile — das liest sich wie abgeschnitten und
     nicht wie "weiterscrollen". Am Ende der Liste faellt die Maske weg,
     damit die letzte Zeile scharf steht. */
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 34px), transparent 100%);
          mask-image: linear-gradient(to bottom, #000 calc(100% - 34px), transparent 100%);
}
.panel-scroll.am-ende {
  -webkit-mask-image: none;
          mask-image: none;
}
.panel-scroll::-webkit-scrollbar { width: 9px; }
.panel-scroll::-webkit-scrollbar-track { background: transparent; }
.panel-scroll::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,.14); border-radius: 5px;
  border: 3px solid var(--bg);
}

.block { padding: 20px 26px 0; }
.block + .block { margin-top: 4px; }

.block-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: .13em;
  text-transform: uppercase; color: var(--mute); margin-bottom: 12px;
}

/* ------------------------------------------------------------ Eingaben */
input[type="search"], select {
  width: 100%; padding: 11px 14px;
  background: var(--bg-raise); border: 1px solid var(--line-dim);
  border-radius: 999px; color: var(--text);
  font-size: 14px; font-family: var(--sans);
  transition: border-color .15s;
}
input[type="search"]::placeholder { color: var(--mute); }
input[type="search"]:focus, select:focus {
  outline: none; border-color: rgba(199,255,159,.45);
}
select { border-radius: 999px; cursor: pointer; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%),
                    linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}

.search-results {
  list-style: none; margin: 8px 0 0; padding: 5px;
  background: var(--bg-raise); border: 1px solid var(--line-dim);
  border-radius: 16px; max-height: 260px; overflow-y: auto;
}
.search-results li {
  padding: 8px 12px; border-radius: 999px; cursor: pointer;
  font-size: 14px; display: flex; justify-content: space-between;
  gap: 10px; align-items: baseline;
}
.search-results li:hover { background: var(--bg-lift); }
.search-results li .n {
  font-family: var(--mono); font-size: 12px; color: var(--mute);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------- Metrikliste
 *
 * Gruppiert nach der Frage, die ein Kaeufer stellt. Vorher standen
 * fuenfzehn gleichrangige Eintraege untereinander — eine Liste von
 * Moeglichkeiten, keine Hilfe bei der Entscheidung.
 */
.metric-list { display: flex; flex-direction: column; }

.mgroup { margin-bottom: 18px; }
.mgroup:last-child { margin-bottom: 0; }
.mgroup-kopf {
  font-family: var(--mono); font-size: 9px; color: var(--mute);
  letter-spacing: .13em; text-transform: uppercase;
  padding-bottom: 7px; margin-bottom: 2px;
  border-bottom: 1px solid var(--line-dim);
}
/* Als Knopf, nicht als Text: vorher war nicht erkennbar, dass sich das
   klicken laesst — und erst recht nicht, dass es wieder zugeht. */
.mgroup-mehr {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 9.5px; color: var(--mute);
  cursor: pointer; padding: 8px 0 2px; letter-spacing: .04em;
  background: none; border: none; text-align: left; width: 100%;
}
.mgroup-mehr:hover { color: var(--accent); }
.mm-pfeil {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 4px;
  border: 1px solid var(--line); font-size: 11px; line-height: 1;
  flex: 0 0 14px;
}
.mgroup-mehr:hover .mm-pfeil { border-color: var(--accent-d); }
.mgroup-mehr.auf .mm-pfeil { border-color: var(--accent-d); color: var(--accent); }

.metric {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 0; cursor: pointer; transition: opacity .15s;
}
.metric:hover .name { color: var(--accent); }
.metric.on .name { color: var(--accent); }
.metric.on .name::before {
  content: ""; display: inline-block; width: 5px; height: 5px;
  border-radius: 50%; background: var(--accent); margin-right: 8px;
  vertical-align: 2px;
}
.metric.off { cursor: default; opacity: .4; }
.metric.off:hover .name { color: var(--text); }

.metric .body { min-width: 0; flex: 1; }
.metric .name {
  display: block;
  font-size: 14.5px; letter-spacing: -0.02em; line-height: 1.25;
  transition: color .15s;
}
.metric .meta {
  display: block;
  font-family: var(--mono); font-size: 9.5px; color: var(--mute);
  margin-top: 3px; line-height: 1.5; letter-spacing: .02em;
}
.metric .tag {
  display: inline-block; font-family: var(--mono); font-size: 8.5px;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--mute); margin-top: 6px;
}
.metric .tag.blocked { color: var(--warn); border-color: rgba(255,178,122,.3); }

/* -------------------------------------------------------------- Legende */
.legend { display: flex; flex-direction: column; gap: 1px; }
.legend-row {
  display: flex; align-items: center; gap: 11px;
  font-family: var(--mono); font-size: 11px; color: var(--dim);
  padding: 3px 0; font-variant-numeric: tabular-nums;
}
.legend-row .sw { width: 26px; height: 9px; flex: 0 0 26px; border-radius: 2px; }
/* Punktmessung im Detailkopf. Steht bewusst abgesetzt: sie gilt fuer den
   angeklickten Ort, nicht fuer das Gebiet darunter — anders als alles
   andere in diesem Panel. */
/* Zonenkennung neben dem Gemeindenamen — kleiner und ruhiger, damit der
   Ort die Ueberschrift traegt und die Nummer nur danebensteht. */
.d-zone {
  font-family: var(--mono); font-size: 12px; color: var(--mute);
  letter-spacing: .02em; margin-left: 10px; white-space: nowrap;
}

.d-punkt {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin: 0 0 4px; padding: 9px 0 11px;
  border-bottom: 1px solid var(--line-dim);
}
.d-punkt-l { font-size: 12px; color: var(--mute); line-height: 1.4; }
.d-punkt-note {
  display: block; font-size: 11px; color: var(--mute);
  opacity: .72; margin-top: 3px; line-height: 1.45; max-width: 30ch;
}
/* Eine ausgewiesene Zone wird markiert, nicht dramatisiert: ein schmaler
   Strich links, kein Warndreieck. Es ist eine Rechtslage, kein Alarm. */
.d-punkt-warn { border-left: 2px solid var(--warn); padding-left: 11px; }
/* Lange Werte untereinander. Rechtsbuendig in einer Spalte laufen sie aus
   dem Panel — derselbe Fehler wie im Kartenpopup, gleiche Loesung. */
.d-punkt-stapel { display: block; }
.d-punkt-stapel .d-punkt-v { display: block; margin-top: 2px; }
.d-punkt-stapel .d-punkt-note { max-width: none; }
.d-punkt-warn .d-punkt-v { color: var(--warn); }
.d-punkt-ok { color: var(--dim); }
.d-punkt-v {
  font-size: 15px; color: var(--text); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.legend-note {
  font-size: 12.5px; color: var(--mute); margin: 14px 0 0; line-height: 1.55;
}

.toggle {
  display: flex; align-items: center; gap: 11px; padding: 8px 0;
  font-size: 14px; cursor: pointer; color: var(--dim);
  border-bottom: 1px solid var(--line-dim);
}
.toggle:last-of-type { border-bottom: none; }
.toggle:hover { color: var(--text); }
.toggle input { accent-color: var(--accent); width: 15px; height: 15px; }

.hint { font-size: 12px; color: var(--mute); margin: 10px 0 0; line-height: 1.55; }

.status {
  border-top: 1px solid var(--line); padding: 18px 26px;
  font-size: 12.5px; color: var(--mute); line-height: 1.7;
}
.status .num { color: var(--text); font-size: 13px; }

/* ------------------------------------------------------------------ Map */
#map-wrap { flex: 1; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: var(--bg); }

.maplibregl-ctrl-attrib { display: none; }
.maplibregl-ctrl-group {
  background: var(--bg-raise) !important;
  border: 1px solid var(--line-dim) !important;
  border-radius: 999px !important; overflow: hidden;
  box-shadow: none !important;
}
.maplibregl-ctrl-group button { background: transparent !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line-dim) !important; }
.maplibregl-ctrl-group button span { filter: invert(1) opacity(.65); }
.maplibregl-ctrl-scale {
  background: transparent !important; border-color: var(--line) !important;
  color: var(--mute) !important; font-family: var(--mono) !important;
  font-size: 10px !important;
}

.tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: #fff; border: 1px solid var(--line);
  border-radius: 4px; padding: 10px 14px; color: var(--text);
  box-shadow: 0 2px 4px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.12);
  transform: translate(-50%, -130%); white-space: nowrap;
  backdrop-filter: blur(8px);
}
.tooltip .t-name { font-size: 14px; letter-spacing: -0.02em; }
.tooltip .t-val {
  font-size: 13px; font-weight: 600; color: var(--text);
  margin-top: 2px; font-variant-numeric: tabular-nums;
}
.tooltip .t-none { font-family: var(--serif); font-style: italic; color: var(--mute); }

.mapnote, .attrib {
  position: absolute; z-index: 4;
  background: #fff; border: 1px solid var(--line);
  border-radius: 4px; padding: 12px 16px; color: var(--text);
  box-shadow: 0 2px 4px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.12);
}
.mapnote {
  top: 20px; left: 20px; max-width: 370px;
  font-size: 12.5px; color: var(--dim); line-height: 1.6;
}
.mapnote .mn-head {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .13em;
  text-transform: uppercase; color: var(--mute); margin-bottom: 6px;
}
.mapnote .num { color: var(--text); }

.attrib {
  bottom: 20px; left: 20px; padding: 8px 14px;
  font-family: var(--mono); font-size: 10px; color: var(--mute);
  letter-spacing: .02em;
}
.attrib a { color: var(--mute); text-decoration: none; }
.attrib a:hover { color: var(--accent); }

/* -------------------------------------------------------------- Detail */
.detail {
  width: var(--detail); flex: 0 0 var(--detail);
  background: var(--bg); border-left: 1px solid var(--line);
  overflow-y: auto; position: relative;
}
.detail::-webkit-scrollbar { width: 9px; }
.detail::-webkit-scrollbar-track { background: transparent; }
.detail::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,.14); border-radius: 5px; border: 3px solid var(--bg);
}

.detail-close {
  position: absolute; top: 20px; right: 22px; z-index: 2;
  width: 30px; height: 30px; border-radius: 999px;
  background: var(--bg-raise); border: 1px solid var(--line-dim);
  color: var(--dim); font-size: 17px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.detail-close:hover { color: var(--text); border-color: var(--line); }
/* Das hidden-Attribut setzt display:none — ein explizites display davor
   ueberstimmt es. Deshalb hier ausdruecklich. */
.detail-close[hidden] { display: none; }

.d-head { padding: 26px 26px 22px; }
.d-name {
  font-size: 38px; font-weight: 400; letter-spacing: -0.05em;
  line-height: 1.02; padding-right: 34px;
}
.d-sub {
  font-family: var(--mono); font-size: 11px; color: var(--mute);
  margin-top: 10px; letter-spacing: .04em;
}

.d-section { padding: 22px 26px; border-top: 1px solid var(--line-dim); }
.d-section h3 {
  font-family: var(--mono); font-size: 10px; font-weight: 400;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--mute); margin: 0 0 16px;
}

.kv { display: grid; grid-template-columns: 1fr auto; gap: 11px 16px; margin: 0; }
.kv dt { font-size: 14px; color: var(--dim); }
.kv dd {
  margin: 0; font-family: var(--mono); font-size: 14px; text-align: right;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.kv dd.none {
  font-family: var(--serif); font-style: italic; font-size: 14px;
  color: var(--mute); letter-spacing: 0;
}

.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { font-size: 13px; }
.bar-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.bar-top .lbl {
  /* flex:1 mit min-width:0 ist noetig, sonst schrumpft ein nowrap-Element
     nicht unter seine Textbreite und schiebt die Zahl aus der Zeile. */
  flex: 1; min-width: 0;
  color: var(--dim); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-size: 13px;
}
.bar-top .n {
  font-family: var(--mono); font-size: 12px; color: var(--text);
  font-variant-numeric: tabular-nums; flex: 0 0 auto;
}
.bar-track { height: 2px; background: var(--line-dim); overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); }

.spark { display: flex; align-items: flex-end; gap: 2px; height: 62px; }
.spark .s-col { flex: 1; background: #2f3f22; min-height: 1px; transition: background .15s; }
.spark .s-col.recent { background: var(--accent); }
.spark .s-col:hover { background: var(--text); }
.spark-axis {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 10px; color: var(--mute); margin-top: 7px;
}

.gap-item { padding: 13px 0; border-bottom: 1px solid var(--line-dim); }
.gap-item:last-child { border-bottom: none; }
.gap-item .g-name { font-size: 14px; color: var(--dim); display: flex; align-items: baseline; gap: 9px; }
.gap-item .g-name::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--mute); flex: 0 0 5px;
}
.gap-item.blocked .g-name::before { background: var(--warn); }
.gap-item .g-why {
  font-family: var(--serif); font-style: italic;
  color: var(--mute); font-size: 14px; margin-top: 6px;
  line-height: 1.45; padding-left: 14px;
}
.gap-item .g-src {
  font-family: var(--mono); font-size: 10px; color: var(--mute);
  margin-top: 7px; padding-left: 14px; letter-spacing: .03em;
}

.prov { font-size: 12.5px; color: var(--mute); line-height: 1.7; margin: 0; }
.prov a { color: var(--dim); }

.maplibregl-popup-content {
  background: #fff !important; border: 1px solid var(--line);
  border-radius: 4px !important; padding: 14px 16px !important;
  color: var(--text); box-shadow: 0 2px 4px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.12);
}
.maplibregl-popup-tip { display: none; }
.maplibregl-popup-close-button { color: var(--mute) !important; font-size: 17px !important; }

/* Die Mobil-Kopfleiste wird von wireMobil() bedingungslos angelegt, weil
   sie beim Wechsel der Fenstergroesse sofort da sein muss. Sichtbar ist
   sie aber nur am Telefon — ohne diese Regel haengt sie auf dem Desktop
   als ungestyltes Element im Flex-Row von #app und wird dort zu einer
   vierten Spalte neben Seitenleiste, Karte und Detail. Der Markenlink
   erscheint dann in der Standardfarbe des Browsers. */
.m-kopf { display: none; }

@media (max-width: 1180px) { :root { --sidebar: 300px; --detail: 340px; } }
/* ------------------------------------------------------------- Mobil
 *
 * Am Telefon ist die Karte die Anwendung, nicht eine Spalte davon.
 * Vorher lag das Detailpanel als Vollbild darueber — wer die Karte
 * oeffnete, sah eine Tabelle und keine Karte. Jetzt fuellt die Karte den
 * Schirm; die Bedienung kommt von links als Schublade, die Ergebnisse
 * von unten als Blatt, das man antippt.
 */
@media (max-width: 860px) {
  #app { display: block; height: 100%; position: relative; }

  /* Kopfleiste: Marke, Ebenenknopf, aktive Kennzahl */
  .m-kopf {
    position: absolute; top: 0; left: 0; right: 0; z-index: 30;
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; background: #fff;
    border-bottom: 1px solid var(--line); backdrop-filter: blur(10px);
  }
  .m-kopf .m-marke {
    font-size: 17px; letter-spacing: -0.045em; color: var(--text);
    text-decoration: none; flex: 0 0 auto;
  }
  .m-kopf .m-marke .dot { color: var(--accent); }
  .m-kopf .m-metrik {
    flex: 1; font-family: var(--mono); font-size: 10px; color: var(--mute);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .m-knopf {
    flex: 0 0 auto; background: var(--bg-raise); color: var(--text);
    border: 1px solid var(--line-dim); border-radius: 999px;
    font-size: 12px; padding: 7px 14px; cursor: pointer; font-family: var(--sans);
  }

  /* Karte fuellt den Schirm, unter der Kopfleiste */
  #map-wrap { position: absolute; inset: 0; }
  .mapnote { display: none; }
  .attrib { bottom: 96px; left: 12px; font-size: 9px; }
  .maplibregl-ctrl-top-right { margin-top: 56px; }

  /* Bedienung als Schublade */
  #sidebar {
    position: absolute; top: 0; bottom: 0; left: 0; z-index: 40;
    width: min(88vw, 340px); max-height: none;
    transform: translateX(-100%); transition: transform .22s ease;
    border-right: 1px solid var(--line); box-shadow: 0 0 40px rgba(0,0,0,.7);
  }
  #app.nav-offen #sidebar { transform: translateX(0); }
  #app.nav-offen::after {
    content: ""; position: absolute; inset: 0; z-index: 35;
    background: rgba(0,0,0,.35);
  }

  /* Ergebnisse als Blatt von unten. Eingeklappt bleibt der Kopf sichtbar,
     damit man weiss, dass es da ist — und die Karte bleibt bedienbar. */
  .detail {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 25;
    width: 100%; height: 84vh; border-left: none;
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    transform: translateY(calc(100% - 92px));
    transition: transform .24s ease;
    box-shadow: 0 -12px 40px rgba(0,0,0,.6);
  }
  #app.blatt-offen .detail { transform: translateY(0); }
  .detail::before {
    content: ""; position: absolute; top: 8px; left: 50%;
    width: 36px; height: 4px; margin-left: -18px; border-radius: 2px;
    background: var(--line); pointer-events: none;
  }
  .d-head { padding-top: 22px; cursor: pointer; }
  .detail-close { top: 22px; }
  .rangliste .rl-zeile { padding: 9px 0; }
}
}

/* ---------------------------------------------------------- Mietniveau */
.d-section h3 .h3-sub {
  font-family: var(--serif); font-style: italic; text-transform: none;
  letter-spacing: 0; color: var(--mute); font-size: 12px; margin-left: 6px;
}

.rent-row { padding: 18px 0 20px; border-bottom: 1px solid var(--line); }
.rent-row:last-child { border-bottom: none; padding-bottom: 4px; }

.rent-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; margin-bottom: 14px;
}
.rent-kind { font-size: 15px; color: var(--text); letter-spacing: -0.02em; }
.rent-val {
  font-family: var(--mono); font-size: 26px; color: var(--cyan);
  letter-spacing: -0.04em; font-variant-numeric: tabular-nums;
}
.rent-val small { font-size: 11px; color: var(--mute); letter-spacing: 0; }
.rent-none { font-size: 14px; color: var(--mute); }

/* Fakten als Wertepaare. Vorher lief das als eine lange Mono-Zeile, die
   mitten im Satz umbrach — Rang, Abweichung und Trend liefen ineinander. */
.rent-fakten {
  display: grid; grid-template-columns: 1fr auto;
  gap: 7px 14px; margin: 0 0 16px;
}
.rent-fakten dt { font-size: 12.5px; color: var(--mute); }
.rent-fakten dd {
  margin: 0; font-family: var(--mono); font-size: 12.5px; text-align: right;
  color: var(--dim); font-variant-numeric: tabular-nums;
}
.rent-fakten .ueber { color: var(--accent); }
.rent-fakten .unter { color: var(--cyan); }

/* Ein Balken statt zweier aehnlich aussehender: die Lage dieser Gemeinde
   in der Spanne aller. Kasten = mittlere Haelfte, Strich = Median,
   Marke = diese Gemeinde. */
.rent-skala { margin-bottom: 12px; }
.rs-bahn { position: relative; height: 4px; background: var(--line-dim); border-radius: 2px; }
.rs-box {
  position: absolute; top: 0; height: 4px;
  background: rgba(0,0,0,.18); border-radius: 2px;
}
.rs-med { position: absolute; top: -3px; width: 1px; height: 10px; background: var(--mute); }
.rs-ich {
  position: absolute; top: -4px; width: 3px; height: 12px;
  background: var(--cyan); border-radius: 1px;
}
.rs-skalen {
  display: flex; justify-content: space-between; margin-top: 8px;
  font-family: var(--mono); font-size: 9.5px; color: var(--mute);
}
.rs-skalen span:nth-child(2) { color: var(--dim); }

.rent-sub {
  font-family: var(--mono); font-size: 10px; color: var(--mute);
  line-height: 1.5;
}

/* ----------------------------------------------------------- Einordnung */
.rang {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 10px; color: var(--mute);
  margin-top: 7px; letter-spacing: .02em;
}
.rang b { color: var(--dim); font-weight: 400; }
.rang .ueber { color: var(--accent); }
.rang .unter { color: var(--cyan); }
.rang .sep { opacity: .4; }

/* Verteilungsbalken: wo liegt diese Gemeinde in der Spanne aller 53 */
.vert { margin-top: 9px; }
.vert-bahn {
  position: relative; height: 3px; background: var(--line-dim); border-radius: 2px;
}
.vert-box {
  position: absolute; top: 0; height: 3px;
  background: rgba(0,0,0,.16); border-radius: 2px;
}
.vert-med {
  position: absolute; top: -3px; width: 1px; height: 9px;
  background: var(--mute);
}
.vert-ich {
  position: absolute; top: -3.5px; width: 3px; height: 10px;
  background: var(--accent); border-radius: 1px;
}
.vert-skala {
  display: flex; justify-content: space-between; margin-top: 5px;
  font-family: var(--mono); font-size: 9px; color: var(--mute);
}

/* --------------------------------------------------------- Rangliste */
.rangliste { display: flex; flex-direction: column; }
.rl-zeile {
  display: grid; grid-template-columns: 22px 1fr auto;
  gap: 10px; align-items: center; padding: 6px 0;
  border-bottom: 1px solid var(--line-dim); cursor: pointer;
}
.rl-zeile:last-child { border-bottom: none; }
.rl-zeile:hover .rl-name { color: var(--accent); }
.rl-zeile.aktiv .rl-name { color: var(--accent); }
.rl-zeile.aktiv .rl-nr { color: var(--accent); }
.rl-nr {
  font-family: var(--mono); font-size: 9.5px; color: var(--mute);
  text-align: right;
}
.rl-name {
  font-size: 13px; color: var(--dim); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; transition: color .12s;
}
.rl-wert {
  font-family: var(--mono); font-size: 12px; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.rl-balken { grid-column: 2 / 4; height: 2px; background: var(--line-dim); margin-top: -2px; }
.rl-balken i { display: block; height: 100%; background: var(--accent-d); }

/* EXPERIMENT 3D-Gebaeude — Rueckbau: docs/EXPERIMENTE.md */
.x-tag {
  font-family: var(--mono); font-style: normal; font-size: 8.5px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--mute);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 1px 7px; margin-left: 7px; vertical-align: 1px;
}

/* Zonen-Detail */
.zone-wert { display: flex; align-items: baseline; gap: 12px; margin: 2px 0 10px; flex-wrap: wrap; }
.zone-fakten { font-family: var(--mono); font-size: 10.5px; color: var(--mute); }
.zone-fakten b { font-weight: 400; }
.zone-fakten .ueber { color: var(--accent); }
.zone-fakten .unter { color: var(--cyan); }

/* ------------------------------------------------------------- Diagramme
 *
 * Dieser Block ist beim Umbau des Mietniveau-Abschnitts versehentlich
 * mitgeloescht worden. Folge: SVG-Text ohne fill ist schwarz — auf
 * schwarzem Grund also unsichtbar. Die Achsen waren die ganze Zeit da,
 * man sah sie nur nicht. Ein Diagramm ohne ablesbare Skala widerspricht
 * dem, was das Produkt verspricht.
 */
.ch-block { margin-bottom: 24px; }
.ch-block:last-child { margin-bottom: 0; }

.ch-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; margin-bottom: 8px;
}
.ch-title { font-size: 13.5px; color: var(--text); letter-spacing: -0.02em; }
.ch-unit {
  font-family: var(--mono); font-size: 9.5px; color: var(--mute);
  letter-spacing: .04em; text-align: right; flex: 0 1 auto;
}

.ch { width: 100%; height: auto; display: block; overflow: visible; }

.ch-ax {
  font-family: var(--mono); font-size: 9px; fill: var(--dim);
}
.ch-serie {
  font-family: var(--sans); font-size: 10px; font-weight: 500;
  letter-spacing: -0.01em;
}
.ch-ref {
  font-family: var(--mono); font-size: 8.5px; fill: var(--mute);
  letter-spacing: .04em;
}
.ch-hit, .ch-bar { cursor: crosshair; }
.ch-hit:hover { fill: rgba(0,0,0,.05); }
.ch-bar:hover { opacity: .75; }

.ch-note {
  font-family: var(--mono); font-size: 9.5px; color: var(--mute);
  margin: 8px 0 0; line-height: 1.5;
}

.ch-tip {
  position: fixed; z-index: 60; pointer-events: none;
  transform: translate(-50%, -100%);
  background: #fff; border: 1px solid var(--line);
  border-radius: 4px; padding: 8px 12px; box-shadow: 0 2px 4px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.12);
  font-family: var(--mono); font-size: 10.5px; color: var(--text);
  white-space: nowrap; backdrop-filter: blur(8px);
}
.rang .hinw { color: var(--mute); font-style: italic; font-family: var(--serif); }



/* Der Schriftzug fuehrt aus der Karte zurueck ins Portal — die Karte ist
   ein Werkzeug, kein eigener Ort. */
a.brand-mark { display: block; text-decoration: none; }
a.brand-mark:hover .dot { color: var(--accent); }

/* EXPERIMENT 3D — Ladezustand des Ausschnitts */
.x-hinweis {
  font-size: 11.5px; color: var(--mute);
  padding: 2px 0 10px; line-height: 1.5;
}

/* -------------------------------------------------- Flaeche zeichnen */
#z-panel { padding: 4px 0 12px; }
.z-flaeche {
  font-family: var(--mono); font-size: 22px; color: var(--accent);
  letter-spacing: -0.03em; margin-bottom: 4px;
}
.z-flaeche .z-in {
  font-family: var(--sans); font-size: 12px; color: var(--mute);
  letter-spacing: 0; margin-left: 8px;
}
.z-basis { display: flex; gap: 4px; margin: 10px 0 12px; }
.z-basis button {
  flex: 1; font-family: var(--sans); font-size: 11.5px; color: var(--dim);
  background: var(--bg-raise); border: 1px solid var(--line-dim);
  border-radius: 999px; padding: 6px 10px; cursor: pointer;
}
.z-basis button.on { color: var(--accent); border-color: var(--accent-d); }

.z-liste { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; margin: 0; }
.z-liste dt { font-size: 12.5px; color: var(--dim); }
.z-liste dd {
  margin: 0; font-family: var(--mono); font-size: 12.5px; text-align: right;
  color: var(--text); font-variant-numeric: tabular-nums;
}
.z-liste dd.z-q {
  grid-column: 1 / -1; text-align: left; font-size: 9.5px;
  color: var(--mute); margin-bottom: 7px; line-height: 1.4;
}
.z-hinweis, .z-fuss {
  font-family: var(--mono); font-size: 9.5px; color: var(--mute);
  line-height: 1.5; margin: 10px 0 0;
}
.z-knoepfe { display: flex; gap: 6px; margin-top: 12px; }
.z-knoepfe button {
  flex: 1; font-family: var(--sans); font-size: 11.5px; color: var(--dim);
  background: none; border: 1px solid var(--line-dim);
  border-radius: 999px; padding: 6px 10px; cursor: pointer;
}
.z-knoepfe button:hover { color: var(--accent); border-color: var(--accent-d); }


/* --------------------------------------------------- Kartenbeschriftung
   Die Namen sind DOM-Elemente, keine Kartenkacheln (siehe app.js). Ohne
   absolute Positionierung flossen sie als Textblock in die Ecke der Karte
   — auf dunklem Grund kaum zu bemerken, auf hellem sofort. Der Halo aus
   drei Schatten haelt sie ueber jeder Flaechenfarbe lesbar. */
.labels { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.map-lbl {
  position: absolute; transform: translate(-50%, -50%);
  white-space: nowrap; color: var(--text); letter-spacing: -0.01em;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 6px #fff;
}
.map-lbl.municipality { font-weight: 600; }
.map-lbl.place { color: var(--dim); font-weight: 400; }
