:root {
  --accent: #178276;
  --accent-soft: rgba(23, 130, 118, 0.12);
  --orange: #f07a2c;
  --orange-soft: rgba(240, 122, 44, 0.13);
  --green: #22a447;
  --red: #e5484d;
  --bg: #f2f2f7;
  --card: #ffffff;
  --fill: #e9e9ef;
  --text: #111;
  --muted: #6b6b72;
  --tertiary: #a0a0a8;
  --sep: rgba(60, 60, 67, 0.14);
  --bar: rgba(249, 249, 251, 0.86);
  --radius: 14px;
  --tabbar-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #4ac7b4;
    --accent-soft: rgba(74, 199, 180, 0.16);
    --orange-soft: rgba(240, 122, 44, 0.2);
    --bg: #000;
    --card: #1c1c1e;
    --fill: #2c2c2e;
    --text: #f2f2f2;
    --muted: #9a9aa2;
    --tertiary: #6a6a72;
    --sep: rgba(84, 84, 88, 0.6);
    --bar: rgba(22, 22, 24, 0.86);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { opacity: 0.4; cursor: default; }
input, select, textarea { font: inherit; color: var(--text); }
p { margin: 6px 0; }

/* Layout */
.page { max-width: 640px; margin: 0 auto; padding-bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); min-height: 100vh; }
.pad { padding: 8px 16px; }
.pad-row { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.center { text-align: center; }
.full { width: 100%; }

/* Navigationsleiste */
.navbar {
  position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; background: var(--bar);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 0.5px solid var(--sep);
}
.navbar .nav-title { font-weight: 600; font-size: 17px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56vw; }
.navbar.large { grid-template-columns: 1fr auto; grid-template-areas: "left right" "title title"; border-bottom: 0; background: var(--bg); position: static; }
.navbar.large .nav-side { grid-area: left; }
.navbar.large .nav-side.right { grid-area: right; }
.navbar.large .nav-title { grid-area: title; text-align: left; font-size: 34px; font-weight: 700; padding: 4px 4px 0; max-width: none; }
.nav-side { display: flex; gap: 4px; align-items: center; min-height: 36px; }
.nav-side.right { justify-content: flex-end; }
.nav-btn { color: var(--accent); font-size: 17px; padding: 6px 8px; border-radius: 10px; }
.nav-btn.icon { font-size: 20px; min-width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; background: var(--card); border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.nav-btn.star { color: #f5b400; font-size: 24px; }
.nav-select { border: 0; background: var(--card); border-radius: 18px; padding: 8px 12px; color: var(--accent); font-size: 15px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* Karten & Zeilen */
.section { margin: 18px 16px 0; }
.section-title { margin: 0 0 6px 16px; font-size: 13px; font-weight: 500; text-transform: none; color: var(--muted); }
.section-footer { margin: 6px 16px 0; font-size: 13px; color: var(--muted); }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 10px 16px; text-align: left; position: relative;
}
.row + .row, .chat + .row, .row + .chat { border-top: 0.5px solid var(--sep); }
.card > .row:not(:first-child)::before { content: none; }
a.row:active, button.row:active { background: var(--fill); }
.chev { color: var(--tertiary); font-size: 22px; line-height: 1; margin-left: 4px; }
.row.accent, .accent { color: var(--accent); }
.row.danger, .danger { color: var(--red); }
.row.radio input { accent-color: var(--accent); width: 20px; height: 20px; }

.muted { color: var(--muted); }
.tertiary { color: var(--tertiary); }
.green { color: var(--green); }
.ok { color: var(--green); }
.small { font-size: 13px; }
.tiny { font-size: 11px; }
.strong, b { font-weight: 600; }
.h2 { font-size: 22px; font-weight: 700; }
.one-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 14px; }

/* Formulare */
.field { display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 48px; }
.field + .field, .row + .field, .field + .row { border-top: 0.5px solid var(--sep); }
.field > span { flex: 0 0 auto; }
.field input, .field select { flex: 1; min-width: 0; border: 0; background: none; text-align: right; outline: none; }
.field select { direction: rtl; color: var(--muted); }
.field.toggle input { flex: 0 0 auto; appearance: none; width: 51px; height: 31px; border-radius: 16px; background: var(--fill); position: relative; transition: .2s; margin-left: auto; }
.field.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: .2s; }
.field.toggle input:checked { background: var(--accent); }
.field.toggle input:checked::after { left: 22px; }
.stepper { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.stepper button { width: 36px; height: 32px; border-radius: 8px; background: var(--fill); font-size: 18px; }
textarea, input.plain { display: block; width: 100%; border: 0; background: none; padding: 12px 16px; resize: vertical; outline: none; }
.search { width: 100%; border: 0; border-radius: 12px; background: var(--fill); padding: 10px 14px; outline: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--accent); color: #fff; font-weight: 600;
  border-radius: 999px; padding: 12px 20px; font-size: 16px; }
.btn.block { display: flex; width: 100%; }
.btn.small { padding: 6px 12px; font-size: 13px; white-space: nowrap; }
.btn.secondary { background: var(--fill); color: var(--text); }
.link { color: var(--accent); font-size: 14px; }

/* Badges & Avatare */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge-orange { background: var(--orange-soft); color: var(--orange); }
.badge-gray { background: var(--fill); color: var(--muted); }
.badge-purple { background: rgba(140, 82, 255, 0.14); color: #7b45e6; }
.badge-blue { background: rgba(10, 132, 255, 0.13); color: #0a72e0; }
@media (prefers-color-scheme: dark) { .badge-purple { color: #b48cff; } .badge-blue { color: #5aaeff; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar { position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
  color: #fff; font-weight: 600; letter-spacing: .3px; }
.live-dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: var(--green); border: 2px solid var(--card); }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { border: 2px solid var(--card); margin-left: -7px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* Runden */
.round-row { align-items: flex-start; }
.rr-head { display: flex; align-items: baseline; gap: 8px; }
.rr-time { font-size: 19px; font-variant-numeric: tabular-nums; }
.rr-course { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.round-row .chips { margin: 6px 0; }
.rr-foot { display: flex; align-items: center; gap: 8px; }

/* Feed */
.act-row { align-items: flex-start; }
.act-avatar { position: relative; }
.act-icon { position: absolute; right: -4px; bottom: -4px; width: 20px; height: 20px; border-radius: 50%; color: #fff; font-size: 10px;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--card); }
.act-avatar:not(:has(.avatar)) .act-icon { position: static; width: 28px; height: 28px; font-size: 13px; }
.snippet { margin-top: 6px; padding: 10px; border-radius: 12px; background: var(--fill); display: flex; flex-direction: column; gap: 6px; }
.bubble-note { margin-top: 5px; padding: 6px 10px; border-radius: 10px; background: var(--fill); color: var(--muted); font-size: 14px; }
.live-strip { display: flex; gap: 14px; overflow-x: auto; padding: 12px 16px; scrollbar-width: none; }
.live-bubble { flex: 0 0 84px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; }
.live-bubble .avatar { box-shadow: 0 0 0 3px var(--card), 0 0 0 6px var(--green); margin: 4px 0; }
.segmented { display: flex; background: var(--fill); border-radius: 10px; padding: 2px; }
.segmented button { flex: 1; padding: 7px 4px; border-radius: 8px; font-size: 14px; font-weight: 500; }
.segmented button.on { background: var(--card); box-shadow: 0 1px 4px rgba(0,0,0,.12); }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.chat:empty { display: none; }
.msg { display: flex; align-items: flex-end; gap: 8px; max-width: 82%; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-col { display: flex; flex-direction: column; gap: 3px; }
.msg.mine .msg-col { align-items: flex-end; }
.msg-bubble { padding: 8px 12px; border-radius: 16px; background: var(--fill); white-space: pre-wrap; word-break: break-word; }
.msg.mine .msg-bubble { background: var(--accent); color: #fff; }
.msg-system { text-align: center; font-size: 12px; color: var(--muted); }
.has-chatbar { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
.chatbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex; gap: 8px; align-items: center;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--bar); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: 0.5px solid var(--sep); }
.chatbar input { flex: 1; border: 0; border-radius: 20px; background: var(--fill); padding: 10px 14px; outline: none; }
.chatbar .send { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 18px; font-weight: 700; }
.chatbar.muted { justify-content: center; }

/* Tab-Leiste */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 6px 4px env(safe-area-inset-bottom);
  background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: 0.5px solid var(--sep); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); }
.tabbar a.on { color: var(--accent); font-weight: 600; }
.tab-icon { position: relative; font-size: 22px; line-height: 28px; filter: grayscale(1); opacity: .75; }
.tabbar a.on .tab-icon { filter: none; opacity: 1; }
.tab-badge { position: absolute; top: -2px; right: -10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red);
  color: #fff; font-size: 11px; font-style: normal; line-height: 18px; text-align: center; filter: none; }

/* Karte */
.map-page { padding-bottom: 0; max-width: none; height: 100vh; display: flex; flex-direction: column; }
.map-page .map { flex: 1; }
.map { width: 100%; height: 100%; min-height: 300px; background: var(--fill); }
.small-map { height: 260px; }
.map-legend { position: fixed; left: 12px; bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom)); z-index: 500; display: flex; gap: 10px;
  background: var(--bar); backdrop-filter: blur(16px); padding: 6px 10px; border-radius: 12px; font-size: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.map-legend span { display: inline-flex; align-items: center; gap: 4px; }
.lg { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block; }
.lg.fav { background: #f5b400; }
.lg.unverified { background: var(--orange); }
.leaflet-bottom.leaflet-right { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
.pin { position: relative; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; display: flex;
  align-items: center; justify-content: center; font-size: 16px; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.pin.fav { background: #f5b400; }
.pin.unverified { background: var(--orange); }
.pin-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--orange); color: #fff;
  font: 700 11px/18px -apple-system, sans-serif; text-align: center; font-style: normal; padding: 0 4px; border: 1.5px solid #fff; }
.pin-live { position: absolute; bottom: -2px; right: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--green); border: 2px solid #fff; }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #2f7cf6; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(47,124,246,.25); }

/* Sheets, Dialoge, Toast */
.sheet-backdrop { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { width: 100%; max-width: 640px; max-height: 92vh; background: var(--bg); border-radius: 16px 16px 0 0; display: flex; flex-direction: column; animation: up .22s ease-out; }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 12px; border-bottom: 0.5px solid var(--sep); }
.sheet-head > div { justify-self: end; }
.sheet-body { overflow-y: auto; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.alert-backdrop { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; padding: 24px; }
.alert { background: var(--card); border-radius: 16px; padding: 20px; max-width: 320px; width: 100%; text-align: center; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); z-index: 1500;
  background: rgba(30,30,32,.92); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; animation: fade .2s; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* Leerzustände */
.empty { text-align: center; padding: 60px 32px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty-icon { font-size: 44px; }
.empty h3 { margin: 6px 0 0; color: var(--text); font-size: 20px; }
.empty .btn { margin-top: 12px; }

/* Login */
.login { min-height: 100vh; max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 40px) 24px calc(env(safe-area-inset-bottom) + 28px); background: var(--bg); }
.login-hero { text-align: center; margin-top: 12vh; }
.login-hero img { width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.login-hero h1 { margin: 16px 0 4px; font-size: 32px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.big-input { width: 100%; border: 0; border-radius: 14px; background: var(--card); padding: 15px 16px; font-size: 17px; outline: none; }
.big-input.code { text-align: center; font-size: 26px; letter-spacing: 8px; font-variant-numeric: tabular-nums; }
.row-links { display: flex; justify-content: center; gap: 20px; }
.error { color: var(--red); font-size: 14px; }
.splash { height: 100vh; display: flex; align-items: center; justify-content: center; }
.splash img { width: 88px; height: 88px; border-radius: 20px; opacity: .9; }

.profile-head { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 16px; text-align: center; }

/* Feinschliff */
.nav-btn { white-space: nowrap; }
.field select { appearance: none; -webkit-appearance: none; direction: ltr; text-align: right; text-align-last: right; padding-right: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.6' fill='none'/%3E%3C/svg%3E") no-repeat right center; }
.field input[type="datetime-local"] { appearance: none; -webkit-appearance: none; }

/* Karte: Leaflet-Ebenen einkapseln, damit Tab-Leiste und Navigationsleiste darüber liegen */
.map { position: relative; z-index: 0; isolation: isolate; }
.map-page { height: 100vh; height: 100dvh; }
.map-page .map { margin-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
.tabbar { z-index: 1100; }
.map-legend { z-index: 1050; }
.leaflet-bottom.leaflet-right { bottom: 0; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 6px 0 2px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 0.5px; background: var(--sep); }
.login-hero { margin-top: 6vh; }
.sheet-backdrop { z-index: 1200; }
.addr-search { display: flex; gap: 8px; align-items: center; padding: 8px 12px; }
.addr-search input { flex: 1; min-width: 0; border: 0; border-radius: 10px; background: var(--fill); padding: 9px 12px; outline: none; }
.addr-search + .row { border-top: 0.5px solid var(--sep); }

/* Freunde auswählen / Einladungen / Neuigkeiten */
.pick-row { width: 100%; text-align: left; }
.pick-check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--fill); flex: 0 0 auto; display: grid; place-items: center; color: #fff; font-size: 14px; }
.pick-check.on { background: var(--accent); border-color: var(--accent); }
.invite-card { border-left: 4px solid var(--accent); }
.invite-actions { display: flex; gap: 10px; margin-top: 10px; }
.invite-actions .btn { flex: 1; white-space: nowrap; font-size: 15px; padding: 12px 14px; }
.btn.ghost { background: var(--fill); color: var(--text); }
.news-card { padding: 14px 16px; }
.news-card .news-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.news-card ul { margin: 6px 0 0; padding-left: 20px; }
.news-card li { margin: 4px 0; }
.news-ver { font-size: 12px; font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); padding: 2px 8px; border-radius: 10px; }

/* Eigener Status / vor Ort */
.status-line { display: flex; gap: 10px; align-items: flex-start; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #22a447; margin-top: 6px; flex: 0 0 auto; box-shadow: 0 0 0 4px rgba(34,164,71,.2); }
.status-card a { color: inherit; }
.status-card .muted a { text-decoration: underline; }
.badge-green { background: rgba(34,164,71,.14); color: #1a8a3a; }
.btn.danger-text { color: #e5484d; }
a.btn { text-decoration: none; }

/* Fundbüro */
.disc-code-card { display: flex; gap: 14px; align-items: center; }
.disc-art { width: 96px; height: 96px; flex: 0 0 auto; }
.disc-art svg { width: 100%; height: 100%; }
.disc-fill { fill: color-mix(in srgb, var(--accent) 22%, var(--card)); stroke: var(--accent); stroke-width: 2; }
.disc-ring { fill: none; stroke: color-mix(in srgb, var(--accent) 45%, transparent); stroke-width: 1.5; }
.disc-rim { font-size: 8.5px; font-weight: 600; fill: var(--text); letter-spacing: .3px; }
.disc-center { font: 700 17px ui-monospace, Menlo, monospace; fill: var(--text); letter-spacing: 1px; }
.disc-code { font: 700 30px ui-monospace, Menlo, monospace; letter-spacing: 3px; color: var(--accent); }
.disc-url { font: 600 15px ui-monospace, Menlo, monospace; word-break: break-all; margin: 2px 0 4px; }
.mono { font-family: ui-monospace, Menlo, monospace; letter-spacing: 1px; }
.small-btn { padding: 6px 14px; font-size: 14px; margin-top: 6px; }
.disc-icon { font-size: 22px; width: 30px; text-align: center; }
.unread-badge { background: #e5484d; color: #fff; font-style: normal; font-size: 12px; font-weight: 700; border-radius: 10px; padding: 1px 7px; margin-right: 4px; }
.disc-reply { display: flex; gap: 8px; padding: 8px 12px 12px; }
.disc-reply input { flex: 1; border-radius: 18px; padding: 9px 14px; background: var(--fill); border: 0; font-size: 16px; color: var(--text); }

/* Profil-Button / Fundbüro-Tab */
.avatar-btn { padding: 0; margin-right: 6px; display: inline-flex; }
.nav-side { display: flex; align-items: center; gap: 4px; }
.fund-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px 6px; }
.fund-action { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 8px; border-radius: 16px; background: var(--card);
  box-shadow: 0 1px 3px rgba(0,0,0,.06); color: var(--text); text-decoration: none; font-weight: 600; text-align: center; }
.fund-action span { font-size: 30px; }
.fund-action small { font-weight: 400; color: var(--muted); font-size: 12px; }
.phone-row { display: flex; gap: 8px; align-items: center; }
.phone-row input { flex: 1; min-width: 0; }
.phone-row .btn { flex: 0 0 auto; }
