/* Suchagent - ein Stylesheet, mobil zuerst: Grundregeln fuers Handy, ab
   48rem (Tablet/Laptop) per Media Query breiter. Kein Build, kein Framework. */

:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --flaeche: #ffffff;
  --text: #1c2026;
  --gedimmt: #626b77;
  --rand: #dfe2e7;
  --akzent: #1f5fbf;
  --akzent-text: #ffffff;
  --gefahr: #b42318;
  --gruen: #1e7a3a;
  --gelb: #a86b00;
  --rot: #c62828;
  --grau: #8a929c;
  --radius: 0.75rem;
  --schatten: 0 1px 2px rgb(0 0 0 / 0.06), 0 1px 3px rgb(0 0 0 / 0.08);
  --tippziel: 2.75rem;
  --tabbar: 3.75rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --flaeche: #1b1f25;
    --text: #e8eaed;
    --gedimmt: #9aa3ad;
    --rand: #2e343c;
    --akzent: #6ea0ff;
    --akzent-text: #0d1117;
    --gefahr: #ff7b72;
    --gruen: #4cc472;
    --gelb: #e0a63a;
    --rot: #ff6b6b;
    --schatten: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Platz fuer die Tab-Leiste unten auf dem Handy. */
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 1rem);
}

/* Links: intern in Textfarbe, ohne Unterstreichung - die Akzentfarbe gehoert
   Knoepfen und externen Links (target="_blank", mit ↗). */
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.15em; }
a[target="_blank"]:not(.knopf) { color: var(--akzent); }
a.knopf:hover, .hauptnav a:hover, a.kartenlink:hover, .zurueck a:hover, a.marke-tief:hover { text-decoration: none; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
p { margin: 0; }
img { max-width: 100%; }

main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.gedimmt { color: var(--gedimmt); }
.klein { font-size: 0.875rem; }

/* --- Kopf und Navigation ------------------------------------------------ */

.kopf {
  position: sticky;
  top: 0;
  z-index: 10;
  /* Kein backdrop-filter: der machte den Kopf zum Bezugsrahmen der festen
     Tab-Leiste, die dann oben statt unten klebte. */
  background: var(--flaeche);
  border-bottom: 1px solid var(--rand);
}

.kopf-innen {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 3.25rem;
}

.marke {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}

/* Auf dem Handy: feste Tab-Leiste unten, mit dem Daumen erreichbar. */
.hauptnav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--flaeche);
  border-top: 1px solid var(--rand);
  padding-bottom: env(safe-area-inset-bottom);
}

.hauptnav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  height: var(--tabbar);
  color: var(--gedimmt);
  text-decoration: none;
  font-size: 0.75rem;
}

.hauptnav a svg { width: 1.4rem; height: 1.4rem; }
/* Kurze Namen in der Tab-Leiste; der volle Name nur am Laptop (.nur-breit). */
.nur-breit { display: none; }
.hauptnav a[aria-current="page"] { color: var(--akzent); font-weight: 600; }

/* --- Bausteine ------------------------------------------------------------ */

.karte {
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 1rem;
}

/* Ganze Karte als Klickflaeche: Der Link im Titel (.kartenlink) spannt per
   ::after ueber die Karte, Bedienelemente liegen darueber und bleiben einzeln
   bedienbar. */
.klickbar { position: relative; transition: border-color 0.15s, box-shadow 0.15s; }
@media (hover: hover) {
  .klickbar:hover { border-color: color-mix(in srgb, var(--akzent) 45%, var(--rand)); }
}
.klickbar:has(.kartenlink:focus-visible) { outline: 2px solid var(--akzent); outline-offset: 2px; }
.kartenlink { color: inherit; outline: none; }
.kartenlink::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.klickbar :is(button, form, details, summary, .knopf, .marke-tief, a[target="_blank"], .griff, input, select, textarea) {
  position: relative;
  z-index: 1;
}

.kartenfuss { display: flex; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.kartenfuss .pfeil { color: var(--akzent); font-weight: 600; }

.seitenkopf {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  flex-wrap: wrap;
}

.knopf, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: var(--tippziel);
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--rand);
  border-radius: 0.6rem;
  background: var(--flaeche);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.knopf:hover, button:hover { border-color: var(--gedimmt); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.knopf.primaer, button.primaer {
  background: var(--akzent);
  border-color: var(--akzent);
  color: var(--akzent-text);
}

.knopf.aktiv { color: #b8860b; border-color: currentColor; }

.link:hover { color: var(--text); text-decoration: underline; }
.link {
  background: none;
  border: none;
  color: var(--gedimmt);
  padding: 0;
  min-height: auto;
  font-weight: normal;
}

form.inline { display: inline; margin: 0; }

input, select {
  font: inherit;
  font-size: 1rem; /* < 16px zoomt iOS beim Antippen hinein */
  min-height: var(--tippziel);
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--rand);
  border-radius: 0.5rem;
  background: var(--flaeche);
  color: var(--text);
  width: 100%;
}

label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--gedimmt); }
label > input, label > select { color: var(--text); }

.formular { display: flex; flex-direction: column; gap: 0.75rem; max-width: 28rem; }

details > summary { cursor: pointer; }

.hinweis {
  background: color-mix(in srgb, var(--akzent) 10%, var(--flaeche));
  border: 1px solid color-mix(in srgb, var(--akzent) 30%, transparent);
  padding: 0.6rem 0.9rem;
  border-radius: 0.6rem;
}

.fehler { color: var(--gefahr); }

.filterleiste {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem 0.75rem;
}

/* Mehrfachauswahl als antippbare Pillen (Zustand, Beurteilung). */
.wahlgruppe {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.wahlgruppe legend { font-size: 0.85rem; color: var(--gedimmt); padding: 0; margin-bottom: 0.25rem; }
.wahl { position: relative; display: inline-flex; flex-direction: row; font-size: 0.9rem; color: var(--text); }
.wahl input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.wahl span {
  display: inline-flex;
  align-items: center;
  min-height: var(--tippziel);
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--rand);
  border-radius: 999px;
  background: var(--flaeche);
  cursor: pointer;
  white-space: nowrap;
}
.wahl input:checked + span {
  background: color-mix(in srgb, var(--akzent) 14%, var(--flaeche));
  border-color: var(--akzent);
  color: var(--akzent);
  font-weight: 600;
}
.wahl input:focus-visible + span { outline: 2px solid var(--akzent); outline-offset: 2px; }

/* --- Ampel ---------------------------------------------------------------- */

.ampel {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  --farbe: var(--grau);
  color: var(--farbe);
  background: color-mix(in srgb, var(--farbe) 14%, transparent);
}

.ampel::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--farbe);
}

.ampel.grün { --farbe: var(--gruen); }
.ampel.gelb { --farbe: var(--gelb); }
.ampel.rot { --farbe: var(--rot); }
.ampel.unbeurteilt { font-weight: 600; }

/* --- Dashboard ------------------------------------------------------------ */

.karten { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }

.profilkarte { display: flex; flex-direction: column; gap: 0.75rem; }
.kennzahl { font-size: 2.25rem; font-weight: 700; line-height: 1; }
.kennzahl small { font-size: 0.95rem; font-weight: 500; color: var(--gedimmt); }

.verteilung {
  display: flex;
  height: 0.6rem;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--grau) 25%, transparent);
}

.verteilung span { display: block; }
.verteilung .grün { background: var(--gruen); }
.verteilung .gelb { background: var(--gelb); }
.verteilung .unbeurteilt { background: var(--grau); opacity: 0.5; }
.ampeln { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* --- Kandidaten ----------------------------------------------------------- */

.kandidatenliste { display: grid; gap: 0.75rem; align-items: start; }

.kandidat { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.85rem; }

.kandidat-kopf { display: flex; gap: 0.75rem; }

.vorschau { flex: none; }
.vorschau img {
  display: block;
  width: 6.5rem;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 0.5rem;
  background: var(--rand);
}

.kandidat-titel { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.kandidat-titel h2 { font-size: 1rem; }

.preis { font-size: 1.15rem; font-weight: 700; }
.eckdaten { color: var(--gedimmt); font-size: 0.85rem; }

.noten { display: flex; gap: 0.4rem; flex-wrap: wrap; font-size: 0.8rem; }
.noten span {
  padding: 0.1rem 0.5rem;
  border-radius: 0.4rem;
  background: color-mix(in srgb, var(--gedimmt) 12%, transparent);
}
.noten b { font-weight: 700; }

.vermerk {
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--gedimmt) 10%, transparent);
}

.begruendungen summary { font-size: 0.85rem; color: var(--gedimmt); }
.begruendungen summary:hover { color: var(--text); }
.begruendungen[open] summary { margin-bottom: 0.4rem; }
.begruendung { color: var(--gedimmt); font-size: 0.875rem; margin-top: 0.3rem; }
.begruendung b { color: var(--text); font-weight: 600; }

.aktionen { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.aktionen > form { flex: 1 1 0; min-width: 0; }
.aktionen > form button { width: 100%; white-space: normal; line-height: 1.2; padding-inline: 0.5rem; }
.symbol { flex: none; width: var(--tippziel); padding: 0; }

.fusszeile { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; align-items: baseline; font-size: 0.85rem; }
.fusszeile .extern { margin-left: auto; }
.fusszeile details[open] { flex-basis: 100%; order: 2; }

.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.korrigieren { flex-basis: auto; }
.korrigieren > summary { list-style: none; }
.korrigieren > summary::-webkit-details-marker { display: none; }
.korrigieren[open] { flex-basis: 100%; }
.korrigieren .formular { margin-top: 0.6rem; }

/* Zurueck-Leiste ueber Detailseiten: ruhig, in Textfarbe, gross genug zum Tippen. */
.zurueck { font-size: 0.9rem; margin: -0.25rem 0 -0.5rem; }
.zurueck a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tippziel);
  padding: 0 0.75rem 0 0.25rem;
  margin-left: -0.25rem;
  border-radius: 0.5rem;
  color: var(--gedimmt);
  font-weight: 500;
}
.zurueck a:hover { color: var(--text); background: color-mix(in srgb, var(--gedimmt) 10%, transparent); }
/* Kandidaten blaettern: auf dem Handy eine schwebende Pille ueber der
   Tab-Leiste, die beim Scrollen abtaucht (app.js, .versteckt); am Laptop
   rechts neben "Alle Kandidaten" (siehe Media Query unten). */
.detail-kopf { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.blaetterleiste {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 0.6rem);
  transform: translateX(-50%);
  z-index: 9;
  display: flex;
  align-items: center;
  padding: 0.15rem;
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.15);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.blaetterleiste.versteckt { opacity: 0; transform: translate(-50%, 1rem); pointer-events: none; }
.blaetterleiste .knopf {
  border: none;
  background: none;
  min-height: 2.5rem;
  min-width: 2.75rem;
  padding: 0 0.9rem;
  font-size: 1.2rem;
  color: var(--akzent);
}
.blaetterleiste [aria-disabled="true"] { opacity: 0.35; cursor: default; color: var(--gedimmt); }
.blaetter-position {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0 0.3rem;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.blaetter-position:hover { text-decoration: none; }
@media (prefers-reduced-motion: reduce) {
  .blaetterleiste { transition: none; }
}
/* Platz, damit die feste Leiste nichts vom Seitenende verdeckt. */
body:has(.blaetterleiste) { padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 4rem); }

/* Schiebe-Animation beim Blaettern (app.js): raus zur einen, rein von der anderen Seite. */
@keyframes rein-von-rechts { from { transform: translateX(2.5rem); opacity: 0; } }
@keyframes rein-von-links { from { transform: translateX(-2.5rem); opacity: 0; } }
.detail.rein-weiter { animation: rein-von-rechts 0.2s ease-out; }
.detail.rein-zurueck { animation: rein-von-links 0.2s ease-out; }
.detail.raus-weiter, .detail.raus-zurueck { transition: transform 0.15s ease-in, opacity 0.15s ease-in; opacity: 0; }
.detail.raus-weiter { transform: translateX(-2.5rem); }
.detail.raus-zurueck { transform: translateX(2.5rem); }
@media (prefers-reduced-motion: reduce) {
  .detail.rein-weiter, .detail.rein-zurueck { animation: none; }
  .detail.raus-weiter, .detail.raus-zurueck { transition: none; }
}

a.weiter { color: var(--gedimmt); font-weight: 500; }
a.weiter:hover { color: var(--text); }

/* Detailseite: grosse Bildleiste, wischbar. */
.galerie-rahmen { position: relative; }
.galerie-zaehler {
  position: absolute;
  left: 0.5rem;
  bottom: 0.5rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: rgb(0 0 0 / 0.6);
  color: #fff;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.galerie {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  /* Ohne scroll-padding rastet das erste Bild an der Kante ein, statt den
     Innenabstand der Karte zu halten. */
  scroll-padding-inline: 0.85rem;
  margin: 0 -0.85rem;
  padding: 0 0.85rem;
}
/* Auf dem Touchscreen wischt man - der Balken waere nur Rauschen. */
@media (pointer: coarse) {
  .galerie { scrollbar-width: none; }
  .galerie::-webkit-scrollbar { display: none; }
}
/* Rechter Innenabstand: padding-right traegt in einer scrollenden Flexbox nicht. */
.galerie::after { content: ""; flex: 0 0 0.35rem; }
.galerie a {
  flex: none;
  width: 85%;
  max-width: 28rem;
  scroll-snap-align: start;
  cursor: zoom-in;
}
.galerie img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 0.5rem;
  background: var(--rand);
}

/* Vollbild (app.js): dunkle Buehne, Bild per Wischen wechseln, per Zwei-Finger-
   Geste oder Doppeltipp zoomen. Die Gesten macht das Skript, daher touch-action. */
.vollbild {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #000;
  color: #fff;
  overflow: hidden;
}
.vollbild::backdrop { background: #000; }
.vollbild-buehne {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.vollbild-buehne img {
  max-width: 100%;
  max-height: 100%;
  transform-origin: center;
  -webkit-user-drag: none;
  cursor: zoom-in;
}
.vollbild-buehne.gezoomt img { cursor: grab; }
.vollbild-leiste {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 0.5rem) 0.75rem 0.5rem;
  background: linear-gradient(rgb(0 0 0 / 0.55), transparent);
  pointer-events: none;
}
.vollbild-leiste > * { pointer-events: auto; }
.vollbild-zaehler { font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.vollbild button {
  min-width: var(--tippziel);
  min-height: var(--tippziel);
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.15);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
}
.vollbild button:hover { background: rgb(255 255 255 / 0.28); }
.vollbild-blaettern {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: none;
}
.vollbild-blaettern[data-schritt="-1"] { left: 1rem; }
.vollbild-blaettern[data-schritt="1"] { right: 1rem; }
/* Pfeile nur mit Maus; auf dem Handy wischt man. */
@media (hover: hover) and (pointer: fine) {
  .vollbild-blaettern { display: block; }
}
html.vollbild-offen { overflow: hidden; }

.detail .kandidat-titel h2 { font-size: 1.35rem; }

/* --- Favoriten ------------------------------------------------------------ */

.favoritenliste { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }

.favorit { display: grid; grid-template-columns: auto 1fr; gap: 0.75rem; padding: 0.75rem; align-items: start; }
.favorit.drag-over { border-color: var(--akzent); }
.favorit-bild { width: 5.5rem; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 0.5rem; background: var(--rand); }
.favorit-ohne-bild {
  width: 5.5rem;
  aspect-ratio: 4 / 3;
  border-radius: 0.5rem;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gedimmt);
  background: color-mix(in srgb, var(--gedimmt) 12%, transparent);
}
.favorit-inhalt { min-width: 0; display: flex; flex-direction: column; gap: 0.25rem; }

.favorit-zeile { display: flex; gap: 0.4rem 0.6rem; flex-wrap: wrap; align-items: center; font-size: 0.85rem; color: var(--gedimmt); }
.herkunft { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.notiz { font-size: 0.875rem; }
.favorit-aktionen { grid-column: 1 / -1; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.favorit-aktionen .reihenfolge { display: flex; gap: 0.25rem; margin-right: auto; }
.favorit-aktionen .reihenfolge button { width: var(--tippziel); padding: 0; }
.favorit .griff { display: none; cursor: grab; user-select: none; color: var(--gedimmt); }
.favorit .bearbeiten-formular { grid-column: 1 / -1; max-width: none; }

/* --- Laeufe --------------------------------------------------------------- */

.laufzahlen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; text-align: center; }
.laufzahlen div { padding: 0.4rem; border-radius: 0.5rem; background: color-mix(in srgb, var(--gedimmt) 8%, transparent); }
.laufzahlen b { display: block; font-size: 1.15rem; }
.laufzahlen span { font-size: 0.75rem; color: var(--gedimmt); }

table.laeufe { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.laeufe th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--gedimmt); }
table.laeufe th, table.laeufe td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--rand); }
table.laeufe tr:last-child td { border-bottom: none; }

/* Auf dem Handy wird jede Tabellenzeile zu einem kurzen Absatz:
   Zeitpunkt fett, dahinter "Bezeichnung Wert" fortlaufend. */
@media (max-width: 47.99rem) {
  table.stapelbar thead { display: none; }
  table.stapelbar, table.stapelbar tbody { display: block; }
  table.stapelbar tr { display: flex; flex-wrap: wrap; gap: 0.1rem 0.75rem; padding: 0.55rem 0; border-bottom: 1px solid var(--rand); }
  table.stapelbar tr:last-child { border-bottom: none; }
  table.stapelbar td { display: inline; padding: 0; border: none; font-size: 0.85rem; }
  table.stapelbar td::before { content: attr(data-label) " "; color: var(--gedimmt); }
  table.stapelbar td:first-child { flex-basis: 100%; font-weight: 600; font-size: 0.9rem; }
  table.stapelbar td:first-child::before { content: none; }
}


/* --- Login ---------------------------------------------------------------- */

.login { max-width: 24rem; width: 100%; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 1rem; }
.login .formular { max-width: none; }

/* --- Breitere Bildschirme ------------------------------------------------- */

@media (min-width: 48rem) {
  body { padding-bottom: 2rem; }
  body:has(.blaetterleiste) { padding-bottom: 2rem; }
  .blaetterleiste,
  .blaetterleiste.versteckt {
    position: static; transform: none; opacity: 1; pointer-events: auto;
    gap: 0.5rem; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none;
  }
  .blaetterleiste .knopf {
    border: 1px solid var(--rand); background: var(--flaeche); color: var(--text);
    font-size: 0.9rem; padding: 0.4rem 0.9rem; min-width: 0;
  }
  .blaetter-position { color: var(--gedimmt); font-weight: 500; padding: 0 0.6rem; }
  main { padding: 1.5rem; gap: 1.25rem; }
  h1 { font-size: 1.75rem; }

  .hauptnav {
    position: static;
    display: flex;
    gap: 0.25rem;
    background: none;
    border: none;
    padding: 0;
  }
  .hauptnav a {
    flex-direction: row;
    height: auto;
    padding: 0.45rem 0.8rem;
    border-radius: 0.5rem;
    font-size: 0.95rem;
  }
  .hauptnav a svg { width: 1.1rem; height: 1.1rem; }
  .hauptnav a[aria-current="page"] { background: color-mix(in srgb, var(--akzent) 12%, transparent); }

  .filterleiste { display: flex; flex-wrap: wrap; gap: 0.75rem; }
  .filterleiste > label { min-width: 11rem; }
  .wahlgruppe { flex: 1 1 100%; }

  .kandidatenliste { grid-template-columns: repeat(2, 1fr); }
  .vorschau img { width: 9rem; }

  .detail { max-width: 52rem; }
  .galerie { margin: 0; padding: 0; scroll-padding-inline: 0; }
  .galerie::after { display: none; }
  .galerie a { width: 24rem; }

  .favorit { grid-template-columns: auto auto 1fr auto; }
  .favorit .griff { display: block; padding-top: 1.5rem; }
  .favorit-aktionen { grid-column: auto; flex-direction: column; align-items: stretch; }
  .favorit-aktionen .reihenfolge { display: none; }
  .favorit-bild, .favorit-ohne-bild { width: 7rem; }
}

@media (min-width: 75rem) {
  .kandidatenliste { grid-template-columns: repeat(3, 1fr); }
}

/* --- Kleinkram ------------------------------------------------------------ */

.detail { display: flex; flex-direction: column; gap: 0.75rem; width: 100%; }
.breit { width: 100%; }
.abstand-oben { margin-top: 0.75rem; }
.ausloeser { font-size: 0.8rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: color-mix(in srgb, var(--gedimmt) 14%, transparent); }

/* --- Detailseite: Fahrzeugdaten und Preisverlauf --------------------------- */

.fahrzeugdaten h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gedimmt); margin-bottom: 0.4rem; }
.datenliste { display: grid; grid-template-columns: 1fr; margin: 0; }
.datenliste > div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.35rem 0; border-bottom: 1px solid var(--rand); font-size: 0.9rem; }
.datenliste dt { color: var(--gedimmt); }
.datenliste dd { margin: 0; text-align: right; font-weight: 500; }
.preisverlauf { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; display: flex; flex-direction: column; gap: 0.2rem; }
.preisverlauf .gesenkt { color: var(--gruen); font-weight: 600; }
.preisverlauf .erhoeht { color: var(--rot); font-weight: 600; }

@media (min-width: 48rem) {
  .datenliste { grid-template-columns: 1fr 1fr; column-gap: 2rem; }
}

/* --- Tiefe Analyse ----------------------------------------------------- */

.tiefe-kopf, .tiefe-abschnitt, .empfang { display: flex; flex-direction: column; gap: 0.6rem; }
.tiefe-kopf h1 { font-size: 1.35rem; }
.tiefe-kopf .links { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.9rem; }
.tiefe-eckwerte { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.fazit { font-weight: 600; }
.marke-tief {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--akzent);
  background: color-mix(in srgb, var(--akzent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--akzent) 35%, transparent);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  white-space: nowrap;
}
/* Unsichtbar groessere Tippflaeche fuer den kleinen Chip. */
a.marke-tief::before { content: ""; position: absolute; inset: -0.5rem -0.25rem; }
a.marke-tief:hover { background: color-mix(in srgb, var(--akzent) 18%, transparent); }

.bericht { display: flex; flex-direction: column; gap: 0.75rem; overflow-wrap: anywhere; }
.bericht h2 { font-size: 1.2rem; margin-top: 0.75rem; }
.bericht h3, .bericht h4, .bericht h5 { font-size: 1.05rem; margin: 0.5rem 0 0; }
.bericht ul, .bericht ol { margin: 0; padding-left: 1.25rem; display: flex; flex-direction: column; gap: 0.25rem; }
.bericht pre {
  margin: 0;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--rand);
  border-radius: 0.5rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.45;
  user-select: all;
}
.bericht code { font-size: 0.9em; }
.bericht hr { border: none; border-top: 1px solid var(--rand); margin: 0.25rem 0; width: 100%; }
.bericht .tabelle { overflow-x: auto; }
/* Kein Umbruch mitten im Wort: "Punk-t" in einer schmalen Spalte. */
.bericht table { border-collapse: collapse; font-size: 0.875rem; overflow-wrap: normal; }
.bericht th, .bericht td { border: 1px solid var(--rand); padding: 0.35rem 0.5rem; text-align: left; vertical-align: top; }

.tiefe-liste { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.tiefe-liste li { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.75rem; }
.einrichtung { display: flex; flex-direction: column; gap: 0.6rem; }
.einrichtung[open] > summary { margin-bottom: 0.6rem; }
.einrichtung h2 { font-size: 1rem; margin-top: 0.5rem; }
.einrichtung ol { margin: 0; padding-left: 1.25rem; }
textarea.code {
  width: 100%;
  font: 0.75rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--rand);
  border-radius: 0.5rem;
  padding: 0.5rem;
}

/* Einblendbare Abschnitte: nur sichtbar als Sprungziel (#id in der URL). */
.einblendbar:not(:target) { display: none; }
.einblendbar { scroll-margin-top: 4.5rem; }

/* Filter der Kandidatenliste: auf dem Handy einklappbar, am Laptop offen. */
.filterbox > summary { font-size: 0.9rem; font-weight: 500; padding: 0.5rem 0; }
.filterbox[open] > summary { margin-bottom: 0.25rem; }
@media (min-width: 48rem) {
  .filterbox > summary { display: none; }
}

@media (min-width: 48rem) {
  .nur-breit { display: inline; }
  .hauptnav a span { white-space: nowrap; }
}

/* --- Suchprofile anlegen und bearbeiten ---------------------------------- */

.suchprofilformular { max-width: 40rem; }
.suchprofilformular textarea {
  font: 1rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--rand);
  border-radius: 0.5rem;
  background: var(--flaeche);
  color: var(--text);
  width: 100%;
  resize: vertical;
  word-break: break-all;
}
.suchprofilformular code { font-size: 0.8rem; }
.suchprofil-schalter { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.suchprofil-schalter h2 { font-size: 1rem; margin: 0; }
button.gefahr { color: var(--gefahr); }
.profilkarte .seitenkopf h2 { margin: 0; }
.profilkarte.pausiert { opacity: 0.7; }
.geloeschte { margin-top: 1rem; }
.geloeschte-liste { list-style: none; padding: 0; margin: 0.5rem 0 0; display: flex; flex-direction: column; gap: 0.5rem; }
.geloeschte-liste li { display: flex; align-items: center; gap: 0.5rem 1rem; flex-wrap: wrap; }
.geloeschte-liste li > span { flex: 1 1 12rem; }
