:root {
  --color-bg: #ffffff;
  --color-surface: #f5f7fa;
  --color-border: #e2e6ed;
  --color-navy: #1b2a4a;
  --color-navy-hover: #24365c;
  /* Indigo aus der Narrenkappe im Vereinswappen - zweiter Marken-Akzent */
  --color-royal: #362a72;
  --color-royal-soft: #eeecf8;
  /* Rosenrot aus dem Wappen - Akzent für Hervorhebungen (bewusst getrennt
     von --color-error, das bleibt für echte Fehlermeldungen reserviert) */
  --color-rose: #c8102e;
  --color-rose-soft: #fbe9ec;
  --color-text: #1a1d29;
  --color-text-muted: #5b6479;
  --color-error: #b3432b;
  --color-error-soft: #fbeeec;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --radius: 8px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 40px;
  --shadow-card: 0 1px 3px rgba(27, 42, 74, 0.08), 0 1px 2px rgba(27, 42, 74, 0.06);
}

/* Dunkles Design (2026-09-05): folgt ausschließlich der Geräte-/
   Browser-Einstellung, kein manueller Umschalter (explizit so gewünscht).
   Überschreibt nur die Farb-Variablen von :root oben - der Rest der App
   nutzt praktisch überall diese Variablen statt fester Farben, deshalb
   reicht das für fast die ganze Oberfläche. Wo Farben trotzdem fest im
   Code standen (v. a. weiße Kartenhintergründe), wurden sie vorher auf
   var(--color-bg) umgestellt, damit sie hier mitziehen. */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #14181f;
    --color-surface: #1c212b;
    --color-border: #323a49;
    --color-navy: #5b8cff;
    --color-navy-hover: #7ea3ff;
    --color-royal: #9c8ce0;
    --color-royal-soft: #292440;
    --color-rose: #ff6b7f;
    --color-rose-soft: #3a2027;
    --color-text: #e7eaf1;
    --color-text-muted: #99a2b5;
    --color-error: #ff8a6b;
    --color-error-soft: #3a2420;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

button, input {
  font-family: inherit;
  font-size: 16px;
}

:focus-visible {
  outline: 2px solid var(--color-navy);
  outline-offset: 2px;
}

a {
  color: var(--color-navy);
}

/* Login-Screen */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
}

.login-card {
  width: 100%;
  max-width: 360px;
}

.brand {
  text-align: center;
  margin-bottom: var(--space-5);
}

.brand-mark {
  width: 88px;
  height: 88px;
  object-fit: contain;
  display: block;
  margin: 0 auto var(--space-3);
}

.brand h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 var(--space-1);
}

.brand p {
  font-size: 14px;
  color: var(--color-text-muted);
  margin: 0;
}

.field {
  margin-bottom: var(--space-3);
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: var(--space-1);
  color: var(--color-text-muted);
}

.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
}

.field input:focus {
  background: var(--color-bg);
  border-color: var(--color-navy);
}

.remember-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  font-size: 14px;
  color: var(--color-text-muted);
}

.remember-row input {
  width: 16px;
  height: 16px;
}

.btn-primary {
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: var(--radius);
  background: var(--color-navy);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--color-navy-hover);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.error-message {
  background: var(--color-error-soft);
  border: 1px solid var(--color-error);
  color: var(--color-error);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: var(--space-3);
  display: none;
}

.error-message.visible {
  display: block;
}

/* App-Shell (nach Login) */

.app-header {
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-header .brand-mark {
  width: 34px;
  height: 34px;
  margin: 0;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.app-header-left span {
  font-weight: 600;
}

.btn-text {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: var(--space-2);
}

.btn-text:hover {
  color: var(--color-navy);
}

/* Menü in der Kopfzeile: ein Symbol statt ausgeschriebener Links, damit die
   Kopfzeile bei vielen Seiten nicht umbricht/gequetscht wirkt. */

.header-menu {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* "?"-Knopf neben dem Menü: führt zu feedback.html (Fragen & Anmerkungen). */
.header-help {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-navy);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.header-help:hover,
.header-help:focus-visible {
  background: var(--color-surface);
}

/* Glocke (2026-10-28): gleiches Aussehen wie "?", der rote Punkt
   (.menu-badge) sitzt oben rechts daran. */
.header-bell {
  position: relative;
}

.menu-toggle {
  position: relative;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  width: 38px;
  height: 38px;
  font-size: 18px;
  line-height: 1;
  color: var(--color-navy);
  cursor: pointer;
}

.menu-toggle:hover {
  background: var(--color-surface);
}

.menu-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--color-rose);
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid var(--color-bg);
}

.menu-badge[hidden] {
  display: none;
}

.menu-panel {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(27, 42, 74, 0.18);
  min-width: 200px;
  padding: var(--space-2);
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Eigene Regeln (auch nur eine Klasse) stehen im Ursprungs-Ranking immer
   über dem Browser-Standardstil für [hidden] - ohne diese Zeile bliebe das
   Menü nach dem Setzen von panel.hidden trotzdem als Flexbox sichtbar. */
.menu-panel[hidden] {
  display: none;
}

.menu-panel a,
.menu-panel button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--color-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
}

/* Gleicher Grund wie bei .menu-panel[hidden] oben: die eigene display:block-
   Regel für Menü-Einträge (z. B. den nur für Admins eingeblendeten
   "Administration"-Link) würde sonst das hidden-Attribut wirkungslos machen -
   der Eintrag stünde unabhängig von der Berechtigung immer sichtbar da. */
.menu-panel a[hidden],
.menu-panel button[hidden] {
  display: none;
}

.menu-panel a:hover,
.menu-panel button:hover {
  background: var(--color-surface);
}

.menu-panel .menu-logout {
  color: var(--color-text-muted);
  font-weight: 600;
  margin-top: var(--space-1);
  border-top: 1px solid var(--color-border);
  padding-top: 10px;
}

.app-main {
  padding: var(--space-4);
  max-width: 560px;
  margin: 0 auto;
}

/* Abstand zwischen den Abschnitten (z. B. Startseite: Nächster Termin,
   Weitere Termine, Neuigkeiten) - <section> hat sonst keinen Eigenabstand. */
.app-main > section {
  margin-bottom: var(--space-5);
}

.welcome-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow-card);
}

.welcome-card h2 {
  margin: 0 0 var(--space-1);
  font-size: 18px;
}

.welcome-card p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 14px;
}

.group-list {
  list-style: none;
  padding: 0;
  margin: var(--space-2) 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.group-list li {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
}

/* Admin-Bereich */

.app-main.wide {
  max-width: 900px;
}

.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-4);
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: var(--space-2) var(--space-3);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
}

.tab.active {
  color: var(--color-navy);
  border-bottom-color: var(--color-navy);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  gap: var(--space-3);
}

.section-head h2 {
  font-size: 18px;
  margin: 0;
  padding-left: 10px;
  border-left: 3px solid var(--color-navy);
}

.btn-secondary {
  padding: 10px 14px;
  border: 1px solid var(--color-navy);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-navy);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: var(--color-surface);
}

.btn-danger {
  background: none;
  border: none;
  color: var(--color-error);
  font-size: 14px;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-2);
}

.data-table td {
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-2);
  vertical-align: top;
}

.data-table tr:hover td {
  background: var(--color-surface);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.tag {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.tag.admin-tag {
  background: var(--color-navy);
  border-color: var(--color-navy);
  color: #fff;
}

.tag.group-tag {
  background: var(--color-royal-soft);
  border-color: var(--color-royal);
  color: var(--color-royal);
}

.empty-state {
  color: var(--color-text-muted);
  font-size: 14px;
  padding: var(--space-5) var(--space-3);
  text-align: center;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
}

/* Dialog */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 29, 41, 0.45);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-4) var(--space-3);
  overflow-y: auto;
  z-index: 10;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  position: relative;
  background: var(--color-bg);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  padding: var(--space-4);
  margin: auto;
}

.modal h3 {
  margin: 0 0 var(--space-4);
  padding-right: 36px;
  font-size: 18px;
}

/* Schließen-Kreuz, wird von nav-menu.js (addModalCloseButtons) eingefügt. */
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--color-text-muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover,
.modal-close:focus-visible {
  background: var(--color-surface);
  color: var(--color-text);
}

.modal-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  margin-top: var(--space-4);
}

.modal-actions .btn-primary {
  width: auto;
  padding: 10px 20px;
}

.field-hint {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.check-grid {
  display: grid;
  gap: var(--space-2);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: 14px;
}

.check-row input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
}

/* Umfragen: Zeile mit Text-Eingabe pro Antwortoption */

.option-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.option-row input[type="text"] {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
}

.option-row input[type="text"]:focus {
  background: var(--color-bg);
  border-color: var(--color-navy);
}

.perm-block {
  margin-bottom: var(--space-3);
}

.perm-block > h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-2);
}

.admin-toggle {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}

.toast {
  position: fixed;
  bottom: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-navy);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  display: none;
  z-index: 20;
  max-width: 90vw;
}

.toast.visible {
  display: block;
}

.nav-link {
  color: var(--color-navy);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  padding: var(--space-2);
}

@media (max-width: 640px) {
  .app-main {
    padding: var(--space-3);
  }
  .data-table th:nth-child(3),
  .data-table td:nth-child(3) {
    display: none;
  }
}

.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: ui-monospace, "Consolas", monospace;
  font-size: 13px;
  resize: vertical;
}

.field textarea:focus {
  background: var(--color-bg);
  border-color: var(--color-navy);
}

#log-area {
  margin-top: var(--space-3);
  max-height: 320px;
  overflow-y: auto;
}

.field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
}

.field select:focus {
  background: var(--color-bg);
  border-color: var(--color-navy);
}

/* Mitteilungen */

.news-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.news-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
}

.news-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.news-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
}

.news-card-body {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  margin: var(--space-2) 0 0;
}

.news-card-meta {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.news-card-actions {
  display: flex;
  gap: var(--space-1);
  flex-shrink: 0;
}

/* Dateien: Ordner-Übersicht (Gesamter Verein + ein Ordner pro Gruppe) */

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.folder-tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: var(--space-3);
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--color-text);
}

.folder-tile:hover {
  border-color: var(--color-navy);
}

/* Startseite: schmale Begrüßungsleiste (das ausführliche Profil mit Rolle
   und Gruppen steht seit der Profilseite dort, nicht mehr groß hier) */

.greeting-bar {
  background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-royal) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(54, 42, 114, 0.2);
}

/* Profilseite: Verlaufs-Begrüßungskarte */

.hero-card {
  background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-royal) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  box-shadow: 0 4px 16px rgba(54, 42, 114, 0.25);
}

.hero-card h2 {
  margin: 0 0 var(--space-1);
  font-size: 19px;
}

.hero-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
}

.hero-card .group-list li {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

/* Startseite: hervorgehobener nächster Termin */

.next-event-card {
  background: var(--color-rose-soft);
  border: 1px solid var(--color-navy);
  border-radius: var(--radius);
  padding: var(--space-4);
  box-shadow: 0 2px 10px rgba(200, 16, 46, 0.12);
}

.next-event-eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-navy);
}

.next-event-card h3 {
  margin: 0 0 var(--space-1);
  font-size: 17px;
}

/* Zu-/Absage direkt auf der Startseite - kleine runde Icon-Buttons statt
   der ausführlichen Buttons/Formulare auf der Kalenderseite. */

.rsvp-icons {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.rsvp-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--color-border);
  background: var(--color-bg);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rsvp-icon-btn.yes {
  color: #1a7a3c;
  border-color: #1a7a3c;
}

.rsvp-icon-btn.yes.active {
  background: #1a7a3c;
  color: #fff;
}

.rsvp-icon-btn.no {
  color: var(--color-error);
  border-color: var(--color-error);
}

.rsvp-icon-btn.no.active {
  background: var(--color-error);
  color: #fff;
}

/* Zu-/Absage-Ergebnisse (Pop-up auf der Kalenderseite) */

.rsvp-summary-counts {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.rsvp-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
}

.rsvp-count-badge.yes {
  background: #1a7a3c;
}

.rsvp-count-badge.no {
  background: var(--color-error);
}

.rsvp-name-list {
  font-size: 14px;
  margin: 0 0 var(--space-3);
}

.rsvp-name-row {
  padding: 4px 0;
  border-bottom: 1px solid var(--color-border);
}

.rsvp-name-row:last-child {
  border-bottom: none;
}

/* Kommentare auf Mitteilungen */

.comment-row {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}

.comment-row:last-child {
  border-bottom: none;
}

.comment-row .comment-text {
  margin: 2px 0 0;
}

/* Mitgliederverzeichnis/Ansprechpartner: kompakte Zeilen statt großer Karten,
   da die Liste lang werden kann. */

.list-section-heading {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-navy);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: var(--space-4) 0 var(--space-2);
  padding-left: 10px;
  border-left: 3px solid var(--color-navy);
}

.list-section-heading:first-child {
  margin-top: 0;
}

.member-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 12px var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.member-row-name {
  font-weight: 600;
  font-size: 14px;
}

.member-row-name-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
}

.member-row-name-btn:hover {
  color: var(--color-navy);
  text-decoration: underline;
}

.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #2fa84f;
  margin-left: 6px;
  vertical-align: middle;
}

/* Profilbilder (2026-09-06): rund zugeschnitten per object-fit, kein
   Cloudinary-Transform nötig - hält den Upload-Weg identisch zu den
   anderen Datei-Uploads (Dateien, Mitteilungs-Anhänge). */
.avatar-image {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.avatar-placeholder {
  border-radius: 50%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}

.avatar-image-sm {
  width: 32px;
  height: 32px;
}

.avatar-image-lg {
  width: 80px;
  height: 80px;
}

.member-row-role {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.member-row-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.member-row-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-navy);
  text-decoration: none;
}

/* Direktnachrichten */

.conversation-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 12px var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.conversation-row:hover {
  background: var(--color-bg);
  border-color: var(--color-navy);
}

.conversation-row.unread .conversation-row-name {
  font-weight: 700;
}

.conversation-row-name {
  font-weight: 600;
  font-size: 14px;
}

.conversation-row-preview {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.conversation-row-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-rose);
  flex-shrink: 0;
}

.thread-messages {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 55vh;
  overflow-y: auto;
  padding: var(--space-2) 2px;
  margin-bottom: var(--space-2);
}

.message-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-bubble.mine {
  align-self: flex-end;
  background: var(--color-navy);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message-bubble.theirs {
  align-self: flex-start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: 4px;
}

/* Gruppenchat: Name der schreibenden Person über fremden Nachrichten. */
.message-sender {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-royal);
  margin-bottom: 2px;
}

/* Zwischenüberschriften in der Nachrichtenliste (Gruppenchats / Direktnachrichten). */
.list-subhead {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: var(--space-3) 0 var(--space-2);
}

.message-meta {
  display: block;
  font-size: 10px;
  opacity: 0.75;
  margin-top: 4px;
}

.message-bubble.mine .message-delete {
  color: rgba(255, 255, 255, 0.75);
}

.message-delete {
  background: none;
  border: none;
  padding: 0;
  margin-left: 8px;
  font-size: 10px;
  text-decoration: underline;
  cursor: pointer;
  color: var(--color-text-muted);
}

/* Impressum/Datenschutz: normale Absatzabstände für lange Rechtstexte -
   .welcome-card setzt Absätze sonst ohne Abstand und gedämpft. Muss nach
   .welcome-card stehen (gleiche Spezifität, spätere Regel gewinnt). */
.legal-text p,
.legal-text ul {
  margin: 0 0 var(--space-3);
  color: var(--color-text);
  font-size: 15px;
  line-height: 1.55;
}

.legal-text ul {
  padding-left: 20px;
}

.legal-text li {
  margin-bottom: var(--space-1);
}

.legal-text h2 {
  font-size: 18px;
  margin: var(--space-4) 0 var(--space-2);
}

.legal-text h3 {
  font-size: 16px;
  margin: var(--space-3) 0 var(--space-1);
}

.legal-text .field-hint {
  color: var(--color-text-muted);
}

/* Gruppenseiten & Statistik (2026-11-03) */
.group-card {
  display: block;
  color: inherit;
  text-decoration: none;
}

.group-card h3 {
  margin: 0 0 var(--space-1);
}

.group-card-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.info-list {
  margin: var(--space-2) 0 0;
}

.info-list dt {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}

.info-list dd {
  margin: 2px 0 0;
  white-space: pre-line;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
}

.filter-row .field {
  margin-bottom: 0;
  min-width: 140px;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.stat-tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-3);
  min-width: 0;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-navy);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.stat-hint {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.table-scroll {
  overflow-x: auto;
  margin-bottom: var(--space-3);
}

.data-table .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.data-table td.amount-in {
  color: #2e7d4f;
}

.data-table td.amount-out {
  color: var(--color-rose);
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover td {
  background: var(--color-surface);
}

.field-pair {
  display: flex;
  gap: 12px;
}

.field-pair > div {
  flex: 1;
  min-width: 0;
}

.field-pair label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--color-text-muted);
}

.bar-cell {
  min-width: 90px;
}

.bar {
  height: 8px;
  border-radius: 4px;
  background: var(--color-navy);
  min-width: 2px;
}

.filter-actions button {
  width: auto;
}

/* Die allgemeine Handy-Regel oben blendet die 3. Tabellenspalte aus (für
   die Admin-Tabellen gedacht) - bei Kassenbuch und Statistik steht dort
   Wichtiges, deshalb hier wieder einblenden. */
@media (max-width: 640px) {
  .data-table.keep-cols th:nth-child(3),
  .data-table.keep-cols td:nth-child(3) {
    display: table-cell;
  }
}

/* Eigene display-Regeln schlagen das hidden-Attribut (siehe CLAUDE.md,
   Fallstricke) - ohne diese Zeilen sahen normale Mitglieder die Reiter
   Kassenbuch/Statistik auf der Gruppenseite. */
.tabs[hidden],
.stat-grid[hidden],
.member-list[hidden],
.news-list[hidden],
.filter-row[hidden],
.check-row[hidden] {
  display: none;
}

/* Rundnachricht (2026-11-03) */
.head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
}

.head-actions button {
  width: auto;
}

.broadcast-people {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-2);
  margin-top: var(--space-2);
}

/* Anwesenheit nach Gruppen aufklappbar (2026-11-04) */
.attendance-group {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: var(--space-2);
  padding: 0 var(--space-3);
}

.attendance-group summary {
  cursor: pointer;
  font-weight: 600;
  padding: var(--space-2) 0;
}

.attendance-group[open] summary {
  border-bottom: 1px solid var(--color-border);
}

/* Geburtstagsgruß auf der Startseite (2026-11-04) */
.birthday-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-royal) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  box-shadow: 0 4px 16px rgba(200, 16, 46, 0.25);
}

.birthday-card[hidden] {
  display: none;
}

.birthday-card h2 {
  margin: 0 0 var(--space-2);
  font-size: 20px;
  position: relative;
}

.birthday-card p {
  margin: 0;
  line-height: 1.5;
  position: relative;
}

/* Runde Geburtstage: goldener Rand und Konfetti im Hintergrund */
.birthday-card-round {
  border: 2px solid #f2c94c;
  background:
    radial-gradient(circle at 3% 6%, #f2c94c 0 3px, transparent 4px),
    radial-gradient(circle at 97% 5%, #ffffff 0 3px, transparent 4px),
    radial-gradient(circle at 97% 95%, #f2c94c 0 4px, transparent 5px),
    radial-gradient(circle at 2% 96%, #ffffff 0 2px, transparent 3px),
    radial-gradient(circle at 55% 3%, #9fe0c0 0 3px, transparent 4px),
    radial-gradient(circle at 40% 98%, #ffffff 0 2px, transparent 3px),
    linear-gradient(135deg, var(--color-navy) 0%, var(--color-royal) 100%);
}

.birthday-card-round h2 {
  font-size: 22px;
  animation: birthday-pop 0.8s ease-out;
}

@keyframes birthday-pop {
  0% { transform: scale(0.85); opacity: 0; }
  60% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .birthday-card-round h2 {
    animation: none;
  }
}

/* "Weitere Termine laden" im Kalender (2026-11-05) */
.load-more-btn { display: block; width: 100%; margin: 12px 0 4px; }

/* Administration als Kachel-Übersicht (2026-11-06) */
.admin-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.admin-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: var(--space-3);
  text-align: left;
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  cursor: pointer;
}
.admin-tile strong { color: var(--color-navy); font-size: 1rem; }
.admin-tile span { color: var(--color-text-muted); font-size: 0.85rem; font-weight: normal; }
.admin-tile:hover { border-color: var(--color-navy); }
.admin-tile.active { border-color: var(--color-navy); box-shadow: inset 4px 0 0 var(--color-navy), var(--shadow-card); }
.admin-tile-count {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--color-error);
  color: #fff;
  font-style: normal;
  font-size: 0.8rem;
  text-align: center;
}
.admin-tile-count[hidden] { display: none; }
.admin-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
  border-radius: var(--radius);
  background: var(--color-error-soft);
  color: var(--color-error);
  font-weight: 600;
}
.admin-alert[hidden] { display: none; }
.admin-alert button { width: auto; }
@media (max-width: 640px) {
  .admin-tiles { grid-template-columns: 1fr 1fr; }
  .admin-tile span { display: none; }
}

/* Familien-Konten (2026-11-11) */
.account-switch {
  padding: var(--space-2) var(--space-3);
  margin: calc(-1 * var(--space-2)) calc(-1 * var(--space-2)) var(--space-2);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}
.account-switch-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); margin-bottom: 4px; }
.account-switch-item, .account-switch-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 0;
  background: none;
  border: none;
  color: var(--color-navy);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.account-switch-item.active { font-weight: 700; cursor: default; }
.account-switch-logout { color: var(--color-text-muted); font-size: 0.85rem; }
.menu-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-error); display: inline-block; }
.menu-dot[hidden] { display: none; }
.family-picker { max-height: 50vh; overflow-y: auto; border: 1px solid var(--color-border); border-radius: var(--radius); }
.family-picker-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--color-border); }
.family-picker-row select { width: auto; }

/* Kontowechsel in der Kopfzeile (2026-11-11) */
.header-account {
  position: relative;
  display: inline-flex;
  align-items: center;
  max-width: 120px;
  padding: 4px 10px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg);
  color: var(--color-navy);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.header-account-name { overflow: hidden; text-overflow: ellipsis; }
.account-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  min-width: 210px;
  margin: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  background: var(--color-bg);
}
.account-panel[hidden] { display: none; }
@media (max-width: 400px) {
  .header-account { max-width: 84px; padding: 4px 8px; }
}

/* Konto mit Passwort hinzufügen (2026-11-16) */
.account-add { display: flex; flex-direction: column; gap: 6px; padding: 4px 0 8px; }
.account-add[hidden] { display: none; }
.account-add input { width: 100%; padding: 6px 8px; font: inherit; }
.account-add .btn-primary { padding: 6px 10px; }
.account-add-error { color: var(--color-error); font-size: 0.85rem; }
.account-add-error[hidden] { display: none; }
.account-add-hint { color: var(--color-text-muted); font-size: 0.75rem; }

/* ---------- Einrichtungs-Assistent (Vereinsheim, 2026-11-26) ---------- */
.setup-body { margin: 0; background: var(--color-surface); color: var(--color-text); }
.setup-shell { max-width: 640px; margin: 0 auto; padding: var(--space-4) var(--space-3) var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.setup-head { display: flex; flex-direction: column; gap: var(--space-2); }
.setup-brand { display: flex; align-items: center; gap: var(--space-2); font-weight: 700; font-size: 18px; }
.setup-logo { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: var(--color-bg); border: 1px solid var(--color-border); }
.setup-progress { height: 6px; border-radius: 3px; background: var(--color-border); overflow: hidden; }
.setup-progress span { display: block; height: 100%; width: 0; background: var(--color-navy); border-radius: 3px; transition: width 0.4s ease; }
.setup-step-label { margin: 0; font-size: 14px; color: var(--color-text-muted); }
.setup-card { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 16px; padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); }
.setup-card h1 { margin: 0; font-size: 24px; color: var(--color-text); }
.setup-card h2 { margin: var(--space-3) 0 0; font-size: 17px; }
.setup-lead { margin: 0 0 var(--space-2); color: var(--color-text-muted); line-height: 1.5; }
.setup-card .field input[type="email"], .setup-card .field input[type="file"], .setup-card .field textarea {
  width: 100%; box-sizing: border-box; padding: 10px 12px; font: inherit; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-bg); color: var(--color-text);
}
.setup-card .field input[type="color"] { width: 64px; height: 44px; padding: 2px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-bg); }
.setup-slug-state { min-height: 1.4em; margin-top: calc(-1 * var(--space-1)); }
.setup-check { align-items: flex-start; gap: var(--space-2); margin-top: var(--space-2); }
.setup-nav { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); }
.setup-next { width: auto; min-width: 160px; min-height: 48px; }
.setup-foot { margin: 0; text-align: center; font-size: 13px; color: var(--color-text-muted); }
.setup-logo-row, .setup-color-row { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: center; }
.setup-logo-preview { width: 120px; height: 120px; border-radius: 24px; object-fit: cover; border: 1px solid var(--color-border); background: var(--color-surface); }
.setup-swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: var(--space-2); max-width: 280px; }
.setup-swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--color-bg); box-shadow: 0 0 0 1px var(--color-border); cursor: pointer; }
.setup-swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--color-text); }
.setup-phone { width: 220px; border-radius: 28px; background: #13201B; padding: 8px; }
.setup-phone-head { display: flex; align-items: center; gap: 8px; padding: 16px 12px 12px; border-radius: 22px 22px 0 0; color: #fff; transition: background 0.4s ease; }
.setup-phone-head img { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; background: #fff; }
.setup-phone-head strong { font-size: 13px; line-height: 1.2; }
.setup-phone-body { background: #F4F6F5; border-radius: 0 0 22px 22px; padding: 12px; }
.setup-phone-card { background: #fff; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #14201C; }
.setup-phone-btn { margin-top: 4px; text-align: center; color: #fff; border-radius: 8px; padding: 6px; font-weight: 700; transition: background 0.4s ease; }
.setup-options { display: flex; flex-direction: column; gap: var(--space-2); }
.setup-option { display: flex; flex-direction: column; gap: 4px; padding: var(--space-3); border: 1px solid var(--color-border); border-radius: 12px; text-decoration: none; color: var(--color-text); }
a.setup-option:hover { border-color: var(--color-navy); }
.setup-option span { color: var(--color-text-muted); font-size: 14px; }
.setup-option-soon { opacity: 0.7; }
@media (max-width: 480px) { .setup-card { padding: var(--space-3); } .setup-next { min-width: 0; flex: 1; } }

/* Zugangsbriefe (Vereinsheim, 2026-11-28) */
.invites-list { display: grid; gap: 4px; max-height: 420px; overflow-y: auto; border: 1px solid var(--color-border); border-radius: 10px; padding: 8px; }
.invites-list label { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.invites-list label:hover { background: var(--color-surface); }
.invites-list .invite-state { margin-left: auto; font-size: 13px; color: var(--color-text-muted); }

/* Beitragsstufen in der Einrichtung (Vereinsheim, 2026-11-28) */
.fee-editor { display: flex; flex-direction: column; gap: 6px; }
.fee-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fee-row input { padding: 8px 10px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-bg); color: var(--color-text); font: inherit; }
.fee-row .fee-label { flex: 1 1 160px; min-width: 0; }
.fee-row .fee-label-text { flex: 1 1 160px; font-weight: 600; }
.fee-row .fee-under { width: 64px; }
.fee-row .fee-amount { width: 92px; text-align: right; }
.fee-row .fee-unit, .fee-row .fee-under-wrap { font-size: 14px; color: var(--color-text-muted); white-space: nowrap; }
.fee-row .fee-remove { padding: 4px 8px; }
.fee-editor[hidden], .fee-row[hidden] { display: none; }

/* Anleitungen & Dokumente (Vereinsheim, 2026-11-28) */
.doc-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.doc-link { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: 10px; color: var(--color-text); text-decoration: none; font-weight: 600; }
.doc-link:hover { background: var(--color-surface); }
.doc-link::after { content: "↗"; color: var(--color-text-muted); font-weight: 400; }
.doc-meta { margin-left: auto; font-weight: 400; font-size: 13px; color: var(--color-text-muted); }
