:root {
  --surface-1: #fcfcfb;
  --surface-2: #f2f1ee;
  --linie: #dddcd7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #7a7974;
  --warnung: #8a5a00;
  --warnung-grund: #fff4dc;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text-primary);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }

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

#seite {
  flex: none;
  width: 300px;
  height: 100vh;
  overflow-y: auto;
  background: var(--surface-1);
  border-left: 1px solid var(--linie);
}
#seite .marke { color: inherit; text-decoration: none; }
#seite .marke:hover h1 { text-decoration: underline; }
#seite > * { padding: 12px 16px; }
#seite > * + * { border-top: 1px solid var(--linie); }

h1 { font-size: 17px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 2px; }
h3 { font-size: 13px; margin: 14px 0 4px; color: var(--text-secondary);
     text-transform: uppercase; letter-spacing: .04em; }
.unter { margin: 2px 0 0; color: var(--text-secondary); }

.auswahl-box {
  width: 250px; padding: 10px 12px; border-radius: 8px;
  background: rgba(252, 252, 251, .95); box-shadow: 0 1px 6px rgba(0,0,0,.18);
  font: 13px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--text-primary);
}
.auswahl-box fieldset { border: 0; margin: 0; padding: 0; }
.auswahl-box legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
.auswahl-box label { display: flex; align-items: center; gap: 7px; cursor: pointer; padding: 2px 0; }
.auswahl-box input { margin: 0; }
.auswahl-box .hinweis, .auswahl-box .quelle { margin: 8px 0 0; font-size: 11px; color: var(--text-secondary); }
.auswahl-box .quelle { margin-top: 4px; }
.zeichen { flex: none; display: inline-block; width: 16px; height: 12px; border-radius: 3px; }
.zeichen-bezirke { border: 2px solid var(--text-secondary); background: rgba(82, 81, 78, .18); }
.zeichen-ueberschneidungen { border: 1.5px dashed #0b0b0b;
  background: repeating-linear-gradient(45deg, rgba(11,11,11,.55) 0 1.5px, transparent 1.5px 5px); }
.zeichen-ausserhalb { border: 2px dotted #e87ba4;
  background: repeating-linear-gradient(135deg, #e87ba4 0 1.5px, transparent 1.5px 5px); }
.zeichen-radien10 { height: 0; border-top: 2px dotted var(--text-secondary); border-radius: 0; }
.zeichen-radien { height: 0; border-top: 2px dashed var(--text-secondary); border-radius: 0; }
.zeichen-standorte { width: 12px; height: 12px; margin: 0 2px; border-radius: 50%;
  background: var(--text-secondary); box-shadow: 0 0 0 2px #fcfcfb inset; border: 1px solid var(--text-secondary); }

#liste a {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; padding: 6px 8px; border: 0; border-radius: 6px;
  background: none; font: inherit; color: inherit; text-align: left; cursor: pointer;
}
#liste a:hover { background: var(--surface-2); }
#liste a[aria-current="page"] { background: var(--surface-2); font-weight: 600; }
#liste .uebersicht { margin-bottom: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--linie);
                     border-radius: 6px 6px 0 0; }
#liste .gruppe {
  margin: 14px 8px 4px; padding-top: 10px; border-top: 1px solid var(--linie);
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary);
}
.paragraf { flex: none; width: 14px; text-align: center; font-weight: 700; color: var(--text-secondary); }
.karte-zeichen {
  flex: none; width: 14px; height: 14px; border-radius: 3px;
  border: 2px solid var(--text-secondary);
  background: linear-gradient(135deg, transparent 45%, var(--text-secondary) 45% 55%, transparent 55%);
}
#liste .nr { color: var(--text-muted); font-variant-numeric: tabular-nums; margin-left: auto; }
.farbe {
  display: inline-block; vertical-align: -1px;
  flex: none; width: 14px; height: 14px; border-radius: 4px;
  border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 35%, transparent);
}

#angaben table { border-collapse: collapse; width: 100%; margin-top: 8px; }
#angaben th, #angaben td { padding: 3px 0; vertical-align: top; text-align: left; }
#angaben th { width: 42%; font-weight: normal; color: var(--text-secondary); padding-right: 8px; }
#angaben td { font-variant-numeric: tabular-nums; }
a { color: #1d5fae; }

.vorbehalt {
  margin: 10px 0 0; padding: 8px 10px; border-radius: 6px;
  background: var(--warnung-grund); color: var(--warnung);
}
.vorbehalt::before { content: "⚠ "; }


/* Grundkarte grau, damit die Bezirksfarben nicht mit Wald und Wiesen konkurrieren */
.leaflet-tile-pane { filter: grayscale(1) brightness(1.04) contrast(.92); }

/* Direktbeschriftung der Standorte */
.leaflet-tooltip.beschriftung {
  background: rgba(252, 252, 251, .9); border: 0; box-shadow: none;
  padding: 1px 5px; font-weight: 600; color: var(--text-primary);
}
.leaflet-tooltip.beschriftung::before { display: none; }
.leaflet-popup-content { font: 13px/1.45 system-ui, sans-serif; margin: 10px 14px; }
.leaflet-popup-content ul { margin: 4px 0; padding-left: 18px; }

@media (max-width: 600px) {
  #app, body.unterseite { flex-direction: column; height: auto; }
  #app { height: 100vh; }
  .unterseite .spalte { overflow: visible; }
  #seite { width: 100%; height: auto; border-left: 0; border-top: 1px solid var(--linie); }
  .auswahl-box { width: auto; max-width: 220px; }
}

/* ------------------------------------------------------------ Unterseite */

body.unterseite { background: var(--surface-1); display: flex; height: 100vh; }
.unterseite .spalte { flex: 1; min-width: 0; overflow-y: auto; }
.unterseite main, .unterseite .fuss { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.unterseite .spalte h1 { font-size: 26px; margin: 22px 0 2px; }
.unterseite .spalte h1 .farbe { width: 20px; height: 20px; border-width: 3px; vertical-align: 0; }
.unterseite .spalte h2 { font-size: 18px; margin: 32px 0 8px; }
.unterseite .spalte .unter { font-size: 15px; }

.raster { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 28px; margin-top: 8px; }
#minikarte {
  position: sticky; top: 16px; height: min(640px, calc(100vh - 32px));
  border: 1px solid var(--linie); border-radius: 8px;
}
#angaben section + section { margin-top: 6px; }
.erlaeuterung { color: var(--text-secondary); font-size: 13px; margin: 8px 0 0; }
.auswahl { list-style: none; padding: 0; line-height: 2; }

table.liste { border-collapse: collapse; width: 100%; }
table.liste th, table.liste td { text-align: left; padding: 5px 12px 5px 0; border-bottom: 1px solid var(--linie); vertical-align: top; }
table.liste th { color: var(--text-secondary); font-weight: 600; font-size: 13px; }
table.liste td:first-child { width: 34%; }

.legende {
  background: rgba(252, 252, 251, .92); padding: 6px 10px; border-radius: 6px;
  font-size: 12px; line-height: 1.8; color: var(--text-primary);
}
.legende span { display: inline-block; vertical-align: -2px; margin-right: 4px; }
.legende .strich { width: 16px; height: 0; border-top: 2px dashed var(--c); vertical-align: 3px; }
.legende .punktiert {
  width: 14px; height: 14px; border: 2px dotted var(--c); border-radius: 3px;
  background: repeating-linear-gradient(135deg, var(--c) 0 1.5px, transparent 1.5px 5px);
}
.legende .kreis10 { width: 16px; height: 0; border-top: 2px dotted #52514e; vertical-align: 3px; }
.legende .ueber10 { width: 14px; height: 12px; border: 1.5px solid #0b0b0b; border-radius: 2px;
                    background: rgba(11, 11, 11, .55); }
.legende .schnitt { width: 16px; height: 0; border-top: 2px dotted #0b0b0b; vertical-align: 3px; }
.legende .schraffur {
  width: 14px; height: 14px; border: 1.5px dashed #0b0b0b; border-radius: 3px;
  background: repeating-linear-gradient(45deg, rgba(11,11,11,.55) 0 1.5px, transparent 1.5px 5px);
}

.unterseite .fuss {
  margin-top: 40px; padding-top: 12px; padding-bottom: 24px; border-top: 1px solid var(--linie);
  font-size: 12px; color: var(--text-secondary);
}

@media (max-width: 860px) {
  .raster { grid-template-columns: 1fr; }
  #minikarte { position: static; height: 360px; order: -1; }
}

@media print {
  #seite, #minikarte { display: none; }
  .raster { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------ Höhenprofil */

.profil { margin-top: 8px; }
.profil-kopf { margin: 4px 0 6px; }
.profil-flaeche { position: relative; }
.profil-flaeche svg { display: block; overflow: visible; }
.profil .raster { stroke: var(--linie); stroke-width: 1; }
.profil .achse { font-size: 11px; fill: var(--text-muted); font-variant-numeric: tabular-nums; }
.profil .gelaende { fill: #e4e1da; }
.profil .gelaende-linie { fill: none; stroke: var(--text-secondary); stroke-width: 2; stroke-linejoin: round; }
.profil .bezug { stroke: var(--text-primary); stroke-width: 1.5; stroke-dasharray: 5 3; }
.profil .bezug-text { font-size: 11px; font-weight: 600; fill: var(--text-primary);
                      paint-order: stroke; stroke: var(--surface-1); stroke-width: 3px; }
.profil .lot { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 2 3; }
.profil .standort-text { font-size: 12px; font-weight: 600; fill: var(--text-primary);
                         paint-order: stroke; stroke: var(--surface-1); stroke-width: 3px; }
.profil .gipfel { fill: var(--text-primary); }
.profil .gipfel-text { font-size: 11px; fill: var(--text-secondary);
                      paint-order: stroke; stroke: var(--surface-1); stroke-width: 3px; }
.profil .band-name { font-size: 11px; fill: var(--text-secondary); }
.profil .fokus-linie { stroke: var(--text-primary); stroke-width: 1; }
.profil .fokus-punkt { fill: var(--surface-1); stroke: var(--text-primary); stroke-width: 2; }
.profil .treffer { fill: transparent; cursor: crosshair; }
.profil-tooltip {
  position: absolute; pointer-events: none; z-index: 2; white-space: nowrap;
  background: var(--surface-1); border: 1px solid var(--linie); border-radius: 6px;
  padding: 6px 9px; font-size: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.profil-quelle { font-size: 12px; color: var(--text-muted); margin: 4px 0 0; }
.profil-tabelle { margin-top: 6px; font-size: 13px; }
.profil-tabelle summary { cursor: pointer; color: var(--text-secondary); }
.profil-tabelle table { border-collapse: collapse; margin-top: 6px; }
.profil-tabelle th, .profil-tabelle td { text-align: left; padding: 2px 16px 2px 0; font-weight: normal; }
.profil-tabelle th { color: var(--text-secondary); }

/* ------------------------------------------------------------ Rechtstexte */

.unterseite main.rechtstext { max-width: 800px; }
.rechtstext .titel-block { margin: 28px 0 24px; }
.rechtstext .titel-block h1 { margin: 0 0 6px; font-size: 24px; line-height: 1.25; }
.rechtstext .meta { color: var(--text-secondary); margin: 2px 0; }
.rechtstext h2 { font-size: 17px; margin: 30px 0 8px; scroll-margin-top: 16px; }
.rechtstext h2 .ueber { display: block; font-weight: normal; color: var(--text-secondary); font-size: 15px; }
.rechtstext p, .rechtstext li { line-height: 1.6; }
.rechtstext p { margin: 8px 0; }
.rechtstext ol.nummern { padding-left: 24px; }
.rechtstext .eingang, .rechtstext .schluss { color: var(--text-secondary); }
.rechtstext .redaktion {
  margin: 16px 0; padding: 10px 12px; border-radius: 6px; font-size: 13px;
  background: var(--surface-2); color: var(--text-secondary);
}
.rechtstext .inhalt { columns: 2; padding-left: 18px; margin: 8px 0 0; }
.rechtstext .anlage h3 { font-size: 15px; margin: 22px 0 4px; text-transform: none; letter-spacing: 0; color: var(--text-primary); }
.rechtstext .anlage table { border-collapse: collapse; width: 100%; font-size: 14px; }
.rechtstext .anlage th, .rechtstext .anlage td {
  text-align: left; padding: 4px 12px 4px 0; border-bottom: 1px solid var(--linie); vertical-align: top;
}
.rechtstext .anlage th { color: var(--text-secondary); font-weight: 600; font-size: 13px; }
.rechtstext .anlage td:first-child { width: 36%; }
.rechtstext .teilflaeche { display: block; color: var(--warnung); font-size: 13px; }

/* ------------------------------------------------------------ Probleme */
/* Statusfarben (dataviz-Referenz) nur zusammen mit Zeichen und Text */

.probleme { margin: 8px 0 18px; }
.probleme ul { max-width: 1000px; }
.probleme ul { list-style: none; padding: 0; margin: 10px 0 0; }
.problem {
  display: grid; grid-template-columns: 92px 1fr; gap: 10px; align-items: start;
  padding: 10px 12px; margin-bottom: 6px; border-radius: 6px;
  background: var(--surface-2); border-left: 4px solid var(--s);
}
.problem .stufe {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  color: var(--text-primary); white-space: nowrap;
}
.problem .stufe span {
  display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  background: var(--s); color: #fff; font-size: 10px; font-style: normal;
}
.stufe-hoch    { --s: #d03b3b; }
.stufe-mittel  { --s: #fab219; }
.stufe-mittel .stufe span { color: #0b0b0b; }
.stufe-hinweis { --s: #9a9890; }
.stufe-gut     { --s: #0ca30c; }

/* Nächster Punkt außerhalb des Schutzbezirks: Raute, schwarz umrandet */
.naechster-punkt span, .naechster-punkt-legende {
  display: block; width: 12px; height: 12px; margin: 2px;
  background: #fcfcfb; border: 2.5px solid #0b0b0b; transform: rotate(45deg);
  box-sizing: border-box;
}
.naechster-punkt-legende { display: inline-block; width: 10px; height: 10px; margin: 0 3px 0 2px; }
.naechster-punkt.nachbar span { border-color: var(--c); }
.gipfel-marke { color: #0b0b0b; font-size: 13px; line-height: 14px; text-align: center;
                text-shadow: 0 0 2px #fcfcfb, 0 0 2px #fcfcfb; }

/* ------------------------------------------------------------ Rasse und Zuchtrichtlinie */
.zucht { margin: 8px 0 22px; max-width: 1000px; }
.zucht-raster { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.zucht h3 { margin-top: 12px; }
.zucht p { margin: 4px 0 8px; line-height: 1.5; }
.zucht table:not(.liste) { border-collapse: collapse; width: 100%; }
.zucht table:not(.liste) th { width: 42%; text-align: left; font-weight: normal; color: var(--text-secondary);
                              padding: 3px 8px 3px 0; vertical-align: top; }
.zucht table:not(.liste) td { padding: 3px 0; vertical-align: top; }
.zucht td.abweichung { font-weight: 600; }
.zucht td.abweichung::before { content: "≠ "; color: var(--text-secondary); }
@media (max-width: 860px) { .zucht-raster { grid-template-columns: 1fr; } }
