:root {
  --gruen: #2e7d32;
  --gruen-d: #1b5e20;
  --gruen-l: #e8f5e9;
  --rot: #c62828;
  --blau: #1565c0;
  --grau: #666;
  --bg: #2e7d32;
  --radius: 10px;
}

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

body {
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  display: flex;
  justify-content: center;
  padding: 10px;
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  background: white;
  padding: 15px;
  border-radius: 15px;
  width: 100%;
  max-width: 900px;
  position: relative;
}

.page { display: none; }
.page.active { display: block; }

.header {
  text-align: center;
  margin-bottom: 12px;
}
.header img {
  width: 120px;
  height: auto;
  margin-bottom: 6px;
}
.header h2 {
  color: var(--gruen);
  font-size: 1.3em;
  margin-bottom: 2px;
}
.header .code { font-size: 0.85em; color: var(--grau); }

.topbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.topbar button { flex: 1; min-width: 80px; }

button {
  padding: 12px 16px;
  margin: 4px 0;
  border: none;
  border-radius: var(--radius);
  background: var(--gruen);
  color: white;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
}
button:hover { background: var(--gruen-d); }
button:active { transform: scale(0.97); }
button.sec { background: #777; }
button.sec:hover { background: #555; }
button.danger { background: var(--rot); }
button.danger:hover { background: #a11; }
button.sm {
  padding: 6px 12px;
  font-size: 13px;
  margin: 2px;
}
button.full { width: 100%; }

input, select, textarea {
  width: 100%;
  padding: 10px;
  margin: 6px 0;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 16px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gruen);
  box-shadow: 0 0 0 2px rgba(46,125,50,0.2);
}

/* Wildkammer-Übersicht auf der Startseite */
.wildkammer-box {
  margin: 12px 0;
  padding: 12px 14px;
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  border-left: 4px solid var(--gruen);
  border-radius: var(--radius);
  font-size: 14px;
}
.wildkammer-box h4 {
  margin: 0 0 6px;
  color: var(--gruen-d);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.wildkammer-box .wk-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  color: #333;
}
.wildkammer-box .wk-count {
  font-weight: bold;
  color: var(--gruen-d);
}
.wildkammer-box .wk-empty {
  color: var(--grau);
  font-style: italic;
}

/* Admin-Button oben rechts (immer sichtbar) */
.admin-fab {
  position: fixed;
  top: 20px;
  /* Rechter Abstand: auf breiten Screens am Container-Rand (max-width
     900px, also 450px von der Mitte), auf schmalen Screens 12px vom
     Viewport-Rand. Die max()-Funktion nimmt den größeren Wert. */
  right: max(12px, calc(50vw - 450px + 24px));
  z-index: 900;
  width: 42px;
  height: 42px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  color: #2e7d32;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  transition: transform 0.1s, background 0.15s;
}
.admin-fab:hover { transform: scale(1.05); background: #fff; }
.admin-fab.admin-active { background: #2e7d32; color: #fff; }

/* ==================== DRUCKANSICHT ==================== */
#druckview { display: none; }
#druckview table { width: 100%; border-collapse: collapse; font-size: 10pt; margin-top: 12px; }
#druckview th, #druckview td {
  border: 1px solid #333; padding: 4px 6px; text-align: left;
  vertical-align: top;
}
#druckview th { background: #e0e0e0; }
#druckview .print-header { text-align: center; margin-bottom: 12px; }
#druckview .print-header h1 { font-size: 18pt; margin: 0 0 4px; }
#druckview .print-header h2 { font-size: 13pt; margin: 0; font-weight: normal; color: #555; }
#druckview .print-footer {
  display: flex; justify-content: space-between; margin-top: 40px;
  font-size: 10pt;
}
#druckview .sig-block { text-align: center; min-width: 30%; }
#druckview .sig-line { border-top: 1px solid #000; padding-top: 2px; margin-bottom: 2px; }

@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff !important; padding: 0; }
  body * { visibility: hidden !important; }
  #druckview, #druckview * { visibility: visible !important; }
  #druckview {
    display: block !important;
    position: absolute; left: 0; top: 0; width: 100%;
    background: #fff !important; color: #000 !important; padding: 0;
  }
  .admin-fab, .popup-overlay, .popup { display: none !important; }
}

.year-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.year-tab {
  padding: 8px 16px;
  border-radius: 20px;
  border: 2px solid var(--gruen);
  background: white;
  color: var(--gruen);
  font-weight: bold;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}
.year-tab:hover { background: var(--gruen-l); }
.year-tab.active { background: var(--gruen); color: white; }

.admin-badge {
  display: inline-block;
  background: #ef6c00;
  color: white;
  font-size: 11px;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 10px;
  vertical-align: middle;
}

.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border: 1px solid #ddd; padding: 6px 5px; text-align: center; white-space: nowrap; }
th { background: var(--gruen); color: white; font-size: 12px; position: sticky; top: 0; }
tr:nth-child(even) { background: #f9f9f9; }
tr:hover { background: var(--gruen-l); }

.tag-btn {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  font-size: 12px;
  border: none;
  color: white;
}
.tag-ent { background: #e53935; }
.tag-del { background: #c62828; }
.tag-edit { background: #ef6c00; }
.tag-abf { background: var(--blau); }
.tag-ja { background: #4caf50; }
.tag-nein { background: #f44336; }
.tag-done { background: #81c784; color: #1b5e20; }
.link { color: var(--blau); cursor: pointer; text-decoration: underline; }

.cards { display: none; }
.card {
  border: 1px solid #ddd;
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 8px;
  background: #fafafa;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}
.card-head strong { font-size: 15px; color: var(--gruen-d); }

/* Kompakte Kopfzeile */
.card-compact-line {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  font-size: 13px;
  flex-wrap: nowrap;
  overflow: hidden;
}
.card-compact-line strong {
  font-size: 14px;
  flex-shrink: 0;
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-compact-wild {
  color: var(--grau);
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-compact-date {
  font-size: 11px;
  color: var(--grau);
  flex-shrink: 0;
}
.card-expand-chevron {
  font-size: 10px;
  color: var(--grau);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.card.expanded .card-expand-chevron { transform: rotate(180deg); }

/* Body ist standardmäßig offen; im compact-Modus eingeklappt,
   außer wenn die Karte manuell expanded ist */
.card-body { margin-top: 8px; }
.card.card-compact .card-body { display: none; }
.card.card-compact.expanded .card-body { display: block; }
.card.card-compact { padding: 8px 10px; margin-bottom: 5px; }
.card.card-compact .card-head { margin-bottom: 0; }

.card-head-admin {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-bottom: 6px;
}
.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  font-size: 13px;
}
.card-grid .label { color: var(--grau); font-size: 11px; }
.card-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

@media (max-width: 700px) {
  .table-wrapper { display: none; }
  .cards { display: block; }
  .container { padding: 10px; }
  .header h2 { font-size: 1.1em; }
}
@media (min-width: 701px) {
  .cards { display: none; }
}

.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 999;
}
.popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  z-index: 1000;
  width: 92%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
}

.summary-table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.summary-table td { padding: 8px 10px; border-bottom: 1px solid #eee; text-align: left; white-space: normal; }
.summary-table td:first-child { font-weight: bold; color: var(--grau); width: 40%; }

.marker {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  transform: translate(-50%,-50%);
  border: 1px solid rgba(0,0,0,0.5);
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.marker-legend { font-size: 12px; margin-top: 8px; display: flex; gap: 12px; flex-wrap: wrap; }
.marker-legend span { display: inline-flex; align-items: center; gap: 4px; }
.marker-legend i {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #000;
  display: inline-block;
}

/* Leaflet-Overrides: Karte nicht höher als Popup, Marker als farbige Kreise */
#mapContainer .wild-marker {
  background: #1E88E5;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px #000, 0 2px 6px rgba(0,0,0,0.4);
  border-radius: 50%;
  width: 18px;
  height: 18px;
}
#mapContainer .wild-marker.reh  { background: #FFD600; }
#mapContainer .wild-marker.rot  { background: #E53935; }
#mapContainer .wild-marker.gams { background: #424242; }
#mapContainer .wild-marker.fox  { background: #FF6D00; }
/* Park-Rotwild: je Klasse eine eigene Farbe */
#mapContainer .wild-marker.park-thirsch    { background: #8E0000; }  /* dunkelrot */
#mapContainer .wild-marker.park-jhirsch    { background: #FF6D00; }  /* orange */
#mapContainer .wild-marker.park-tier       { background: #E91E63; }  /* pink */
#mapContainer .wild-marker.park-schmaltier { background: #AB47BC; }  /* violett */
#mapContainer .wild-marker.park-kalb       { background: #FFEB3B; }  /* gelb */
#mapContainer .wild-marker.fox  { background: #FF6D00; }
#mapContainer .leaflet-div-icon {
  background: transparent;
  border: none;
}

.hint { font-size: 12px; color: #555; margin: 6px 0; }

/* Bottom-Navigation (mobil-first, auch auf Desktop sichtbar) */
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  background: rgba(255,255,255,0.97);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.18);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 6px 8px 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 900;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  gap: 2px;
}
.bottom-nav button {
  flex: 1 1 auto;
  background: transparent;
  color: var(--grau);
  margin: 0;
  padding: 6px 2px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  border: none;
  border-radius: 8px;
  min-width: 0;
}
.bottom-nav button:hover { background: #e8f5e9; }
.bottom-nav button.active { color: var(--gruen-d); background: #e8f5e9; }
.bottom-nav .bn-icon { font-size: 22px; line-height: 1; }
.bottom-nav .bn-lbl { white-space: nowrap; }
/* Floating Action Button (Neuer Eintrag).
   Schwebt rechts oberhalb der Bottom-Nav als eigenständiger Kreis.
   Die right-Formel mit max() sorgt dafür, dass der Button auf breiten
   Bildschirmen am Container-Rand sitzt (max-width 900px), nicht am
   Viewport-Rand im grünen Hintergrund. */
.floating-fab {
  position: fixed !important;
  right: max(18px, calc(50vw - 450px + 24px)) !important;
  /* Höhe der Bottom-Nav (~60px) + Abstand (~30px) + safe-area */
  bottom: calc(100px + env(safe-area-inset-bottom)) !important;
  left: auto !important;
  top: auto !important;
  transform: none !important;
  width: 62px !important;
  height: 62px !important;
  border-radius: 50% !important;
  background: var(--gruen) !important;
  color: #fff !important;
  font-size: 30px !important;
  line-height: 62px !important;
  text-align: center;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  box-shadow: 0 6px 18px rgba(46,125,50,0.45) !important;
  z-index: 920 !important;
  cursor: pointer;
  flex: none !important;
  transition: transform 0.1s, box-shadow 0.15s;
}
.floating-fab:hover {
  background: var(--gruen-d) !important;
  box-shadow: 0 8px 24px rgba(46,125,50,0.55) !important;
}
.floating-fab:active { transform: scale(0.95) !important; }

/* Platz für Bottom-Nav schaffen, damit der letzte Inhalt nicht darunter verschwindet */
body.has-bottom-nav .container { padding-bottom: 90px; }

/* PWA Install Banner */
#pwaInstallBanner {
  display: none;
  position: fixed;
  bottom: 80px; left: 50%; transform: translateX(-50%);
  width: 92%; max-width: 400px;
  background: #fff; border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.25);
  padding: 14px 16px; z-index: 1600;
  text-align: center;
}
#pwaInstallBanner .pwa-title {
  font-weight: bold; font-size: 15px; color: var(--gruen-d); margin-bottom: 6px;
}
#pwaInstallBanner .pwa-text {
  font-size: 13px; color: #555; margin-bottom: 12px;
}
#pwaInstallBanner .pwa-btns {
  display: flex; gap: 8px; justify-content: center;
}
#pwaInstallBanner .pwa-btns button { min-width: 100px; }

/* Toast-Benachrichtigungen */
.toast-box {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  max-width: 92%;
}
.toast {
  background: #2e7d32;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  font-size: 14px;
  animation: toastIn 0.25s ease-out;
  pointer-events: auto;
}
.toast.err  { background: #c62828; }
.toast.warn { background: #f57c00; }
.toast.info { background: #1565c0; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Admin-Panel */
.admin-page { padding-bottom: 90px; }  /* Platz für sticky bar */
.admin-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.admin-header h3 { margin: 0; }

.admin-tabs {
  display: flex; gap: 4px; overflow-x: auto;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 12px;
  padding-bottom: 0;
}
.admin-tab {
  flex: 0 0 auto;
  background: #eeeeee !important; color: #555 !important;
  padding: 10px 14px;
  border-radius: 8px 8px 0 0;
  font-size: 13px;
  margin: 0;
  white-space: nowrap;
}
.admin-tab.active {
  background: var(--gruen) !important; color: #fff !important;
}
.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; }

.admin-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 900px;
  display: flex; gap: 8px;
  background: rgba(255,255,255,0.97);
  padding: 10px 12px;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
  z-index: 900;
  backdrop-filter: blur(6px);
}
.admin-bottom-bar button {
  flex: 1;
  margin: 0;
  padding: 10px 8px;
  font-size: 14px;
}

.admin-section { margin: 12px 0; padding: 12px; background: #f5f5f5; border-radius: var(--radius); overflow-x: hidden; max-width: 100%; box-sizing: border-box; }
.admin-section h4 { margin-bottom: 8px; color: var(--gruen-d); }
.admin-row { display: flex; gap: 8px; align-items: center; margin: 6px 0; flex-wrap: wrap; }
.admin-row label { min-width: 120px; font-size: 14px; }
.admin-row input, .admin-row select, .admin-row textarea { flex: 1; min-width: 120px; margin: 0; }

.edit-row { margin: 8px 0; }
.edit-row label { display: block; font-size: 12px; color: var(--grau); margin-bottom: 2px; }
.edit-row input, .edit-row select { margin: 0; }

.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0; }
.btn-grid button { width: 100%; margin: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; margin: 10px 0; }
.stat-box {
  background: var(--gruen-l); padding: 10px; border-radius: var(--radius);
  text-align: center; cursor: pointer; user-select: none;
  transition: background 0.15s, transform 0.05s;
  border: 2px solid transparent;
}
.stat-box:hover { background: #c8e6c9; }
.stat-box:active { transform: scale(0.97); }
.stat-box.active { background: var(--gruen); border-color: var(--gruen-d); }
.stat-box.active .num, .stat-box.active .lbl { color: #fff; }
.stat-box.stat-fallwild { background: #ffe0e0; }
.stat-box.stat-fallwild .num { color: #b71c1c; }
.stat-box.stat-fallwild.active { background: #b71c1c; border-color: #b71c1c; }
.stat-box .num { font-size: 1.5em; font-weight: bold; color: var(--gruen-d); }
.stat-box .lbl { font-size: 11px; color: var(--grau); }

/* Plan / Ist / Rest */
.plan-ist-wrap { grid-column: 1 / -1; margin-top: 4px; }
.plan-ist-wrap h4 { color: var(--gruen-d); margin: 6px 0; }
.plan-ist {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
  font-size: 13px;
}
.plan-ist th, .plan-ist td {
  border: 1px solid #ddd;
  padding: 5px 6px;
  text-align: center;
}
.plan-ist th {
  background: var(--gruen);
  color: white;
  font-weight: 600;
}
.plan-ist tr.sum td { background: var(--gruen-l); font-weight: bold; }
.plan-ist tr.over td { color: var(--rot); font-weight: bold; }

/* Plan-Editor (Admin) */
.plan-group { margin: 12px 0; padding: 8px 10px; background: #f7f7f7; border-radius: 6px; max-width: 100%; box-sizing: border-box; overflow-x: hidden; }
.plan-group h5 {
  margin: 0 0 6px; color: var(--gruen-d);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px;
}
.plan-edit { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: auto; }
.plan-edit th, .plan-edit td { padding: 3px 4px; border-bottom: 1px solid #e0e0e0; text-align: left; }
.plan-edit th { background: var(--gruen); color: #fff; text-align: left; font-weight: 600; }
.plan-edit input[type="number"],
.plan-edit input[type="text"] { margin: 0; padding: 4px 6px; min-width: 0; box-sizing: border-box; }
.plan-edit input[type="checkbox"] { width: 18px; height: 18px; }

/* Plan-Bearbeiter auf Mobile: Klasse volle Breite, Plan/Extern schmal,
   Lösch-Button rechts bei Plan/Extern */
@media (max-width: 700px) {
  .plan-edit, .plan-edit tbody { display: block; width: 100%; box-sizing: border-box; }
  .plan-edit thead, .plan-edit tr > th { display: none; }
  .plan-edit tr {
    display: grid;
    grid-template-columns: 28px 80px 80px 1fr auto;
    grid-template-areas:
      "check klasse klasse klasse klasse"
      ".     plan   extern .      del"
      ".     match  match  match  match";
    gap: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    background: #fff;
    align-items: end;
  }
  .plan-edit td {
    padding: 0; border: none; min-width: 0;
  }
  .plan-edit td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    color: var(--grau);
    margin-bottom: 2px;
    font-weight: 500;
  }
  .plan-edit td.pe-check { grid-area: check; align-self: end; padding-bottom: 4px; }
  .plan-edit td.pe-check::before { display: none; }
  .plan-edit tr td:nth-child(2) { grid-area: klasse; }
  .plan-edit tr td:nth-child(3) { grid-area: plan; }
  .plan-edit tr td:nth-child(4) { grid-area: extern; }
  .plan-edit tr td:nth-child(5) { grid-area: match; }
  .plan-edit td.pe-del { grid-area: del; align-self: end; padding-bottom: 0; }
  .plan-edit td.pe-del::before { display: none; }
  .plan-edit td.pe-del button {
    padding: 6px 10px !important; margin: 0;
    border-radius: 50%; line-height: 1;
    width: 34px; height: 34px;
  }
  .plan-edit input[type="text"],
  .plan-edit input[type="number"] { width: 100% !important; max-width: 100%; }
  .plan-edit input[type="checkbox"] { width: 20px !important; height: 20px; }
}

/* Meldeliste im Admin */
.meld-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: auto; }
.meld-table td {
  border-bottom: 1px solid #e0e0e0;
  padding: 6px;
  vertical-align: middle;
  word-break: break-word;
}
.meld-table td:first-child { text-align: left; }
.meld-table td:last-child { text-align: right; white-space: nowrap; }

/* Meldungs-Liste auf Mobile: Label oben, Button + Status in einer Zeile */
@media (max-width: 700px) {
  .meld-table, .meld-table tbody { display: block; width: 100%; box-sizing: border-box; }
  .meld-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "label label"
      "btn   status";
    gap: 8px;
    align-items: center;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    background: #fff;
  }
  .meld-table td { border: none; padding: 0; white-space: normal; }
  .meld-table td:first-child { grid-area: label; font-weight: 500; font-size: 13px; }
  .meld-table td:nth-child(2) { grid-area: status; font-size: 12px; text-align: right; }
  .meld-table td:last-child { grid-area: btn; text-align: left; }
  .meld-table td:last-child button { padding: 6px 14px; font-size: 13px; margin: 0; }
}

/* Hilfe-Popup: kompakte Accordion-Struktur */
.help-sections details.help-section {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 6px;
  background: #fafafa;
}
.help-sections details.help-section > summary {
  list-style: none;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
  user-select: none;
}
.help-sections details.help-section > summary::-webkit-details-marker { display: none; }
.help-sections details.help-section > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  color: var(--grau);
  transition: transform 0.15s;
}
.help-sections details.help-section[open] > summary::before { transform: rotate(90deg); }
.help-sections .help-body {
  padding: 2px 14px 12px 28px;
  font-size: 13px;
  color: #333;
  line-height: 1.45;
}
.help-sections .help-body ul,
.help-sections .help-body ol { padding-left: 18px; margin: 6px 0; }
.help-sections .help-body code {
  background: #eceff1; padding: 1px 5px; border-radius: 3px; font-size: 12px;
}

/* Revier-Header (kompakter Titel im Revier- und Park-Modus) */
.revier-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
.revier-header h2 {
  margin: 0; font-size: 18px; color: var(--gruen-d);
}
.revier-header h2 span { color: var(--grau); font-weight: normal; font-size: 15px; }

/* Hervorhebung gemeldeter Einträge */
.row-gemeldet td { background: #fff8e1 !important; }
.card-gemeldet { background: #fff8e1; border-left: 4px solid #c62828; }

/* ==================== LOGIN / REGISTRATION ==================== */
.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 20px;
}
.login-page .header { margin-bottom: 24px; }
.login-box {
  width: 100%;
  max-width: 400px;
}
.login-box h3 { text-align: center; color: var(--gruen-d); margin-bottom: 16px; }
.login-box .field-group { margin-bottom: 10px; }
.login-box .field-group label { display: block; font-size: 13px; color: #333; margin-bottom: 2px; font-weight: 600; }
.login-box .field-hint { font-size: 11px; color: var(--grau); margin: 2px 0 0; }
.login-box .login-toggle {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--grau);
}
.login-box .login-toggle a {
  color: var(--blau);
  cursor: pointer;
  text-decoration: underline;
}
.login-box .login-error {
  background: #ffebee;
  color: var(--rot);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 10px;
  display: none;
}

/* ==================== PERMISSION BADGES ==================== */
.perm-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 8px;
  margin: 1px 2px;
  color: #fff;
}
.perm-badge.perm-revier { background: var(--gruen); }
.perm-badge.perm-park { background: #00695c; }
.perm-badge.perm-admin { background: #ef6c00; }
.perm-badge.perm-lesen { background: var(--blau); }
.perm-badge.perm-plan { background: #7b1fa2; }
.perm-badge.perm-name { background: #455a64; }
.perm-badge.perm-inactive { background: #bdbdbd; color: #666; }

/* ==================== USER MANAGEMENT TABLE ==================== */
.user-table-wrap { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.user-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.user-table th { background: var(--gruen); color: #fff; padding: 8px 6px; text-align: left; font-size: 12px; white-space: nowrap; }
.user-table td { padding: 6px; border-bottom: 1px solid #e0e0e0; vertical-align: middle; word-break: break-word; }
.user-table td.user-email { font-size: 11px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-table tr:hover { background: var(--gruen-l); cursor: pointer; }
@media (max-width: 700px) {
  .user-table th.col-email, .user-table td.col-email,
  .user-table th.col-rechte, .user-table td.col-rechte { display: none; }
  .user-table { font-size: 12px; }
  .user-table th, .user-table td { padding: 6px 4px; }
}

/* ==================== IMPRESSUM PAGE ==================== */
.impressum-page { padding: 10px; }
.impressum-page h3 { color: var(--gruen-d); margin: 18px 0 8px; font-size: 16px; }
.impressum-page h3:first-child { margin-top: 0; }
.impressum-page h4 { color: #333; margin: 12px 0 6px; font-size: 14px; }
.impressum-page p, .impressum-page ul { font-size: 13px; line-height: 1.6; color: #333; margin: 6px 0; }
.impressum-page ul { padding-left: 20px; }

/* ==================== DOKUMENTE ==================== */
.doc-list { margin-top: 12px; }
.doc-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px; background: var(--gruen-l);
  margin-bottom: 6px; cursor: pointer; text-decoration: none; color: #333;
  transition: background 0.2s;
}
.doc-item:hover { background: #c8e6c9; }
.doc-item .doc-icon { font-size: 22px; flex: 0 0 auto; }
.doc-item .doc-info { flex: 1; min-width: 0; }
.doc-item .doc-name { font-weight: 600; font-size: 14px; word-break: break-word; }
.doc-item .doc-meta { font-size: 11px; color: var(--grau); }
.doc-item .doc-del { flex: 0 0 auto; }

/* ==================== PROFILE POPUP ==================== */
.profile-section { margin: 12px 0; padding: 12px; background: #f5f5f5; border-radius: var(--radius); }
.profile-section h4 { margin-bottom: 8px; color: var(--gruen-d); font-size: 14px; }
.profile-info { font-size: 13px; color: #333; }
.profile-info .label { color: var(--grau); font-size: 11px; }

/* ==================== SEILWINDE ==================== */

/* Der Seilwinden-Button sieht aus wie seine Nachbarn in der Leiste.
   Den Zustand zeigt ein kleiner Punkt oben rechts am Symbol - und zwar
   nur dann, wenn es etwas zu melden gibt. Frei = kein Punkt. */
.bottom-nav button.bn-seilwinde .bn-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}
.bottom-nav button.bn-seilwinde .sw-icon { width: 22px; height: 22px; }
.bn-seilwinde .bn-icon::after {
  content: "";
  position: absolute;
  top: -3px;
  right: -6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  display: none;
}
.bn-seilwinde.sw-ausgeliehen .bn-icon::after { display: block; background: var(--rot); }
.bn-seilwinde.sw-gesperrt .bn-icon::after    { display: block; background: #757575; }

/* Hinweis auf einen im Voraus eingetragenen Termin in der Statuskarte */
.sw-status .sw-kommend {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(255,255,255,0.35);
  font-size: 13px;
  opacity: 0.95;
}

/* Status-Karte auf der Seilwinden-Seite */
.sw-status {
  border-radius: 12px;
  padding: 14px;
  color: #fff;
  margin-bottom: 14px;
}
.sw-status.frei         { background: var(--gruen); }
.sw-status.heute        { background: #f9a825; }
.sw-status.ausgeliehen  { background: var(--rot); }
.sw-status.ueberfaellig { background: #8e0000; }
.sw-status.gesperrt     { background: #616161; }
.sw-status .sw-titel { font-size: 19px; font-weight: 700; margin-bottom: 3px; }
.sw-status .sw-sub   { font-size: 14px; opacity: 0.95; line-height: 1.45; }
.sw-status a { color: #fff; text-decoration: underline; font-weight: 600; }

/* Karte einer einzelnen Buchung */
.sw-card {
  border: 1px solid #ddd;
  border-left: 5px solid var(--gruen);
  border-radius: 10px;
  padding: 11px 13px;
  margin-bottom: 9px;
  background: #fff;
}
.sw-card.st-abgeholt    { border-left-color: var(--rot); }
.sw-card.st-zurueck     { border-left-color: #9e9e9e; opacity: 0.75; }
.sw-card.st-storniert   { border-left-color: #bdbdbd; opacity: 0.6; }
.sw-card.extern         { border-left-color: #8d6e63; }
.sw-badge.b-extern      { background: #efebe9; color: #5d4037; }
.sw-gebuehr {
  font-size: 12.5px; font-weight: 600; color: #5d4037;
  background: #efebe9; border-radius: 6px;
  padding: 4px 8px; margin-top: 6px; display: inline-block;
}
.sw-card .sw-zeit  { font-weight: 600; font-size: 15px; }
.sw-card .sw-meta  { font-size: 12.5px; color: var(--grau); margin-top: 3px; }
.sw-card .sw-badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px; margin-left: 6px; vertical-align: middle;
}
.sw-badge.b-abgeholt   { background: #ffebee; color: #b71c1c; }
.sw-badge.b-zurueck    { background: #e8f5e9; color: var(--gruen-d); }
.sw-badge.b-storniert  { background: #eee; color: #616161; }
/* Aktionsbuttons: auf Mobile untereinander, gross genug zum Tippen */
.sw-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.sw-actions button { margin: 0; flex: 1 1 auto; min-width: 116px; min-height: 42px; }

/* Buchungsformular */
.sw-form label { display: block; font-size: 13px; color: var(--grau); margin: 8px 0 3px; }
.sw-form input[type="datetime-local"],
.sw-form input[type="text"],
.sw-form select {
  width: 100%; margin: 0; min-height: 46px; font-size: 16px;
}
.sw-form label .hint { font-weight: normal; font-size: 12px; }
.sw-konflikt {
  background: #ffebee; border: 1px solid #ffcdd2; border-radius: 10px;
  padding: 11px 13px; margin-top: 11px; font-size: 13.5px; line-height: 1.5;
}
.sw-konflikt b { color: #b71c1c; }
.sw-hinweis { background: #f5f5f5; border-radius: 10px; padding: 10px 12px; margin-top: 14px; }
.sw-hinweis summary { cursor: pointer; font-weight: 600; color: var(--gruen-d); font-size: 14px; }
.sw-hinweis div { font-size: 13px; line-height: 1.6; margin-top: 8px; }
.sw-leer { color: var(--grau); font-size: 13.5px; padding: 6px 0; }

/* Kalender: pro Tag ein 24-Stunden-Balken (kompakt, mobiltauglich) */
.sw-kal { margin-top: 4px; }
.sw-kal-tag { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.sw-kal-tag.heute .sw-kal-datum { color: var(--gruen-d); font-weight: 700; }
.sw-kal-datum {
  flex: 0 0 62px; font-size: 12.5px; color: var(--grau); line-height: 1.2;
}
.sw-kal-bar {
  position: relative; flex: 1 1 auto; height: 26px; min-width: 0;
  background: #e8f5e9; border-radius: 6px; overflow: hidden; cursor: pointer;
}
.sw-kal-seg { position: absolute; top: 0; bottom: 0; }
.sw-kal-seg.extern { background: #8d6e63; }
.sw-kal-seg.fremd  { background: #ef9a9a; }
.sw-kal-seg.meine  { background: var(--gruen-d); }
.sw-kal-seg.sperre {
  background: repeating-linear-gradient(45deg, #9e9e9e, #9e9e9e 5px, #757575 5px, #757575 10px);
}
.sw-kal-seg span {
  position: absolute; left: 4px; right: 2px; top: 50%; transform: translateY(-50%);
  font-size: 10.5px; color: #fff; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; font-weight: 600;
}
.sw-kal-legende {
  display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px;
  color: var(--grau); margin-top: 8px;
}
.sw-kal-legende i {
  display: inline-block; width: 12px; height: 12px; border-radius: 3px;
  margin-right: 4px; vertical-align: -2px;
}

/* Seilwinden-Symbol als SVG (eindeutiger als jedes Emoji) */
.sw-icon { display: block; }
.sw-icon-sm { display: inline-block; vertical-align: -4px; margin-right: 5px; }
