:root {
  --lila: #5a2d82;
  --lila-dunkel: #3f1e5c;
  --hintergrund: #f6f3fa;
  --karte: #ffffff;
  --rand: #e1d9ea;
  --text: #2a2630;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, sans-serif; background: var(--hintergrund); color: var(--text); }

.topbar { display: flex; justify-content: space-between; align-items: center; background: var(--lila); color: white; padding: 0.8rem 1.2rem; flex-wrap: wrap; gap: 0.5rem; }
.topbar .brand { color: white; font-weight: bold; font-size: 1.2rem; text-decoration: none; }
.topbar nav a { color: white; text-decoration: none; margin-left: 1rem; }
.topbar nav a:hover { text-decoration: underline; }

main { max-width: 1100px; margin: 0 auto; padding: 1rem; }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--lila); }
.login-box { background: white; padding: 2rem; border-radius: 0.8rem; width: 90%; max-width: 320px; display: flex; flex-direction: column; gap: 0.8rem; }
.login-box h1 { text-align: center; margin-top: 0; }
.login-box .fehler { color: #b00020; font-size: 0.9rem; }

label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; color: #555; }
label.checkbox { flex-direction: row; align-items: center; gap: 0.5rem; }
input, select, textarea, button { padding: 0.6rem; border: 1px solid var(--rand); border-radius: 0.5rem; font-size: 1rem; font-family: inherit; }
button { background: var(--lila); color: white; border: none; cursor: pointer; }
button:hover { background: var(--lila-dunkel); }
button.mini { padding: 0.2rem 0.5rem; font-size: 0.75rem; }

.filterbar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.2rem; background: var(--karte); padding: 0.8rem; border-radius: 0.6rem; }
.filterbar input, .filterbar select { flex: 1 1 140px; }

.karten-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.karte { background: var(--karte); border-radius: 0.6rem; overflow: hidden; text-decoration: none; color: var(--text); border: 1px solid var(--rand); display: flex; flex-direction: column; }
.karte img { width: 100%; height: 160px; object-fit: cover; }
.kein-bild { width: 100%; height: 160px; display: flex; align-items: center; justify-content: center; font-size: 3rem; background: var(--hintergrund); }
.kein-bild.groß { height: 260px; font-size: 5rem; border-radius: 0.6rem; }
.karte-info { padding: 0.7rem; display: flex; flex-direction: column; gap: 0.2rem; }
.karte-info .art { font-size: 0.85rem; color: #777; }
.karte-info .meta { font-size: 0.8rem; color: #999; }

.status { display: inline-block; font-size: 0.75rem; padding: 0.1rem 0.5rem; border-radius: 1rem; margin-top: 0.3rem; align-self: flex-start; }
.status-lebend { background: #e3f5e1; color: #257a3e; }
.status-verkauft { background: #e3eefc; color: #2457a3; }
.status-abgegeben { background: #fdf0d5; color: #9a6a0e; }
.status-verstorben { background: #f5e1e1; color: #a32525; }

.eingabe-formular { display: flex; flex-direction: column; gap: 0.8rem; max-width: 500px; background: var(--karte); padding: 1.2rem; border-radius: 0.6rem; }

.detail-kopf { display: flex; gap: 1.5rem; flex-wrap: wrap; background: var(--karte); padding: 1rem; border-radius: 0.6rem; margin-bottom: 1.2rem; }
.detail-bilder { display: flex; flex-wrap: wrap; gap: 0.6rem; max-width: 260px; }
.foto-wrap { position: relative; }
.foto-wrap img { width: 120px; height: 120px; object-fit: cover; border-radius: 0.4rem; }
.mini-badge { position: absolute; bottom: 0.2rem; left: 0.2rem; background: var(--lila); color: white; font-size: 0.65rem; padding: 0.1rem 0.4rem; border-radius: 0.6rem; }
.detail-info { flex: 1; min-width: 250px; }
.detail-info dl { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 1rem; }
.detail-info dt { color: #777; }
.detail-info dd { margin: 0; }
.aktionen { display: flex; gap: 0.6rem; margin-top: 1rem; flex-wrap: wrap; }
.button { background: var(--lila); color: white; padding: 0.5rem 1rem; border-radius: 0.5rem; text-decoration: none; border: none; font-size: 1rem; cursor: pointer; }
.button.loeschen { background: #a32525; }

section { background: var(--karte); padding: 1rem; border-radius: 0.6rem; margin-bottom: 1rem; }
.haeutung-formular, .foto-formular { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.haeutungs-liste { list-style: none; padding: 0; }
.haeutungs-liste li { padding: 0.3rem 0; border-bottom: 1px solid var(--rand); }

.stammbaum-knoten { border: 1px solid var(--rand); border-radius: 0.5rem; padding: 0.6rem; margin-top: 0.5rem; }
.stammbaum-eltern { display: flex; gap: 1rem; margin-top: 0.5rem; }
.stammbaum-ast { flex: 1; }
.unbekannt { color: #aaa; font-size: 0.85rem; }

@media (max-width: 600px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .detail-kopf { flex-direction: column; }
  .stammbaum-eltern { flex-direction: column; }
}
