/* ============================================================
   VEREIN.CSS - Mitglieder, Buchhaltung, Mitgliederversammlung
   ============================================================ */

/* Kennzahlen-Kacheln */
.ve-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 0 0 16px; }
.ve-kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.ve-kpi-label { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; display: flex; align-items: center; gap: 6px; }
.ve-kpi-label .material-icons { font-size: 16px; }
.ve-kpi-wert { font-size: 20px; font-weight: 700; margin-top: 4px; white-space: nowrap; }
.ve-kpi-sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

/* Beträge */
.ve-zahl { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ve-plus { color: var(--pal-gruen-dunkel); }
.ve-minus { color: var(--danger); }
.ve-um { color: var(--ink-soft); }

/* Seiten-Reiter */
.ve-tabs { margin: 0 0 14px; }
.ve-pane { display: none; }
.ve-pane.active { display: block; }

/* Tabellen im Bericht */
.ve-tabelle { width: 100%; border-collapse: collapse; margin: 6px 0 18px; font-size: 14px; }
.ve-tabelle th, .ve-tabelle td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ve-tabelle th.ve-zahl, .ve-tabelle td.ve-zahl { text-align: right; }
.ve-tabelle thead th { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
.ve-tabelle tfoot th { border-top: 2px solid var(--ink); }
.ve-bereich th { background: var(--accent-tint); }
.ve-summe td { font-style: italic; color: var(--ink-soft); }
.ve-ergebnis td, .ve-gesamt td { font-weight: 700; }
.ve-gesamt td { border-top: 2px solid var(--ink); }
.ve-hinweis { color: var(--ink-soft); font-size: 13px; margin: 6px 0 12px; }
.ve-warnung { color: var(--danger); font-size: 13px; margin: 6px 0 12px; }
.ve-block { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.ve-block h3 { margin: 0 0 8px; font-size: 16px; }
.ve-block-kopf { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.ve-block-kopf h3 { margin: 0; }
.ve-aktionen { display: flex; gap: 8px; flex-wrap: wrap; }

/* Dialoge */
dialog.ve-dialog { max-width: 760px; }
dialog.ve-gross { max-width: 1000px; width: calc(100vw - 32px); }
.ve-dialog .dialog-inner, .ve-gross .dialog-inner { overflow-y: auto; max-height: calc(100vh - 80px); }
.ve-dialog textarea, .ve-gross textarea { width: 100%; resize: vertical; font: inherit; }

/* Bearbeitbare Zeilen (Tagesordnung, Teilnehmer, Protokoll) */
.ve-liste { width: 100%; border-collapse: collapse; font-size: 14px; }
.ve-liste th, .ve-liste td { padding: 6px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.ve-liste th { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; }
.ve-liste input[type="text"], .ve-liste input[type="number"], .ve-liste select, .ve-liste textarea {
  width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--paper); color: var(--ink);
}
.ve-liste .ve-nr { width: 56px; }
.ve-liste .ve-stimme { width: 70px; }
.ve-liste .ve-knopf { width: 40px; text-align: center; }
.ve-proto-top { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.ve-proto-top h4 { margin: 0 0 6px; font-size: 16px; }
.ve-proto-zeile { display: grid; grid-template-columns: repeat(3, 90px) 1fr; gap: 8px; margin-top: 6px; }
.ve-proto-zeile label { font-size: 12px; color: var(--ink-soft); display: block; }
.ve-proto-zeile input, .ve-proto-zeile select, .ve-proto-top textarea { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--paper); color: var(--ink); }

.ve-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); background: var(--surface); white-space: nowrap; }
.ve-badge-e { background: var(--pal-anthrazit-hell); border-color: var(--pal-gruen-mittel); color: var(--pal-gruen-dunkel); }
.ve-badge-a { background: var(--danger-tint); border-color: var(--pal-rot-mittel); color: var(--danger); }
.ve-badge-u { background: var(--surface); color: var(--ink-soft); }
.ve-gedimmt { opacity: .55; }

@media (max-width: 700px) {
  .ve-proto-zeile { grid-template-columns: repeat(3, 1fr); }
  .ve-proto-zeile > :last-child { grid-column: 1 / -1; }
  .ve-kpi-wert { font-size: 18px; }
}

/* Vereinsstatus: Häkchen + farbiges Etikett (wie Kategorien im Adressbuch) */
.ve-st { display: inline-block; padding: 3px 10px; border-radius: 8px; font-size: 13px; line-height: 1.4; white-space: nowrap; color: var(--nacht-800); }
.ve-st-mitglied { background: var(--el-verein-mitglied-hell); }
.ve-st-spender { background: var(--el-verein-spender-hell); }
.ve-st-vorstand { background: var(--el-verein-vorstand-hell); }
.ve-st-liste { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--paper); }
.ve-st-zeile { display: flex; align-items: center; gap: 12px; padding: 7px 12px; cursor: pointer; font-weight: normal; margin: 0; }
.ve-st-zeile + .ve-st-zeile { border-top: 1px solid var(--line); }
.ve-st-zeile:hover { background: var(--surface); }
.ve-st-zeile input { width: 18px; height: 18px; margin: 0; accent-color: var(--pal-blau); }

/* Beitrittserklärung mit Unterschrift */
.ve-beitritt-text { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; font-size: 14px; line-height: 1.5; margin-bottom: 12px; }
.ve-beitritt-text p { margin: 0 0 8px; }
.ve-beitritt-text dl { display: grid; grid-template-columns: 120px 1fr; gap: 2px 10px; margin: 8px 0 0; }
.ve-beitritt-text dt { color: var(--ink-soft); }
.ve-beitritt-text dd { margin: 0; }
.ve-sig-rahmen { position: relative; border: 1px dashed var(--ink-faint); border-radius: 8px; background: #fff; touch-action: none; }
.ve-sig-rahmen canvas { display: block; width: 100%; height: 180px; cursor: crosshair; touch-action: none; }
.ve-sig-linie { position: absolute; left: 16px; right: 16px; bottom: 40px; border-bottom: 1px solid var(--pal-grau-mittel); pointer-events: none; }
.ve-sig-hinweis { position: absolute; left: 16px; bottom: 16px; font-size: 12px; color: var(--pal-anthrazit-mittel); pointer-events: none; }
.ve-beitritt-check { display: flex; gap: 10px; align-items: flex-start; font-weight: normal; font-size: 13px; line-height: 1.45; margin: 10px 0; }
.ve-beitritt-check input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
/* Etiketten nicht wie Feldbeschriftungen (Großbuchstaben) darstellen */
.field label.ve-st-zeile, .ve-st-zeile { text-transform: none; letter-spacing: normal; font-size: 16px; color: var(--ink); }
.ve-st-zeile .ve-st { text-transform: none; letter-spacing: normal; font-weight: 500; font-size: 14px; }
.field label.ve-beitritt-check { text-transform: none; letter-spacing: normal; color: var(--ink); }

/* Beitrittserklärung: Vorschau wie beim Ablaufplan */
dialog.ve-dok-dialog { max-width: 720px; }
.ve-dok-dialog h2 { display: flex; align-items: center; gap: 8px; }
.ve-dok-info { margin: -6px 0 12px; font-size: 14px; color: var(--ink-soft); }
.ve-dok-vorschau { display: flex; flex-direction: column; align-items: center; gap: 14px; max-height: 58vh; overflow: auto;
  padding: 16px; border-radius: 12px; background: var(--surface); margin-bottom: 10px; }
.ve-dok-seite { width: 100%; max-width: 520px; aspect-ratio: 210 / 297; object-fit: contain; background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15); border-radius: 2mm; }
.ve-dok-bild { aspect-ratio: auto; }
.ve-dok-leer { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 40px 20px; color: var(--ink-soft); font-size: 14px; }
.ve-dok-leer .material-icons { font-size: 40px; color: var(--ink-faint); }
.ve-dok-leer strong { color: var(--ink); }
.ve-dok-upload { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.ve-dok-aktionen { flex-wrap: wrap; }
.ve-dok-aktionen .btn-cancel[disabled], .ve-dok-aktionen .btn-submit[disabled] { opacity: .45; cursor: not-allowed; }
.ve-dok-ok { color: var(--pal-gruen-dunkel); }
.ve-dok-fehlt { color: var(--ink-faint); }

/* ---------- Formulare im Bereich Verein: Rahmen mit Überschrift, gleiche Feldhöhen ---------- */
.ve-rahmen.multi-select { padding: 10px 14px 2px; background: var(--card); }
.ve-rahmen > legend { font-size: 12px; }
.ve-rahmen .field { margin-bottom: 12px; }
.ve-rahmen .ve-hinweis, .ve-rahmen .field-hint { margin: 6px 0 0; }
.ve-name { font-weight: 600; font-size: 16px; padding: 4px 0; }

/* Alle einzeiligen Felder gleich hoch (Safari zeichnet Datum und Auswahl sonst höher) */
.ve-form .field input[type="text"],
.ve-form .field input[type="date"],
.ve-form .field input[type="number"],
.ve-form .field input[type="email"],
.ve-form .field select,
.ve-dialog .field input[type="text"],
.ve-dialog .field input[type="date"],
.ve-dialog .field input[type="number"],
.ve-dialog .field input[type="time"],
.ve-dialog .field select {
  box-sizing: border-box;
  height: 46px;
  min-height: 46px;
  line-height: 1.2;
  padding-top: 0;
  padding-bottom: 0;
}
.ve-form .field input[type="date"],
.ve-dialog .field input[type="date"],
.ve-dialog .field input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
}
.ve-form input[type="date"]::-webkit-date-and-time-value,
.ve-dialog input[type="date"]::-webkit-date-and-time-value,
.ve-dialog input[type="time"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
.ve-form .field select,
.ve-dialog .field select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.ve-form .field input[type="text"]::placeholder { color: var(--ink-faint); }
.ve-rahmen .ve-st-liste { border: 0; border-radius: 0; margin: 0 -4px; }
.ve-st-zeile input { flex: none; align-self: center; }

/* Mehrere Status-Etiketten: gleichmäßiger Abstand, auch beim Umbruch */
.ve-st-gruppe { display: inline-flex; flex-wrap: wrap; gap: 6px; }

/* Mitgliederversammlung: Rahmen */
.ve-rahmen .detail-grid { margin: 2px 0 10px; }
.ve-rahmen .ve-liste { margin-bottom: 4px; }
.ve-rahmen-fuss { margin: 10px 0 12px; }
.ve-rahmen > .ve-hinweis:last-child, .ve-rahmen > div > .ve-hinweis:last-child { margin-bottom: 10px; }
.ve-rahmen .ve-proto-top { background: var(--surface); }
.ve-rahmen .ve-kpis-klein { margin: 4px 0 12px; }
.ve-schritte { margin: 2px 0 12px; padding-left: 20px; font-size: 14px; color: var(--ink-soft); line-height: 1.7; }
.ve-gross .ve-pane > .ve-aktionen { margin-bottom: 8px; }
/* Viele Reiter: waagerecht scrollen statt den Dialog zu verbreitern */
.ve-gross .dialog-inner { overflow-x: hidden; }
html[data-tabs] .ve-gross .ve-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
html[data-tabs] .ve-gross .ve-tabs .tab-button { flex: none; white-space: nowrap; }
/* Scrollbereich schneidet die überlappende Aktiv-Linie ab → Grundlinie als Schatten, Aktiv-Linie liegt darauf */
html[data-tabs] .ve-gross .ve-tabs { border-bottom: 0; box-shadow: inset 0 -2px 0 var(--line); }
html[data-tabs] .ve-gross .ve-tabs .tab-button { margin-bottom: 0; }
/* Tabellenzeilen: alle Felder gleich flach */
.ve-liste input[type="text"], .ve-liste input[type="number"], .ve-liste input[type="date"], .ve-liste select {
  box-sizing: border-box; height: 36px; min-height: 36px; padding: 0 8px; border-radius: 8px; font-size: 14px;
}
.ve-liste input[type="date"] { -webkit-appearance: none; appearance: none; }
/* Nur-Lese-Feld (z. B. Versammlungsleitung = 1. Vorsitzende/r) */
.ve-feld-info { box-sizing: border-box; min-height: 46px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 0 0.9rem; border: 1.5px dashed var(--line); border-radius: 8px; font-size: 0.95rem; }
.ve-feld-info .ve-hinweis, .ve-feld-info .ve-warnung { margin: 0; }
/* Einladung: Knöpfe wie beim „E-Mail Flyer“ rechtsbündig */
.ve-mail-aktionen { justify-content: flex-end; margin: 12px 0; }
.ve-rahmen .th-preview { margin-bottom: 6px; }
.ve-rahmen .th-empfaenger { max-height: 280px; }

/* ---------- Buchhaltung: Aufbau wie Einstellungen ---------- */
.bh-kopf { flex-wrap: wrap; gap: 12px; }
.bh-kopf-aktionen { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; }
.bh-kopf-aktionen .th-filter-select { min-width: 190px; margin-left: 0; height: auto; }
.bh-seite #jahr-hinweis:not(:empty) { margin-bottom: 12px; }
.bh-kpis { margin-bottom: 0; }
.bh-filter { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.bh-filter .suchfeld-container { flex: 1 1 320px; max-width: 520px; }
.bh-seite .stock-filter-chips { padding: 0; margin: 0 0 12px; background: transparent; border: 0; }
.bh-tabelle { margin: 0 -24px -24px; border-top: 1px solid var(--line); }
.bh-seite .ve-tabelle { margin-bottom: 0; }
@media (max-width: 700px) {
  .bh-tabelle { margin: 0 -16px -16px; }
  .bh-kopf-aktionen { width: 100%; }
}
.bh-kopf > div:first-child { flex: 1 1 320px; min-width: 0; }
.bh-kopf-aktionen { flex: 0 0 auto; }

/* ============================================================
   Digitale Unterschriften (VE.US)
   ============================================================ */
.us-felder { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 4px 0 12px; }
.us-feld { border: 1px solid var(--line, var(--neutral-200)); border-radius: 12px; padding: 10px 12px; background: var(--surface, var(--neutral-50)); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.us-kopf { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.us-rolle { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft, var(--pal-grau)); }
.us-name { font-weight: 600; }
.us-bild { height: 64px; border-bottom: 1px solid var(--pal-grau-mittel); background: #fff; border-radius: 8px 8px 0 0; display: flex; align-items: flex-end; padding: 4px 8px; }
.us-bild img { max-height: 58px; max-width: 100%; object-fit: contain; }
.us-bild span { font-size: 12px; color: var(--pal-anthrazit-mittel); padding-bottom: 6px; }
.us-status { display: flex; gap: 6px; align-items: flex-start; font-size: 13px; color: var(--ink-soft, var(--pal-grau)); line-height: 1.35; }
.us-status .material-icons { font-size: 18px; flex: none; }
.us-ok .us-status { color: var(--pal-gruen-dunkel); }
.us-offen .us-status { color: var(--pal-senf-dunkel); }
.us-alt .us-status { color: var(--pal-rot); }
.us-alt .us-bild img { opacity: .35; }
.us-meldung { margin: 0; font-size: 13px; color: var(--pal-gruen-dunkel); }
.us-feld .ve-warnung { margin: 0; }
.us-knoepfe { display: flex; flex-wrap: wrap; gap: 6px; }
.us-btn { font-size: 13px; padding: 6px 10px; min-height: 34px; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.us-btn .material-icons { font-size: 16px; }
.us-weg { margin-left: auto; }
.us-wer { margin: 0 0 8px; }
.us-inhalt { max-height: 220px; overflow: auto; font-size: 13px; }
.us-gesperrt { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 8px; background: var(--neutral-50); color: var(--pal-gruen-dunkel); font-size: 13px; margin: 0 0 10px; }
.us-gesperrt .material-icons { font-size: 18px; }
.us-gesperrt[hidden], .ve-aktionen [hidden] { display: none !important; }
/* Einstellungen → Vorstand: Feld ohne eigenen Rahmen in der Rollenkarte */
.es-unterschrift .us-feld { border: 0; padding: 0; background: none; }

/* ============================================================
   Spenden & Zuwendungsbestätigungen
   ============================================================ */
.sp-jahr { height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font: inherit; }
#sp-hinweise:empty { display: none; }
#sp-hinweise { padding: 16px 24px; display: flex; flex-direction: column; gap: 10px; }
.sp-hinweis { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 8px; font-size: 14px; line-height: 1.45; background: var(--accent-tint, var(--gold-tint)); }
/* Warnhinweis im App-Design: warm hinterlegt, dunkle Schrift, Symbol und Links in Akzentfarbe */
.sp-hinweis { color: var(--ink); border: 1px solid color-mix(in srgb, var(--accent-dark, var(--gold-mittel)) 25%, transparent); }
.sp-hinweis .material-icons { color: var(--accent-dark, var(--gold-mittel)); }
.sp-hinweis a { color: var(--accent-dark, var(--gold-mittel)); text-decoration: underline; text-underline-offset: 2px; }
.sp-hinweis.is-warnung { background: var(--el-meldung-hinweis-hell); border-color: var(--el-meldung-hinweis-mittel); color: var(--ink); }
.sp-hinweis.is-warnung .material-icons { color: var(--el-meldung-hinweis); }
body.dark-mode .sp-hinweis.is-warnung { background: var(--pal-anthrazit-nacht); border-color: var(--neutral-700); }
.sp-hinweis .material-icons { font-size: 20px; flex: none; }
.sp-hinweis a { color: inherit; font-weight: 600; }
.sp-status { display: inline-flex; flex-direction: column; gap: 2px; font-size: 13px; }
.sp-status .ve-badge { align-self: flex-start; }
.sp-sub { font-size: 12px; color: var(--ink-soft); }
.sp-offen { background: var(--el-meldung-hinweis-hell); border-color: var(--el-meldung-hinweis-mittel); color: var(--el-meldung-hinweis-dunkel); }
.sp-alt { background: var(--danger-tint); border-color: var(--pal-rot-mittel); color: var(--danger); }
.sp-liste td, .sp-liste th { padding: 8px 10px; font-size: 14px; }
.sp-liste tfoot td { font-weight: 700; border-top: 1.5px solid var(--ink); }
.sp-liste .ve-zahl { text-align: right; white-space: nowrap; }
/* Spenden-Kopfzeile: Suche, Jahr und Filter umbrechen statt überlappen */
.sp-toolbar { flex-wrap: wrap; row-gap: 10px; }
.sp-toolbar .toolbar-left { flex-wrap: wrap; row-gap: 10px; min-width: 0; flex: 1 1 520px; }
.sp-toolbar .suchfeld-container { min-width: 220px; }
.sp-toolbar .toolbar-right { margin-left: auto; }

/* Mitglieder-Tabelle: breite Namensspalte, Anschrift ohne Zeilenumbruch */
.table-mitglieder th.mi-col-name { width: 34%; }
.table-mitglieder th.mi-col-datum { width: 130px; }
.table-mitglieder .table-entry-subtitle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
.table-mitglieder .table-identity > div:last-child { min-width: 0; }

/* Mitgliederversammlungen-Tabelle: Titel und Ort ohne Zeilenumbruch */
.table-mv th.mv-col-datum { width: 130px; }
.table-mv th.mv-col-titel { width: 28%; }
.table-mv th.mv-col-ort { width: 24%; }
.table-mv th.mv-col-gj { width: 150px; }
.table-mv td:nth-child(2) > div, .table-mv td.mv-ort > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
.sp-toolbar .va-typ-wahl { width: 190px; }
.sp-jahr[hidden] { display: none; }

/* Spender im Spenden-Dialog: Link als kleiner Knopf, rechtsbündig unter den Angaben */
.sp-spender-aktion { display: flex; justify-content: flex-end; margin: 16px 0 4px; padding: 16px 0 0; border-top: 1px solid var(--line); }
.btn.sp-adressbuch-link { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; font-size: 14px; font-weight: 600; text-decoration: none; color: var(--ink); }
.btn.sp-adressbuch-link .material-icons { font-size: 18px; color: var(--accent-dark, var(--gold-mittel)); }
