:root {
  --primaer: #2f5d50; --akzent: #6b7280;
  --bg: #f4f5f3; --card: #ffffff; --text: #1f2a26; --muted: #6b7280; --line: #dfe3df;
  --gruen: #2e9e5b; --gelb: #e0a800; --rot: #d64545;
  --radius: 14px; --schrift: 16px;
}
:root[data-theme="dark"] {
  --bg: #121614; --card: #1c2220; --text: #e7ece9; --muted: #9ca3af; --line: #2e3633;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: var(--schrift)/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: .85em; }
h1, h2, h3 { margin: .2em 0 .5em; line-height: 1.2; }
h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; margin-top: 1.2em; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }
#login { align-items: center; justify-content: center; padding: 20px; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: 0 2px 14px rgba(0,0,0,.08); }
.login-card { width: 100%; max-width: 360px; display: grid; gap: 12px; text-align: center; }
.login-logo { width: 84px; height: 84px; margin: 0 auto; object-fit: contain; }

label { display: grid; gap: 4px; text-align: left; font-weight: 600; font-size: .92em; }
input, select, textarea { font: inherit; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--text); width: 100%; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primaer); border-color: transparent; }

.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 11px 14px; border-radius: 12px; cursor: pointer; }
a.btn { text-decoration: none; text-align: center; }
.btn.primary { background: var(--primaer); border-color: var(--primaer); color: #fff; }
.btn.danger { color: var(--rot); }
.btn.wide { width: 100%; }
.btn.small { padding: 6px 10px; font-size: .85em; }
.icon-btn { font-size: 1.25rem; background: none; border: 0; color: var(--text); padding: 8px; cursor: pointer; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.btn-row .btn { flex: 1 1 auto; }

.topbar { display: flex; gap: 8px; align-items: center; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top));
  background: var(--card); border-bottom: 1px solid var(--line); z-index: 500; }
.topbar-logo { width: 34px; height: 34px; object-fit: contain; }
.topbar input { flex: 1; padding: 9px 12px; }
.filter-info { background: var(--primaer); color: #fff; padding: 6px 12px; font-size: .9em; z-index: 500;
  display: flex; justify-content: space-between; gap: 8px; }
.filter-info button { background: none; border: 0; color: #fff; text-decoration: underline; font: inherit; }
#map { flex: 1; }
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9); }
:root[data-theme="dark"] .leaflet-container { background: #0e1110; }

.fab-row { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; justify-content: center;
  padding: 10px; padding-bottom: max(12px, env(safe-area-inset-bottom)); z-index: 600; pointer-events: none; flex-wrap: wrap; }
.fab-row .btn { pointer-events: auto; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.sync { position: absolute; top: 62px; right: 10px; z-index: 600; background: var(--card); padding: 4px 10px;
  border-radius: 20px; font-size: .8em; box-shadow: 0 1px 6px rgba(0,0,0,.15); }

/* Kartensymbole: Icon = Kategorie, Rand = Status, Ring = Besuchsalter */
.ra-marker { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 19px;
  background: var(--card); border: 3px solid var(--mcolor, #4b5563); box-shadow: 0 0 0 4px var(--ring, transparent), 0 2px 6px rgba(0,0,0,.35); }
.ra-marker.entwurf { border-style: dashed; }
.ra-marker.schaden { border-color: var(--rot) !important; }
.ra-marker.archiviert { opacity: .55; filter: grayscale(1); }
.ra-marker .count { position: absolute; top: -6px; right: -8px; background: var(--primaer); color: #fff; font-size: 11px;
  border-radius: 10px; padding: 0 5px; font-weight: 700; }

.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 900; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto; z-index: 1000;
  background: var(--card); border-radius: 18px 18px 0 0; padding: 8px 16px; padding-bottom: max(20px, env(safe-area-inset-bottom));
  box-shadow: 0 -4px 24px rgba(0,0,0,.2); }
@media (min-width: 760px) { .sheet { left: auto; right: 16px; bottom: 16px; width: 440px; border-radius: 18px; max-height: 85vh; } }
.sheet-handle { width: 44px; height: 5px; background: var(--line); border-radius: 3px; margin: 4px auto 10px; }
.sheet-head { display: flex; gap: 10px; align-items: center; }
.sheet-head .big-icon { font-size: 2rem; }
.sheet-head .close { margin-left: auto; }

.kv { display: grid; grid-template-columns: 42% 58%; gap: 4px 8px; font-size: .95em; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: .78em; font-weight: 700; background: var(--line); }
.badge.entwurf { background: #fde68a; color: #6b4e00; } .badge.archiviert { background: #d1d5db; color: #374151; }
.badge.offen { background: #fecaca; color: #7f1d1d; } .badge.vorl { background: #e0e7ff; color: #3730a3; }

.form { display: grid; gap: 12px; }
.field-row { display: grid; gap: 4px; }
.field-row .label-line { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: .92em; }
.help { border: 1px solid var(--line); border-radius: 50%; width: 22px; height: 22px; font-size: .8em; background: none; color: var(--muted); cursor: pointer; }
.help-text { font-size: .85em; color: var(--muted); background: var(--bg); padding: 6px 8px; border-radius: 8px; }
.inline { display: flex; gap: 6px; align-items: center; } .inline > * { flex: 1; } .inline .btn { flex: 0 0 auto; }
.stars button { font-size: 1.5rem; background: none; border: 0; cursor: pointer; color: #c9c9c9; padding: 0 2px; }
.stars button.on { color: #e0a800; }
.toggle { display: flex; gap: 6px; } .toggle button { flex: 1; }
.toggle button.on { background: var(--primaer); color: #fff; border-color: var(--primaer); }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.photos figure { margin: 0; } .photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.photos figcaption { font-size: .72em; color: var(--muted); text-align: center; }
.list { list-style: none; padding: 0; margin: 0; } .list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li.click { cursor: pointer; }
.list .row { display: flex; gap: 10px; align-items: center; } .list .row .grow { flex: 1; min-width: 0; }
.secret { font-family: ui-monospace, monospace; letter-spacing: .1em; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #111; color: #fff;
  padding: 10px 16px; border-radius: 12px; z-index: 2000; max-width: 90vw; display: flex; gap: 12px; align-items: center; }
.toast button { background: none; border: 0; color: #9fe3c6; font: inherit; font-weight: 700; }

/* ---------- Stufe 2 ---------- */
.ra-marker { position: relative; }
.ra-marker.form-quadrat { border-radius: 9px; }
.ra-marker.form-pin { border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
.ra-marker.form-pin .glyph, .ra-marker.form-pin .zusatz, .ra-marker.form-pin .count, .ra-marker.form-pin .imp { transform: rotate(45deg); }
.ra-marker .zusatz { position: absolute; bottom: -7px; left: -8px; background: var(--mcolor, #4b5563); color: #fff; font-size: 10px;
  font-weight: 800; border-radius: 8px; padding: 0 4px; line-height: 15px; }
.ra-marker .imp { position: absolute; bottom: -7px; right: -8px; background: #6366f1; color: #fff; font-size: 10px; font-weight: 800; border-radius: 8px; padding: 0 4px; line-height: 15px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.tabs button { white-space: nowrap; }
.tabs button.on { background: var(--primaer); color: #fff; border-color: var(--primaer); }
.bund { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin: 8px 0; }
.bund h4 { margin: 0 0 4px; display: flex; justify-content: space-between; align-items: center; }
.kette { background: var(--bg); border-radius: 10px; padding: 8px 10px; margin: 6px 0; font-size: .92em; }
.kette b { color: var(--primaer); }
.badge.bestaetigt { background: #bbf7d0; color: #14532d; } .badge.plan { background: #bfdbfe; color: #1e3a8a; }
.badge.vermutet { background: #fde68a; color: #6b4e00; } .badge.unbekannt { background: #e5e7eb; color: #374151; }
.geheim-modus dt[data-feld], .geheim-modus dd[data-feld] { outline: 2px dashed var(--rot); cursor: pointer; border-radius: 4px; }
.scan-video { width: 100%; border-radius: 12px; background: #000; max-height: 50vh; object-fit: cover; }
.icon-preview { display: flex; gap: 14px; align-items: center; padding: 10px; background: var(--bg); border-radius: 12px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; max-height: 180px; overflow-y: auto; }
.emoji-grid button { font-size: 1.35rem; color: var(--text); background: none; border: 1px solid transparent; border-radius: 8px; padding: 4px; cursor: pointer; }
.emoji-grid button:hover, .emoji-grid button.on { border-color: var(--primaer); }
.map-table { width: 100%; border-collapse: collapse; font-size: .9em; } .map-table td { padding: 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
details.faq { border-bottom: 1px solid var(--line); padding: 8px 0; } details.faq summary { font-weight: 600; cursor: pointer; }
@media print { body * { visibility: hidden; } }

a { color: var(--primaer); }
:root[data-theme="dark"] a { color: #7fd1b9; }

.locate-btn { position: absolute; left: 10px; top: 70px; z-index: 600; width: 44px; height: 44px; padding: 0; font-size: 1.4rem; border-radius: 50%; box-shadow: 0 2px 10px rgba(0,0,0,.2); }
.pick-info { position: absolute; left: 10px; right: 10px; top: 66px; z-index: 700; background: var(--primaer); color: #fff; border-radius: 12px; padding: 10px 12px;
  display: flex; gap: 10px; align-items: center; justify-content: space-between; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.leaflet-container { cursor: crosshair; }

svg.lucide { vertical-align: -0.15em; }
.ra-marker svg.lucide { width: 20px; height: 20px; color: var(--mcolor, #374151); }
.big-icon svg.lucide { width: 32px; height: 32px; }

.bell { position: relative; }
.bell-count { position: absolute; top: 2px; right: 0; background: var(--rot); color: #fff; font-size: 10px; font-weight: 800; border-radius: 9px; padding: 0 5px; line-height: 16px; }
.dash { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { background: var(--bg); border-radius: 14px; padding: 12px; min-height: 96px; position: relative; }
.tile.breit { grid-column: span 2; }
.tile h4 { margin: 0 0 6px; font-size: .9em; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.tile .zahl { font-size: 2rem; font-weight: 800; color: var(--primaer); line-height: 1.1; }
.tile ul { list-style: none; padding: 0; margin: 4px 0 0; font-size: .88em; } .tile li { padding: 3px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.tile .edit { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.tile[draggable="true"] { outline: 2px dashed var(--line); cursor: grab; }
.legend { display: grid; gap: 2px; font-size: .8em; } .legend span { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; }
.lock-hint { background: #fff7e6; color: #7a4b00; border-radius: 10px; padding: 8px 10px; margin: 8px 0; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
:root[data-theme="dark"] .lock-hint { background: #3a2c10; color: #ffd58a; }
.chip { display: inline-block; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 2px 8px; margin: 2px; font-size: .8em; }
