@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Source+Sans+3:wght@300;400;500;600&display=swap');

:root {
  --gruen-dunkel:  #1a3a2a;
  --gruen-mittel:  #2d5a3d;
  --gruen-hell:    #3d7a52;
  --gold:          #c8963c;
  --gold-hell:     #e8b85a;
  --gold-blass:    #f5e6c8;
  --creme:         #faf7f0;
  --creme-dunkel:  #f0ebe0;
  --text-dunkel:   #1a1a1a;
  --text-mittel:   #4a4a4a;
  --text-hell:     #7a7a7a;
  --sidebar-w:     255px;
  --radius:        8px;
  --shadow:        0 2px 12px rgba(0,0,0,0.08);
  --shadow-md:     0 4px 24px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Source Sans 3', sans-serif;
  background: var(--creme);
  color: var(--text-dunkel);
  font-size: 15px;
  line-height: 1.6;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--gruen-dunkel);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(200,150,60,0.3);
}

.sidebar-logo h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold-hell);
  line-height: 1.3;
}

.sidebar-logo p {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 3px;
}

.sidebar-logo .wappen { font-size: 2rem; display: block; margin-bottom: 8px; }

.nav-section { padding: 16px 0 4px; }

.nav-section-title {
  font-size: 0.63rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.28);
  padding: 0 18px 5px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 18px;
  color: rgba(255,255,255,0.68);
  text-decoration: none;
  font-size: 0.88rem;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}

.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; border-left-color: rgba(200,150,60,0.4); }
.nav-link.aktiv { background: rgba(200,150,60,0.12); color: var(--gold-hell); border-left-color: var(--gold); font-weight: 500; }
.nav-link .icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto;
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user-avatar {
  width: 32px; height: 32px;
  background: var(--gold); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: white; flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.8rem; color: rgba(255,255,255,0.85); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-rolle { font-size: 0.66rem; color: rgba(255,255,255,0.35); text-transform: uppercase; letter-spacing: 0.08em; }
.sidebar-logout { color: rgba(255,255,255,0.3); text-decoration: none; font-size: 1.1rem; transition: color 0.15s; }
.sidebar-logout:hover { color: #ff6b6b; }

/* ── Topbar / Burger ─────────────────────────────────────── */
.burger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--gruen-dunkel);
  font-size: 1.4rem;
  line-height: 1;
}

/* ── Hauptinhalt ─────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: white;
  border-bottom: 1px solid var(--creme-dunkel);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  gap: 12px;
}

.topbar h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--gruen-dunkel);
  white-space: nowrap;
}

.topbar-rechts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.page-content { padding: 24px 28px; flex: 1; }

/* ── Stat-Karten ─────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: white; border-radius: var(--radius);
  padding: 18px 16px; box-shadow: var(--shadow);
  border: 1px solid var(--creme-dunkel);
  border-top: 3px solid var(--gold); text-align: center;
}
.stat-card.gruen { border-top-color: var(--gruen-mittel); }
.stat-card.gold  { border-top-color: var(--gold); }
.stat-card.rot   { border-top-color: #dc3545; }
.stat-card.blau  { border-top-color: #0d6efd; }

.stat-zahl { font-family: 'Playfair Display', serif; font-size: 2rem; font-weight: 700; color: var(--gruen-dunkel); line-height: 1; margin-bottom: 5px; }
.stat-label { font-size: 0.72rem; color: var(--text-hell); text-transform: uppercase; letter-spacing: 0.07em; }

/* ── Karte ───────────────────────────────────────────────── */
.card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--creme-dunkel); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--creme-dunkel); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.card-title { font-family: 'Playfair Display', serif; font-size: 1rem; font-weight: 600; color: var(--gruen-dunkel); }
.card-body { padding: 20px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 6px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.875rem; font-weight: 500;
  text-decoration: none; border: none; cursor: pointer;
  transition: all 0.15s ease; white-space: nowrap;
}
.btn-primary { background: var(--gruen-mittel); color: white; }
.btn-primary:hover { background: var(--gruen-dunkel); color: white; }
.btn-gold { background: var(--gold); color: white; }
.btn-gold:hover { background: #b8832c; }
.btn-outline { background: transparent; color: var(--gruen-mittel); border: 1px solid var(--gruen-mittel); }
.btn-outline:hover { background: var(--gruen-mittel); color: white; }
.btn-danger { background: #dc3545; color: white; }
.btn-danger:hover { background: #bb2d3b; }
.btn-grau { background: #6c757d; color: white; }
.btn-sm { padding: 5px 11px; font-size: 0.78rem; }
.btn-lg { padding: 12px 26px; font-size: 1rem; }

/* ── Formular ────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-mittel); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1px solid #ddd; border-radius: 6px;
  font-family: 'Source Sans 3', sans-serif; font-size: 0.9rem;
  color: var(--text-dunkel); background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus { outline: none; border-color: var(--gruen-mittel); box-shadow: 0 0 0 3px rgba(45,90,61,0.1); }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ── Tabelle ─────────────────────────────────────────────── */
.table-container { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--creme-dunkel); }
table { width: 100%; border-collapse: collapse; background: white; }
thead tr { background: var(--gruen-dunkel); color: white; }
thead th { padding: 11px 14px; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; text-align: left; white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--creme-dunkel); transition: background 0.1s; }
tbody tr:hover { background: var(--creme); }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 10px 14px; font-size: 0.86rem; vertical-align: middle; }

/* ── Badge ───────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.badge-gruen  { background: #d4edda; color: #155724; }
.badge-gold   { background: #fff3cd; color: #856404; }
.badge-rot    { background: #f8d7da; color: #721c24; }
.badge-blau   { background: #d1ecf1; color: #0c5460; }
.badge-grau   { background: #e2e3e5; color: #383d41; }
.badge-lila   { background: #e9d7f5; color: #6a0dad; }
.badge-pink   { background: #fce4ec; color: #880e4f; }

/* ── Alert ───────────────────────────────────────────────── */
.alert { padding: 11px 16px; border-radius: var(--radius); font-size: 0.88rem; margin-bottom: 14px; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger  { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay.offen { display: flex; }
.modal-box { background: white; border-radius: var(--radius); box-shadow: var(--shadow-md); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--creme-dunkel); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-family: 'Playfair Display', serif; font-size: 1.1rem; font-weight: 600; color: var(--gruen-dunkel); }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-hell); transition: color 0.15s; line-height: 1; }
.modal-close:hover { color: var(--text-dunkel); }
.modal-body { padding: 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--creme-dunkel); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Suchleiste ──────────────────────────────────────────── */
.suchleiste { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.suchleiste .form-control { max-width: 280px; }

/* ── Detailseite ─────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.info-liste { list-style: none; }
.info-liste li { display: flex; padding: 8px 0; border-bottom: 1px solid var(--creme-dunkel); font-size: 0.88rem; }
.info-liste li:last-child { border-bottom: none; }
.info-liste .label { color: var(--text-hell); width: 140px; flex-shrink: 0; font-size: 0.82rem; }
.info-liste .wert { color: var(--text-dunkel); font-weight: 500; }

.chronik-item { display: flex; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--creme-dunkel); }
.chronik-item:last-child { border-bottom: none; }
.chronik-datum { font-size: 0.78rem; color: var(--text-hell); width: 80px; flex-shrink: 0; padding-top: 2px; }
.chronik-titel { font-size: 0.9rem; font-weight: 500; }
.chronik-anm   { font-size: 0.8rem; color: var(--text-hell); }

/* ── Berechtigungs-Checkboxen ────────────────────────────── */
.modul-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.modul-check { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--creme-dunkel); border-radius: 6px; cursor: pointer; transition: background 0.1s; }
.modul-check:hover { background: var(--creme); }
.modul-check input[type=checkbox] { accent-color: var(--gruen-mittel); width: 16px; height: 16px; flex-shrink: 0; }
.modul-check span { font-size: 0.84rem; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE – Mobile (Burger-Menü)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 820px) {

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.mobile-offen {
    transform: translateX(0);
  }

  .sidebar-overlay.mobile-offen {
    display: block;
  }

  .burger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .main-content {
    margin-left: 0;
  }

  .topbar {
    padding: 12px 16px;
  }

  .topbar h2 {
    font-size: 1.1rem;
  }

  .page-content {
    padding: 14px 14px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .suchleiste .form-control {
    max-width: 100%;
    flex: 1;
  }

  .btn { padding: 9px 14px; font-size: 0.9rem; }
  .btn-sm { padding: 7px 11px; }

  .topbar-rechts { gap: 6px; }

  /* Tabellen auf Mobile besser lesbar */
  tbody td { font-size: 0.82rem; padding: 8px 10px; }
  thead th { padding: 9px 10px; font-size: 0.68rem; }

  /* Modal Vollbild auf Mobile */
  .modal-box { max-width: 100%; max-height: 95vh; }

  /* Dashboard Grid */
  .content-grid {
    grid-template-columns: 1fr !important;
  }

  .modul-grid {
    grid-template-columns: 1fr;
  }
}

/* Benutzer Aktionen-Dropdown */
.aktionen-menu { position: relative; display: inline-block; }
.aktionen-menu > summary {
  list-style: none;
  cursor: pointer;
}
.aktionen-menu > summary::-webkit-details-marker { display: none; }
.aktionen-menu-liste {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 40;
  min-width: 200px;
  background: white;
  border: 1px solid var(--creme-dunkel);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  padding: 6px 0;
  margin-top: 4px;
}
.aktionen-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 14px;
  font-size: 0.85rem;
  color: var(--text-dunkel);
  cursor: pointer;
}
.aktionen-item:hover { background: #f0f7f0; }
.aktionen-item-danger { color: #721c24; }
.aktionen-menu form { margin: 0; }

/* Einstellungen Unterseiten */
.einstellungen-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  align-items: start;
}
.einstellungen-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: white;
  border: 1px solid var(--creme-dunkel);
  border-radius: 10px;
  padding: 10px;
  position: sticky;
  top: 16px;
}
.einstellungen-nav-link {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-dunkel);
  text-decoration: none;
  font-size: 0.88rem;
}
.einstellungen-nav-link:hover { background: #f0f7f0; }
.einstellungen-nav-link.aktiv {
  background: var(--gruen-mittel);
  color: white;
  font-weight: 600;
}
@media (max-width: 800px) {
  .einstellungen-layout { grid-template-columns: 1fr; }
  .einstellungen-nav { position: static; flex-direction: row; flex-wrap: wrap; }
}
