/* Nunito lokal ausgeliefert (kein Google-Fonts-Abruf, DSGVO), SIL Open Font License */
@font-face {
  font-family: Nunito;
  src: url("/static/fonts/nunito-latin.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --green: #2f5a14;       /* Kopfzeile, Haupt-Buttons, Links */
  --text: #1f2a17;
  --muted: #5a6b4f;
  --bg: #f5f8f0;
  --line: #cfd9c4;
  --line-soft: #e0e7d8;
  --line-faint: #edf2e8;
  --seg: #e4ebdc;
  --on-dark: #e4efd8;
  --accent: #acd47f;      /* Hellgrün der Website */
  --accent-light: #bbdc98;
  --tint: #e9f4dc;
  --red: #b3261e;
  --radius: 10px;
  --radius-card: 14px;
  --shadow: 0 1px 2px rgb(31 42 23 / 0.06), 0 6px 16px rgb(31 42 23 / 0.05);
  font-family: Nunito, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 800; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
p { margin: 0; }
a { color: var(--green); }
a:hover { color: var(--text); }
small { font-size: 0.85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Kopfzeile --- */
.topbar { background: var(--green); color: #fff; }
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
}
.brand { display: flex; align-items: center; gap: 0.6rem; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.1rem; }
.brand:hover { color: #fff; }
.logo { width: 30px; height: 40px; object-fit: contain; background: #fff; border-radius: 6px; padding: 3px; }
.nav { display: flex; flex-wrap: wrap; gap: 0.25rem; flex: 1; }
.nav a { padding: 0.6rem 0.85rem; border-radius: 8px; color: #fff; font-weight: 700; text-decoration: none; }
.nav a:hover { background: rgb(255 255 255 / 0.1); }
.nav a[aria-current="page"] { background: rgb(187 220 152 / 0.18); color: var(--accent-light); font-weight: 800; }
.nav-user { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; color: var(--on-dark); }
.nav-user form { margin: 0; }
.nav-user .link { color: #fff; min-height: 44px; }

/* --- Layout --- */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 1.25rem 1rem; flex: 1; display: flex; flex-direction: column; gap: 1rem; }
.footer { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.35rem 1.25rem;
  text-align: center; color: var(--muted); font-size: 0.85rem; padding: 1.5rem 1rem; }
.footer nav { display: flex; gap: 1rem; }
.footer a { color: inherit; }
.footer .version { opacity: 0.8; }

.auth { width: 100%; max-width: 440px; margin: 0 auto; padding: 2.5rem 1.25rem 1.5rem; flex: 1; display: flex; flex-direction: column; gap: 1.5rem; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; text-align: center; color: var(--text); text-decoration: none; }
.auth-brand .logo { width: 72px; height: 100px; border-radius: 12px; padding: 8px; }
.auth-brand small { font-weight: 600; color: var(--muted); }
.auth-brand strong { display: block; font-size: 1.6rem; font-weight: 800; }

.card {
  background: #fff;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.card.highlight { border: 2px solid var(--accent-light); }
.card.narrow { width: 100%; max-width: 440px; margin: 0 auto; }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 0.75rem; }
.page-head > div { display: flex; flex-direction: column; gap: 0.35rem; }
.back { display: inline-flex; align-items: center; gap: 0.25rem; font-weight: 700; align-self: flex-start; }

/* Hauptspalte + Seitenleiste, bricht auf dem Handy untereinander um */
.split { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: flex-start; }
.split > .main { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 1.25rem; }
.split > aside { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 1.25rem; }

.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.row > .grow { flex: 1 1 280px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 1.5rem 1rem; }

/* --- Formulare --- */
label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; font-weight: 700; }
input, select, textarea {
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: #7f8c75; }
textarea { min-height: 6rem; resize: vertical; }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; margin: 0.15rem 0 0; flex: none; accent-color: var(--green); }
label.check { flex-direction: row; align-items: flex-start; gap: 0.75rem; font-weight: 400; font-size: 0.95rem; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, .link:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--green) 35%, transparent);
  outline-offset: 1px;
}
input:focus, select:focus, textarea:focus { border-color: var(--green); }
.hint { font-size: 0.85rem; font-weight: 400; color: var(--muted); }
.field-error { font-size: 0.85rem; font-weight: 700; color: #8c1d16; }
[aria-invalid="true"] { border-color: var(--red); }
fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.85rem; }

.fields { display: grid; gap: 0.75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields > .wide { grid-column: 1 / -1; }
.fields.plz { grid-template-columns: 7rem minmax(0, 1fr); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 46px;
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-weight: 800;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--bg); color: var(--text); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: #24470f; color: #fff; }
.btn.accept { background: var(--accent); border-color: var(--accent); color: var(--text); }
.btn.accept:hover { background: #9cc86c; }
.btn.soft { background: var(--tint); border-color: var(--tint); }
.btn.soft:hover { background: #dcedc8; }
.btn.danger { color: var(--red); border: 2px solid var(--red); }
.btn.danger:hover { background: #fbe7e4; color: var(--red); }
.btn.quiet { font-weight: 700; color: var(--muted); }
.btn.block { width: 100%; }
.btn.big { min-height: 52px; font-size: 1.05rem; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--green); text-decoration: underline; cursor: pointer; }

/* --- Meldungen --- */
.flash, .alert { padding: 0.75rem 1rem; border-radius: var(--radius); }
.flash { background: var(--tint); color: var(--green); font-weight: 700; }
.alert { background: #fbe7e4; color: #8c1d16; }

.divider { display: flex; align-items: center; gap: 0.75rem; color: var(--muted); font-size: 0.85rem; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line-soft); }

/* --- Filter-Chips & Suche --- */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--text);
}
.chip[aria-current="page"] { background: var(--green); border-color: var(--green); color: #fff; font-weight: 800; }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0; }
.toolbar > .search { flex: 1 1 260px; }
.toolbar > label:not(.search) { flex: 0 1 220px; }

/* --- Tabellen --- */
.table-wrap { background: #fff; border-radius: var(--radius-card); box-shadow: var(--shadow); overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.list th {
  text-align: left;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.85rem 1rem;
  white-space: nowrap;
}
table.list td { padding: 0.85rem 1rem; border-top: 1px solid var(--line-faint); vertical-align: top; }
table.list td a.name { font-weight: 800; text-decoration: none; }
table.list td small { display: block; color: var(--muted); }

/* Auf dem Handy werden Tabellenzeilen zu Karten */
@media (max-width: 720px) {
  .table-wrap { background: none; box-shadow: none; overflow: visible; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; }
  table.list thead { display: none; }
  table.list tr {
    background: #fff;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
  }
  table.list td { border: 0; padding: 0.15rem 0; }
  table.list td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
}

/* --- Status-Badges --- */
.badge {
  display: inline-block;
  align-self: flex-start;
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
  background: var(--seg);
  color: var(--muted);
}
.badge.neu { background: #e3ecfa; color: #24467f; }
.badge.offen, .badge.zugewiesen { background: #fdf0d2; color: #6b4800; }
.badge.angenommen, .badge.vergeben, .badge.aktiv { background: #e6f2d9; color: var(--green); }
.badge.abgelehnt, .badge.inaktiv { background: #fbe7e4; color: #8c1d16; }

/* --- Detailangaben --- */
dl.facts { margin: 0; display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 0.6rem 1rem; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }

ul.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
ul.plain li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 0.75rem; }

/* --- Verlauf --- */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.timeline li { display: flex; gap: 0.75rem; }
.timeline li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--line); margin-top: 0.45rem; flex: none; }
.timeline li.notiz::before, .timeline li.anruf::before, .timeline li.mail::before { background: var(--accent); }
.timeline li.status::before { background: var(--green); }
.timeline .meta { display: block; font-size: 0.85rem; color: var(--muted); }
.timeline .text { white-space: pre-line; }

@media (min-width: 640px) {
  .container { padding: 1.75rem 1.5rem; gap: 1.25rem; }
  .card { padding: 1.25rem; }
  h1 { font-size: 1.9rem; }
}

/* --- Vorstandsansicht --- */
.brand small { display: block; font-size: 0.8rem; font-weight: 700; color: var(--accent-light); line-height: 1.2; }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; background: var(--seg); border-radius: 12px; padding: 4px; }
.seg a { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 9px; font-weight: 700; color: var(--muted); text-decoration: none; }
.seg a[aria-current="page"] { background: #fff; color: var(--text); font-weight: 800; box-shadow: 0 1px 2px rgb(31 42 23 / 0.12); }
.cards { display: grid; gap: 0.85rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.item-card { display: flex; flex-direction: column; gap: 0.6rem; background: #fff; border-radius: var(--radius-card); padding: 1rem; text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.item-card:hover { color: var(--text); box-shadow: 0 0 0 2px var(--accent-light), var(--shadow); }
.item-card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.item-card .name { font-size: 1.1rem; font-weight: 800; }
.item-card .foot { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.9rem; color: var(--muted); border-top: 1px solid var(--line-faint); padding-top: 0.6rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.port-zeile { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 0.6rem; }
.decision { display: flex; flex-direction: column; gap: 0.85rem; }
.decision form { display: flex; flex-direction: column; gap: 0.85rem; margin: 0; }

/* --- Öffentliche Seiten --- */
.hero { background: var(--green); color: #fff; }
.hero-inner { max-width: 720px; margin: 0 auto; padding: 1.5rem 1rem 1.75rem; display: flex; flex-direction: column; align-items: center; gap: 0.85rem; text-align: center; }
.hero-brand { display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; font-weight: 700; color: var(--accent-light); }
.hero-brand .logo { width: 40px; height: 54px; border-radius: 8px; padding: 4px; }
.hero h1 { font-size: 1.75rem; }
.hero p { color: var(--on-dark); max-width: 52ch; }
.narrow-page { max-width: 720px; }
.prose { display: flex; flex-direction: column; gap: 0.75rem; }
.prose h2 { margin-top: 0.5rem; }
.prose ul { margin: 0; padding-left: 1.25rem; }
/* Honeypot gegen Spam-Bots: für Menschen unsichtbar, auch für Screenreader ausgeblendet */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
@media (min-width: 640px) {
  .hero h1 { font-size: 2.1rem; }
  .hero-inner { padding: 2rem 1.5rem 2.25rem; }
}
.text-pre { white-space: pre-line; }

/* --- Mehrfachauswahl (Wunschvereine) --- */
legend { font-size: 0.9rem; font-weight: 700; padding: 0; }
.checks { display: grid; gap: 0.5rem 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.checks label.check { align-items: center; min-height: 44px; padding: 0 0.6rem; border: 1px solid var(--line); border-radius: var(--radius); }
.checks label.check:has(input:checked) { border-color: var(--green); background: var(--tint); }
fieldset[aria-invalid="true"] .checks label.check { border-color: var(--red); }
.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }

/* --- Sortierung & Seiten --- */
table.list th a.sort { color: inherit; text-decoration: none; display: inline-flex; min-height: 44px; align-items: center; }
table.list th a.sort:hover { color: var(--text); }
table.list th[aria-sort] a.sort { color: var(--text); }
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; }

/* --- Hinweis auf Änderungen (Vorstandsliste) --- */
.marker { display: inline-block; vertical-align: 0.15em; margin-right: 0.45rem; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 800; background: var(--accent); color: var(--text); }
.marker.neu { background: var(--green); color: #fff; }
.item-card.ungelesen { box-shadow: inset 4px 0 0 var(--accent), var(--shadow); }

/* --- Handy: kompakte Kopfzeile, Aktionen nach oben, ganze Karten antippbar --- */
@media (max-width: 720px) {
  /* Kopfzeile: Logo + Abmelden in einer Zeile, Menü darunter als waagerecht wischbare Leiste */
  .topbar-inner { gap: 0.25rem 0.75rem; padding: 0.5rem 1rem 0.35rem; }
  .brand { order: 1; font-size: 1rem; }
  .nav-user { order: 2; margin-left: auto; }
  .nav-user > span { display: none; }
  .nav {
    order: 3;
    flex: 1 0 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -1rem;
    padding: 0 0.5rem;
  }
  .nav:empty { display: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; padding: 0.5rem 0.55rem; min-height: 44px; display: flex; align-items: center; font-size: 0.95rem; }

  /* Listen-Karten: die ganze Karte führt zur Detailseite */
  table.list tr { position: relative; }
  table.list td a.name::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-card); }
  table.list tr:has(a.name:active) { box-shadow: 0 0 0 2px var(--accent-light), var(--shadow); }

  /* Suche/Filter: Suchfeld + Knopf, darunter die beiden Auswahllisten */
  .toolbar { display: grid; grid-template-columns: minmax(0, 1fr) 9rem; }
  .toolbar > .search { grid-row: 1; grid-column: 1; }
  .toolbar > button { grid-row: 1; grid-column: 2; }
  .toolbar > label:not(.search) { grid-row: 2; grid-column: 1; }
  .toolbar > label:not(.search) + label:not(.search) { grid-column: 2; }
  .toolbar > a { grid-row: 3; grid-column: 1 / -1; }
}

/* Detailseiten einspaltig: Angaben zuerst, dann die Aktion (Zuweisen bzw. Entscheiden), danach Notizen und Verlauf */
@media (max-width: 860px) {
  .split { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
  .split > .main { display: contents; }
  .split > .main > * { order: 2; }
  .split > .main > :first-child { order: 0; }
  .split > aside { order: 1; }
}

/* --- Bewerberliste: Ungelesen/Geändert für den Stadtverband --- */
.chip.neuigkeiten { border-color: var(--accent); }
.chip.neuigkeiten[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--text); }
table.list tr.ungelesen td:first-child { box-shadow: inset 4px 0 0 var(--accent); }
table.list td .marker { margin-bottom: 0.2rem; }
@media (max-width: 720px) {
  table.list tr.ungelesen { box-shadow: inset 4px 0 0 var(--accent), var(--shadow); }
  table.list tr.ungelesen td:first-child { box-shadow: none; }
}
