/* Kickdesk Vereins-App — Theme & Mobile-First
 * --------------------------------------------------------------------------
 * Die Akzentfarbe wird per CSS-Variable im <head> der base.html injiziert
 * (aus den Vereinseinstellungen). Alles andere ist neutral.
 */

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

:root {
  --bg: #ffffff;
  --bg-muted: #f5f5f4;
  --fg: #0a0a0a;
  --fg-muted: #57534e;
  --line: rgba(10,10,10,0.10);
  --line-strong: rgba(10,10,10,0.20);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 14px rgba(0,0,0,.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  /* Vereinsfarbe — wird per inline-style auf <html> überschrieben */
  --primary: #0b6cf3;
  --primary-soft: rgba(11, 108, 243, .10);
  --on-primary: #ffffff;

  --container: 720px;     /* Mobile-First: schmaler */
  --gutter: 16px;
}

body { padding-bottom: env(safe-area-inset-bottom); }

a { color: inherit; }
button { font: inherit; cursor: pointer; }
img, svg { max-width: 100%; height: auto; }

/* ---------- DEMO-Banner ---------- */
.demo-banner {
  position: sticky; top: 0; z-index: 100;
  background: #f59e0b;
  color: #1c1917;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 12px;
  letter-spacing: 0.02em;
}
.demo-banner strong { font-weight: 700; }

/* ---------- App-Header (Mobile-First) ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.demo-banner + .app-header { top: 33px; }

.app-header__brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
  color: var(--fg);
}
.app-logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--on-primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  flex-shrink: 0;
}
.app-logo img { width: 100%; height: 100%; object-fit: cover; }

.app-logo--demo {
  background: #0a0a0a;
  color: #fafaf9;
}

.app-brand__name {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.app-brand__sub {
  display: block;
  font-weight: 400;
  font-size: 11.5px;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app-header__actions { display: flex; gap: 6px; align-items: center; }
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--bg-muted); }

/* ---------- Container & Layout ---------- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.page-pad { padding-block: 20px 80px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14.5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg);
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}
.btn:active { transform: scale(0.98); }
.btn--primary {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}
.btn--ghost {
  background: var(--bg);
  border-color: var(--line-strong);
}
.btn--full { width: 100%; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
}
.card--highlight {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.section-title {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 28px 0 10px;
}

/* ---------- Trainings-Liste (Mobile-Use-Case) ---------- */
.training-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}
.training-date {
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: var(--radius-sm);
  text-align: center;
  padding: 8px 4px;
}
.training-date__day { font-size: 22px; font-weight: 700; line-height: 1; }
.training-date__mon { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; margin-top: 2px; }
.training-info__title { font-weight: 600; font-size: 15px; }
.training-info__meta { color: var(--fg-muted); font-size: 12.5px; margin-top: 2px; }
.training-status {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.training-status--abgesagt { background: rgba(220,38,38,.10); color: #b91c1c; }

/* ---------- Quick-Stats ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
}
.stat-card__num {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.stat-card__num--primary { color: var(--primary); }
.stat-card__label {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 4px;
}

/* ---------- Bottom-Nav (Mobile) ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 6px var(--gutter);
  padding-bottom: calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px;
  text-decoration: none;
  color: var(--fg-muted);
  font-size: 10.5px;
  font-weight: 500;
  min-height: 48px;
}
.bottom-nav a[aria-current="page"] { color: var(--primary); }
.bottom-nav svg { width: 22px; height: 22px; }

/* ---------- Page Head ---------- */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.page-head__title {
  font-size: 26px; font-weight: 700; letter-spacing: -0.02em;
  margin: 0; line-height: 1.2;
}

/* ---------- Hero-Card ---------- */
.hero-card {
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 18px;
}
.hero-card__greeting {
  font-size: 22px; font-weight: 700; letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.hero-card__sub { opacity: .85; font-size: 13.5px; margin: 0; }

/* ---------- Search & Filter Chips ---------- */
.search-bar { margin-bottom: 12px; }
.search-bar input {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg-muted);
  font: inherit;
}
.filter-row {
  display: flex; gap: 6px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin-bottom: 16px;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--fg);
  font-size: 13px; font-weight: 500;
  white-space: nowrap;
}
.chip--active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

/* ---------- Avatars & Lists ---------- */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  flex-shrink: 0;
}
.jersey-num {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--primary);
  color: var(--on-primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
}
.member-list { list-style: none; margin: 0; padding: 0; }
.member-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}
.member-row:last-child { border-bottom: 0; }
.member-info__name { font-weight: 600; font-size: 15px; }
.member-info__meta { color: var(--fg-muted); font-size: 12.5px; margin-top: 2px; }
.icon-btn--sm { width: 32px; height: 32px; border: 0; }

/* ---------- Team Cards ---------- */
.team-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.team-card {
  display: block;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--fg);
  transition: transform 120ms ease, border-color 120ms ease;
}
.team-card:active { transform: scale(0.98); }
.team-card:hover { border-color: var(--primary); }
.team-card__name { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.team-card__count { color: var(--primary); font-size: 13px; font-weight: 600; margin-top: 4px; }
.team-card__schedule { color: var(--fg-muted); font-size: 12px; margin-top: 8px; }

/* ---------- Event List ---------- */
.event-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}
.event-date { text-align: center; }
.event-date__day { font-size: 22px; font-weight: 700; line-height: 1; }
.event-date__dow { font-size: 11px; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }
.event-info__title { font-weight: 600; font-size: 15px; }
.event-info__meta { color: var(--fg-muted); font-size: 12.5px; margin-top: 2px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot--spiel { background: var(--primary); }
.dot--verein { background: #f59e0b; }
.dot--training { background: #16a34a; }

/* ---------- Threads / Nachrichten ---------- */
.thread-list { list-style: none; margin: 0; padding: 0; }
.thread-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
}
.thread-row:last-child { border-bottom: 0; }
.thread-info__head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
}
.thread-info__title { font-weight: 600; font-size: 15px; }
.thread-info__time { font-size: 11.5px; color: var(--fg-muted); white-space: nowrap; }
.thread-info__last {
  font-size: 13px; color: var(--fg-muted);
  margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge {
  background: var(--primary);
  color: var(--on-primary);
  font-size: 11px; font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
}

/* ---------- Login ---------- */
/* Login-Main: ersetzt den default .container.page-pad Wrapper.
   Nutzt dvh damit die iOS-Tastatur den Inhalt nicht verschiebt. */
.login-main {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg);
}
/* Auf kleinen Screens: oben anhaengen statt vertikal zentrieren —
   sonst springt der Inhalt mit der Tastatur. */
@media (max-height: 720px) {
  .login-main { align-items: flex-start; padding-top: 32px; }
}

.login-wrap {
  width: 100%;
  max-width: 420px;
  /* Kein min-height/flex mehr — das uebernimmt .login-main aussen. */
}
.login-brand { text-align: center; margin-bottom: 32px; }
.app-logo--xl {
  width: 80px; height: 80px;
  border-radius: 22px;
  font-size: 26px;
  margin: 0 auto 20px;
}
.login-title {
  font-size: 24px; font-weight: 700; letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.login-sub { color: var(--fg-muted); margin: 0; }
.login-foot {
  text-align: center;
  color: var(--fg-muted);
  font-size: 12px;
  margin-top: auto; padding-top: 32px;
}

/* ---------- Brand Preview (Settings) ---------- */
.brand-preview {
  display: flex; align-items: center; gap: 14px;
  padding: 16px;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
  margin-bottom: 18px;
}
.brand-preview__icon {
  width: 64px; height: 64px;
  border-radius: 16px;
  background: var(--primary);
  color: var(--on-primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 18px;
  overflow: hidden;
}
.brand-preview__icon img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Settings-Form ---------- */
.field {
  display: block;
  margin-bottom: 18px;
}
.field__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.field__hint {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 4px;
}
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="tel"],
.field input[type="number"],
.field input[type="search"],
.field input[type="url"],
.field input[type="date"],
.field input[type="time"],
.field input[type="color"],
.field input[type="file"],
.field input:not([type]),
.field textarea,
.field select {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-2);   /* Dezenter Kontrast zum Card-Hintergrund */
  color: var(--fg);
  font: inherit;
  font-size: 16px;                /* iOS verhindert Auto-Zoom bei >=16px */
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .14s, box-shadow .14s, background .14s;
}
[data-theme="dark"] .field input[type="text"],
[data-theme="dark"] .field input[type="email"],
[data-theme="dark"] .field input[type="password"],
[data-theme="dark"] .field input[type="tel"],
[data-theme="dark"] .field input[type="number"],
[data-theme="dark"] .field input[type="search"],
[data-theme="dark"] .field input[type="url"],
[data-theme="dark"] .field input[type="date"],
[data-theme="dark"] .field input[type="time"],
[data-theme="dark"] .field input:not([type]),
[data-theme="dark"] .field textarea,
[data-theme="dark"] .field select {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--line-strong);
  /* iOS Safari schreibt sonst Form-Eingaben dunkel auf dunkel — explizit -webkit-text-fill-color */
  -webkit-text-fill-color: var(--fg);
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring, var(--primary-soft));
  background: var(--surface);
}
.field input::placeholder,
.field textarea::placeholder {
  color: var(--fg-faint);
  opacity: 1;
}
.field input[type="color"] {
  height: 52px; padding: 4px;
}
.field input[type="file"] {
  padding: 10px 16px;
}
.field__label {
  /* groesser + lesbarer auf Mobile */
  font-size: 14px;
  font-weight: 600;
}

/* ---------- Demo-Branding-Grid ---------- */
.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.demo-phone {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow-md);
}
.demo-phone__header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.demo-phone__logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--demo-primary);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
}
.demo-phone__hero {
  background: var(--demo-primary);
  color: #fff;
  border-radius: 14px;
  padding: 14px;
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 12px;
}
.demo-phone__row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 8px;
}
.demo-phone__row-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--demo-primary) 14%, transparent);
}
.demo-phone__btn {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  background: var(--demo-primary);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}

/* ---------- iPad-Layout ---------- */
@media (min-width: 720px) {
  :root { --container: 920px; --gutter: 28px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .bottom-nav { display: none; }
  body { padding-bottom: 0; }
  .app-header { padding-block: 16px; }
  .app-logo { width: 42px; height: 42px; font-size: 14px; }
}

/* ---------- Desktop ---------- */
@media (min-width: 1024px) {
  :root { --container: 1100px; --gutter: 32px; }
  .stat-grid { gap: 16px; }
}

/* ============================================================================
 * KICKDESK NAV v2 — Theme-Tokens (Light/Dark) + 2-Zeilen-Header
 * ----------------------------------------------------------------------------
 * Quelle: Kickdesk.de/Hauptnavigation Redesign v2.html
 * - --primary wird weiterhin per inline-style auf <html> aus Vereinsfarbe
 *   injiziert; HIER definierte --primary-Werte sind nur Fallback.
 * - data-theme="light"|"dark" wird vom Server gerendert (FOUC-frei)
 *   und vom JS-Theme-Manager bei User-Klick umgeschaltet.
 * ============================================================================
 */

/* Light theme tokens */
[data-theme="light"] {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f5f5f4;
  --surface-hover: #f5f5f4;
  --fg: #0c0a09;
  --fg-muted: #57534e;
  --fg-faint: #a8a29e;
  --line: #e7e5e4;
  --line-strong: #d6d3d1;
  --primary-ring: rgba(200,16,46,.18);
  --shadow-md: 0 12px 30px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.05);
  --user-pill-bg: #ffffff;
  --user-pill-border: #e7e5e4;
  --search-bg: #ffffff;
  --search-border: #d6d3d1;
  --search-placeholder: #a8a29e;
  --segment-bg: #f5f5f4;
  --segment-border: #e7e5e4;
  --segment-active-bg: #ffffff;
  --segment-active-fg: #0c0a09;
  --segment-fg: #57534e;
  --row-divider: #e7e5e4;
  --notif-dot-border: #ffffff;
}

/* Dark theme tokens */
[data-theme="dark"] {
  --bg: #0c0a09;
  --surface: #1c1917;
  --surface-2: #292524;
  --surface-hover: #292524;
  --fg: #fafaf9;
  --fg-muted: #d6d3d1;
  --fg-faint: #78716c;
  --line: #292524;
  --line-strong: #44403c;
  --primary-ring: rgba(200,16,46,.30);
  --shadow-md: 0 12px 30px rgba(0,0,0,.40);
  --user-pill-bg: #292524;
  --user-pill-border: #44403c;
  --search-bg: #292524;
  --search-border: #44403c;
  --search-placeholder: #78716c;
  --segment-bg: #292524;
  --segment-border: #44403c;
  --segment-active-bg: var(--primary);
  --segment-active-fg: #ffffff;
  --segment-fg: #a8a29e;
  --row-divider: #292524;
  --notif-dot-border: #1c1917;
}

html, body {
  transition: background .18s ease, color .18s ease;
}

/* ---------- Top-Shell (App-Header v2, 2 Zeilen) -------------------------- */
.shell {
  background: var(--surface);
  border-bottom: 3px solid var(--primary);
  transition: background .18s ease, border-color .18s ease;
  /* Sticky: Header bleibt beim Scrollen oben — wichtig u.a. fuer Anker-Spruenge
     wie /dashboard#meine-mannschaften, sonst scrollt die Nav weg. */
  position: sticky; top: 0;
  z-index: 70;
  /* iOS PWA: Safe-Area-Inset damit Statusbar nicht ueber Brand laeuft */
  padding-top: env(safe-area-inset-top, 0px);
}
.demo-banner + .shell { top: 33px; }

.row1 {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--row-divider);
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; text-decoration: none; }
.brand__mark {
  width: 32px; height: 32px; border-radius: 7px;
  background: var(--primary); color: var(--on-primary, #fff);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
  overflow: hidden;
}
.brand__mark img { width: 100%; height: 100%; object-fit: cover; }
.brand__name { font-weight: 700; font-size: 15px; line-height: 1.1; color: var(--fg); }
.brand__sub  { display: block; font-size: 11px; font-weight: 500; color: var(--fg-muted); letter-spacing: .03em; }

.segment {
  display: inline-flex;
  background: var(--segment-bg);
  border: 1px solid var(--segment-border);
  border-radius: 7px; padding: 2px;
  flex-shrink: 0;
}
.segment a, .segment button {
  border: 0; background: transparent;
  padding: 5px 14px; border-radius: 5px;
  font-size: 13px; font-weight: 500;
  color: var(--segment-fg);
  text-decoration: none;
  transition: background .14s, color .14s;
}
.segment a[aria-pressed="true"], .segment button[aria-pressed="true"] {
  background: var(--segment-active-bg);
  color: var(--segment-active-fg);
  font-weight: 600;
}
[data-theme="light"] .segment a[aria-pressed="true"],
[data-theme="light"] .segment button[aria-pressed="true"] {
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

.search { flex: 1; max-width: 360px; min-width: 200px; position: relative; }
.search input {
  width: 100%; padding: 7px 12px 7px 34px;
  border: 1px solid var(--search-border);
  border-radius: 7px;
  background: var(--search-bg); color: var(--fg);
  font: inherit; font-size: 13px;
}
.search input::placeholder { color: var(--search-placeholder); }
.search input:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--fg-faint); }

.spacer { flex: 1; }
.actions { display: flex; align-items: center; gap: 4px; }

.iconbtn {
  width: 34px; height: 34px;
  border-radius: 7px; border: 0; background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--fg-muted); position: relative;
  text-decoration: none;
  transition: background .14s, color .14s;
}
.iconbtn:hover { background: var(--surface-hover); color: var(--fg); }
.iconbtn .dot {
  position: absolute; top: 7px; right: 7px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--notif-dot-border);
}

/* Theme toggle (3-way segmented) */
.theme-switch {
  display: inline-flex;
  background: var(--segment-bg);
  border: 1px solid var(--segment-border);
  border-radius: 7px; padding: 2px;
}
.theme-switch button {
  width: 28px; height: 26px;
  border: 0; background: transparent;
  border-radius: 5px;
  color: var(--segment-fg);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .14s, color .14s;
  position: relative;
  cursor: pointer;
}
.theme-switch button:hover { color: var(--fg); }
.theme-switch button[aria-pressed="true"] {
  background: var(--segment-active-bg);
  color: var(--segment-active-fg);
}
[data-theme="light"] .theme-switch button[aria-pressed="true"] { box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.theme-switch button svg { width: 14px; height: 14px; }

.user {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--user-pill-border);
  background: var(--user-pill-bg);
  cursor: pointer; transition: background .14s;
  text-decoration: none;
  color: var(--fg);
}
.user:hover { background: var(--surface-hover); }
.user__avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
[data-theme="dark"] .user__avatar { background: var(--primary); color: #fff; }
.user__name { font-size: 13px; font-weight: 500; color: var(--fg); }
.user__role {
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  background: var(--primary); color: #fff;
  padding: 2px 6px; border-radius: 3px; text-transform: uppercase;
}

/* Row 2 nav */
.row2 {
  display: flex; align-items: center;
  padding: 0 14px;
  flex-wrap: wrap;
}
.nav { display: flex; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.nav__item { position: relative; }
.nav__btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 14px;
  border: 0; background: transparent;
  font-size: 13.5px; font-weight: 500;
  color: var(--fg);
  border-bottom: 2px solid transparent;
  transition: color .14s;
  text-decoration: none;
  cursor: pointer;
}
.nav__btn:hover { color: var(--primary); }
.nav__btn[aria-current="page"] {
  color: var(--primary);
  font-weight: 600;
  border-bottom-color: var(--primary);
}
.nav__btn .icon { width: 16px; height: 16px; color: var(--fg-muted); }
.nav__btn[aria-current="page"] .icon,
.nav__btn:hover .icon { color: var(--primary); }
.nav__btn .chev { width: 12px; height: 12px; color: var(--fg-faint); margin-left: 2px; }
.nav__btn .badge {
  margin-left: 4px;
  font-size: 9.5px; font-weight: 700;
  background: var(--primary); color: #fff;
  padding: 1px 5px; border-radius: 3px;
  letter-spacing: .04em;
}

.dropdown {
  position: absolute; top: 100%; left: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  min-width: 240px; padding: 6px;
  z-index: 100; display: none;
}
.nav__item:hover .dropdown,
.nav__item:focus-within .dropdown { display: block; }
.dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 5px;
  font-size: 13px; color: var(--fg);
  text-decoration: none;
}
.dropdown a:hover { background: var(--surface-hover); }
.dropdown a svg { width: 16px; height: 16px; color: var(--fg-muted); flex-shrink: 0; }
.dropdown__head {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--fg-faint);
  padding: 8px 10px 4px;
}
.dropdown__sep { height: 1px; background: var(--line); margin: 4px 0; }
.dropdown a span.label { font-weight: 500; line-height: 1.3; }
.dropdown a small { font-size: 11px; color: var(--fg-muted); display: block; font-weight: 400; }

/* Mobile fallback */
/* Hamburger: per Default versteckt, nur auf Mobile sichtbar */
.nav-mobile-toggle { display: none; }

@media (max-width: 720px) {
  .row1 { gap: 6px; padding: 8px 10px; flex-wrap: wrap; }
  /* Suche in eigene Zeile darunter */
  .row1 .search { order: 99; flex: 1 1 100%; max-width: none; min-width: 0; }
  /* Jugend/Senioren-Toggle bleibt in der gleichen Zeile wie Brand+Icons */
  .row1 .segment { order: 4; flex-shrink: 0; }
  .row1 .segment a, .row1 .segment button { padding: 4px 9px; font-size: 12px; }
  .row1 .spacer { display: none; }
  .row1 .actions { order: 5; margin-left: auto; }
  .row1 .brand { order: 1; }
  /* Auf Mobile NUR das Logo, keine Textbeschriftung — sonst keine Reihe */
  .brand__name, .brand__sub { display: none; }
  .user__name, .user__role { display: none; }
  .actions { gap: 2px; }
  .iconbtn { width: 30px; height: 30px; }
  .theme-switch button { width: 32px; height: 30px; }

  /* Hauptnav (.row2) versteckt — Hamburger-Drawer uebernimmt */
  .row2 { display: none; }
  .nav-mobile-toggle { display: inline-flex !important; }
}

/* ============== Mobile-Drawer fuer Hauptnav ============== */
.nav-drawer {
  position: fixed; inset: 0;
  z-index: 250;
  pointer-events: none;
  display: flex; justify-content: flex-end;
}
.nav-drawer[hidden] { display: none; }
.nav-drawer__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.5);
  opacity: 0; transition: opacity .22s ease;
  pointer-events: auto;
}
.nav-drawer[data-open="true"] .nav-drawer__backdrop { opacity: 1; }

.nav-drawer__panel {
  position: relative;
  width: min(85vw, 320px);
  max-width: 320px;
  background: var(--surface);
  color: var(--fg);
  box-shadow: -8px 0 30px rgba(0,0,0,.20);
  transform: translateX(100%);
  transition: transform .26s cubic-bezier(.32,.72,0,1);
  pointer-events: auto;
  overflow-y: auto;
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
}
.nav-drawer[data-open="true"] .nav-drawer__panel { transform: translateX(0); }

.nav-drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.nav-drawer__title { font-size: 14px; font-weight: 700; color: var(--fg-muted); letter-spacing: .04em; text-transform: uppercase; }
.nav-drawer__close {
  width: 36px; height: 36px;
  border-radius: 8px; border: 0; background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--fg-muted);
}
.nav-drawer__close:hover { background: var(--surface-hover); color: var(--fg); }

.nav-drawer__list {
  display: flex; flex-direction: column;
  padding: 8px 0;
  flex: 1;
}
.nav-drawer__list a,
.nav-drawer__list button {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  border: 0; background: transparent;
  color: var(--fg);
  text-decoration: none;
  font-size: 15px; font-weight: 500;
  width: 100%; text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.nav-drawer__list a:hover,
.nav-drawer__list button:hover { background: var(--surface-hover); }
.nav-drawer__list a[aria-current="page"] {
  color: var(--primary); font-weight: 600;
}
.nav-drawer__list svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--fg-muted); }
.nav-drawer__list a[aria-current="page"] svg { color: var(--primary); }
.nav-drawer__group {
  font-size: 11px; font-weight: 700;
  color: var(--fg-muted); letter-spacing: .08em;
  text-transform: uppercase;
  padding: 14px 18px 6px;
}
.nav-drawer__sep { height: 1px; background: var(--line); margin: 6px 0; }
.nav-drawer__sub {
  display: block; font-size: 11px;
  color: var(--fg-muted); font-weight: 400;
  margin-top: 2px;
}

.nav-mobile-toggle {
  width: 34px; height: 34px;
  border-radius: 7px; border: 0; background: transparent;
  align-items: center; justify-content: center;
  color: var(--fg-muted);
  cursor: pointer;
}
.nav-mobile-toggle:hover { background: var(--surface-hover); color: var(--fg); }

/* ============================================================================
 * KICKDESK Mobile-Theme: Bottom-Sheet (drag-to-dismiss)
 * ----------------------------------------------------------------------------
 * Quelle: Kickdesk.de/Mobiler Theme-Toggle.html
 * - Mobil (<600px): Segmented-Toggle wird ausgeblendet, Icon-Button erscheint
 *   und oeffnet das Sheet
 * - Desktop (>=600px): Segmented-Toggle direkt im Header, Icon-Button hidden
 * ============================================================================
 */

/* Mobile-Icon mit dynamischem Sonne/Mond-Symbol */
.icon-btn--theme-mobile { display: none; }
.icon-btn--theme-mobile .theme-icon-light,
.icon-btn--theme-mobile .theme-icon-dark { display: none; }
[data-theme="light"] .icon-btn--theme-mobile .theme-icon-light { display: inline-block; }
[data-theme="dark"]  .icon-btn--theme-mobile .theme-icon-dark  { display: inline-block; }

@media (max-width: 600px) {
  .actions .theme-switch { display: none; }
  .icon-btn--theme-mobile { display: inline-flex; }
}

/* Bottom-Sheet */
.theme-sheet {
  position: fixed; inset: 0;
  z-index: 200;
  display: flex; flex-direction: column; justify-content: flex-end;
  pointer-events: none;
}
.theme-sheet[hidden] { display: none; }

.theme-sheet__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.5);
  opacity: 0; transition: opacity .22s ease;
  pointer-events: auto;
}
.theme-sheet[data-open="true"] .theme-sheet__backdrop { opacity: 1; }

.theme-sheet__panel {
  position: relative;
  background: var(--surface);
  color: var(--fg);
  border-radius: 18px 18px 0 0;
  padding: 8px 16px 24px;
  box-shadow: 0 -8px 30px rgba(0,0,0,.20);
  transform: translateY(100%);
  transition: transform .26s cubic-bezier(.32,.72,0,1);
  pointer-events: auto;
}
.theme-sheet[data-open="true"] .theme-sheet__panel { transform: translateY(0); }

.theme-sheet__handle {
  width: 40px; height: 4px;
  background: var(--line-strong);
  border-radius: 2px;
  margin: 6px auto 14px;
  cursor: grab;
}

.theme-sheet__title {
  font-size: 17px; font-weight: 600; margin: 0;
  letter-spacing: -.01em;
}
.theme-sheet__sub {
  font-size: 13px; color: var(--fg-muted);
  margin: 2px 0 14px;
}

.theme-sheet__options {
  display: flex; flex-direction: column; gap: 2px;
  margin-bottom: 8px;
}
.theme-sheet__option {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 56px;
  padding: 10px 12px;
  border: 0; border-radius: 12px;
  background: transparent; color: var(--fg);
  text-align: left; font: inherit; cursor: pointer;
  transition: background .14s;
}
.theme-sheet__option:hover,
.theme-sheet__option:active { background: var(--surface-2); }

.theme-sheet__option-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--surface-2); color: var(--fg-muted);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.theme-sheet__option-icon svg { width: 18px; height: 18px; }

.theme-sheet__option-label { flex: 1; }
.theme-sheet__option-title {
  display: block; font-size: 15px; font-weight: 500;
}
.theme-sheet__option-desc {
  display: block; font-size: 12px; color: var(--fg-muted);
  margin-top: 1px;
}

.theme-sheet__option-check {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--primary); color: var(--on-primary);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  opacity: 0; transform: scale(.6);
  transition: opacity .14s, transform .14s;
}
.theme-sheet__option-check svg { width: 13px; height: 13px; }
.theme-sheet__option[aria-pressed="true"] .theme-sheet__option-check {
  opacity: 1; transform: scale(1);
}
.theme-sheet__option[aria-pressed="true"] .theme-sheet__option-icon {
  background: var(--primary-soft); color: var(--primary);
}

.theme-sheet__cancel {
  width: 100%; min-height: 50px;
  margin-top: 6px;
  border: 0; border-radius: 12px;
  background: var(--surface-2); color: var(--fg);
  font: inherit; font-weight: 600; font-size: 15px;
  cursor: pointer;
}

body.theme-sheet-open { overflow: hidden; }
