/* ═══════════════════════════════════════════════════════════════════════════
   BLUE HORIZON · Team Hub — Design System
   Umsetzung des FLX-DESIGN (Blue Horizon Remastered).
   Reihenfolge: Tokens → Reset → Typo → Layout → Komponenten → Responsive
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Tokens ─────────────────────────────────────────────────────────── */
:root {
  /* Farben */
  --accent:            #8B93FF;
  --accent-cta:        #3E43F0;
  --accent-secondary:  #7A00DF;
  --accent-tertiary:   #007CBA;

  --text-primary:      #FAFAFA;
  --text-secondary:    #D4D4D8;
  --text-tertiary:     #A1A1AA;
  --text-muted:        #71717A;

  --surface-1:         #17171A;  /* Karten, Container       */
  --surface-2:         #111113;  /* Seitenhintergrund       */
  --surface-3:         #27272A;  /* Navigation, Hervorhebung */
  --border:            #27272A;
  --border-strong:     #3F3F46;

  --success:           #22C55E;
  --error:             #CF2E2E;
  --warning:           #FCB900;

  --overlay-accent:    rgba(62, 67, 240, 0.18);
  --border-soft:       rgba(255, 255, 255, 0.22);
  --btn-overlay:       rgba(255, 255, 255, 0.08);

  /* Elevation */
  --shadow-1: rgba(0, 0, 0, 0.3) 0 1px 2px 0;
  --shadow-2: rgba(0, 0, 0, 0.4) 0 1px 3px 0, rgba(0, 0, 0, 0.3) 0 1px 2px -1px;
  --shadow-3: rgba(0, 0, 0, 0.5) 0 4px 8px 0, rgba(0, 0, 0, 0.3) 0 2px 4px -1px;

  /* Radius */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 10px;

  /* Spacing (4px-Basis) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-6: 24px; --s-8: 32px; --s-12: 48px; --s-16: 64px;

  --sidebar-w: 248px;
  --max-w: 1440px;

  --font: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', 'Courier New', monospace;
}

/* ── 2. Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  line-height: 19.5px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── 3. Typografie ─────────────────────────────────────────────────────── */
h1, h2, h3, h4 { color: var(--text-primary); margin: 0; font-weight: 600; }
h1 { font-size: 48px; line-height: 57.6px; }
h2 { font-size: 32px; line-height: 38.4px; }
h3 { font-size: 20px; line-height: 24px; }
h4 { font-size: 14px; line-height: 20px; }
p  { margin: 0 0 var(--s-3); }

/* Links erben grundsätzlich die Textfarbe — kein Browser-Blau, keine
   Unterstreichung. Farbe bekommt nur, was ohne sie nicht auffindbar wäre
   (siehe .prose weiter unten). */
a { color: inherit; text-decoration: none; transition: color .15s ease; }

/* Dezenter Navigationslink: "Alle Termine", "Alle", Zurück-Pfeile.
   Ruhig im Normalzustand, Akzent erst bei Interaktion. */
.link,
.back-link,
.section-head a,
.card-head a {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--text-tertiary);
  font-size: 13px; font-weight: 500;
  white-space: nowrap;
}
.link:hover,
.back-link:hover,
.section-head a:hover,
.card-head a:hover { color: var(--accent); }

/* Zurück-Pfeil bewegt sich leicht — reicht als Affordanz ohne Unterstreichung */
.back-link { gap: 6px; }
.back-link::before { content: '←'; transition: transform .15s ease; }
.back-link:hover::before { transform: translateX(-2px); }

/* Überschriften und Textlinks: neutral, Akzent nur im Hover */
.event-title a:hover,
.card-title a:hover,
h3 a:hover,
a.strong:hover,
.table a:hover { color: var(--accent); }

/* Ganze Zeile als Ziel: Hintergrund statt Unterstreichung. */
.list-row {
  min-height: 36px;
  color: var(--text-secondary);
  border-radius: var(--r-md);
  padding-left: var(--s-2); padding-right: var(--s-2);
  margin-left: calc(var(--s-2) * -1); margin-right: calc(var(--s-2) * -1);
  transition: background .15s ease, color .15s ease;
}
.list-row:hover { background: var(--surface-3); color: var(--text-primary); }

/* Fließtext: hier MÜSSEN Links erkennbar sein, sonst findet sie niemand. */
.prose a,
.comment .body a { color: var(--accent); font-weight: 500; overflow-wrap: anywhere; }
.prose a:hover,
.comment .body a:hover { color: var(--accent-cta); text-decoration: underline; }

code, pre, .mono { font-family: var(--font-mono); font-size: 13px; }

.text-lg    { font-size: 16px; line-height: 24px; }
.text-sm    { font-size: 12px; line-height: 18px; }
.muted      { color: var(--text-tertiary); }
.dim        { color: var(--text-muted); }
.strong     { color: var(--text-primary); font-weight: 600; }
.nowrap     { white-space: nowrap; }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-success { color: var(--success); }
.text-error   { color: var(--error); }
.text-warning { color: var(--warning); }

/* ── 4. Layout ─────────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-6) var(--s-4);
  border-bottom: 1px solid var(--border);
}
/* Die Marke ist ein Link, soll aber nicht wie einer aussehen. */
.sidebar-brand .mark { transition: background .15s ease; }
.sidebar-brand:hover .mark { background: rgba(139, 147, 255, .28); }
.sidebar-brand .mark {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: var(--r-lg);
  background: var(--overlay-accent);
  color: var(--accent);
  display: grid; place-items: center;
}
.sidebar-brand strong { display: block; color: var(--text-primary); font-size: 14px; line-height: 20px; }
.sidebar-brand span   { display: block; color: var(--text-muted); font-size: 12px; line-height: 16px; }

.nav { padding: var(--s-4) var(--s-2); flex: 1; }
.nav-section { margin-bottom: var(--s-6); }
.nav-label {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); padding: 0 var(--s-3) var(--s-2);
}
.nav-item {
  display: flex; align-items: center; gap: var(--s-3);
  min-height: 36px; padding: var(--s-2) var(--s-3);
  border-radius: var(--r-lg);
  color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: var(--surface-3); color: var(--text-primary); text-decoration: none; }
.nav-item.is-active { background: var(--overlay-accent); color: var(--accent); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item .count {
  margin-left: auto; font-size: 11px; font-weight: 600;
  background: var(--surface-3); color: var(--text-tertiary);
  padding: 1px 7px; border-radius: 999px;
}
.nav-item.is-active .count { background: rgba(139,147,255,.18); color: var(--accent); }

.sidebar-user {
  border-top: 1px solid var(--border);
  padding: var(--s-3);
  display: flex; align-items: center; gap: var(--s-3);
}
.sidebar-user img { width: 36px; height: 36px; border-radius: 50%; }
.sidebar-user a:hover { text-decoration: none; }
.sidebar-user a:hover .meta b { color: var(--accent); }
.sidebar-user .meta { min-width: 0; flex: 1; }
.sidebar-user .meta b { display: block; color: var(--text-primary); font-size: 13px; font-weight: 600; }
.sidebar-user .meta span { display: block; color: var(--text-muted); font-size: 11px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: none;
  align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}

.content {
  flex: 1;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--s-8) var(--s-8) var(--s-16);
}

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s-4); flex-wrap: wrap;
  margin-bottom: var(--s-6);
}
.page-head h2 { letter-spacing: -0.02em; }
.page-head .sub { color: var(--text-tertiary); font-size: 14px; margin-top: var(--s-1); }
.page-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

.section { margin-bottom: var(--s-12); }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4); margin-bottom: var(--s-4);
}
.section-head h3 { letter-spacing: -0.01em; }
/* "Alle Termine ›" darf nie zwischen Text und Chevron umbrechen. */
.section-head a { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }

.grid { display: grid; gap: var(--s-4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(0, 1fr) 320px; gap: var(--s-6); }

.stack   { display: flex; flex-direction: column; gap: var(--s-4); }
.stack-2 { display: flex; flex-direction: column; gap: var(--s-2); }
.row     { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.row-tight { display: flex; align-items: center; gap: var(--s-2); }
.spacer  { flex: 1; }

/* ── 5. Karten ─────────────────────────────────────────────────────────── */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-1);
  padding: var(--s-6);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.card.is-interactive:hover {
  border-color: var(--border-strong);
  box-shadow: rgba(0, 0, 0, 0.4) 0 2px 4px 0;
}
.card-wide { padding: var(--s-6) var(--s-8); }
.card-compact { padding: var(--s-4); }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3); margin-bottom: var(--s-4);
}
.card-title { font-size: 20px; font-weight: 600; color: var(--text-primary); line-height: 24px; }
.card-divider { height: 1px; background: var(--border); margin: var(--s-4) calc(var(--s-6) * -1); }

.icon-box {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: var(--r-lg);
  background: var(--overlay-accent);
  color: var(--accent);
  display: grid; place-items: center;
}
.icon-box.success { background: rgba(34,197,94,.15);  color: var(--success); }
.icon-box.error   { background: rgba(207,46,46,.15);  color: var(--error); }
.icon-box.warning { background: rgba(252,185,0,.15);  color: var(--warning); }

/* Kennzahl-Kachel */
.stat { display: flex; align-items: center; gap: var(--s-4); }
.stat .value { font-size: 32px; line-height: 38.4px; font-weight: 600; color: var(--text-primary); }
.stat .label { font-size: 12px; color: var(--text-tertiary); }

/* ── 6. Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 36px; padding: 0 14px;
  border-radius: var(--r-lg);
  border: 1px solid transparent;
  background: #FAFAFA; color: #0A0A0A;
  font-size: 13px; font-weight: 500; line-height: 20px;
  box-shadow: var(--shadow-2);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover  { background: #D4D4D8; color: #0A0A0A; text-decoration: none; }
.btn:active { background: #A1A1AA; }
.btn svg { width: 16px; height: 16px; }

.btn-primary { background: var(--accent-cta); color: #FAFAFA; }
.btn-primary:hover  { background: #5257F3; color: #FFFFFF; }
.btn-primary:active { background: #2E33D8; }

.btn-secondary {
  background: transparent; color: var(--text-primary);
  font-weight: 700; border-radius: var(--r-md); padding: 0 10px;
  box-shadow: none;
}
.btn-secondary:hover  { background: rgba(139,147,255,.1); color: var(--accent); border-color: var(--accent); }
.btn-secondary:active { background: rgba(139,147,255,.2); color: var(--accent-cta); border-color: var(--accent-cta); }

.btn-ghost {
  background: var(--btn-overlay); color: var(--text-primary);
  border: 1px solid var(--border-soft); box-shadow: none;
}
.btn-ghost:hover { background: rgba(139,147,255,.15); border-color: var(--accent); color: var(--text-primary); }

.btn-danger { background: var(--error); color: #FFFFFF; }
.btn-danger:hover { background: #E04141; color: #FFFFFF; }

.btn-icon { width: 36px; height: 36px; padding: 0; }

.btn[disabled], .btn.is-disabled {
  opacity: .5; cursor: not-allowed; pointer-events: none; box-shadow: none;
}

.btn-block { width: 100%; }

/* Discord-Login */
.btn-discord { background: #5865F2; color: #FFFFFF; min-height: 44px; padding: 0 var(--s-6); font-weight: 600; }
.btn-discord:hover { background: #4752C4; color: #FFFFFF; }

/* ── 7. Badges & Pills ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: var(--s-1);
  padding: 4px 10px; border-radius: var(--r-md);
  font-size: 12px; font-weight: 600; line-height: 16px;
  background: rgba(139,147,255,.15); color: var(--accent);
  border: 1px solid var(--accent);
}
.badge-success { background: rgba(34,197,94,.15);  color: var(--success); border-color: var(--success); }
.badge-error   { background: rgba(207,46,46,.15);  color: var(--error);   border-color: var(--error); }
.badge-warning { background: rgba(252,185,0,.15);  color: var(--warning); border-color: var(--warning); }
.badge-muted   { background: var(--surface-3);     color: var(--text-tertiary); border-color: var(--border-strong); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.chip {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: var(--s-1) var(--s-3); border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 12px; font-weight: 500;
}
.chip .swatch { width: 8px; height: 8px; border-radius: 50%; }

/* ── 8. Formulare ──────────────────────────────────────────────────────── */
.field { margin-bottom: var(--s-4); }
.label {
  display: block; margin-bottom: var(--s-2);
  font-size: 14px; font-weight: 600; line-height: 20px; color: var(--text-primary);
}
.hint { margin-top: var(--s-2); font-size: 12px; color: var(--text-muted); }

.input, .select, .textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 12px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text-primary);
  font-size: 13px; line-height: 19.5px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139,147,255,.1);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A1A1AA' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 34px;
}
.input-error { border-color: var(--error); }

.checkbox, .radio {
  display: flex; align-items: flex-start; gap: var(--s-3);
  min-height: 36px; padding: var(--s-2) 0;
  cursor: pointer;
}
.checkbox input, .radio input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent-cta); flex-shrink: 0; }
.checkbox .txt b, .radio .txt b { display: block; color: var(--text-primary); font-weight: 500; font-size: 13px; }
.checkbox .txt span, .radio .txt span { display: block; color: var(--text-muted); font-size: 12px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--s-4); }
.form-grid .span-2 { grid-column: 1 / -1; }

.form-actions {
  display: flex; justify-content: flex-end; gap: var(--s-2);
  padding-top: var(--s-4); margin-top: var(--s-4);
  border-top: 1px solid var(--border);
}

/* ── 9. Event-Karten & RSVP ────────────────────────────────────────────── */
.event-card {
  display: flex; gap: var(--s-4); align-items: stretch;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-1);
  padding: var(--s-4);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.event-card:hover { border-color: var(--border-strong); box-shadow: rgba(0,0,0,.4) 0 2px 4px 0; }
.event-card.is-cancelled { opacity: .6; border-left-color: var(--error); }
.event-card.is-cancelled .event-title { text-decoration: line-through; }

.event-date {
  width: 56px; flex-shrink: 0; text-align: center;
  background: var(--surface-3); border-radius: var(--r-lg);
  padding: var(--s-2) 0;
  align-self: flex-start;
}
.event-date .dow  { font-size: 11px; font-weight: 600; color: var(--accent); text-transform: uppercase; }
.event-date .day  { font-size: 20px; font-weight: 600; color: var(--text-primary); line-height: 24px; }
.event-date .mon  { font-size: 11px; color: var(--text-muted); text-transform: uppercase; }

.event-body { flex: 1; min-width: 0; }
.event-title { font-size: 16px; font-weight: 600; color: var(--text-primary); line-height: 24px; }
.event-title a { color: inherit; }
.event-title a:hover { color: var(--accent); text-decoration: none; }
.event-meta { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); margin-top: var(--s-1); font-size: 12px; color: var(--text-tertiary); }
.event-meta span { display: inline-flex; align-items: center; gap: 5px; }
.event-meta svg { width: 14px; height: 14px; opacity: .8; }

.rsvp-group { display: inline-flex; gap: var(--s-2); flex-wrap: wrap; }
.rsvp-btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: 36px; padding: 0 var(--s-4);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
}
.rsvp-btn:hover { border-color: var(--border-strong); color: var(--text-primary); }
.rsvp-btn svg { width: 16px; height: 16px; }
.rsvp-btn[data-value="yes"].is-active   { background: rgba(34,197,94,.15); border-color: var(--success); color: var(--success); }
.rsvp-btn[data-value="maybe"].is-active { background: rgba(252,185,0,.15); border-color: var(--warning); color: var(--warning); }
.rsvp-btn[data-value="no"].is-active    { background: rgba(207,46,46,.15); border-color: var(--error);   color: var(--error); }
.rsvp-group.is-busy { opacity: .6; pointer-events: none; }

.rsvp-bar { display: flex; height: 6px; border-radius: 999px; overflow: hidden; background: var(--surface-3); }
.rsvp-bar i { display: block; height: 100%; }
.rsvp-bar .yes   { background: var(--success); }
.rsvp-bar .maybe { background: var(--warning); }
.rsvp-bar .no    { background: var(--error); }

/* ── 10. Mitglieder-Listen ─────────────────────────────────────────────── */
.member-row {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) 0;
  min-height: 44px;
}
.member-row + .member-row { border-top: 1px solid var(--border); }
.member-row img { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.member-row .name { color: var(--text-primary); font-size: 13px; font-weight: 500; }
.member-row .sub  { color: var(--text-muted); font-size: 11px; }

.avatar-stack { display: flex; }
.avatar-stack img {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--surface-1);
  margin-left: -8px;
}
.avatar-stack img:first-child { margin-left: 0; }
.avatar-stack .more {
  width: 28px; height: 28px; border-radius: 50%; margin-left: -8px;
  border: 2px solid var(--surface-1); background: var(--surface-3);
  display: grid; place-items: center; font-size: 10px; font-weight: 600; color: var(--text-tertiary);
}

/* ── 11. Tabellen ──────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface-1); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: var(--s-3) var(--s-4);
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); background: var(--surface-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(255,255,255,.02); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Fortschrittsbalken in Statistiken */
.meter { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 80px; }
.meter i { display: block; height: 100%; background: var(--accent); }
.meter.good i { background: var(--success); }
.meter.mid  i { background: var(--warning); }
.meter.bad  i { background: var(--error); }

/* ── 11a. Einklappbare Karte (<details>) ───────────────────────────────── */
.collapsible { padding: 0; }
.collapsible > summary {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4) var(--s-6);
  cursor: pointer;
  list-style: none;          /* Standard-Dreieck weg */
  min-height: 44px;
  border-radius: var(--r-xl);
  transition: background .15s ease;
}
.collapsible > summary::-webkit-details-marker { display: none; }
.collapsible > summary:hover { background: rgba(255, 255, 255, .02); }
.collapsible > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.collapsible-chevron {
  display: inline-flex; flex-shrink: 0;
  color: var(--text-muted);
  transform: rotate(90deg);   /* zeigt nach unten = "aufklappen" */
  transition: transform .18s ease, color .15s ease;
}
.collapsible[open] > summary .collapsible-chevron { transform: rotate(-90deg); }
.collapsible > summary:hover .collapsible-chevron { color: var(--text-primary); }

/* Inhalt bekommt die Kartenpolsterung; die Trennlinie sitzt direkt
   unter dem Kopf, nicht mit Abstand darunter. */
.collapsible > *:not(summary) {
  padding: var(--s-2) var(--s-6) var(--s-6);
  border-top: 1px solid var(--border);
  margin-top: 0;
}

/* ── 11b. Einrichtungs-Checkliste ──────────────────────────────────────── */
.setup-list { display: flex; flex-direction: column; }
.setup-step {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) 0; min-height: 44px;
}
.setup-step + .setup-step { border-top: 1px solid var(--border); }
.setup-step.is-done { opacity: .55; }
.setup-step.is-done .strong { text-decoration: line-through; }
.setup-marker {
  width: 24px; height: 24px; flex-shrink: 0;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-tertiary);
  font-size: 11px; font-weight: 600;
}
.setup-step.is-done .setup-marker { background: rgba(34,197,94,.15); color: var(--success); }

/* ── 11c. Monatskalender ───────────────────────────────────────────────── */
.cal-scroll { overflow-x: auto; }
.cal {
  min-width: 720px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--surface-1);
  box-shadow: var(--shadow-1);
}
.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface-3); }
.cal-dow {
  padding: var(--s-2) var(--s-3);
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.cal-dow-short { display: none; }

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-cell {
  min-height: 116px;
  padding: var(--s-2);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 3px;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-grid > .cal-cell:nth-last-child(-n+7) { border-bottom: none; }
.cal-cell.is-outside { background: var(--surface-2); }
.cal-cell.is-outside .cal-daynum { color: var(--text-muted); }
.cal-cell.is-today { background: rgba(139,147,255,.06); box-shadow: inset 0 0 0 1px var(--accent); }

.cal-daynum {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 2px;
}
.cal-cell.is-today .cal-daynum { color: var(--accent); }
.cal-count {
  font-size: 10px; font-weight: 600; color: var(--text-muted);
  background: var(--surface-3); border-radius: 999px; padding: 0 6px;
}

.cal-event {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 6px;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--evt, #8B93FF) 14%, transparent);
  border-left: 2px solid var(--evt, #8B93FF);
  color: var(--text-secondary);
  font-size: 11px; line-height: 15px;
  min-width: 0;
  transition: background .15s ease;
}
.cal-event:hover { background: color-mix(in srgb, var(--evt, #8B93FF) 26%, transparent); text-decoration: none; color: var(--text-primary); }
.cal-event.is-cancelled { opacity: .5; }
.cal-event.is-cancelled .cal-event-title { text-decoration: line-through; }
.cal-event-time { color: var(--text-muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.cal-event-title { min-width: 0; }

.cal-event-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-muted);
}
.cal-event-dot[data-resp="yes"]   { background: var(--success); }
.cal-event-dot[data-resp="maybe"] { background: var(--warning); }
.cal-event-dot[data-resp="no"]    { background: var(--error); }

/* Ältere Browser ohne color-mix: einfarbiger Fallback */
@supports not (background: color-mix(in srgb, red 10%, transparent)) {
  .cal-event { background: var(--surface-3); }
  .cal-event:hover { background: var(--border-strong); }
}

/* ── 12. Tabs ──────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--border); margin-bottom: var(--s-6); overflow-x: auto; }
.tab {
  min-height: 36px; padding: var(--s-2) var(--s-4);
  color: var(--text-tertiary); font-size: 13px; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap; background: none; border-top: 0; border-left: 0; border-right: 0; cursor: pointer;
}
.tab:hover { color: var(--text-primary); text-decoration: none; }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── 13. Kommentare ────────────────────────────────────────────────────── */
.comment { display: flex; gap: var(--s-3); padding: var(--s-3) 0; }
.comment + .comment { border-top: 1px solid var(--border); }
.comment img { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.comment .who { color: var(--text-primary); font-size: 13px; font-weight: 600; }
.comment .when { color: var(--text-muted); font-size: 11px; }
.comment .body { color: var(--text-secondary); font-size: 13px; margin-top: var(--s-1); overflow-wrap: anywhere; }

/* ── 14. Leerzustände ──────────────────────────────────────────────────── */
.empty {
  text-align: center; padding: var(--s-16) var(--s-6);
  border: 1px dashed var(--border-strong); border-radius: var(--r-xl);
  color: var(--text-tertiary);
}
.empty .icon-box { margin: 0 auto var(--s-4); }
.empty h4 { font-size: 16px; margin-bottom: var(--s-2); }
.empty p { max-width: 420px; margin: 0 auto var(--s-4); }

/* ── 15. Flash & Toast ─────────────────────────────────────────────────── */
.flash {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-3) var(--s-4); margin-bottom: var(--s-4);
  border-radius: var(--r-lg); border: 1px solid var(--border);
  background: var(--surface-1); font-size: 13px;
}
.flash-success { border-left: 3px solid var(--success); }
.flash-error   { border-left: 3px solid var(--error); }
.flash-warning { border-left: 3px solid var(--warning); }
.flash-info    { border-left: 3px solid var(--accent); }

/* Benachrichtigungen ploppen oben rechts auf und räumen sich selbst weg. */
.toasts {
  position: fixed; top: var(--s-4); right: var(--s-4); z-index: 500;
  display: flex; flex-direction: column; gap: var(--s-2);
  width: 360px; max-width: calc(100vw - var(--s-8));
  pointer-events: none;
}
.toast {
  position: relative;
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--surface-1);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  font-size: 13px; line-height: 19.5px;
  overflow: hidden;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(16px) scale(.98);
  transition: opacity .22s cubic-bezier(.16,1,.3,1),
              transform .22s cubic-bezier(.16,1,.3,1),
              margin .22s ease;
}
.toast.is-in  { opacity: 1; transform: none; }
.toast.is-out { opacity: 0; transform: translateX(16px) scale(.96); margin-bottom: -52px; }

.toast-icon {
  flex-shrink: 0;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
}
.toast-body { flex: 1; min-width: 0; padding-top: 3px; }
.toast-title { display: block; color: var(--text-primary); font-weight: 600; margin-bottom: 2px; }
.toast-text  { display: block; overflow-wrap: anywhere; }

.toast-close {
  flex-shrink: 0;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border: 0; background: transparent; padding: 0;
  color: var(--text-muted); border-radius: var(--r-md);
  cursor: pointer; transition: background .15s ease, color .15s ease;
}
.toast-close:hover { background: var(--surface-3); color: var(--text-primary); }

/* Laufzeitanzeige — macht sichtbar, wie lange die Meldung noch steht. */
.toast-progress {
  position: absolute; left: 0; bottom: 0; height: 2px;
  background: currentColor; opacity: .5;
  transform-origin: left center;
  animation: toastCountdown linear forwards;
}
@keyframes toastCountdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.toast:hover .toast-progress { animation-play-state: paused; }

.toast-success .toast-icon { background: rgba(34,197,94,.15);  color: var(--success); }
.toast-success .toast-progress { color: var(--success); }
.toast-error   .toast-icon { background: rgba(207,46,46,.15);  color: var(--error); }
.toast-error   .toast-progress { color: var(--error); }
.toast-warning .toast-icon { background: rgba(252,185,0,.15);  color: var(--warning); }
.toast-warning .toast-progress { color: var(--warning); }
.toast-info    .toast-icon { background: var(--overlay-accent); color: var(--accent); }
.toast-info    .toast-progress { color: var(--accent); }

@media (max-width: 639px) {
  .toasts { top: var(--s-3); left: var(--s-3); right: var(--s-3); width: auto; max-width: none; }
  .toast.is-out { margin-bottom: -60px; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity .15s ease; transform: none; }
  .toast.is-in, .toast.is-out { transform: none; }
  .toast-progress { animation: none; }
}

/* ── 16. Modal ─────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 300; display: none; align-items: center; justify-content: center; padding: var(--s-4); }
.modal.is-open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.7); }
.modal-panel {
  position: relative;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--shadow-3);
  width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto;
  animation: modalPop .2s cubic-bezier(.16,1,.3,1);
}
@keyframes modalPop { from { opacity: 0; transform: scale(.97) translateY(8px); } to { opacity: 1; transform: none; } }
.modal-head { padding: var(--s-6) var(--s-6) var(--s-3); display: flex; justify-content: space-between; gap: var(--s-3); }
.modal-body { padding: 0 var(--s-6) var(--s-4); }
.modal-foot { padding: var(--s-4) var(--s-6) var(--s-6); display: flex; justify-content: flex-end; gap: var(--s-2); border-top: 1px solid var(--border); }

/* ── 17. Login-Seite ───────────────────────────────────────────────────── */
.auth-screen {
  min-height: 100vh; display: grid; place-items: center;
  padding: var(--s-6);
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(62,67,240,.18), transparent 70%),
    var(--surface-2);
}
.auth-card { width: 100%; max-width: 420px; text-align: center; }
.auth-card .mark {
  width: 56px; height: 56px; margin: 0 auto var(--s-6);
  border-radius: var(--r-xl); background: var(--overlay-accent);
  color: var(--accent); display: grid; place-items: center;
}
.auth-card h1 { font-size: 32px; line-height: 38.4px; margin-bottom: var(--s-2); }
.auth-card p  { color: var(--text-tertiary); font-size: 14px; margin-bottom: var(--s-6); }

/* ── 18. Responsive ────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-sidebar { grid-template-columns: minmax(0, 1fr); }
  .content { padding: var(--s-6) var(--s-6) var(--s-16); }
}

@media (max-width: 767px) {
  .app { flex-direction: column; }

  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 100;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-3);
  }
  .sidebar.is-open { transform: none; }
  .sidebar-scrim {
    position: fixed; inset: 0; z-index: 90;
    background: rgba(0,0,0,.7); display: none;
  }
  .sidebar-scrim.is-open { display: block; }

  .topbar { display: flex; }
  .content { padding: var(--s-4) var(--s-4) var(--s-16); }

  h1 { font-size: 28px; line-height: 34px; }
  h2 { font-size: 20px; line-height: 26px; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }

  .page-head { flex-direction: column; align-items: stretch; }
  .page-actions .btn { flex: 1; min-height: 44px; }

  .rsvp-group { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  .rsvp-btn { min-height: 44px; justify-content: center; padding: 0 var(--s-2); }

  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; min-height: 44px; }

  /* Kalender scrollt horizontal statt zu zerbrechen */
  .cal { min-width: 640px; }
  .cal-cell { min-height: 92px; }
  .cal-dow-long { display: none; }
  .cal-dow-short { display: inline; }
  .cal-event-time { display: none; }
  .setup-step { flex-wrap: wrap; }
  .setup-step .btn { width: 100%; }

  .collapsible > summary { padding: var(--s-3) var(--s-4); }
  .collapsible > summary .meter { display: none; }
  .collapsible > *:not(summary) { padding: var(--s-2) var(--s-4) var(--s-4); }

  .toasts { left: var(--s-4); right: var(--s-4); bottom: var(--s-4); max-width: none; }
}

@media print {
  .sidebar, .topbar, .page-actions, .btn { display: none !important; }
  body { background: #FFFFFF; color: #0A0A0A; }
  .card, .table-wrap { border-color: #DDDDDD; box-shadow: none; background: #FFFFFF; }
}

/* ── 20. Forum-Übergang ────────────────────────────────────────────────────
   Markup, das main.js und nav.php zur Laufzeit per innerHTML erzeugen.
   Ausschliesslich aus Tokens gebaut. Dieser Abschnitt verschwindet, sobald
   die betroffenen JS-Vorlagen auf Systemklassen umgestellt sind.
   ──────────────────────────────────────────────────────────────────────── */

.hidden { display: none !important; }
.loading { opacity: .6; pointer-events: none; }
.rotate  { transform: rotate(180deg); }

.btn-small { min-height: 28px; padding: 0 var(--s-2); font-size: 12px; }
.btn-icon-tiny { width: 28px; min-height: 28px; padding: 0; }
.avatar-tiny { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }

/* Benachrichtigungen und Unterhaltungen */
.notif-list { display: flex; flex-direction: column; }
.notif-empty {
  padding: var(--s-8) var(--s-4);
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.notif-error { color: var(--error); }
.notif-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-2);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: background .15s ease;
}
.notif-item:hover { background: var(--surface-3); }
.notif-item + .notif-item { border-top: 1px solid var(--border); }
.notif-item.unread { background: var(--overlay-accent); }
.notif-avatar, .notif-avatar-wrapper img {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
}
.notif-avatar-wrapper { position: relative; flex-shrink: 0; }
.notif-content { min-width: 0; flex: 1; }
.notif-user { color: var(--text-primary); font-weight: 600; }
.notif-time { color: var(--text-muted); font-size: 11px; }
.notif-type { color: var(--accent); }
.notif-header { gap: var(--s-2); }
.mark-all-btn { white-space: nowrap; }

/* Chatverlauf im Nachrichten-Modal */
.dropdown-msg-container { display: flex; margin-bottom: var(--s-2); }
.dropdown-msg-container.sent { justify-content: flex-end; }
.dropdown-msg-bubble {
  max-width: 78%;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-xl);
  background: var(--surface-3);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 19.5px;
  word-break: break-word;
}
.dropdown-msg-container.sent .dropdown-msg-bubble {
  background: var(--overlay-accent);
  color: var(--text-primary);
}
.msg-bubble-header {
  display: block;
  font-size: 11px; font-weight: 600;
  color: var(--accent);
  margin-bottom: 2px;
}
.msg-status { font-size: 11px; color: var(--text-muted); }
.chat-input-tiny { gap: var(--s-2); }

/* Auswahl neuer Chatteilnehmer */
.selected-users-list { gap: var(--s-2); }
.user-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px var(--s-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-secondary);
  font-size: 12px;
}
.user-chip img { width: 18px; height: 18px; border-radius: 50%; }
.selection-indicator { color: var(--accent); margin-left: auto; }

/* Hover-Karte fuer Benutzer */
.user-hover-card {
  position: fixed; z-index: 400;
  width: 320px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  overflow: hidden;
}
.hover-card-loader { padding: var(--s-8); text-align: center; color: var(--text-muted); }
.hover-card-banner { height: 64px; background: var(--surface-3); object-fit: cover; width: 100%; }
.hover-card-header { padding: var(--s-4); }
.hover-card-avatar-container { margin-top: -32px; }
.hover-card-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  border: 2px solid var(--surface-1);
}
.hover-card-username { color: var(--text-primary); font-weight: 600; font-size: 14px; }
.hover-card-user-info { min-width: 0; }
.hover-card-bio { color: var(--text-tertiary); font-size: 12px; padding: 0 var(--s-4) var(--s-3); }
.hover-card-content { padding: 0 var(--s-4) var(--s-4); }
.hover-card-stats { display: flex; gap: var(--s-4); padding: var(--s-3) var(--s-4); border-top: 1px solid var(--border); }
.hover-card-stats .stat-item { font-size: 12px; color: var(--text-tertiary); }
.hover-card-footer { padding: var(--s-3) var(--s-4); border-top: 1px solid var(--border); }
.hover-card-socials { display: flex; gap: var(--s-2); }
.hover-card-badge { font-size: 11px; }
.social-icon { color: var(--text-muted); }
.social-icon:hover { color: var(--accent); }

/* Markdown-Ausgabe: Zitate und Erwaehnungen */
.premium-quote {
  border-left: 2px solid var(--accent);
  background: var(--surface-3);
  border-radius: var(--r-md);
  padding: var(--s-3);
  margin: var(--s-3) 0;
}
.quote-header {
  display: flex; align-items: center; gap: 6px;
  color: var(--text-muted); font-size: 11px; font-weight: 600;
  margin-bottom: var(--s-2);
}
.quote-body { color: var(--text-tertiary); font-size: 13px; }
.mention {
  color: var(--accent);
  background: var(--overlay-accent);
  border-radius: var(--r-sm);
  padding: 0 4px;
  cursor: pointer;
}
.mention-self { background: rgba(139,147,255,.28); }
.mention-avatar { width: 16px; height: 16px; border-radius: 50%; }

@media (max-width: 640px) {
  .user-hover-card { width: calc(100vw - var(--s-8)); }
}
