:root {
  --gruen: #1f5f4a; --gruen-hell: #e6f0ec; --text: #1d2420; --grau: #5d6862; --rand: #d9dfdb;
  --hg: #f5f7f6; --karte: #ffffff; --rot: #b3261e; --rot-hell: #fbe9e7; --gelb: #fff4d6; --blau: #1d5fa8;
}
@media (prefers-color-scheme: dark) {
  :root { --text: #e8ece9; --grau: #a7b1ab; --rand: #34403a; --hg: #141917; --karte: #1d2420; --gruen-hell: #23352e; --rot-hell: #3a1f1d; --gelb: #3a331f; --blau: #7fb0ea; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--hg); }
a { color: var(--blau); }
button, select, input, textarea { font: inherit; }
button { cursor: pointer; border: 1px solid var(--rand); background: var(--karte); color: var(--text); padding: .45rem .8rem; border-radius: 8px; }
button.haupt { background: var(--gruen); color: #fff; border-color: var(--gruen); font-weight: 600; }
button.gefahr { color: var(--rot); }
button:disabled { opacity: .5; cursor: wait; }
input, select, textarea { border: 1px solid var(--rand); background: var(--karte); color: var(--text); border-radius: 8px; padding: .45rem .6rem; }

.kopf { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; padding: .7rem 1rem; background: var(--gruen); color: #fff; position: sticky; top: 0; z-index: 500; }
.kopf h1 { margin: 0; font-size: 1.25rem; }
.kopf nav { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.kopf nav button { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.kopf nav button.aktiv { background: #fff; color: var(--gruen); }
.kopf .abmelden { color: #fff; font-size: .9rem; margin-left: .3rem; }

.werkzeug { max-width: 1200px; margin: 1rem auto 0; padding: 0 1rem; }
.link-form { display: flex; gap: .5rem; }
.link-form input { flex: 1; min-width: 0; }
.werkzeug-reihe { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; margin-top: .7rem; }
.werkzeug-reihe label { color: var(--grau); font-size: .9rem; }
.hinweisbox { margin-top: .8rem; padding: .7rem .9rem; background: var(--gelb); border-radius: 10px; font-size: .95rem; }
.hinweisbox ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.meldung { min-height: 1.4rem; margin-top: .5rem; font-size: .95rem; }
.meldung.fehler { color: var(--rot); } .meldung.warn { color: #9a6700; }

main { max-width: 1200px; margin: 0 auto; padding: .5rem 1rem 3rem; }
.karten { display: grid; gap: 1rem; }
.leer { text-align: center; padding: 3rem 1rem; color: var(--grau); }

.objekt { display: grid; grid-template-columns: 300px 1fr; background: var(--karte); border: 1px solid var(--rand); border-radius: 14px; overflow: hidden; }
.objekt.status-verworfen { opacity: .55; }
.objekt.status-interessant { border-left: 5px solid var(--gruen); }
.objekt.status-besichtigung { border-left: 5px solid var(--blau); }
.objekt.hervor { box-shadow: 0 0 0 3px var(--gruen); }
.objekt .bild { position: relative; background: var(--gruen-hell); min-height: 220px; }
.objekt .bild img { width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; inset: 0; }
.kein-bild { display: grid; place-items: center; height: 100%; color: var(--grau); }
.bildzahl { position: absolute; right: .5rem; bottom: .5rem; background: rgba(0,0,0,.6); color: #fff; padding: .1rem .5rem; border-radius: 6px; font-size: .8rem; }
.objekt .inhalt { padding: .9rem 1.1rem 1rem; min-width: 0; }
.objekt h2 { margin: .3rem 0 .1rem; font-size: 1.15rem; line-height: 1.3; }
.objekt h2 a { color: var(--text); text-decoration: none; }
.objekt h2 a:hover { text-decoration: underline; }
.objekt h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.ort { margin: 0; color: var(--grau); font-size: .9rem; }
.preis { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: baseline; margin: .4rem 0; }
.preis .gross { font-size: 1.45rem; font-weight: 700; }
.gesenkt { color: #1b7a3a; font-weight: 600; } .erhoeht { color: var(--rot); font-weight: 600; }
.eckdaten { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .4rem .8rem; margin: .5rem 0; }
.fakt .n { display: block; font-size: .78rem; color: var(--grau); }
.fakt .w { font-weight: 600; }
.badges { display: flex; flex-wrap: wrap; gap: .35rem; }
.badge { font-size: .75rem; padding: .15rem .5rem; border-radius: 99px; background: var(--gruen-hell); }
.badge.portal-immoscout { background: #e1ecfa; color: #1d4f8a; } .badge.portal-kleinanzeigen { background: #e8f5d9; color: #3d6b12; }
@media (prefers-color-scheme: dark) { .badge.portal-immoscout { background: #1d2f45; color: #a9cbf1; } .badge.portal-kleinanzeigen { background: #273a17; color: #c2e39b; } }
.badge.zustand-blockiert, .badge.zustand-entfernt, .badge.warn { background: var(--rot-hell); color: var(--rot); }
.badge.zustand-pc_noetig { background: var(--gelb); }
.badge.score { background: var(--gruen); color: #fff; font-weight: 600; }
.badge.dup { background: var(--gelb); }

.ki { margin: .7rem 0; padding: .7rem .8rem; background: var(--gruen-hell); border-radius: 10px; }
.ki.leer { color: var(--grau); font-size: .9rem; }
.ki-spalten { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.ki h3 { margin: 0 0 .3rem; }
.ki ol { margin: 0; padding-left: 1.2rem; font-size: .93rem; }
.ki-spalte.vor h3 { color: #1b7a3a; } .ki-spalte.nach h3 { color: var(--rot); }
.fazit { margin: .6rem 0 0; font-style: italic; }
.kriterien { font-size: .9rem; padding-left: 1.1rem; }

.mehr { margin-top: .6rem; border-top: 1px solid var(--rand); padding-top: .5rem; }
.mehr summary, .ki summary { cursor: pointer; color: var(--blau); }
.verlauf { width: 100%; height: auto; max-height: 200px; }
.verlauf .gitter { stroke: var(--rand); stroke-dasharray: 3 3; }
.verlauf .achse { font-size: 11px; fill: var(--grau); }
.verlauf .linie { fill: none; stroke: var(--gruen); stroke-width: 2.5; }
.verlauf .punkt { fill: var(--karte); stroke: var(--gruen); stroke-width: 2; }
.verlauf .punkt.runter { fill: #1b7a3a; stroke: #1b7a3a; } .verlauf .punkt.hoch { fill: var(--rot); stroke: var(--rot); }
.kosten table { border-collapse: collapse; width: 100%; max-width: 520px; font-size: .93rem; }
.kosten td { padding: .2rem .3rem; border-bottom: 1px solid var(--rand); }
.kosten td.r { text-align: right; white-space: nowrap; }
.kosten tr.summe td { font-weight: 700; }
.hinweise { font-size: .92rem; padding-left: 1.1rem; }
.warn { color: var(--rot); }
.beschreibung { white-space: pre-line; font-size: .93rem; max-height: 360px; overflow: auto; background: var(--hg); padding: .6rem; border-radius: 8px; }
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .4rem; margin-top: .6rem; }
.galerie img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; display: block; }
.klein { font-size: .85rem; color: var(--grau); }
.aktionen { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: flex-start; margin-top: .8rem; padding-top: .7rem; border-top: 1px solid var(--rand); }
.aktionen textarea { flex: 1 1 220px; min-height: 2.4rem; }
.knoepfe { display: flex; flex-wrap: wrap; gap: .4rem; }

#karte { height: 70vh; min-height: 360px; border-radius: 12px; border: 1px solid var(--rand); }

#ansicht-einstellungen { max-width: 760px; }
.krit, .ortz { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; margin-bottom: .4rem; }
.krit .k-name { flex: 1 1 240px; } .krit .k-gew { width: 4rem; }
.ortz .o-name { flex: 0 1 170px; } .ortz .o-adr { flex: 1 1 260px; }
.fin { display: flex; flex-wrap: wrap; gap: .6rem 1rem; } .fin input { width: 9rem; }
.bm-link { display: inline-block; padding: .55rem 1rem; background: var(--gruen); color: #fff; border-radius: 8px; text-decoration: none; font-weight: 600; cursor: grab; }

.overlay { position: fixed; inset: 0; background: rgba(10,20,15,.6); display: grid; place-items: center; z-index: 1000; padding: 1rem; }
.overlay[hidden] { display: none; }
.overlay-box { background: var(--karte); border-radius: 16px; padding: 1.5rem; width: min(460px, 100%); text-align: center; }
.overlay-box h2 { font-size: 1.15rem; margin: .6rem 0; }
.overlay-box p { margin: .4rem 0; word-break: break-word; }
.spinner { width: 42px; height: 42px; margin: 0 auto; border: 4px solid var(--gruen-hell); border-top-color: var(--gruen); border-radius: 50%; animation: dreh 1s linear infinite; }
@keyframes dreh { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.fortschritt { height: 8px; background: var(--gruen-hell); border-radius: 99px; overflow: hidden; margin: .8rem 0 .4rem; }
#overlay-balken { height: 100%; width: 0; background: var(--gruen); transition: width .4s; }
.countdown strong { font-size: 1.3rem; }

body.login { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.login-box { background: var(--karte); border: 1px solid var(--rand); border-radius: 14px; padding: 1.5rem; width: min(360px, 100%); display: grid; gap: .6rem; }
.login-box h1 { margin: 0 0 .3rem; color: var(--gruen); }
.fehler { color: var(--rot); }

@media (max-width: 720px) {
  .objekt { grid-template-columns: 1fr; }
  .objekt .bild { min-height: 200px; aspect-ratio: 16/10; }
  .ki-spalten { grid-template-columns: 1fr; }
  .link-form { flex-direction: column; }
  .kopf { position: static; }
}
