:root {
  --green: #2f5d0a;        /* Kopfzeile, Hauptaktion */
  --green-bright: #84b414; /* Parteigrün als Akzent */
  --magenta: #c4006a;
  --amber: #f2b705;
  --ink: #1c2416;
  --muted: #5f6b57;
  --line: #dfe5d8;
  --bg: #f6f8f2;
  --card: #fff;
  --free: #c4006a;
  --claimed: #f2b705;
  --done: #3f8f1f;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { display: flex; flex-direction: column; background: var(--bg); overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Kopf */
.top { background: var(--green); color: #fff; padding: calc(8px + env(safe-area-inset-top)) 12px 10px; display: grid; gap: 8px; z-index: 5; }
.top-row { display: flex; align-items: center; gap: 8px; }
.top h1 { font-size: 17px; margin: 0; flex: 1; line-height: 1.2; font-weight: 700; }
.top h1 span { font-weight: 400; opacity: .8; font-size: 13px; margin-left: 4px; white-space: nowrap; }
.chip { border: 1px solid rgba(255,255,255,.45); background: transparent; color: #fff; border-radius: 99px; padding: 5px 11px; font-size: 13px; cursor: pointer; max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-admin { background: #fff; color: var(--green); border-color: #fff; font-weight: 600; }
.campaign { display: flex; align-items: center; gap: 6px; background: #fff; color: var(--ink); border-radius: 10px; padding: 0 4px 0 10px; min-width: 0; flex: 1 1 55%; }
.campaign span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.campaign select { border: 0; background: transparent; padding: 9px 4px; font-weight: 600; min-width: 0; flex: 1; text-overflow: ellipsis; }
.progress { flex: 1 1 45%; font-size: 12px; line-height: 1.25; min-width: 0; }
.progress .bar { height: 7px; border-radius: 9px; background: rgba(255,255,255,.25); overflow: hidden; display: flex; margin-top: 4px; }
.progress .bar i { display: block; height: 100%; }
.progress .bar .d { background: var(--green-bright); }
.progress .bar .c { background: var(--amber); }

/* Hauptbereich */
main { flex: 1; position: relative; min-height: 0; }
#map { position: absolute; inset: 0; z-index: 0; background: #e8ece3; }
.list { position: absolute; inset: 0; overflow-y: auto; padding: 12px 12px 24px; background: var(--bg); z-index: 3; }
.list h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 4px 8px; }
.list h2:first-child { margin-top: 4px; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 12px; margin-bottom: 8px; cursor: pointer; }
.row .txt { flex: 1; min-width: 0; }
.row b { display: block; font-size: 15px; }
.row small { color: var(--muted); font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; line-height: 1.5; }

/* Gebiets-Marken */
.badge { display: inline-flex; align-items: center; gap: 3px; min-width: 34px; justify-content: center; padding: 3px 7px; border-radius: 8px; font-weight: 700; font-size: 13px; line-height: 1.2; white-space: nowrap; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.badge.free { background: var(--free); color: #fff; }
.badge.claimed { background: var(--claimed); color: #2a2000; }
.badge.done { background: var(--done); color: #fff; }
.badge.mine { outline: 3px solid var(--ink); outline-offset: 1px; }
.badge.static { box-shadow: none; border-color: transparent; min-width: 44px; padding: 6px 8px; font-size: 14px; }
.pin { position: absolute; transform: translate(-50%, -50%); cursor: pointer; }
.pin.sel .badge { transform: scale(1.2); box-shadow: 0 0 0 4px rgba(28,36,22,.35); }
.far .pin .badge { font-size: 10px; padding: 1px 4px; min-width: 0; border-width: 1px; border-radius: 6px; }
.leaflet-container { font: inherit; }

.legend { position: absolute; left: 10px; top: 10px; z-index: 2; background: rgba(255,255,255,.94); border-radius: 10px; padding: 6px 10px; font-size: 12px; display: flex; gap: 10px; box-shadow: 0 1px 5px rgba(0,0,0,.2); }
.legend span { display: flex; align-items: center; gap: 4px; }
.dot { width: 11px; height: 11px; border-radius: 4px; display: inline-block; }
.dot.free { background: var(--free); } .dot.claimed { background: var(--claimed); } .dot.done { background: var(--done); }
.filter { position: absolute; left: 10px; top: 46px; z-index: 2; border: 2px solid var(--free); background: #fff; color: var(--free); border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 700; cursor: pointer; box-shadow: 0 1px 5px rgba(0,0,0,.2); }
.filter[aria-pressed=true] { background: var(--free); color: #fff; }
.list .filter { position: static; box-shadow: none; margin: 0 0 4px 2px; }
.pin.dim { opacity: .55; }
.pin.dim .badge { background: #8a9285; color: #fff; font-size: 10px; padding: 1px 4px; min-width: 0; border-width: 1px; border-radius: 6px; box-shadow: none; }
.fab { position: absolute; right: 10px; bottom: 34px; z-index: 2; width: 46px; height: 46px; border-radius: 50%; border: 0; background: #fff; color: var(--green); box-shadow: 0 1px 6px rgba(0,0,0,.3); cursor: pointer; display: grid; place-items: center; }
.drawbar { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 4; background: var(--ink); color: #fff; border-radius: 12px; padding: 8px 8px 8px 14px; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.drawbar span { flex: 1; }

/* Tabs */
.tabs { display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs button { flex: 1; border: 0; background: none; padding: 13px 4px; font-size: 14px; color: var(--muted); cursor: pointer; border-top: 3px solid transparent; }
.tabs button.on { color: var(--green); font-weight: 700; border-top-color: var(--green-bright); }

/* Bottom Sheet */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; background: var(--card); border-radius: 18px 18px 0 0; box-shadow: 0 -6px 30px rgba(0,0,0,.25); max-height: 82dvh; overflow-y: auto; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; }
.sheet-head { display: flex; align-items: flex-start; gap: 10px; }
.sheet-head h2 { margin: 0; font-size: 20px; line-height: 1.2; flex: 1; }
.sheet-head .close { border: 0; background: var(--bg); width: 36px; height: 36px; border-radius: 50%; font-size: 20px; line-height: 1; cursor: pointer; flex: none; }
.state { margin: 8px 0 2px; font-size: 15px; }
.state b { font-weight: 700; }
.meta { color: var(--muted); font-size: 14px; margin: 2px 0 10px; }
.desc { font-size: 15px; line-height: 1.45; margin: 10px 0; }
.plan { display: block; margin: 10px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg); }
.plan img { display: block; width: 100%; max-height: 260px; object-fit: cover; }
.plan span { display: block; padding: 7px 10px; font-size: 13px; color: var(--green); font-weight: 600; }
.actions { display: grid; gap: 8px; margin: 14px 0 6px; }
.actions.two { grid-template-columns: 1fr 1fr; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 13px 14px; font-size: 16px; font-weight: 600; cursor: pointer; text-align: center; text-decoration: none; color: var(--ink); display: block; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.go { background: var(--magenta); border-color: var(--magenta); color: #fff; }
.btn.danger { color: #a3180f; }
.btn.small { padding: 7px 12px; font-size: 14px; border-radius: 9px; }
.btn:disabled { opacity: .5; }
.sub { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 6px; }
.note { background: var(--bg); border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; font-size: 14px; line-height: 1.4; }
.note small { color: var(--muted); display: block; font-size: 12px; margin-top: 2px; }
.note button { float: right; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; }
.noteform { display: flex; gap: 6px; }
.field { display: grid; gap: 4px; margin-bottom: 12px; font-size: 14px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], textarea { width: 100%; border: 1px solid #b9c3ae; border-radius: 10px; padding: 11px 12px; font-size: 16px; background: #fff; color: var(--ink); }
textarea { min-height: 90px; resize: vertical; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, .btn:focus-visible { outline: 3px solid var(--green-bright); outline-offset: 2px; }
.adminrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); }
.camp { display: flex; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.camp b { flex: 1 1 100%; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.45; }

/* Dialog */
.modal { position: fixed; inset: 0; z-index: 2000; background: rgba(20,30,10,.55); display: grid; place-items: center; padding: 16px; }
.dialog { background: #fff; border-radius: 18px; padding: 20px; width: 100%; max-width: 380px; max-height: 90dvh; overflow-y: auto; }
.dialog h2 { margin: 0 0 6px; font-size: 20px; }
.dialog p { margin: 0 0 14px; color: var(--muted); font-size: 15px; line-height: 1.45; }
.error { color: #a3180f; font-size: 14px; margin: -4px 0 10px; }

.toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); z-index: 3000; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 90vw; text-align: center; box-shadow: 0 4px 16px rgba(0,0,0,.3); }

@media (min-width: 900px) {
  .sheet { left: auto; right: 16px; bottom: 70px; border-radius: 18px; width: 420px; max-height: calc(100dvh - 190px); margin: 0; }
  .list { max-width: 720px; margin: 0 auto; }
}
