@charset "UTF-8";

/* ============================================================
   BERATUNG — "Nordic Marine" Design System
   Rheuma-Liga Sachsen e.V.
   Schwester-Modul des Funktionstrainingsmoduls (FT)
   ============================================================
   0. FONTS        Lokale Schriftarten
   1. TOKENS       Design Tokens, Reset
   2. LAYOUT       Container, Page-Main
   3. SITE-HEADER  Markenleiste + Hauptnavigation
   4. PAGE-HEADER  Slimmer Seitentitel
   5. SITE-FOOTER  Preferences + Adresszeile
   6. KOMPONENTEN  Buttons, Cards, Forms, Tabellen, Modals
   7. DASHBOARD    CTA, Widgets, Stats
   8. WIZARD       Beratungsformular-Reiter
   9. EINSTELLUNGEN  Settings-Nav + Inhalt
  10. WISSEN       Wissensbausteine, Filter, Print-Tree
  11. STATISTIK
  12. RESPONSIVE
  13. A11Y/PRINT
   ============================================================ */


/* ============================================================
   0. FONTS
   ============================================================ */

@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/open-sans-v44-latin-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('assets/fonts/open-sans-v44-latin-600.woff2') format('woff2');
}


/* ============================================================
   1. TOKENS
   ============================================================ */

:root {
  --navy:          #1B2A4A;
  --navy-light:    #2D4166;
  --navy-muted:    #8B97AD;
  --navy-wash:     #EEF1F6;
  --navy-tint:     #F6F8FB;

  --copper:        #C06B3E;
  --copper-dark:   #A25832;
  --copper-light:  #FDF3EE;
  --copper-wash:   #F9EDE6;

  --sea:           #2B7A78;
  --sea-light:     #EBF5F5;
  --plum:          #7C5295;
  --plum-light:    #F4EFF8;
  --amber:         #B8860B;
  --amber-light:   #FDF6E3;
  --rose:          #B44D5E;
  --rose-light:    #FBF0F1;

  --bg:            #F5F4F1;
  --surface:       #FFFFFF;
  --border:        #E4E1DB;
  --border-light:  #EDEBE6;
  --text:          #1F1F1E;
  --text-mid:      #555550;
  --text-muted:    #8A877F;

  --danger:        #C0392B;
  --danger-light:  #FDF0EF;
  --success:       #1A7A3A;
  --success-light: #E8F5EC;

  /* Legacy-Aliase – einzelne PHP-Seiten setzen diese noch
     in inline-<style>-Blöcken aus der DB-Konfiguration. */
  --primary-color:   var(--navy);
  --secondary-color: var(--navy-wash);
  --text-color:      var(--text);
  --bg-color:        var(--bg);
  --border-color:    var(--border);
  --urgent-color:    var(--danger);
  --input-bg:        var(--surface);
  --focus-ring:      rgba(27, 42, 74, 0.18);
  --label-color:     var(--text-mid);

  --sp-2xs: 2px;  --sp-xs: 4px;  --sp-sm: 8px;
  --sp-md: 16px;  --sp-lg: 24px; --sp-xl: 32px;
  --sp-2xl: 48px; --sp-3xl: 64px;

  --font: 'Open Sans', "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --fs-2xs: 0.6875rem; --fs-xs: 0.75rem; --fs-sm: 0.875rem;
  --fs-base: 1rem; --fs-md: 1.0625rem; --fs-lg: 1.25rem;
  --fs-xl: 1.5rem; --fs-2xl: 1.875rem;

  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --r-xl: 20px; --r-full: 9999px;

  --sh-xs:  0 1px 2px rgba(27,42,74,.04);
  --sh-sm:  0 1px 4px rgba(27,42,74,.06), 0 1px 2px rgba(27,42,74,.04);
  --sh-md:  0 4px 16px rgba(27,42,74,.07), 0 1px 4px rgba(27,42,74,.03);
  --sh-lg:  0 12px 40px rgba(27,42,74,.09), 0 2px 8px rgba(27,42,74,.04);
  --sh-glow: 0 0 0 3px rgba(192,107,62,.28);
  --sh-focus: 0 0 0 3px rgba(27,42,74,.2);
  --shadow:  var(--sh-sm);

  --ease: cubic-bezier(.22,.68,0,1);
  --dur: 180ms;
  --dur-slow: 350ms;
  --max-w: 1320px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;    /* iOS Safari: ohne dynamic viewport ragt die Toolbar in das Layout */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; height: auto; }
a {
  color: var(--navy);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}
a:hover { color: var(--navy-light); }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; border-radius: var(--r-sm); }
ul { list-style: none; }

hr.form-divider {
  border: none;
  border-top: 1px dashed var(--border);
  margin: var(--sp-lg) 0;
}

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: var(--r-sm);
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--navy-muted); }

/* Skip-Link */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-md);
  background: var(--copper);
  color: #fff;
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--r-sm);
  z-index: 200;
  font-weight: 600;
}
.skip-link:focus { top: var(--sp-sm); color: #fff; }


/* ============================================================
   2. LAYOUT
   ============================================================ */

.dashboard-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

.main-wrapper {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--sp-xl) var(--sp-lg) var(--sp-3xl);
}

.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
}


/* ============================================================
   3. SITE-HEADER (Markenleiste + Hauptnavigation)
   ============================================================ */

.site-header {
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  -webkit-transform: translateZ(0);  /* iOS-Sticky-Fix */
  transform: translateZ(0);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 12px var(--sp-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
}
.header-brand:hover { color: #fff; text-decoration: none; }

.header-logo {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: var(--fs-sm);
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.95);
  flex-shrink: 0;
}

.header-brand-text {
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.header-brand-text small {
  display: block;
  font-size: var(--fs-2xs);
  font-weight: 400;
  opacity: 0.55;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}

.header-user {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-size: var(--fs-sm);
  color: rgba(255, 255, 255, 0.7);
  min-width: 0;
}
.header-user strong { color: #fff; font-weight: 600; }

.avatar {
  width: 30px; height: 30px;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--fs-xs);
  flex-shrink: 0;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  text-decoration: none;
  line-height: 1.3;
}
.btn-logout:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 255, 255, 0.2);
  text-decoration: none;
}
.btn-logout i { font-size: 0.85rem; }

.site-header :focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

/* ============================================================
   4. PAGE-HEADER + HAUPTNAVIGATION (qa-row, admin-bar)
   ============================================================ */

/* ── 4.1 QA-Row (große Navigationsbuttons) ───────────────── */

.qa-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-md);
  margin-bottom: var(--sp-lg);
  animation: fadeIn .45s var(--ease) both;
}

/* Variante mit 3 Buttons (Dashboard ohne sich selbst). */
.qa-row--3 { grid-template-columns: repeat(3, 1fr); }

.qa-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-sm);
  padding: var(--sp-lg) var(--sp-md);
  border-radius: var(--r-lg);
  text-decoration: none;
  transition: all var(--dur) var(--ease);
  position: relative;
  overflow: hidden;
  min-height: 110px;
}

.qa-card::before {
  content: '';
  position: absolute;
  inset: 0;
  top: 0; right: 0; bottom: 0; left: 0;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
  border-radius: inherit;
}

.qa-card:hover { transform: translateY(-2px); text-decoration: none; }
.qa-card:hover::before { opacity: 1; }
.qa-card:focus-visible { box-shadow: var(--sh-glow); }

.qa-card i {
  font-size: 1.35rem;
  position: relative;
  z-index: 1;
}
.qa-card span {
  font-weight: 700;
  font-size: var(--fs-base);
  line-height: 1.3;
  position: relative;
  z-index: 1;
  letter-spacing: -0.01em;
}
.qa-card small {
  font-size: var(--fs-xs);
  opacity: 0.85;
  position: relative;
  z-index: 1;
  line-height: 1.4;
}

.qa-card--copper {
  background: var(--copper);
  color: #fff;
  box-shadow: 0 4px 12px rgba(192, 107, 62, 0.2);
}
.qa-card--copper::before {
  background: linear-gradient(135deg, rgba(255,255,255,.08) 0%, transparent 60%);
}
.qa-card--copper:hover {
  box-shadow: 0 8px 24px rgba(192, 107, 62, 0.25);
  color: #fff;
}

.qa-card--navy {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 4px 12px rgba(27, 42, 74, 0.15);
}
.qa-card--navy::before {
  background: linear-gradient(135deg, rgba(255,255,255,.06) 0%, transparent 60%);
}
.qa-card--navy:hover {
  box-shadow: 0 8px 24px rgba(27, 42, 74, 0.2);
  color: #fff;
}

.qa-card--sea {
  background: var(--sea);
  color: #fff;
  box-shadow: 0 4px 12px rgba(43, 122, 120, 0.18);
}
.qa-card--sea::before {
  background: linear-gradient(135deg, rgba(255,255,255,.08) 0%, transparent 60%);
}
.qa-card--sea:hover {
  box-shadow: 0 8px 24px rgba(43, 122, 120, 0.22);
  color: #fff;
}

.qa-card--plum {
  background: var(--plum);
  color: #fff;
  box-shadow: 0 4px 12px rgba(124, 82, 149, 0.2);
}
.qa-card--plum::before {
  background: linear-gradient(135deg, rgba(255,255,255,.08) 0%, transparent 60%);
}
.qa-card--plum:hover {
  box-shadow: 0 8px 24px rgba(124, 82, 149, 0.25);
  color: #fff;
}

/* Aktive Seite – kleiner Punkt rechts oben, kein Klick-Feedback nötig */
.qa-card--active {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: -2px;
}
.qa-card--active::after {
  content: '';
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  z-index: 2;
}


/* ── 4.1b Back-to-Dashboard-Button (am Fuß der Unterseiten) ── */

.back-to-dashboard {
  margin-top: var(--sp-2xl);
  padding-top: var(--sp-lg);
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: center;
}

.back-to-dashboard__btn {
  /* erbt die Form aus .btn .btn-secondary – etwas mehr Innenabstand
     und eine sanfte Hover-Lift, damit der Button als „Aktion zurück
     zur Startseite" leicht hervorsticht, ohne marktschreierisch zu wirken. */
  padding: 12px 24px;
  font-size: var(--fs-sm);
  letter-spacing: 0.01em;
  transition: all var(--dur) var(--ease);
}
.back-to-dashboard__btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--sh-sm);
}
.back-to-dashboard__btn i {
  font-size: 0.85rem;
  transition: transform var(--dur) var(--ease);
}
.back-to-dashboard__btn:hover i {
  transform: translateX(-3px);
}


/* ── 4.2 Admin-Bar (rollenbasierte Verwaltungs-Chips) ─────── */

.admin-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  padding: var(--sp-md) var(--sp-lg);
  background: var(--navy-tint);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-lg);
}

.admin-bar-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: var(--sp-sm);
}
.admin-bar-label i { font-size: 0.85rem; }

.admin-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-mid);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all var(--dur) var(--ease);
}
.admin-chip i { font-size: 0.75rem; color: var(--text-muted); }
.admin-chip:hover {
  color: var(--navy);
  border-color: var(--navy-muted);
  box-shadow: var(--sh-xs);
  text-decoration: none;
}
.admin-chip:hover i { color: var(--navy); }

.admin-chip--active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
  font-weight: 600;
}
.admin-chip--active i { color: var(--copper); }
.admin-chip--active:hover {
  background: var(--navy-light);
  border-color: var(--navy-light);
  color: #fff;
}


/* ── 4.3 Page-Header (Seitentitel im Inhalt) ─────────────── */

.page-header {
  margin-bottom: var(--sp-lg);
  animation: fadeIn .45s var(--ease) both;
}

.page-header h1 {
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin: 0;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  margin: 4px 0 0;
}

/* Visuell ausgeblendete Variante – auf dem Dashboard wirken die
   großen QA-Buttons und der Site-Header bereits als Identitätsanker,
   ein zusätzliches „Dashboard"-h1 wäre redundant. Wir blenden den
   Header optisch aus, behalten ihn aber für Screen-Reader im DOM
   (Standard-„sr-only"-Pattern), damit die Seite weiterhin eine
   semantisch korrekte Überschriftenstruktur hat. */
.page-header--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;
}


/* ============================================================
   5. SITE-FOOTER (Preferences + Adresszeile)
   ============================================================ */

.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--sp-lg);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-lg);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.footer-inner a { color: var(--navy); font-weight: 600; }
.footer-inner strong { color: var(--text); font-weight: 600; }
.footer-right { color: var(--text-muted); opacity: 0.6; }


/* ============================================================
   6. KOMPONENTEN
   ============================================================ */

/* ── 6.1 Buttons ──────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  line-height: 1.3;
  text-align: center;
}
.btn:active { transform: translateY(1px); }
.btn i { font-size: 0.95rem; flex-shrink: 0; }

.btn-primary {
  background: var(--copper);
  color: #fff;
  border-color: var(--copper);
}
.btn-primary:hover {
  background: var(--copper-dark);
  border-color: var(--copper-dark);
  color: #fff;
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  color: var(--text-mid);
  border-color: var(--border);
}
.btn-secondary:hover {
  border-color: var(--navy-muted);
  color: var(--navy);
  background: var(--navy-wash);
  text-decoration: none;
}

.btn-small {
  padding: 6px 12px;
  font-size: var(--fs-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-mid);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  font-weight: 500;
}
.btn-small:hover {
  background: var(--navy-wash);
  border-color: var(--navy-muted);
  color: var(--navy);
}

/* Icon-Buttons in Tabellen */
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-left: 4px;
  border-radius: var(--r-sm);
  font-size: 1rem;
  color: var(--text-muted);
  transition: all var(--dur) var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: var(--navy-wash); color: var(--navy); }
.btn-icon.btn-edit { color: var(--navy); }
.btn-icon.btn-edit:hover { background: var(--navy-wash); }
.btn-icon.btn-deactivate { color: var(--danger); }
.btn-icon.btn-deactivate:hover { background: var(--danger-light); }
.btn-icon.btn-activate { color: var(--success); }
.btn-icon.btn-activate:hover { background: var(--success-light); }
.btn-icon.btn-delete-kategorie,
.btn-icon.btn-trash,
.btn-icon[data-status="0"] { color: var(--danger); }
.btn-icon.btn-delete-kategorie:hover,
.btn-icon.btn-trash:hover,
.btn-icon[data-status="0"]:hover { background: var(--danger-light); color: var(--danger); }


/* ── 6.2 Cards ────────────────────────────────────────────── */

.content-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: var(--sp-xl);
  margin-bottom: var(--sp-lg);
  box-shadow: var(--sh-xs);
}

.content-card h2 {
  margin-bottom: var(--sp-lg);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: var(--sp-sm);
  display: flex;
  align-items: center;
  gap: 10px;
}
.content-card h2 i { font-size: 1.1rem; color: var(--copper); }

.content-header-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-lg);
  flex-wrap: wrap;
  gap: var(--sp-md);
}
.content-header-controls h2 {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}
.content-header-controls--single {
  justify-content: flex-end;
}

.content-section { margin-bottom: var(--sp-lg); }


/* ── 6.3 Formulare ────────────────────────────────────────── */

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-weight: 700;
  margin-bottom: 6px;
  font-size: var(--fs-xs);
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.form-group label .knowledge-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  width: 22px;
  height: 22px;
  border-radius: var(--r-full);
  background: var(--copper-light);
  color: var(--copper);
  font-size: 0.75rem;
  text-decoration: none;
  transition: all var(--dur) var(--ease);
  flex-shrink: 0;
  text-transform: none;
  letter-spacing: 0;
}
.form-group label .knowledge-toggle:hover {
  background: var(--copper);
  color: #fff;
  transform: scale(1.08);
  box-shadow: var(--sh-xs);
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group input[type="datetime-local"],
.form-group input[type="tel"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="search"],
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--fs-base);
  font-family: inherit;
  line-height: 1.4;
  min-height: 42px;
  background-color: var(--bg);
  color: var(--text);
  transition: all var(--dur) var(--ease);
  width: 100%;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}

/* ── Browser-Kompatibilität für native Date-/Time-Pickers ─────
   Safari (WebKit) und Firefox rendern type=date/time mit eigenen
   internen Layouts; ohne diese Regeln liegen Höhe und Padding
   sichtbar anders als bei regulären Text-Inputs. */
.form-group input[type="date"],
.form-group input[type="time"],
.form-group input[type="datetime-local"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;            /* Safari rendert sonst inline-block ohne volle Breite */
  min-height: 42px;
}
.form-group input[type="date"]::-webkit-calendar-picker-indicator,
.form-group input[type="time"]::-webkit-calendar-picker-indicator,
.form-group input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  opacity: 0.55;
  cursor: pointer;
  filter: invert(0.35);
  transition: opacity var(--dur) var(--ease);
}
.form-group input[type="date"]:hover::-webkit-calendar-picker-indicator,
.form-group input[type="time"]:hover::-webkit-calendar-picker-indicator,
.form-group input[type="datetime-local"]:hover::-webkit-calendar-picker-indicator {
  opacity: 1;
}
.form-group input[type="date"]::-webkit-datetime-edit,
.form-group input[type="time"]::-webkit-datetime-edit,
.form-group input[type="datetime-local"]::-webkit-datetime-edit {
  padding: 0;
}

.form-group select {
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3e%3cpath fill='%238A877F' d='M6 8L1 3h10z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 36px;
  line-height: 1.4;
}
.form-group select::-ms-expand { display: none; }

.form-group textarea {
  resize: vertical;
  min-height: 96px;
}

/* WICHTIG: hier nur `background-color`, nicht der Shorthand
   `background` – sonst würden die in `.form-group select` gesetzten
   background-image / -repeat / -position / -size beim Focus
   zurückgesetzt, und das Pfeil-Icon würde gefliest dargestellt.
   Im Dark-Mode war das besonders sichtbar, weil dort eine
   eigene background-image-Regel das Tiling sichtbar machte. */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  background-color: var(--surface);
  border-color: var(--navy);
  box-shadow: var(--sh-focus);
}

.form-control {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--fs-base);
  font-family: inherit;
  background-color: var(--bg);
  color: var(--text);
  transition: all var(--dur) var(--ease);
  width: 100%;
  outline: none;
}
.form-control:focus {
  background-color: var(--surface);
  border-color: var(--navy);
  box-shadow: var(--sh-focus);
}

/* Read-only / disabled Inputs: visuell leicht gedämpft, damit
   sofort erkennbar ist, dass sie nicht editierbar sind. Greift
   für alle Eingabetypen einheitlich – auch im Dark-Mode, weil
   wir Tokens verwenden. */
.form-group input[readonly],
.form-group input[disabled],
.form-group select[disabled],
.form-group textarea[readonly],
.form-control[readonly],
.form-control[disabled] {
  background-color: var(--navy-tint);
  color: var(--text-muted);
  cursor: not-allowed;
}
.form-group input[readonly]:focus,
.form-group textarea[readonly]:focus,
.form-control[readonly]:focus {
  border-color: var(--border);
  box-shadow: none;
}

/* Checkboxes */
.form-group input[type="checkbox"],
.checkbox-grid input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  display: inline-block;
  vertical-align: middle;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
  transition: all var(--dur) var(--ease);
}
.form-group input[type="checkbox"]:hover,
.checkbox-grid input[type="checkbox"]:hover { border-color: var(--navy-muted); }
.form-group input[type="checkbox"]:focus-visible,
.checkbox-grid input[type="checkbox"]:focus-visible { box-shadow: var(--sh-focus); }
.form-group input[type="checkbox"]:checked,
.checkbox-grid input[type="checkbox"]:checked {
  background-color: var(--copper);
  border-color: var(--copper);
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='20 6 9 17 4 12'%3e%3c/polyline%3e%3c/svg%3e");
  background-size: 14px;
  background-position: center;
  background-repeat: no-repeat;
}

.form-group label:has(input[type="checkbox"]) {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  text-transform: none;
  letter-spacing: 0;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text);
}
.form-group label input[type="checkbox"] { float: left; margin-right: 12px; }

/* Form Grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-lg) var(--sp-md);
  align-items: flex-start;
}
.form-group.full-width { grid-column: 1 / -1; }

fieldset {
  border: none;
  padding: 0;
  margin: 0 0 var(--sp-lg) 0;
  min-width: 0;
}
fieldset legend {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--navy);
  margin-bottom: var(--sp-md);
  padding-bottom: var(--sp-sm);
  border-bottom: 1px solid var(--border-light);
  width: 100%;
  letter-spacing: -0.01em;
}
.form-step fieldset legend {
  font-size: var(--fs-md);
  margin-bottom: var(--sp-md);
}

.form-navigation {
  display: flex;
  gap: var(--sp-sm);
  justify-content: flex-end;
  margin-top: var(--sp-lg);
  padding-top: var(--sp-md);
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
}

/* ── 6.4 Tabellen ─────────────────────────────────────────── */

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-md);
  border: 1px solid var(--border-light);
  background: var(--surface);
}

.item-list-table,
.item-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
  font-size: var(--fs-sm);
}

.item-list-table th,
.item-list-table td,
.item-table th,
.item-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.item-list-table th,
.item-table th {
  background: var(--bg);
  font-weight: 700;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border-bottom: 2px solid var(--border-light);
}

.item-list-table tr:last-child td,
.item-table tr:last-child td { border-bottom: none; }

.item-list-table tbody tr:hover,
.item-table tbody tr:hover { background: var(--navy-tint); }

tr.is-inactive { background: var(--bg); color: var(--text-muted); }
tr.is-inactive td { text-decoration: line-through; }

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.status-badge.status-active { background: var(--success-light); color: #105C28; }
.status-badge.status-inactive {
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.status-badge.status-warning {
  background: var(--amber-light);
  color: #7A5C0A;
  border: 1px solid #E4C76A;
}
.status-badge.status-danger {
  background: var(--danger-light);
  color: #8B1A10;
  border: 1px solid #E8A09A;
}

/* Dashboard-Termin-Tabelle: kleine Hilfsklassen */
.dashboard-termine .termin-relativ {
  color: var(--text-muted);
  font-style: italic;
}
.dashboard-termine .termin-teilnehmer-max {
  color: var(--text-muted);
}
.dashboard-termine .anmeldeform {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--r-full);
  background: var(--navy-wash);
  color: var(--navy);
  font-size: 0.95rem;
}

.action-buttons { text-align: right; white-space: nowrap; }


/* ── 6.5 Modale ───────────────────────────────────────────── */

.modal-backdrop,
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27, 42, 74, 0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  animation: fadeIn var(--dur) var(--ease);
  padding: var(--sp-md);
}

.modal-content,
.modal-box {
  background: var(--surface);
  padding: var(--sp-xl);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-box { max-width: 700px; padding: var(--sp-lg); }

.modal-content h2,
.modal-header h3 {
  margin-top: 0;
  margin-bottom: var(--sp-md);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: var(--sp-md);
  margin-bottom: var(--sp-md);
}
.modal-header h3 { margin-bottom: 0; }

.modal-body { overflow-y: auto; flex: 1; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--r-sm);
  transition: all var(--dur) var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-close-modal:hover { background: var(--navy-wash); color: var(--navy); }

.modal-content .form-group { width: 100%; }
.modal-content .form-navigation {
  border-top: 1px solid var(--border-light);
  margin-top: var(--sp-md);
  padding-top: var(--sp-md);
  display: flex;
  justify-content: space-between;
  gap: var(--sp-sm);
}


/* ── 6.6 Alerts ───────────────────────────────────────────── */

.success-box {
  background: var(--success-light);
  color: #105C28;
  border: 1px solid #A8D5BA;
  padding: 12px 16px;
  border-radius: var(--r-md);
  margin-bottom: var(--sp-lg);
  display: flex;
  align-items: center;
  font-size: var(--fs-sm);
  font-weight: 500;
  gap: 10px;
}
.success-box i { font-size: 1.05rem; flex-shrink: 0; }

.error-box {
  background: var(--danger-light);
  color: #8B1A10;
  border: 1px solid #E8A09A;
  padding: 12px 16px;
  border-radius: var(--r-md);
  margin-bottom: var(--sp-lg);
  font-size: var(--fs-sm);
  font-weight: 500;
}
.error-box i { font-size: 1.05rem; flex-shrink: 0; margin-right: 8px; }

.warning-box {
  background: var(--amber-light);
  color: #7A5C0A;
  border: 1px solid #E4C76A;
  padding: 12px 16px;
  border-radius: var(--r-md);
  margin-bottom: var(--sp-lg);
  display: flex;
  align-items: center;
  font-size: var(--fs-sm);
  font-weight: 500;
  gap: 10px;
}
.warning-box i { font-size: 1.05rem; flex-shrink: 0; }

/* Bestätigungs-/Hinweis-Karte für Action-Result-Seiten */
.action-result {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-md);
  padding: var(--sp-md) var(--sp-lg);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-lg);
  border: 1px solid var(--border-light);
}
.action-result__icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
  padding-top: 2px;
}
.action-result__text { flex: 1; }
.action-result__text strong { display: block; margin-bottom: 4px; }
.action-result--success {
  background: var(--success-light);
  border-color: #A8D5BA;
}
.action-result--success .action-result__icon { color: var(--success); }
.action-result--danger {
  background: var(--danger-light);
  border-color: #E8A09A;
}
.action-result--danger .action-result__icon { color: var(--danger); }
.action-result--warning {
  background: var(--amber-light);
  border-color: #E4C76A;
}
.action-result--warning .action-result__icon { color: var(--amber); }

/* Form-Abschnitte (wenn mehrere form-grid hintereinander stehen) */
.form-section {
  padding-top: var(--sp-md);
  margin-top: var(--sp-md);
  border-top: 1px solid var(--border-light);
}
.form-section:first-child {
  padding-top: 0;
  margin-top: 0;
  border-top: 0;
}
.form-section__title {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 var(--sp-md);
}

/* Inline-Termin-Editor in veranstaltungen.php */
.inline-editor {
  display: none;
  padding: var(--sp-lg);
  background: var(--navy-tint);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-md);
}
.inline-editor.is-open { display: block; }
.inline-editor__hint {
  color: var(--danger);
  margin-right: auto;
  font-size: var(--fs-sm);
  align-self: center;
}

/* Sortierbare Tabellen-Spaltenköpfe */
.sortable-table thead th.th-sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 22px;
  white-space: nowrap;
}
.sortable-table thead th.th-sortable:hover {
  color: var(--navy);
}
.sortable-table thead th.th-sortable::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 50%;
  width: 0; height: 0;
  margin-top: -2px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 4px solid currentColor;
  opacity: 0.25;
  transform: translateY(-4px);
}
.sortable-table thead th.th-sortable::before {
  content: "";
  position: absolute;
  right: 6px;
  top: 50%;
  width: 0; height: 0;
  margin-top: 2px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  opacity: 0.25;
  transform: translateY(0);
}
.sortable-table thead th.sort-asc::after  { opacity: 1; }
.sortable-table thead th.sort-asc::before { opacity: 0; }
.sortable-table thead th.sort-desc::after  { opacity: 0; }
.sortable-table thead th.sort-desc::before { opacity: 1; }

/* SHG-Filter-Leiste (oberhalb von Listen-Tabellen) */
.list-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-sm) var(--sp-md);
  margin-bottom: var(--sp-md);
  padding: var(--sp-sm) var(--sp-md);
  background: var(--navy-tint);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
}
.list-filter label {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.list-filter select {
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background-color: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-sm);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3e%3cpath fill='%238A877F' d='M6 8L1 3h10z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px;
  min-width: 220px;
}
.list-filter select:focus { outline: none; border-color: var(--navy); box-shadow: var(--sh-focus); }
.list-filter__reset {
  margin-left: auto;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  text-decoration: none;
}
.list-filter__reset:hover { color: var(--navy); text-decoration: underline; }

/* Filter-Tabs (z.B. Terminliste: Aktuell + Archiv-Jahre) */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs);
  margin-bottom: var(--sp-lg);
  padding-bottom: var(--sp-md);
  border-bottom: 1px solid var(--border-light);
}
.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  background: var(--bg);
  color: var(--text-mid);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border-light);
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
}
.filter-tab:hover {
  background: var(--navy-wash);
  color: var(--navy);
  border-color: var(--navy-wash);
}
.filter-tab--active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.filter-tab--active:hover {
  background: var(--navy-light);
  color: #fff;
  border-color: var(--navy-light);
}
.filter-tab__count {
  display: inline-block;
  min-width: 22px;
  padding: 0 7px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  background: rgba(0, 0, 0, 0.06);
  color: inherit;
  border-radius: var(--r-full);
  font-size: var(--fs-2xs);
  font-weight: 700;
}
.filter-tab--active .filter-tab__count {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* Activity-Liste im Dashboard-Widget */
.activity-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--sp-md);
}
.activity-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-sm);
  padding: var(--sp-sm) 0;
  border-bottom: 1px solid var(--border-light);
}
.activity-list li:last-child { border-bottom: 0; }
.activity-icon {
  width: 28px; height: 28px;
  border-radius: var(--r-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.8rem;
}
.activity-icon--success { background: var(--success-light); color: var(--success); }
.activity-icon--danger  { background: var(--danger-light);  color: var(--danger);  }
.activity-icon--navy    { background: var(--navy-wash);     color: var(--navy);    }
.activity-text { flex: 1; line-height: 1.4; font-size: var(--fs-sm); }
.activity-text small { color: var(--text-muted); }
.activity-detail {
  color: var(--text-mid);
  font-style: italic;
}

/* Btn-Variante für destruktive Aktionen */
.btn-danger {
  background: var(--danger);
  color: #fff;
  border: 1px solid var(--danger);
}
.btn-danger:hover {
  background: #A03326;
  border-color: #A03326;
}
.btn.btn-secondary.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn.btn-secondary.btn-danger:hover {
  background: var(--danger-light);
  color: var(--danger);
}


/* ============================================================
   7. DASHBOARD
   ============================================================ */

.dashboard-action-bar {
  text-align: center;
  margin-bottom: var(--sp-lg);
}

.dashboard-widgets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--sp-lg);
  margin-bottom: var(--sp-lg);
}

.widget {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--navy);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  box-shadow: var(--sh-xs);
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--dur-slow) var(--ease);
}
.widget:hover { box-shadow: var(--sh-sm); }
.widget:nth-of-type(2) { border-left-color: var(--copper); }

.widget h3 {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--navy);
  margin-bottom: var(--sp-md);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.01em;
}
.widget h3 i { color: var(--copper); font-size: 1rem; }

.widget ul {
  margin-bottom: var(--sp-sm);
  flex-grow: 1;
}
.widget ul li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: var(--fs-sm);
  color: var(--text-mid);
}
.widget ul li:last-child { border-bottom: none; }
.widget ul li.urgent { color: var(--danger); font-weight: 600; }
.widget ul li a { color: inherit; }
.widget ul li a:hover { color: var(--navy); }
.widget ul li strong { color: var(--text); font-weight: 600; }

.widget-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-end;
  margin-top: auto;
  padding: 4px 0;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--copper);
}
.widget-link:hover { color: var(--copper-dark); text-decoration: none; }
.widget-link i { font-size: 0.75rem; }

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-md);
  margin-bottom: var(--sp-lg);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  box-shadow: var(--sh-xs);
  text-align: center;
}
.stat-card h3 {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--sp-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.stat-card h3 i { color: var(--copper); font-size: 0.95rem; }
.stat-card .stat-number {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: var(--sp-md);
  box-shadow: var(--sh-xs);
}


/* ============================================================
   8. WIZARD (Beratungsformular)
   ============================================================ */

.data-entry-form { display: block; }
.form-step { display: none; animation: fadeIn 0.5s var(--ease); }
.form-step.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wizard-navigation {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  margin-bottom: var(--sp-lg);
  border-bottom: 2px solid var(--border-light);
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  overflow: hidden;
}
.wizard-tabs { display: flex; flex-wrap: wrap; }
.wizard-tab-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--dur) var(--ease);
  cursor: pointer;
}
.wizard-tab-link:hover {
  color: var(--navy);
  background: var(--navy-tint);
}
.wizard-tab-link.active {
  color: var(--navy);
  border-bottom-color: var(--copper);
  background: var(--surface);
}
.wizard-tab-link i { color: var(--text-muted); font-size: 0.95rem; }
.wizard-tab-link.active i { color: var(--copper); }

.btn-wizard-save {
  margin: 8px;
  align-self: center;
}
.btn-wizard-save.btn-success-feedback {
  background: var(--success);
  border-color: var(--success);
}

.grouped-checkboxes fieldset {
  margin-bottom: var(--sp-md);
  background: var(--navy-tint);
  border-radius: var(--r-md);
  padding: var(--sp-md);
  border: 1px solid var(--border-light);
}
.grouped-checkboxes fieldset legend {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--navy);
  padding: 0 6px;
  margin-bottom: 8px;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: auto;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 6px;
}
.checkbox-grid label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  background: var(--surface);
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-light);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  margin: 0;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: 0;
}
.checkbox-grid label:hover {
  background: var(--navy-tint);
  border-color: var(--navy-muted);
  transform: translateY(-1px);
  box-shadow: var(--sh-xs);
}

.knowledge-box {
  margin-top: var(--sp-md);
  padding: var(--sp-md);
  background: var(--navy-wash);
  border-left: 3px solid var(--copper);
  border-radius: var(--r-md);
  animation: fadeIn var(--dur) var(--ease);
}
.kb-entry {
  margin-bottom: var(--sp-md);
  padding-bottom: var(--sp-md);
  border-bottom: 1px dotted var(--border);
}
.kb-entry:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.kb-entry strong {
  color: var(--navy);
  font-size: var(--fs-md);
  font-weight: 700;
  display: block;
  margin-bottom: 5px;
  letter-spacing: -0.01em;
}
.kb-entry p {
  font-size: var(--fs-sm);
  line-height: 1.55;
  margin-bottom: 8px;
  color: var(--text);
  white-space: pre-wrap;
}
.kb-entry ul { padding-left: 0; }
.kb-entry ul li a {
  font-weight: 600;
  font-size: var(--fs-xs);
  color: var(--copper);
}
.kb-entry ul li a:hover { color: var(--copper-dark); }
.kb-entry ul li a i { margin-right: 8px; color: var(--text-muted); }


/* ============================================================
   9. EINSTELLUNGEN
   ============================================================ */

.settings-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-lg);
}

.settings-nav {
  flex: 0 0 260px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: var(--sp-md);
  box-shadow: var(--sh-xs);
  align-self: flex-start;
}
.settings-nav h3 {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding-bottom: var(--sp-sm);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: var(--sp-sm);
}
.settings-group { margin-bottom: var(--sp-sm); }
.settings-group h4 {
  font-size: var(--fs-2xs);
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: var(--sp-md) 0 6px;
  padding-top: var(--sp-sm);
  border-top: 1px solid var(--border-light);
}
.settings-group:first-child h4 {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.settings-nav ul li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: var(--fs-sm);
  font-weight: 500;
  border-radius: var(--r-sm);
  color: var(--text-mid);
  transition: all var(--dur) var(--ease);
}
.settings-nav ul li a i {
  color: var(--text-muted);
  font-size: 0.95rem;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}
.settings-nav ul li a:hover {
  background: var(--navy-wash);
  color: var(--navy);
}
.settings-nav ul li a:hover i { color: var(--navy); }
.settings-nav ul li a.active {
  background: var(--navy);
  color: #fff;
  font-weight: 600;
}
.settings-nav ul li a.active i { color: var(--copper); }

.settings-content { flex: 1; min-width: 300px; }
.settings-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-xs);
  color: var(--copper);
  font-weight: 600;
}
.settings-link:hover { color: var(--copper-dark); text-decoration: underline; }

.add-item-form {
  background: var(--navy-tint);
  padding: var(--sp-lg);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-lg);
  border: 1px solid var(--border-light);
}
.add-item-form h3 {
  margin-bottom: var(--sp-md);
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--navy);
  grid-column: 1 / -1;
  letter-spacing: -0.01em;
}
.add-item-form .form-grid { align-items: flex-end; }
.add-item-form .form-group { margin: 0; max-width: 100%; }
.add-item-form .btn-primary {
  height: 44px;
  margin-bottom: 1px;
}

.setting-card { display: none; }
.setting-card.active { display: block; animation: fadeIn 0.4s var(--ease); }
.setting-card h2 {
  font-size: var(--fs-xl);
  margin-bottom: var(--sp-md);
}


/* ============================================================
   10. WISSEN / FILTER / DRUCK-TREE
   ============================================================ */

.file-list { padding-left: 0; }
.file-list li {
  background: var(--bg);
  padding: 10px 12px;
  border-radius: var(--r-sm);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-sm);
}
.file-list li i { margin-right: 10px; color: var(--text-muted); }
.delete-file-label {
  font-size: var(--fs-xs);
  color: var(--danger);
  cursor: pointer;
}

.filter-form {
  background: var(--surface);
  padding: var(--sp-lg);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--sh-xs);
}
.filter-form .form-grid-suche {
  display: grid;
  gap: var(--sp-md);
  align-items: flex-end;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.filter-form .form-navigation {
  display: flex;
  gap: var(--sp-sm);
  justify-content: flex-end;
  margin-top: var(--sp-md);
  flex-wrap: wrap;
  border-top: none;
  padding-top: 0;
}

.date-range-group {
  display: flex;
  gap: var(--sp-md);
}
.date-range-group .form-group { flex-grow: 1; }

/* Druck-Tree im Modal (Wissensbausteine wählen) */
.filter-tree {
  border: 1px solid var(--border-light);
  padding: var(--sp-md);
  background: var(--bg);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-md);
}
.tree-group { margin-bottom: var(--sp-md); }
.tree-group-title {
  font-weight: 700;
  font-size: var(--fs-md);
  color: var(--navy);
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  padding-bottom: 4px;
  letter-spacing: -0.01em;
}
.tree-category { margin-left: 8px; margin-bottom: var(--sp-md); }
.cat-label {
  font-size: var(--fs-sm);
  color: var(--text);
  margin-bottom: 6px;
  font-weight: 600;
}
.tree-entries {
  margin-left: var(--sp-lg);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
}
.entry-label {
  font-size: var(--fs-xs);
  color: var(--text-mid);
  background: var(--surface);
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--r-sm);
  transition: all var(--dur) var(--ease);
}
.entry-label:hover { border-color: var(--navy-muted); background: var(--navy-tint); }
.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  gap: 8px;
}

/* Leere-Liste-Hinweis im Druck-Tree (index.php, wissensdatenbank.php) */
.filter-tree-empty {
  padding: var(--sp-lg);
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

/* Kleiner Tipp-Hinweis unter Form-Gruppen (z.B. einstellungen.php) */
.form-hint-tip {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.form-hint-tip i { color: var(--copper); }


/* ============================================================
   11. STATISTIK
   ============================================================ */

.stat-group-box {
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  margin-bottom: var(--sp-lg);
  background: var(--surface);
  box-shadow: var(--sh-xs);
}
.stat-group-box h5 {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--navy);
  margin-bottom: var(--sp-md);
  padding-bottom: var(--sp-sm);
  border-bottom: 1px solid var(--border-light);
  letter-spacing: -0.01em;
}

.stat-categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--sp-md);
}
.stat-categories-container { margin-top: var(--sp-md); }

.stat-category-group {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  overflow: hidden;
}

.stat-table {
  margin-bottom: 0;
  border: none;
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.stat-table th {
  background: var(--navy-tint);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
  font-weight: 700;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-mid);
}
.stat-table tr:last-child td { border-bottom: none; }

.report-header {
  margin-bottom: var(--sp-lg);
  padding-bottom: var(--sp-md);
  border-bottom: 2px solid var(--border-light);
}

.page-break { page-break-before: always; break-before: page; }

/* Hinweis: .login-card wird ausschließlich in login.php verwendet
   und dort lokal über inline-<style> definiert. Bewusst keine
   globale Regel hier, damit kein Padding oder Border in den
   navy-Header der Login-Karte hineinwirkt. */


/* ============================================================
   11.5  KONTAKT-LIVE-SUCHE (im Beratungsformular)
   ============================================================
   Ersetzt das frühere HTML-<datalist>. Die Trefferliste schwebt
   als absolut positioniertes Panel direkt unter dem Suchfeld. */

.contact-search-wrap {
  position: relative;
}

.contact-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 50;
  max-height: 320px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-md);
  padding: var(--sp-2xs);
}

.contact-search-results[hidden] { display: none; }

.contact-search-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: background var(--dur) var(--ease);
}
.contact-search-item:hover,
.contact-search-item:focus {
  background: var(--navy-wash);
  outline: none;
}
.contact-search-item__title {
  font-weight: 600;
  font-size: var(--fs-sm);
  line-height: 1.3;
  color: var(--text);
}
.contact-search-item__meta {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  line-height: 1.4;
}

.contact-search-empty {
  padding: 12px 14px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
}

/* Visuelles Erfolgs-Feedback nach Übernahme eines Treffers. */
.contact-search--bound {
  border-color: var(--copper) !important;
  box-shadow: 0 0 0 3px var(--copper-wash) !important;
}


/* ============================================================
   12. RESPONSIVE
   ============================================================ */

@media (max-width: 1023px) {
  .main-wrapper { padding: var(--sp-lg) var(--sp-md) var(--sp-2xl); }
  .header-inner,
  .footer-inner {
    padding-left: var(--sp-md);
    padding-right: var(--sp-md);
  }
}

/* qa-row reagiert ähnlich wie im Funktionstrainingsmodul.
   Bei 4 Buttons (Default-Modifier) zwei Spalten auf dem Tablet,
   bei der 3-Button-Variante des Dashboards bleiben es drei Spalten,
   damit kein hässliches 2+1-Layout entsteht. */
@media (min-width: 601px) and (max-width: 768px) {
  .qa-row    { grid-template-columns: repeat(2, 1fr); }
  .qa-row--3 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .wizard-navigation { flex-direction: column; height: auto; }
  .wizard-tabs { flex-direction: column; width: 100%; }
  .wizard-tab-link {
    border-bottom-width: 2px;
    justify-content: flex-start;
  }
  .btn-wizard-save {
    width: calc(100% - 16px);
    justify-content: center;
    margin: 8px;
  }
  .settings-container { flex-direction: column; }
  .settings-nav { flex: 1 1 auto; width: 100%; }
  .settings-content { flex: 1 1 auto; width: 100%; }
}

@media (max-width: 600px) {
  /* Header kompakter */
  .header-inner {
    padding: 8px var(--sp-md);
    gap: var(--sp-sm);
  }
  .header-brand-text { font-size: var(--fs-xs); }
  .header-brand-text small { display: none; }
  .header-logo {
    width: 30px; height: 30px;
    font-size: var(--fs-2xs);
  }
  .header-user { font-size: var(--fs-xs); }
  .header-user span:not(.avatar) { display: none; }
  .btn-logout span { display: none; }
  .btn-logout { padding: 6px 8px; }

  /* qa-row: einspaltig stapeln, kompakt */
  .qa-row { grid-template-columns: 1fr; gap: var(--sp-sm); }
  .qa-card {
    min-height: auto;
    flex-direction: row;
    align-items: center;
    padding: var(--sp-md);
    gap: var(--sp-md);
  }
  .qa-card small { display: none; }
  .qa-card i { font-size: 1.2rem; }

  /* admin-bar: ebenfalls stapeln */
  .admin-bar {
    flex-direction: column;
    align-items: flex-start;
    padding: var(--sp-sm) var(--sp-md);
  }
  .admin-bar-label { margin-right: 0; margin-bottom: 4px; }

  /* Page-Header */
  .page-header h1 { font-size: var(--fs-xl); }

  /* Footer */
  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  /* Forms / Listen */
  .form-grid,
  .form-grid-suche,
  .date-range-group {
    grid-template-columns: 1fr;
    flex-direction: column;
  }
  .checkbox-grid { grid-template-columns: 1fr; }
  .filter-form .form-navigation {
    justify-content: stretch;
    flex-direction: column;
  }
  .filter-form .form-navigation .btn {
    justify-content: center;
    width: 100%;
  }
  .add-item-form { display: flex; flex-direction: column; align-items: stretch; }
  .add-item-form .form-group {
    margin-right: 0;
    margin-bottom: var(--sp-md);
    max-width: 100%;
  }
  .item-list-table,
  .item-table { font-size: var(--fs-xs); }
  .item-list-table th,
  .item-list-table td,
  .item-table th,
  .item-table td {
    padding: 8px;
  }
  .action-buttons {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
  }
  .form-navigation { justify-content: stretch; flex-direction: column; }
  .form-navigation .btn { width: 100%; justify-content: center; }
  .main-wrapper { padding: var(--sp-md) var(--sp-sm) var(--sp-2xl); }
  .dashboard-widgets { grid-template-columns: 1fr; }
}


/* ============================================================
   13. A11Y / PRINT
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: high) {
  :root {
    --border: #444;
    --border-light: #666;
    --text-muted: #333;
    --text-mid: #222;
  }
  .widget { border-width: 2px; border-left-width: 5px; }
  .qa-card { border: 3px solid #000; }
}

@media print {
  .site-header,
  .site-footer,
  .dashboard-action-bar,
  .modal-overlay,
  .modal-backdrop,
  .skip-link {
    display: none !important;
  }
  body { background: #fff; color: #000; }
  .main-wrapper { padding: 0; max-width: none; }
  .content-card,
  .widget,
  .stat-card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }
}
