:root {
  color-scheme: light;
  --bg: #f5f3ee;
  --panel-bg: #ffffff;
  --border: #d8d6cf;
  --text: #1c1d1a;
  --muted: #6f6e69;
  --accent: #2c6e49;
  --accent-strong: #1e4d33;
  --danger: #b3261e;
  --header-bg: #1e3a25;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

body { display: flex; flex-direction: column; min-height: 100vh; }

.app-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.7rem 1rem;
  background: var(--header-bg);
  color: #fff;
  flex-wrap: wrap;
}
.app-header h1 { font-size: 1.1rem; margin: 0; letter-spacing: 0.02em; }
.app-header .subtitle { margin: 0; font-size: 0.85rem; opacity: 0.8; }
.app-header nav {
  margin-left: auto;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.9rem;
}
.app-header nav a {
  color: #fff;
  text-decoration: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.5);
}
.app-header nav .muted { color: rgba(255, 255, 255, 0.7); }

.layout {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative; /* Anker für das rechte Slide-in-Panel */
}

.sidebar {
  width: 340px;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 0.9rem;
  background: var(--bg);
  border-right: 1px solid var(--border);
}

#map {
  flex: 1;
  min-height: 50vh;
  background: #e8e6df;
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.75rem;
}
.panel h2 {
  font-size: 0.95rem;
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.panel label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.5rem 0 0.2rem;
}
.panel input,
.panel select,
.panel textarea {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
  background: #fff;
}
.panel textarea { resize: vertical; }

.panel button {
  margin-top: 0.6rem;
  padding: 0.45rem 0.85rem;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
}
.panel button:hover { background: var(--accent-strong); }
.panel button.danger { background: var(--danger); }
.panel button.secondary { background: #6f6e69; }

.toggle-list { display: flex; flex-direction: column; gap: 0.15rem; }
.theme-group { margin-bottom: 0.5rem; }
/* `.panel label` (Element+Klasse) hätte sonst höhere Spezifität und würde
   display:flex auf block zurücksetzen -> daher .panel .theme-group-head. */
.panel .theme-group-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0.4rem 0 0.2rem;
  padding: 0.2rem 0.3rem;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
}
.theme-group-head:hover { background: #efeee8; }
/* Sammel-Checkbox in natürlicher Größe (sonst greift .panel input{width:100%})
   und per margin-left:auto ans rechte Ende der Themenfeld-Zeile schieben */
.theme-group-head input { width: auto; margin: 0 0 0 auto; cursor: pointer; }
.theme-group-head .ti { font-size: 1rem; }
/* Unterpunkte eingerückt, damit die Themenfeld-Blöcke klar erkennbar sind */
.theme-group .toggle { padding-left: 1.5rem; }
.toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  padding: 0.15rem 0;
  cursor: pointer;
}
.toggle input { width: auto; margin: 0; }
.swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}
.swatch-conflict {
  background:
    repeating-linear-gradient(
      45deg,
      #b3261e,
      #b3261e 3px,
      #ffd8d6 3px,
      #ffd8d6 6px
    );
  border-color: #b3261e;
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.actions button { margin-top: 0; }

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
/* `.overlay { display: flex }` would otherwise win over the UA's `[hidden]`. */
.overlay[hidden] { display: none; }
.login-form {
  background: #fff;
  padding: 1.25rem;
  border-radius: 8px;
  width: min(360px, 90%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.login-form h2 { margin: 0 0 0.5rem; }
.login-form label { font-size: 0.85rem; display: block; }
.login-form input {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
  margin-top: 0.2rem;
}
.login-form button {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
.error {
  color: var(--danger);
  min-height: 1.2em;
  margin: 0;
  font-size: 0.85rem;
}

/* Marker als farbiger Pin mit Kategorie-Icon */
.map-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.map-pin .ti {
  transform: rotate(45deg);
  color: #fff;
  font-size: 14px;
}

/* Themen-Chips (Wirkungsebene) im Detail-Panel und in Popups */
.theme-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.3rem 0; }
.theme-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  color: #fff;
}
.theme-chip .ti { font-size: 0.85rem; }

.popup-detail strong { display: block; margin-bottom: 0.25rem; }
.popup-detail em { color: var(--muted); }
.popup-detail .link {
  background: none;
  border: 0;
  color: var(--accent);
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  font: inherit;
}

/* Rechtes Slide-in-Panel für Detailinformationen */
.info-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(384px, 92%);
  background: var(--panel-bg);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 18px rgba(0, 0, 0, 0.14);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 1100;
  overflow-y: auto;
  padding: 1rem 1.1rem 2rem;
}
.info-panel.open { transform: translateX(0); }
.info-close {
  position: sticky;
  top: 0;
  float: right;
  margin: -0.2rem -0.2rem 0 0;
  background: none;
  border: 0;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}
.info-close:hover { color: var(--text); }
.info-count {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.2rem 0 0.7rem;
}
.info-empty { color: var(--muted); }
.info-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.7rem;
  background: #fff;
}
.info-card h3 { margin: 0.4rem 0 0.3rem; font-size: 1rem; }
.info-card p { margin: 0.3rem 0; font-size: 0.9rem; line-height: 1.4; }
.info-card small { color: var(--muted); }
.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  color: #fff;
  background: var(--c, #777);
}
.cat-badge .ti { font-size: 0.85rem; }
.btn-detail {
  margin-top: 0.5rem;
  padding: 0.35rem 0.65rem;
  font: inherit;
  font-size: 0.82rem;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
.btn-detail:hover { background: var(--accent-strong); }
.btn-detail:disabled { opacity: 0.6; cursor: default; }
.project-detail {
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
  padding-top: 0.45rem;
}

/* Linken Schalter „aufflashen", wenn man über das Karten-Element fährt */
.toggle.flash {
  background: #fff7cc;
  box-shadow: 0 0 0 2px #f5c518;
  border-radius: 4px;
}

/* Auswahl-Hervorhebung für Marker-Pins */
.map-pin.pin-selected {
  box-shadow: 0 0 0 3px #f5c518, 0 1px 3px rgba(0, 0, 0, 0.4);
}

kbd {
  font: inherit;
  font-size: 0.8em;
  background: #eceae3;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 0.3em;
}

/* Hervorgehobener Einstieg in die Verwaltung (linke Sidebar) */
.panel .mgmt-launch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin: 0 0 0.8rem;
  padding: 0.6rem 0.85rem;
  background: var(--header-bg);
  color: #fff;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.panel .mgmt-launch:hover { background: #27502f; }
.panel .mgmt-launch .ti { font-size: 1.15rem; }

/* Eigenes Zeichenwerkzeug (Admin) */
.draw-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}
.draw-toolbar button {
  margin: 0;
  flex: 1 1 auto;
  padding: 0.4rem 0.5rem;
  font-size: 0.82rem;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}
.draw-toolbar button:hover { background: #f0efe9; }
.draw-toolbar button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.project-fields {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.6rem 0.6rem;
  margin: 0.4rem 0;
}
.project-fields legend { font-size: 0.8rem; padding: 0 0.3rem; }
.project-fields .muted { font-weight: 400; font-size: 0.75rem; }

/* Bearbeitungs-Griffe für Geometrien */
.vertex-handle {
  display: block;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid var(--accent-strong);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.midpoint-handle {
  display: block;
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px dashed var(--accent-strong);
  border-radius: 50%;
}
.centroid-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--accent);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  font-size: 13px;
}
.leaflet-container.drawing { cursor: crosshair; }

/* Kleiner WYSIWYG-Editor */
.rte { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin-top: 0.25rem; background: #fff; }
.rte-toolbar {
  display: flex; flex-wrap: wrap; gap: 2px; align-items: center;
  padding: 4px 6px; background: #f5f3ee; border-bottom: 1px solid var(--border);
}
.rte-toolbar button {
  margin: 0; padding: 2px 8px; min-width: 28px; background: none;
  border: 1px solid transparent; border-radius: 4px; cursor: pointer;
  color: var(--text); font-size: 0.9rem; line-height: 1.5;
}
.rte-toolbar button:hover { background: #e7e4db; }
.rte-toolbar .ti { font-size: 1rem; }
.rte-sep { width: 1px; height: 16px; background: var(--border); margin: 0 4px; }
.rte-editor {
  min-height: 7rem; max-height: 45vh; overflow-y: auto;
  padding: 0.6rem 0.7rem; line-height: 1.55; color: var(--text);
  /* NICHT font:inherit – der Editor steckt im <label> (font-weight 600) */
  font-family: inherit; font-size: 0.92rem; font-weight: 400;
}
.rte.tall .rte-editor { min-height: 13rem; }
.rte-editor:focus { outline: none; box-shadow: inset 0 0 0 2px rgba(44, 110, 73, 0.18); }
.rte-editor p { margin: 0 0 0.5em; }
.rte-editor ul, .rte-editor ol { margin: 0.3em 0; padding-left: 1.4rem; }
.rte-editor:empty::before { content: "Text eingeben …"; color: var(--muted); }

/* Formatierter Text in der Anzeige (öffentliche Karte) */
.rich-row { margin: 0.35rem 0; }
.rich-content { font-size: 0.9rem; line-height: 1.5; }
.rich-content p { margin: 0.3rem 0; }
.rich-content ul, .rich-content ol { margin: 0.3rem 0; padding-left: 1.3rem; }
.rich-content a { color: var(--accent); }

/* Verwaltungslisten (Projekte / Organisationen) */
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel-head h2 { margin: 0; }
.add-btn {
  margin: 0;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
.add-btn:hover { background: var(--accent-strong); }
.mgmt-list { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.5rem; }
.mgmt-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
}
.mgmt-row .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.mgmt-row .grow { flex: 1; min-width: 0; }
.mgmt-row .title { font-size: 0.86rem; }
.mgmt-row .sub { font-size: 0.74rem; color: var(--muted); }
.mgmt-row .icon-btn {
  margin: 0; padding: 0.2rem 0.35rem; background: none; color: var(--muted);
  border: 0; cursor: pointer; font-size: 0.95rem; line-height: 1;
}
.mgmt-row .icon-btn:hover { color: var(--text); background: none; }
.mgmt-row .icon-btn.del:hover { color: var(--danger); }
.mgmt-empty { font-size: 0.8rem; color: var(--muted); }

/* Modaler Dialog (Anlegen/Bearbeiten) */
.modal-dialog {
  background: #fff;
  border-radius: 10px;
  width: min(760px, 96%);
  max-height: 92vh;
  overflow-y: auto;
  padding: 1.4rem 1.7rem 1.6rem;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.modal-head h2 { margin: 0; font-size: 1.15rem; }
#modal-close { margin: 0; background: none; border: 0; font-size: 1.6rem; line-height: 1; color: var(--muted); cursor: pointer; }
#modal-close:hover { color: var(--text); }

/* Großzügige, einheitliche Formularfelder im Dialog */
#modal-form label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
  margin: 0.95rem 0 0.3rem;
}
#modal-form input,
#modal-form select,
#modal-form textarea {
  display: block;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  background: #fff;
  color: var(--text);
}
#modal-form textarea { resize: vertical; min-height: 4.8rem; line-height: 1.55; }
/* Beschreibung bekommt am meisten Raum (lange Texte) */
#modal-form textarea[name="description"] { min-height: 9rem; }
#modal-form input:focus,
#modal-form select:focus,
#modal-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(44, 110, 73, 0.15);
}

.modal-dialog .slug-hint {
  font-size: 0.76rem; color: var(--muted); margin: 0.4rem 0 0.2rem;
  display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap;
}
.modal-dialog .slug-hint code { font-family: ui-monospace, monospace; background: #f0efe8; padding: 0.05rem 0.35rem; border-radius: 3px; color: var(--text); }

.field-row { display: flex; gap: 0.9rem; }
.field-row > label { flex: 1; }

#modal-form .actions { margin-top: 1.4rem; display: flex; gap: 0.6rem; }
#modal-form .actions button { margin: 0; padding: 0.55rem 1.1rem; font: inherit; border-radius: 6px; cursor: pointer; border: 0; }
#modal-save { background: var(--accent); color: #fff; }
#modal-save:hover { background: var(--accent-strong); }
#modal-cancel { background: #ece9e1; color: var(--text); }
#modal-cancel:hover { background: #ddd9cf; }
#modal-error { margin: 0.7rem 0 0; }

/* Themenfeld-Chips zum Anklicken (Mehrfachauswahl) */
.chip-select { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.3rem 0 0.2rem; }
.chip-select .chip {
  font-size: 0.76rem; padding: 0.25rem 0.6rem; border-radius: 999px;
  border: 1px solid var(--border); background: #fff; color: var(--text); cursor: pointer;
}
.chip-select .chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Großes Verwaltungs-Modal mit Reitern und Tabelle */
#mgmt { z-index: 1050; }
#modal { z-index: 1100; } /* Bearbeiten-Dialog über dem Verwaltungs-Modal */
.mgmt-modal {
  background: #fff;
  border-radius: 8px;
  width: min(1000px, 96%);
  height: min(86vh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mgmt-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.7rem 1rem; border-bottom: 1px solid var(--border);
}
.mgmt-head button { margin: 0; }
.mgmt-tabs { display: flex; gap: 0.3rem; }
.mgmt-tab {
  margin: 0; padding: 0.45rem 0.9rem; font: inherit; font-size: 0.9rem;
  background: none; color: var(--muted); border: 0; border-bottom: 2px solid transparent;
  cursor: pointer;
}
.mgmt-tab:hover { color: var(--text); }
.mgmt-tab.active { color: var(--accent-strong); border-bottom-color: var(--accent); font-weight: 600; }
.mgmt-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
/* display:flex würde sonst [hidden] schlagen -> beide Reiter sichtbar */
.mgmt-panel[hidden] { display: none; }
.mgmt-toolbar {
  display: flex; gap: 0.5rem; align-items: center;
  padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.mgmt-toolbar input[type="search"] {
  flex: 1; min-width: 160px; padding: 0.4rem 0.6rem;
  border: 1px solid var(--border); border-radius: 4px; font: inherit; background: #fff;
}
.mgmt-toolbar select {
  padding: 0.4rem 0.5rem; border: 1px solid var(--border); border-radius: 4px; font: inherit; background: #fff;
}
.mgmt-toolbar .add-btn { margin: 0; }
.mgmt-table-wrap { flex: 1; overflow-y: auto; }
.mgmt-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.mgmt-table thead th {
  position: sticky; top: 0; background: #f5f3ee; text-align: left;
  padding: 0.5rem 0.8rem; border-bottom: 1px solid var(--border);
  font-weight: 600; white-space: nowrap;
}
.mgmt-table thead th[data-sort] { cursor: pointer; user-select: none; }
.mgmt-table thead th[data-sort]:hover { background: #ece9e1; }
.mgmt-table thead th .arrow { color: var(--accent); margin-left: 0.2rem; }
.mgmt-table tbody td { padding: 0.45rem 0.8rem; border-bottom: 1px solid #ebe9e2; vertical-align: middle; }
.mgmt-table tbody tr:hover { background: #faf9f5; }
.mgmt-table .cell-name { display: flex; align-items: center; gap: 0.45rem; }
.mgmt-table .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.mgmt-table .org-link {
  background: none; border: 0; padding: 0; font: inherit; color: var(--accent);
  text-decoration: underline; cursor: pointer;
}
.mgmt-table .num { text-align: center; }
.mgmt-table .row-actions { text-align: right; white-space: nowrap; }
.mgmt-table .icon-btn {
  margin: 0; padding: 0.2rem 0.35rem; background: none; color: var(--muted);
  border: 0; cursor: pointer; font-size: 1rem; line-height: 1;
}
.mgmt-table .icon-btn:hover { color: var(--text); }
.mgmt-table .icon-btn.del:hover { color: var(--danger); }
.mgmt-empty-row td { color: var(--muted); padding: 1rem 0.8rem; }
.status-badge {
  font-size: 0.72rem; padding: 0.1rem 0.45rem; border-radius: 999px;
  background: #ece9e1; color: #5f5e59;
}

/* Auswahl bei Überlappung: Chips für alle Elemente an der Klickstelle */
.overlap-chooser { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.5rem; }
.overlap-chooser .ov-label { width: 100%; font-size: 0.74rem; color: var(--muted); }
.overlap-chooser .chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.74rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text); /* sonst erbt der Button .panel button{color:#fff} -> unlesbar */
  cursor: pointer;
}
.overlap-chooser .chip.active {
  background: var(--accent-strong);
  color: #fff;
  border-color: var(--accent-strong);
  font-weight: 500;
}
.overlap-chooser .chip .dot { width: 9px; height: 9px; border-radius: 2px; flex: none; }

/* Dokumente / Anhänge im Projekt-Dialog (Admin) */
.doc-section { margin-top: 1rem; border-top: 1px solid var(--border); padding-top: 0.8rem; }
.doc-section h3 { font-size: 0.95rem; margin: 0 0 0.5rem; color: var(--text); }
.doc-list { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.6rem; }
.doc-row {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: 5px;
  background: #fff; font-size: 0.85rem;
}
.doc-row .doc-name { font-weight: 600; }
.doc-row .doc-meta { color: var(--muted); font-size: 0.78rem; flex: 1; }
.doc-row .icon-btn { margin: 0; padding: 0.2rem 0.35rem; background: none; border: 0; cursor: pointer; color: var(--muted); }
.doc-row .icon-btn:hover { color: var(--text); }
.doc-row .icon-btn.del:hover { color: var(--danger); }
.doc-vis-badge { font-size: 0.7rem; padding: 0.1rem 0.45rem; border-radius: 999px; flex: none; }
.doc-vis-badge.is-public { background: #e6f1d8; color: #3b6d11; }
.doc-vis-badge.is-internal { background: #ece9e1; color: #5f5e59; }
.doc-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
#modal-form .doc-upload input[type="text"] { display: inline-block; width: auto; flex: 1; min-width: 140px; margin: 0; }
#modal-form .doc-upload input[type="file"] { display: inline-block; width: auto; margin: 0; }
.doc-upload .doc-vis { display: inline-flex; align-items: center; gap: 0.3rem; margin: 0; font-weight: 400; font-size: 0.8rem; color: var(--text); }
.doc-upload .doc-vis input { display: inline-block; width: auto; margin: 0; }
#doc-upload-btn { margin: 0; padding: 0.45rem 0.8rem; background: var(--accent); color: #fff; border: 0; border-radius: 4px; cursor: pointer; font: inherit; }
#doc-upload-btn:hover { background: var(--accent-strong); }
#doc-msg { width: 100%; margin: 0.2rem 0 0; }

/* Öffentliche Dokument-Downloads im Info-Panel */
.doc-downloads { margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.2rem; }
.doc-downloads a { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--accent); font-size: 0.88rem; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .info-panel { width: 100%; }
  .sidebar {
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    max-height: 45vh;
  }
  #map { min-height: 55vh; }
}

/* ==========================================================================
   Website-Rahmen: Navigation, Fußzeile, Inhaltsseiten
   (site.js injiziert .site-nav und .site-footer auf allen Seiten)
   ========================================================================== */

.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.2rem;
  background: var(--header-bg);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 500;
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #fff;
  text-decoration: none;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}
.site-brand strong { font-weight: 700; }
.site-brand .ti { font-size: 1.4rem; color: #9ccf9c; }

.site-menu {
  margin-left: auto;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.site-menu a {
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: 5px;
  font-size: 0.95rem;
}
.site-menu a:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.site-menu a.active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: 600;
}

.site-nav-toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  border-radius: 5px;
  padding: 0.35rem 0.5rem;
  font-size: 1.1rem;
  cursor: pointer;
}

@media (max-width: 720px) {
  .site-nav-toggle { display: inline-flex; }
  .site-menu {
    display: none;
    flex-direction: column;
    width: 100%;
    order: 3;
    gap: 0.15rem;
    margin: 0.3rem 0 0;
  }
  .site-menu.open { display: flex; }
  .site-menu a { padding: 0.6rem 0.7rem; }
}

/* Inhaltsseiten-Container */
.page {
  flex: 1;
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  padding: 2rem 1.2rem 3rem;
}
.page h1 { font-size: 1.9rem; margin: 0 0 0.4rem; color: var(--accent-strong); }
.page h2 { font-size: 1.3rem; margin: 2rem 0 0.6rem; color: var(--accent-strong); }
.page p { line-height: 1.65; }
.page .lead {
  font-size: 1.15rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 1.5rem;
  max-width: 62ch;
}

/* Hero der Startseite */
.hero {
  background: linear-gradient(135deg, #1e3a25, #2c6e49);
  color: #fff;
  border-radius: 12px;
  padding: 2.4rem 2rem;
  margin-bottom: 2rem;
}
.hero h1 { color: #fff; font-size: 2.2rem; margin: 0 0 0.6rem; }
.hero p { font-size: 1.2rem; line-height: 1.6; margin: 0 0 1.4rem; max-width: 60ch; opacity: 0.95; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #fff;
  color: var(--accent-strong);
  text-decoration: none;
  padding: 0.6rem 1.1rem;
  border-radius: 6px;
  font-weight: 600;
}
.btn:hover { background: #eef3ee; }
.btn.ghost { background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.5); }

/* Kachelraster (Wegweiser, Themen) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.card {
  display: block;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem 1.3rem;
  text-decoration: none;
  color: var(--text);
}
a.card:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(0,0,0,0.06); }
.card .ti { font-size: 1.7rem; color: var(--accent); }
.card h3 { margin: 0.5rem 0 0.3rem; font-size: 1.1rem; color: var(--accent-strong); }
.card p { margin: 0; font-size: 0.95rem; color: var(--muted); line-height: 1.5; }

/* Info-/Hinweiskasten */
.callout {
  background: #eef4ee;
  border: 1px solid #cfe0cf;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin: 1.5rem 0;
}
.callout.warn { background: #faf1da; border-color: #e6cf8a; border-left-color: #c9982e; }

/* eingebetteter Rechner */
.embed-tool {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 1400px;
}

.badge {
  display: inline-block;
  font-size: 0.78rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: #e3efe3;
  color: var(--accent-strong);
  margin-left: 0.4rem;
}

/* Fußzeile */
.site-footer {
  background: var(--header-bg);
  color: rgba(255, 255, 255, 0.85);
  margin-top: auto;
}
.foot-inner {
  max-width: 940px;
  margin: 0 auto;
  padding: 1.6rem 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: flex-start;
}
.foot-brand { font-size: 0.95rem; line-height: 1.5; }
.foot-links { display: flex; flex-direction: column; gap: 0.3rem; }
.foot-links a { color: rgba(255,255,255,0.85); text-decoration: none; font-size: 0.9rem; }
.foot-links a:hover { color: #fff; text-decoration: underline; }
.foot-links a.muted { color: rgba(255,255,255,0.5); }
.foot-note { flex-basis: 100%; margin: 0.5rem 0 0; font-size: 0.8rem; color: rgba(255,255,255,0.55); }

/* Quellennachweis – für Inhalte, die von Vereinen/Projekten stammen.
   Verwendung: <p class="source">Quelle: …</p> */
.source {
  font-size: 0.85rem;
  color: var(--muted);
  border-left: 3px solid var(--border);
  border-radius: 0;
  padding: 0.25rem 0 0.25rem 0.7rem;
  margin: 0.6rem 0;
  font-style: italic;
}

/* Werkzeug-/Spielebereich – hebt die interaktiven Tools vom Infoteil ab.
   Verwendung:
     <section class="tools-zone">
       <p class="tools-zone-label"><i class="ti ti-player-play"></i> Zum Ausprobieren</p>
       <h2>…</h2> <p>…</p> <iframe class="embed-tool" …></iframe>
     </section> */
.tools-zone {
  background: #eef4ec;
  border: 1px solid #cfe0cf;
  border-radius: 14px;
  padding: 1.25rem 1.5rem 1.75rem;
  margin: 2.5rem 0 1.5rem;
}
.tools-zone-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.5rem;
}
.tools-zone h2 { margin-top: 0.2rem; }
.tools-zone > p { color: var(--muted); }
.tools-zone .embed-tool { background: #fff; }

/* Fußnoten – Quellenverweise im Text [1] und gesammelte Liste am Seitenende.
   Im Text:  …Fakt<sup class="fn"><a href="#q1" id="r1">1</a></sup>.
   Am Ende:  <section class="footnotes"><h2>Quellen</h2>
               <ol><li id="q1">… <a href="#r1">↩</a></li></ol></section> */
sup.fn { font-size: 0.7em; line-height: 0; }
sup.fn a { text-decoration: none; color: var(--accent); font-weight: 600; padding: 0 1px; }
.footnotes { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.footnotes h2 { font-size: 1rem; color: var(--muted); margin: 0 0 0.5rem; }
.footnotes ol { margin: 0; padding-left: 1.3rem; }
.footnotes li { font-size: 0.85rem; color: var(--muted); line-height: 1.55; margin: 0.35rem 0; }
.footnotes a { color: var(--accent); word-break: break-word; }
