/* ===================================================================
   MVRO Mitgliederverwaltung – Main Stylesheet
   Colors: Primary #7a0f1b · Dark #5a0b13 · Secondary #f8ecee
           Accent #c89a1c · Text #1a1a1a · Border #d2ddec · BG #f2f5fa
   =================================================================== */

/* ===================== VARIABLES ===================== */
:root {
  color-scheme: light dark;
  --primary: #7a0f1b;
  --primary-dark: #5a0b13;
  --secondary: #f8ecee;
  --accent: #c89a1c;
  --text: #1a1a1a;
  --border: #d2ddec;
  --bg: #f2f5fa;
  --surface: #ffffff;
  --shadow: rgba(11, 47, 90, 0.1);
  --shadow-btn: rgba(122, 15, 27, 0.2);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --t: 0.17s ease;

  /* Text (gray scale) */
  --text-strong: #1f2937;
  --text-secondary: #374151;
  --text-tertiary: #4b5563;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --border-muted: #d1d5db;
  --surface-alt: #f1f5f9;

  /* Status colors */
  --danger: #dc3545;
  --danger-hover: #dc2626;
  --danger-dark: #b91c1c;
  --danger-bg: #fee2e2;
  --danger-border: #fecaca;
  --success: #15803d;
  --success-bg: #dcfce7;
  --success-border: #bbf7d0;
  --warn: #a16207;
  --warn-bg: #fef9c3;
  --warn-border: #fde047;
  --neutral: #6c757d;
  --neutral-hover: #5a6268;

  /* Vorwärtstext-Variante von --primary: in Hell identisch, im Dark-Mode-Block
     unten aufgehellt, damit auch dunkle Vereinsfarben auf dunklem Grund lesbar
     bleiben (--primary selbst bleibt für Flächen/Buttons unverändert). */
  --primary-fg: var(--primary);

  /* Markenabhängige, aber themenfeste Flächentöne. Ersetzen vormals fixe
     Pastellfarben, damit sie sich automatisch an Vereinsfarbe und Dark Mode
     anpassen. */
  --tint-primary-weak: color-mix(in srgb, var(--primary) 8%, var(--surface));
  --tint-primary-medium: color-mix(in srgb, var(--primary) 14%, var(--surface));
  --tint-primary-strong: color-mix(in srgb, var(--primary) 22%, var(--surface));
  --tint-accent-weak: color-mix(in srgb, var(--accent) 16%, var(--surface));

  /* Abstands-Skala */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 2rem;
  --space-8: 3rem;

  /* Typografie-Skala */
  --fs-xs: 0.75rem;
  --fs-sm: 0.85rem;
  --fs-base: 0.9375rem;
  --fs-md: 1rem;
  --fs-lg: 1.15rem;
  --fs-xl: 1.4rem;
  --fs-2xl: 1.7rem;
  --fs-3xl: 2rem;

  /* Elevation */
  --shadow-sm: 0 1px 3px var(--shadow);
  --shadow-md: 0 4px 20px var(--shadow);
  --shadow-lg: 0 14px 40px var(--shadow);
}

/* ===================== DARK MODE ===================== */
/* Automatisch nach Systemeinstellung, kein manueller Umschalter. Header,
   Buttons und aktive Tabs behalten die Vereinsfarbe als Fläche (Marke bleibt
   in beiden Themes erkennbar) – nur Seiten-Chrome (Hintergrund/Karten/Text/
   Status-Flächen) wechselt auf Dunkel. Diese Werte sind bewusst fest verdrahtet
   (nicht Tenant-abhängig wie --primary/--accent), da sie reines UI-Chrome sind. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --surface: #1c2027;
    --surface-alt: #262b34;
    --border: #333a46;
    --border-muted: #3a4150;
    --shadow: rgba(0, 0, 0, 0.45);

    --text: #e7e9ee;
    --text-strong: #f1f2f5;
    --text-secondary: #d3d7de;
    --text-tertiary: #b6bcc8;
    --text-muted: #939bab;
    --text-faint: #6b7280;

    --danger: #f04b5c;
    --danger-hover: #f66;
    --danger-dark: #ffb4bb;
    --danger-bg: #3a1a1f;
    --danger-border: #6b2530;
    --success: #4ade80;
    --success-bg: #17301f;
    --success-border: #285238;
    --warn: #facc15;
    --warn-bg: #332a0e;
    --warn-border: #5c4a17;
    --neutral: #7a8794;
    --neutral-hover: #8e9aa6;

    --primary-fg: color-mix(in srgb, var(--primary) 45%, white);
  }
}

/* ===================== RESET & BASE ===================== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Poppins", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 15px;
}

a {
  color: var(--primary-fg);
}

/* Generischer Fokus-Ring für Tastaturnutzung, sofern eine Komponente keinen
   eigenen definiert (Buttons/Kacheln/Header-Icons haben spezifischere Regeln). */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

p {
  margin: 0 0 0.6rem;
}

/* ===================== HEADER ===================== */
.site-header {
  background:
    radial-gradient(
      ellipse 480px 120px at 12% -40%,
      rgba(255, 255, 255, 0.16),
      transparent 70%
    ),
    linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.18);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}

.logo:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.logo img {
  height: 38px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}

/* Logout */
.logout {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-shrink: 0;
}

.logout form {
  margin: 0;
}

.logout button {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 0.38rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  transition: background var(--t);
}

.logout button:hover {
  background: rgba(255, 255, 255, 0.22);
}

.logout button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .logo span {
    font-size: 0.88rem;
  }
}

/* ===================== LAYOUT ===================== */
.container {
  padding: 2rem 2.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

@media (max-width: 700px) {
  .container {
    padding: 1rem;
  }
}

/* ===================== APP SHELL / SIDEBAR (Desktop only) =====================
   Zeigt innerhalb eines Moduls die anderen Module derselben Kategorie zum
   schnellen Wechseln an. Auf dem Handy bleibt das Layout unverändert – die
   Sidebar existiert dort schlicht nicht (display: none), damit auf schmalen
   Bildschirmen kein Platz verloren geht. */
.app-shell {
  display: block;
}

.app-sidebar {
  display: none;
}

@media (min-width: 960px) {
  .app-shell {
    display: flex;
    align-items: flex-start;
  }

  .app-shell .container {
    flex: 1;
    min-width: 0;
  }

  .app-sidebar {
    display: flex;
    flex-direction: column;
    width: 230px;
    flex-shrink: 0;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1rem 0.75rem;
    transition: width var(--t);
  }

  .app-sidebar.collapsed {
    width: 56px;
    padding: 1rem 0.5rem;
  }

  .sidebar-toggle {
    align-self: flex-end;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition:
      background var(--t),
      transform var(--t);
  }

  .sidebar-toggle:hover {
    background: var(--surface-alt);
  }

  .sidebar-toggle .ic {
    width: 16px;
    height: 16px;
  }

  .app-sidebar.collapsed .sidebar-toggle {
    align-self: center;
    transform: rotate(180deg);
  }

  .sidebar-category-label {
    margin: 0.75rem 0.25rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
  }

  .app-sidebar.collapsed .sidebar-category-label {
    text-align: center;
  }

  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
  }

  .sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.6rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
    transition:
      background var(--t),
      color var(--t);
  }

  .sidebar-link .ic {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  .sidebar-link:hover {
    background: var(--surface-alt);
  }

  .sidebar-link.active {
    background: var(--secondary);
    color: var(--primary);
    font-weight: 600;
  }

  .sidebar-link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
  }

  .app-sidebar.collapsed .sidebar-link {
    justify-content: center;
  }

  .app-sidebar.collapsed .sidebar-link-label {
    display: none;
  }
}

/* ===================== CARDS ===================== */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

/* ===================== TYPOGRAPHY ===================== */
h1 {
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--primary-fg);
  margin: 0 0 0.5rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h2 {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--primary-fg);
  margin: 0 0 0.9rem;
}

h3 {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--primary-fg);
  margin: 0 0 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--tint-primary-medium);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ===================== TOOLBAR ===================== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.toolbar form {
  margin: 0;
}

.toolbar .button,
.toolbar .dropdown summary.button {
  height: 40px;
  padding: 0 1.15rem;
  font-size: 0.875rem;
}

/* ===================== STATUS TABS ===================== */
.status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.tab {
  padding: 0.35rem 0.9rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--tint-primary-medium);
  color: var(--primary-fg);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  transition:
    background var(--t),
    color var(--t),
    box-shadow var(--t);
  border: 1.5px solid transparent;
}

.tab:hover {
  background: var(--tint-primary-strong);
}

.tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 3px 10px var(--shadow-btn);
  border-color: var(--primary-dark);
}

/* ===================== BUTTONS ===================== */
.button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: #fff;
  padding: 0.52rem 1.15rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: none;
  font-weight: 600;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 3px 10px var(--shadow-btn);
  transition:
    filter var(--t),
    transform var(--t),
    box-shadow var(--t);
  white-space: nowrap;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.button:hover,
.btn:hover {
  filter: brightness(1.09);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--shadow-btn);
}

.button:active,
.btn:active {
  transform: translateY(0);
  filter: brightness(0.97);
}

.button:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* secondary */
.button.button-secondary,
.btn-secondary {
  background: var(--neutral);
  box-shadow: none;
}
.button.button-secondary:hover,
.btn-secondary:hover {
  background: var(--neutral-hover);
  box-shadow: none;
  filter: none;
}

/* danger */
.btn-danger,
.button[style*="dc3545"],
.button[style*="#dc3545"] {
  background: var(--danger) !important;
  box-shadow: 0 3px 10px rgba(220, 53, 69, 0.22);
}
.btn-danger:hover {
  background: #b91c2c !important;
  box-shadow: 0 5px 14px rgba(220, 53, 69, 0.3);
  filter: none;
}

.btn-sm {
  padding: 0.42rem 0.85rem;
  font-size: 0.85rem;
  border-radius: 6px;
  box-shadow: none;
}

/* Quadratische, touch-freundliche Icon-Buttons (z. B. Aktionen in Tabellenzeilen).
   Einheitliche Größe für alle Symbole, ~44px Tap-Fläche. Kombiniert mit
   .btn + .btn-secondary/.btn-danger (Farbe & zentrierte Ausrichtung). */
.icon-btn {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
  border-radius: var(--radius-sm);
  box-shadow: none;
}
/* Gruppe gleich großer Aktions-Icons; bricht erst bei <2 Spalten um. */
.icon-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  justify-content: flex-end;
  min-width: 5.95rem;
}

/* Einfarbige Linien-Icons (erben die Textfarbe über currentColor) – einheitliche
   Optik statt bunter Emoji. Strich/Füllung hier zentral, damit die Sprite-Symbole
   schlank bleiben. */
.ic,
.ic-inline {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.ic {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
}
/* Variante für Icons inline neben Text (em-basiert → skaliert mit der Schrift). */
.ic-inline {
  width: 1.05em;
  height: 1.05em;
  display: inline-block;
  vertical-align: -0.15em;
  margin-right: 0.4em;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

/* ===================== DROPDOWN ===================== */
.dropdown {
  position: relative;
}

.dropdown summary.button {
  list-style: none;
  cursor: pointer;
}
.dropdown summary.button::-webkit-details-marker {
  display: none;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.35rem;
  min-width: 155px;
  display: none;
  flex-direction: column;
  gap: 0.15rem;
  box-shadow: var(--shadow-md);
  z-index: 10;
}

.dropdown[open] .dropdown-menu {
  display: flex;
}

.dropdown-menu a {
  text-decoration: none;
  color: var(--text);
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  transition:
    background var(--t),
    color var(--t);
}

.dropdown-menu a:hover {
  background: var(--tint-primary-weak);
  color: var(--primary-fg);
}

/* ===================== FORMS ===================== */
.form {
  display: grid;
  gap: 1rem;
}

.form.grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

input,
select,
textarea {
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition:
    border-color var(--t),
    box-shadow var(--t);
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

input:hover:not(:focus),
select:hover:not(:focus),
textarea:hover:not(:focus) {
  border-color: var(--border-muted);
}

select[multiple] {
  min-height: 120px;
}

textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.55;
}

/* filter bar */
.filter-bar {
  background: linear-gradient(
    135deg,
    var(--surface) 0%,
    var(--tint-primary-weak) 100%
  );
  border: 1px solid var(--tint-primary-strong);
}

.filter-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem 1.5rem;
  align-items: end;
}

.filter-group label {
  font-weight: 600;
}

.filter-actions {
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
  align-self: end;
}

.filter-actions .button {
  height: 38px;
  padding: 0 1rem;
}

/* form-group (legacy) */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
}

.form-group small {
  display: block;
  margin-top: 0.3rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  font-weight: 500;
  color: var(--text);
}

/* Checkboxen/Radios sollen nicht auf volle Breite wachsen (globale input-Regel) */
.checkbox input[type="checkbox"],
.checkbox input[type="radio"] {
  width: auto;
  flex-shrink: 0;
}

/* ===================== TABLES ===================== */
table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th {
  background: var(--tint-primary-weak);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--primary-fg);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

tbody tr {
  transition: background var(--t);
}
tbody tr:hover {
  background: var(--tint-primary-weak);
}
tbody tr:last-child td {
  border-bottom: none;
}

tbody td a {
  color: var(--primary-fg);
  text-decoration: none;
  font-weight: 600;
}
tbody td a:hover {
  text-decoration: underline;
}

/* .table alias */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th {
  background: var(--tint-primary-weak);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--primary-fg);
}

/* admin users table */
.admin-users-card {
  padding: 1.5rem 1.75rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.admin-users-table {
  width: 100%;
}

.admin-users-table th,
.admin-users-table td {
  vertical-align: top;
}

.admin-users-table td {
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.admin-users-table thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
}

.admin-users-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* ===================== MEMBER DETAIL ===================== */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

.tag-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.tag {
  background: var(--tint-primary-medium);
  color: var(--primary-fg);
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.honor-box {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--tint-primary-weak);
  border: 1px solid var(--tint-primary-strong);
  font-size: 0.9rem;
}

.honor-box.eligible {
  background: var(--tint-accent-weak);
  border-color: var(--accent);
}

/* ===================== ALERTS ===================== */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  /* default: error-like */
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-dark);
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger-dark);
  border: 1px solid var(--danger-border);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

/* ===================== STATUS PILLS ===================== */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  gap: 0.3rem;
  line-height: 1;
  white-space: nowrap;
}

.status-ok {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.status-wait {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid var(--warn-border);
}

.status-danger {
  background: var(--danger-bg);
  color: var(--danger-dark);
  border: 1px solid var(--danger-border);
}

.status-muted {
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border-muted);
}

/* ===================== PERMISSIONS & INLINE CHECKS ===================== */
.inline-check {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  font-weight: 600;
  color: var(--text-strong);
}

.inline-check input:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}
.inline-check input:disabled + span {
  opacity: 0.6;
}

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 1.2rem;
}

/* ===================== TEAMS LEADER ===================== */
.teams-leader-form label {
  gap: 0.35rem;
}
.teams-leader-list {
  display: grid;
  gap: 0.75rem;
}

.teams-leader-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(280px, 2fr) auto;
  gap: 1rem;
  align-items: end;
}

.teams-leader-row .team-name {
  font-weight: 700;
}
.teams-leader-row .team-leader-select select {
  min-width: 260px;
}

.teams-leader-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 1rem;
}

/* ===================== BIRTHDAY GRID ===================== */
.birthday-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.birthday-card {
  background: var(--tint-accent-weak);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  min-height: 220px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--surface));
}

.birthday-card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--primary-fg);
  border-bottom: none;
  padding-bottom: 0;
  font-size: 0.92rem;
  text-transform: none;
  letter-spacing: 0;
}

.birthday-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.35rem;
}

.birthday-card li {
  display: grid;
  grid-template-columns: 2.5rem 1fr 2rem;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.88rem;
}

.birthday-card .day {
  font-weight: 700;
  color: var(--primary-fg);
}
.birthday-card .age {
  text-align: right;
  font-weight: 700;
  color: var(--accent);
}
.birthday-card .empty {
  color: var(--text-faint);
  font-style: italic;
  font-size: 0.82rem;
}

/* ===================== LOGIN PAGE ===================== */
body.login-page > main.container {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: radial-gradient(
    ellipse at 60% 30%,
    var(--tint-primary-weak) 0%,
    transparent 70%
  );
}

.login-card {
  width: 100%;
  max-width: 420px;
  margin: 0;
  padding: 2.25rem 2rem;
}

.login-hero {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-hero-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--tint-primary-medium);
  color: var(--primary-fg);
  margin-bottom: 0.85rem;
}

.login-hero-icon svg {
  width: 30px;
  height: 30px;
}

.login-hero h1 {
  font-size: 1.35rem;
  margin: 0;
}

.login-hero p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.2rem 0 0;
}

.login-footer {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.login-footer a {
  color: var(--primary-fg);
  font-weight: 600;
}

/* ===================== STAT CARDS (Dashboard) ===================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.stat-value {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1;
  color: var(--primary-fg);
  font-variant-numeric: tabular-nums;
}

.stat-value--accent {
  color: var(--accent);
}
.stat-value--muted {
  color: var(--text-faint);
}

.stat-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-event-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-fg);
  line-height: 1.3;
  margin-top: 0.15rem;
}

.stat-event-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* ===================== RSVP ICON BUTTONS ===================== */
.rsvp-toggle {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.rsvp-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--border-muted);
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0;
  transition:
    background var(--t),
    border-color var(--t),
    color var(--t),
    transform var(--t);
  line-height: 1;
}

.rsvp-icon-btn:hover {
  transform: scale(1.15);
}

.rsvp-icon-btn-yes:hover,
.rsvp-icon-btn-yes.active {
  background: var(--success-bg);
  border-color: #16a34a;
  color: var(--success);
}

.rsvp-icon-btn-maybe:hover,
.rsvp-icon-btn-maybe.active {
  background: var(--warn-bg);
  border-color: var(--warn);
  color: var(--warn);
}

.rsvp-icon-btn-no:hover,
.rsvp-icon-btn-no.active {
  background: var(--danger-bg);
  border-color: var(--danger-hover);
  color: var(--danger-dark);
}

/* Auf dem Handy größere, gut tippbare Buttons */
@media (max-width: 640px) {
  .rsvp-icon-btn {
    width: 44px;
    height: 44px;
    font-size: 1.3rem;
  }
  .rsvp-toggle {
    gap: 0.75rem;
  }
}

/* RSVP-Zusammenfassungsbalken (zugesagt / vielleicht / abgesagt / offen) */
.rsvp-bar-link {
  display: block;
  margin-top: 0.45rem;
  border-top: 1px solid var(--surface-alt);
  padding-top: 0.45rem;
  text-decoration: none;
}

.rsvp-bar-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.rsvp-bar-date {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 2.7rem;
  flex-shrink: 0;
}

.rsvp-bar {
  display: flex;
  flex: 1;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-alt);
}

.rsvp-bar-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  min-width: 1.4rem;
  overflow: hidden;
}

.rsvp-seg-yes {
  background: #22a559;
}
.rsvp-seg-maybe {
  background: #eab308;
}
.rsvp-seg-no {
  background: #f06a6a;
}
.rsvp-seg-open {
  background: var(--border-muted);
  color: var(--text-tertiary);
}

.rsvp-bar-legend {
  font-size: 0.7rem;
  color: #2563eb;
  margin-top: 0.15rem;
}

/* ===================== AGENDA / TERMINLISTE ===================== */
.agenda-month {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-fg);
  margin: 1.5rem 0 0.6rem;
  text-transform: capitalize;
}
.agenda-month:first-of-type {
  margin-top: 0;
}

.agenda {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.agenda-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
  box-shadow: var(--shadow-sm);
}

.agenda-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 58px;
  flex-shrink: 0;
  text-align: center;
}

.agenda-weekday {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
  background: var(--primary);
  border-radius: 5px;
  padding: 0.08rem 0.5rem;
}
.agenda-weekday.is-sunday {
  background: var(--danger-hover);
}

.agenda-day {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-strong);
}
.agenda-month-short {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: -0.15rem;
}
.agenda-time {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 0.15rem;
}

.agenda-body {
  flex: 2 1 200px;
  min-width: 0;
}
.agenda-title {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text-strong);
}
.agenda-rsvp {
  margin-top: 0.5rem;
}

.agenda-bar-link {
  flex: 3 1 220px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-decoration: none;
}
.agenda-bar-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: right;
}

/* ===================== CALENDAR GRID ===================== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.calendar-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.calendar-card h3 {
  margin-top: 0;
  margin-bottom: 0.6rem;
  color: var(--primary-fg);
  border-bottom: 2px solid var(--tint-primary-medium);
  padding-bottom: 0.4rem;
  font-size: 0.88rem;
}

.calendar-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

.calendar-card li {
  display: grid;
  gap: 0.2rem;
  padding: 0.5rem 0.5rem 0.5rem 0.85rem;
  border-bottom: 1px solid var(--surface-alt);
  border-left: 3px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition:
    border-color var(--t),
    background var(--t);
  margin-left: -0.5rem;
}

.calendar-card li:hover {
  border-left-color: var(--primary);
  background: var(--tint-primary-weak);
}

.calendar-card li:last-child {
  border-bottom: none;
}

.calendar-date {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.875rem;
}

.calendar-time {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.85rem;
}
.calendar-location {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.calendar-description {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.calendar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.calendar-audience-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* ── RSVP multi-day layout ── */
.rsvp-multiday {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.rsvp-day {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.rsvp-day-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 72px;
  padding-top: 0.1rem;
}

.rsvp-day-members {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.rsvp-member-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.rsvp-member-name {
  font-size: 0.78rem;
  color: var(--text-muted);
  min-width: 100px;
  flex-shrink: 0;
}

.rsvp-btns {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

/* ===================== PROFILE LAYOUT ===================== */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 640px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
}

/* ===================== EMPTY STATE ===================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-faint);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 0.75rem;
  opacity: 0.45;
  color: var(--text-faint);
}

.empty-state p {
  font-size: 0.9rem;
  margin: 0;
}

/* ===================== GLOBAL SEARCH ===================== */
/* Auf dem Handy im Hauptmenü sichtbar; ab Desktop-Breite übernimmt stattdessen
   die Suche in der Kopfzeile (.header-search in partials/header.ejs). */
.dashboard-search {
  margin-bottom: 1.75rem;
}

.dashboard-search .search-form {
  max-width: 480px;
}

@media (min-width: 701px) {
  .dashboard-search {
    display: none;
  }
}

.search-form {
  display: flex;
  gap: 0.6rem;
}

.search-form input[type="search"] {
  flex: 1;
}

.search-result-group h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-result-count {
  margin-left: auto;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: normal;
}

.search-result-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.search-result-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: background var(--t);
}

.search-result-item:hover {
  background: var(--tint-primary-medium);
}

.search-result-title {
  font-weight: 600;
}

.search-result-subtitle {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.search-result-more {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

/* ===================== PRINT LOGO ===================== */
.print-logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 0.5rem;
}

.print-logo img {
  height: 32px;
  width: auto;
  display: block;
}

/* ===================== HEADER SEARCH (Desktop only, siehe .dashboard-search
   für die Handy-Variante im Hauptmenü) ===================== */
.header-search {
  display: none;
  flex: 1;
  align-items: center;
  gap: 0.25rem;
  max-width: 380px;
  margin: 0 1.5rem;
  padding: 0 0.3rem 0 1rem;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  transition: background var(--t);
}

.header-search:focus-within {
  background: rgba(255, 255, 255, 0.22);
}

.header-search input[type="search"] {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  padding: 0.45rem 0;
  color: #fff;
  box-shadow: none;
}

.header-search input[type="search"]::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.header-search input[type="search"]:focus {
  outline: none;
  box-shadow: none;
}

.header-search button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  transition: background var(--t);
}

.header-search button:hover {
  background: rgba(255, 255, 255, 0.16);
}

.header-search button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

@media (min-width: 701px) {
  .header-search {
    display: flex;
  }
}

/* ===================== HEADER ACTIONS (simplified nav) ===================== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.home-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  transition:
    background var(--t),
    color var(--t);
  flex-shrink: 0;
}

.home-btn svg {
  width: 22px;
  height: 22px;
}

.home-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.home-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  transition:
    background var(--t),
    color var(--t);
  white-space: nowrap;
  overflow: hidden;
  max-width: 220px;
}

.header-user span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-user:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.header-user:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .header-user span {
    display: none;
  }
  .logo span {
    display: none;
  }
}

/* ===================== DASHBOARD / TILE GRID ===================== */
.dashboard {
  padding-top: 0.5rem;
}

.dashboard-greeting {
  font-size: 1rem;
  color: var(--text-tertiary);
  margin-bottom: 1.75rem;
}

.tile-section {
  margin-bottom: 2.25rem;
}

.tile-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 0.9rem;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.25rem;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 1.75rem 1rem 1.5rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  transition:
    transform var(--t),
    box-shadow var(--t),
    border-color var(--t);
  min-height: 148px;
  text-align: center;
  animation: tile-in 0.35s ease backwards;
}

.tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--tint-primary-strong);
}

.tile:active {
  transform: translateY(0);
}

.tile:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Kacheln fallen dezent gestaffelt ein statt alle gleichzeitig zu erscheinen. */
@keyframes tile-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tile-grid .tile:nth-child(1) {
  animation-delay: 0.02s;
}
.tile-grid .tile:nth-child(2) {
  animation-delay: 0.06s;
}
.tile-grid .tile:nth-child(3) {
  animation-delay: 0.1s;
}
.tile-grid .tile:nth-child(4) {
  animation-delay: 0.14s;
}
.tile-grid .tile:nth-child(5) {
  animation-delay: 0.18s;
}
.tile-grid .tile:nth-child(n + 6) {
  animation-delay: 0.2s;
}

@media (prefers-reduced-motion: reduce) {
  .tile {
    animation: none;
  }
}

.tile-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
}

.tile-icon svg {
  width: 30px;
  height: 30px;
}

/* colour variants */
.tile-icon--primary {
  background: var(--tint-primary-medium);
  color: var(--primary-fg);
}

.tile-icon--accent {
  background: var(--tint-accent-weak);
  color: color-mix(in srgb, var(--accent) 65%, var(--text-strong));
}

.tile-icon--neutral {
  background: var(--surface-alt);
  color: var(--text-tertiary);
}

.tile-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.3;
}

.settings-back {
  margin-bottom: 1.25rem;
}

.settings-back a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--primary-fg);
  text-decoration: none;
}

.settings-back a:hover {
  text-decoration: underline;
}

.tile-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

@media (max-width: 480px) {
  .tile-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.9rem;
  }
  .tile {
    min-height: 130px;
    padding: 1.25rem 0.75rem 1.1rem;
  }
  .tile-icon {
    width: 50px;
    height: 50px;
  }
  .tile-icon svg {
    width: 26px;
    height: 26px;
  }
}

/* ===================== MOBILE RESPONSIVE ===================== */
@media (max-width: 700px) {
  /* Card: weniger Padding, kein horizontaler Überlauf */
  .card {
    padding: 1rem;
    border-radius: var(--radius-md);
  }

  /* btn-sm hat auf Mobile mindestens 44 px Tippen-Fläche */
  .btn-sm {
    min-height: 44px;
  }

  /* Tabellen horizontal scrollbar statt Überlauf */
  table,
  .table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Benutzerverwaltung: Tabelle als gestapelte Karten statt abgeschnittener Spalten */
  .admin-users-table {
    overflow-x: visible;
  }
  .admin-users-table thead {
    display: none;
  }
  .admin-users-table tbody,
  .admin-users-table tr,
  .admin-users-table td {
    display: block;
    width: 100%;
  }
  .admin-users-table tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.85rem;
    margin-bottom: 0.85rem;
  }
  .admin-users-table td {
    border-bottom: none;
    padding: 0.35rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
  }
  .admin-users-table td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    flex-shrink: 0;
  }
  .admin-users-table td.admin-users-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.5rem;
  }
  .admin-users-table td.admin-users-actions::before {
    width: 100%;
  }

  /* Toolbar: untereinander stapeln */
  .toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .toolbar > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
  }

  /* H1 auf kleinen Screens etwas kleiner */
  h1 {
    font-size: 1.25rem;
  }

  /* Teams-Zeile: einspaltig stapeln */
  .teams-leader-row {
    grid-template-columns: 1fr;
  }
  .teams-leader-row .team-leader-select select {
    min-width: unset;
    width: 100%;
  }

  /* Berechtigungen: einspaltig */
  .permissions-grid {
    grid-template-columns: 1fr;
  }

  /* Filter-Bar: einspaltig */
  .filter-form {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  /* Admin-Users-Card: kein extra Padding */
  .admin-users-card {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  /* Dropdown-Menü links ausrichten, damit es nicht rechts abschneidet */
  .dropdown-menu {
    right: auto;
    left: 0;
  }
}

/* ===================== TEAMS-FILTER: Multi-Select ↔ Checkboxen ===================== */
/* Desktop zeigt den normalen Multi-Select, Mobile tauscht auf Checkboxen. */
.teams-mobile-checks {
  display: none;
}

@media (max-width: 600px) {
  .teams-desktop-select {
    display: none;
  }
  .teams-mobile-checks {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
  }
}

/* ===================== RESPONSIVE TABLE UTILITIES ===================== */
/* Secondary columns hidden on narrow screens */
@media (max-width: 600px) {
  .col-mobile-hide {
    display: none !important;
  }
  /* Inline alternative shown only on mobile */
  .show-mobile {
    display: block !important;
  }
  /* Shorten link text on very narrow screens via aria-label trick */
  .btn-text-mobile-hide {
    display: none;
  }
}

.show-mobile {
  display: none;
}

/* ===================== PRINT STYLES ===================== */
@media print {
  .site-header,
  .app-sidebar,
  .toolbar,
  .header-nav,
  .logout,
  .button {
    display: none !important;
  }
  body {
    background: #fff;
  }
  .card {
    box-shadow: none;
    border: none;
  }
}

@media print {
  body.print-calendar {
    font-size: 9px;
  }
  @page {
    size: A4 landscape;
    margin: 8mm;
  }
  body.print-calendar .calendar-card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

@media print {
  body.print-birthdays {
    font-size: 9px;
  }
  @page {
    size: A4 landscape;
    margin: 8mm;
  }
  body.print-birthdays .card {
    padding: 0;
  }
  body.print-birthdays .print-logo {
    justify-content: center;
    margin-bottom: 0.35rem;
  }
  body.print-birthdays .print-logo img {
    height: 28px;
  }
  body.print-birthdays .birthday-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.25rem;
  }
  body.print-birthdays .birthday-card {
    padding: 0.3rem 0.4rem;
    min-height: 0;
    background: #f2eadc;
  }
  body.print-birthdays .birthday-card h3 {
    margin-bottom: 0.2rem;
    font-size: 10px;
  }
  body.print-birthdays .birthday-card li {
    font-size: 8.5px;
    grid-template-columns: 1.6rem 1fr 1.2rem;
  }
}

/* Willkommen / Erste-Schritte / Release-Notes Overlay */
.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(11, 47, 90, 0.45);
  backdrop-filter: blur(2px);
}
.welcome-modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px var(--shadow);
  overflow: hidden;
}
.welcome-modal-head {
  padding: 1.25rem 1.5rem;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: #fff;
}
.welcome-modal-head h2 {
  margin: 0;
  font-size: 1.2rem;
  color: #fff;
}
.welcome-modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
}
.welcome-section + .welcome-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.welcome-section h3 {
  margin: 0 0 0.6rem;
  color: var(--primary-fg);
  font-size: 1.05rem;
}
.welcome-release ul {
  margin: 0;
  padding-left: 1.2rem;
}
.welcome-release li {
  margin-bottom: 0.35rem;
}
.welcome-note {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  background: var(--tint-accent-weak);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
}
.welcome-guide {
  margin: 0;
}
.welcome-guide dt {
  font-weight: 600;
  color: var(--primary-fg);
  margin-top: 1rem;
  font-size: 1rem;
}
.welcome-guide dd {
  margin: 0.15rem 0 0;
  font-size: 0.93rem;
  color: var(--text);
}
.welcome-guide dd p {
  margin: 0 0 0.45rem;
}
.welcome-guide dd ul,
.welcome-guide dd ol {
  margin: 0.3rem 0 0.55rem;
  padding-left: 1.25rem;
}
.welcome-guide dd li {
  margin-bottom: 0.28rem;
}

/* ===================== HILFE: INHALTSVERZEICHNIS & KATEGORIEN ===================== */
/* Anker-Ziele sollen nicht unter dem sticky Header verschwinden. */
.guide-category {
  scroll-margin-top: 84px;
}

.guide-toc {
  background: var(--tint-primary-weak);
  border: 1px solid var(--tint-primary-strong);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.75rem;
}

.guide-toc-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 0.65rem;
}

.guide-toc-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem 1.5rem;
}

.guide-toc-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin: 0.5rem 0 0.25rem;
}

.guide-toc-groups a {
  display: block;
  padding: 0.15rem 0;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--primary-fg);
}

.guide-toc-groups a:hover {
  text-decoration: underline;
}

.guide-category-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--primary-fg);
  margin: 2.25rem 0 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--tint-primary-medium);
}

.guide-category:first-of-type .guide-category-title {
  margin-top: 0;
}

.guide-category-title svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* Im Erste-Login-Modal ist weniger Platz: Inhaltsverzeichnis kompakter. */
.welcome-guide-scope .guide-toc {
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}
.welcome-guide-scope .guide-category-title {
  font-size: 1rem;
  margin: 1.5rem 0 0.4rem;
}
.welcome-modal-foot {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  background: var(--bg);
}

/* "App installieren"-Banner (unten links, lässt die Chat-Blase frei) */
.push-banner,
.pwa-install-banner {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  right: auto;
  z-index: 900;
  max-width: min(420px, calc(100vw - 5rem));
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.85rem;
  box-shadow: 0 8px 28px var(--shadow);
  font-size: 0.88rem;
}
.pwa-install-banner[hidden] {
  display: none;
}
.pwa-install-text {
  flex: 1;
  line-height: 1.35;
}
.pwa-install-btn {
  flex-shrink: 0;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.42rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
}
.pwa-install-btn[hidden] {
  display: none;
}
.pwa-install-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Verein24-Spalte standardmäßig ausgeblendet; per Knopf einblendbar
   (Übersicht, wer schon bei Verein24 gemeldet ist). */
.verein24-col {
  display: none;
}
.members-table.show-verein24 .verein24-col {
  display: table-cell;
}
.button[data-verein24-column-toggle][aria-pressed="true"] {
  background: var(--primary);
  color: #fff;
}

/* Schalter (Toggle) – z. B. Verein24-Status in der Mitgliederliste */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  vertical-align: middle;
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--border-muted);
  border-radius: 24px;
  transition: background 0.2s ease;
}
.switch-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}
.switch input:checked + .switch-slider {
  background: var(--primary);
}
.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}
.switch input:disabled + .switch-slider {
  opacity: 0.6;
}
.switch input:focus-visible + .switch-slider {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Statistik-Drill-Down: klickbare Kriterien + Mitglieder-Modal ── */
.stat-drill {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0.35rem 0.4rem;
  margin-left: -0.4rem;
  margin-right: -0.4rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background 0.15s;
}
.stat-drill:hover:not(:disabled),
.stat-drill:focus-visible:not(:disabled) {
  background: var(--tint-primary-weak);
  outline: none;
}
.stat-drill:disabled {
  cursor: default;
  opacity: 0.55;
}
.stat-drill-bar {
  padding: 0;
  border: none;
  cursor: pointer;
}
.stat-drill-bar:hover:not(:disabled),
.stat-drill-bar:focus-visible:not(:disabled) {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.stat-drill-bar:disabled {
  cursor: default;
}

.stat-modal[hidden] {
  display: none;
}
.stat-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.stat-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 47, 90, 0.45);
  backdrop-filter: blur(2px);
}
.stat-modal-box {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px var(--shadow);
  overflow: hidden;
}
.stat-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: #fff;
}
.stat-modal-head h2 {
  margin: 0;
  font-size: 1.1rem;
  color: #fff;
}
.stat-modal-x {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-modal-meta {
  margin: 0;
  padding: 0.75rem 1.25rem 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.stat-modal-body {
  padding: 0.5rem 1.25rem 1.25rem;
  overflow-y: auto;
}
.stat-modal-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.stat-modal-list li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--surface-alt);
}
.stat-modal-list li:last-child {
  border-bottom: none;
}
.stat-modal-list a {
  font-size: 0.9rem;
  font-weight: 600;
}
.stat-modal-empty {
  margin: 0.5rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Generisches Dialog-Overlay (z. B. "Mail an alle"), gleiches Erscheinungsbild
   wie .stat-modal, aber unter neutralem Namen für Nicht-Statistik-Dialoge. */
.modal[hidden] {
  display: none;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 47, 90, 0.45);
  backdrop-filter: blur(2px);
}
.modal-box {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px var(--shadow);
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: #fff;
}
.modal-head h2 {
  margin: 0;
  font-size: 1.1rem;
  color: #fff;
}
.modal-x {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-body {
  padding: 0.5rem 1.25rem 1.25rem;
  overflow-y: auto;
}
