/* Laufrunde – Styles */
:root {
  --bg: #f4f6f2;
  --surface: #ffffff;
  --surface-2: #eef2ec;
  --text: #17201a;
  --muted: #5b6960;
  --line: #dde4dc;
  --primary: #1f6f43;
  --primary-ink: #ffffff;
  --primary-soft: #dcefe3;
  --accent: #0f5c38;
  --warn-bg: #fff1d6;
  --warn-ink: #7a4b00;
  --ok-bg: #dcefe3;
  --ok-ink: #165232;
  --danger: #b42318;
  --shadow: 0 1px 2px rgba(16, 24, 18, .06), 0 4px 16px rgba(16, 24, 18, .06);
  --radius: 14px;
  --topbar-h: 56px;
  --tabbar-h: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1411;
    --surface: #171e19;
    --surface-2: #1f2822;
    --text: #e6ece7;
    --muted: #9aa89f;
    --line: #2a352e;
    --primary: #3fae72;
    --primary-ink: #08140d;
    --primary-soft: #1d3527;
    --warn-bg: #3a2c10;
    --warn-ink: #f3cf8a;
    --ok-bg: #1d3527;
    --ok-ink: #9fe0b9;
    --danger: #f97066;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: grid;
  grid-template-rows: var(--topbar-h) minmax(0, 1fr) calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  grid-template-areas: "top" "main" "nav";
  height: 100dvh;
  overflow: hidden;
}
body.no-scroll { overflow: hidden; }
h1 { font-size: 1.4rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0; }
h3 { font-size: .95rem; margin: 1.1rem 0 .5rem; }
a { color: var(--primary); }
input, select, textarea, button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- Kopf & Navigation ---------- */
.topbar {
  grid-area: top;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.1rem; }
.tabbar {
  grid-area: nav;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 500;
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: .75rem; font-weight: 600;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { color: var(--primary); }

main { grid-area: main; min-height: 0; position: relative; }
.view { height: 100%; }

@media (min-width: 960px) {
  body {
    grid-template-columns: 1fr auto;
    grid-template-rows: var(--topbar-h) minmax(0, 1fr);
    grid-template-areas: "top nav" "main main";
  }
  .tabbar { display: flex; border-top: 0; border-bottom: 1px solid var(--line); padding: 0 12px; gap: 4px; }
  .tabbar a { flex-direction: row; gap: 8px; padding: 0 14px; font-size: .9rem; }
  .tabbar svg { width: 20px; height: 20px; }
}

/* ---------- Split-Layout: Karte + Panel ---------- */
.split { display: flex; flex-direction: column; overflow-y: auto; }
.map-wrap { position: relative; height: 42dvh; min-height: 260px; flex: none; }
.map { width: 100%; height: 100%; background: var(--surface-2); }
.panel { padding: 16px; }
@media (min-width: 960px) {
  .split { display: grid; grid-template-columns: minmax(0, 1fr) 440px; overflow: hidden; }
  .map-wrap { height: 100%; }
  .panel { overflow-y: auto; border-left: 1px solid var(--line); background: var(--bg); }
}
.map-tools { position: absolute; left: 56px; top: 10px; z-index: 450; display: flex; gap: 8px; }
.map-hint {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 450; margin: 0;
  background: rgba(23, 32, 26, .78); color: #fff; padding: 5px 12px; border-radius: 999px; font-size: .78rem;
  white-space: nowrap; pointer-events: none; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis;
}

.page { overflow-y: auto; }
.page-inner { max-width: 820px; margin: 0 auto; padding: 20px 16px 40px; }

/* ---------- Formulare ---------- */
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > input, .row > .field { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend, .field > label, .label-row label { font-weight: 600; font-size: .9rem; padding: 0; margin-bottom: 6px; display: block; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .9rem; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.label-row label { margin: 0; }
output { font-weight: 700; color: var(--primary); }
input[type=search], input:not([type]), input[type=text], input[type=date], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); font-weight: 400; min-height: 40px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, .card:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
input[type=range] { width: 100%; accent-color: var(--primary); }
.sub { margin-top: 10px; }
details summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
label.select { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; flex: 1; min-width: 140px; }

.seg { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 3px; }
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.seg span {
  display: block; text-align: center; padding: 7px 4px; border-radius: 8px; font-size: .85rem; font-weight: 600;
  color: var(--muted); cursor: pointer; white-space: nowrap;
}
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 2px solid var(--primary); }

.checks { display: flex; flex-direction: column; gap: 6px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; min-height: 40px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn.small { padding: 5px 12px; min-height: 32px; font-size: .85rem; }
.btn:disabled { opacity: .6; cursor: progress; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px;
  font-size: .82rem; font-weight: 600; cursor: pointer; box-shadow: var(--shadow);
}
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.presets .chip { box-shadow: none; }
.linkish { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; text-align: left; font-weight: 600; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700;
  background: var(--surface-2); color: var(--muted); text-decoration: none; white-space: nowrap;
}
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); }

/* ---------- Karten/Listen ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.results { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.results-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cand, .route-card { cursor: pointer; display: flex; flex-direction: column; gap: 8px; transition: border-color .15s; }
.cand.active { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.cand-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.match { font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.match.good { background: var(--ok-bg); color: var(--ok-ink); }
.match.ok { background: var(--warn-bg); color: var(--warn-ink); }
.match.low { background: var(--surface-2); color: var(--muted); }
.stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .88rem; color: var(--muted); }
.stats b { color: var(--text); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

.sbar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--surface-2); }
.sbar i { display: block; height: 100%; }
.legend { list-style: none; padding: 0; margin: 8px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 4px 12px; font-size: .85rem; }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend b { margin-left: auto; }

.stars { color: #e5a00d; letter-spacing: 1px; }
.stars .off { color: var(--line); }

.notice { padding: 14px; border-radius: var(--radius); background: var(--surface-2); color: var(--muted); }
.notice.error { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }

.progress { margin-top: 16px; display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--muted); }
.progress .bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress .bar i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .3s; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
@media (max-width: 560px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; }
.tile b { font-size: 1.35rem; }
.tile span { color: var(--muted); font-size: .8rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: 0; padding: 10px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--primary); border-color: var(--primary); }
.run { gap: 6px; display: flex; flex-direction: column; }
.run p { margin: 0; }

/* ---------- Detail-Sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(8, 12, 10, .5); }
.sheet-body {
  position: relative; width: 100%; max-height: 94dvh; overflow-y: auto; background: var(--bg);
  border-radius: 18px 18px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, .25);
}
@media (min-width: 760px) {
  .sheet { align-items: center; padding: 24px; }
  .sheet-body { max-width: 760px; max-height: 90dvh; border-radius: 18px; }
}
.sheet-close {
  position: absolute; top: 10px; right: 10px; z-index: 600; width: 38px; height: 38px; border-radius: 50%;
  border: 0; background: var(--surface); box-shadow: var(--shadow); font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.detail-map { height: 300px; }
.detail { padding: 16px 16px 28px; }
.detail-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.detail-head h2 { font-size: 1.3rem; }
.detail-head p { margin: 2px 0 0; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 14px 0; }
.stat-grid div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; }
.stat-grid span { font-size: .78rem; color: var(--muted); }
.stat-grid b { font-size: 1.1rem; }
.desc { white-space: pre-line; }
.detail .actions { margin-top: 18px; }
.detail form.card { margin-top: 14px; }

.social { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.btn.like { border-radius: 999px; }
.btn.like.on { color: #d6336c; border-color: #d6336c; background: color-mix(in srgb, #d6336c 10%, var(--surface)); }
.rate { display: flex; }
.rate button { background: none; border: 0; font-size: 1.5rem; color: var(--line); cursor: pointer; padding: 0 2px; line-height: 1; }
.rate button.on { color: #e5a00d; }
.rate:hover button { color: #e5a00d; }
.rate button:hover ~ button { color: var(--line); }

.elev { margin: 0; position: relative; }
.elev svg { width: 100%; height: 130px; display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.elev-area { fill: color-mix(in srgb, var(--primary) 22%, transparent); }
.elev-line { fill: none; stroke: var(--primary); stroke-width: 2; vector-effect: non-scaling-stroke; }
.elev figcaption { position: absolute; top: 6px; left: 10px; bottom: 26px; display: flex; flex-direction: column; justify-content: space-between; font-size: .72rem; color: var(--muted); pointer-events: none; }
.elev-x { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); margin-top: 3px; }

.comments { margin-top: 10px; }
.comment { border-top: 1px solid var(--line); padding: 10px 0; }
.comment p { margin: 4px 0 0; }
.comments form { margin-top: 8px; }

/* ---------- Karten-Pins ---------- */
.pin-start span { display: block; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.pin-flag span { display: block; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 4px solid var(--primary); box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.leaflet-container { font: inherit; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: #17201a; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: .9rem; z-index: 2000;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 960px) { .toast { bottom: 24px; } }

/* ---------- Ortssuche: Vorschlagsliste ---------- */
.ac-wrap { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 900;
  list-style: none; margin: 0; padding: 4px; max-height: 300px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.ac-list li { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.ac-list li b { font-weight: 600; }
.ac-list li span { font-size: .8rem; color: var(--muted); }
.ac-list li:hover, .ac-list li[aria-selected="true"] { background: var(--primary-soft); }
.ac-list li.ac-empty { color: var(--muted); cursor: default; }
.ac-list li.ac-empty:hover { background: none; }
.stat-grid small { font-size: .72rem; margin-top: 2px; }

/* ---------- Wege bewerten / gelaufene Wege ---------- */
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.map-tools { flex-wrap: wrap; right: 60px; }
.map.rating { cursor: crosshair; }
.rate-pop { display: flex; flex-direction: column; gap: 6px; min-width: 250px; font: inherit; }
.pref-btns button { white-space: nowrap; }
.rate-pop b { font-size: .95rem; }
.rate-pop span { color: #5b6960; font-size: .8rem; }
.pref-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 4px; }
.pref-btns button { border: 1px solid #dde4dc; background: #fff; border-radius: 8px; padding: 7px 8px; font-weight: 600; cursor: pointer; color: #17201a; }
.pref-btns button.on { color: #fff; border-color: transparent; }
.pref-btns button[data-pref="like"].on { background: #2f9e44; }
.pref-btns button[data-pref="avoid"].on { background: #e8590c; }
.pref-btns button[data-pref="blocked"].on { background: #c92a2a; }
.pref-btns button[data-pref=""] { grid-column: span 2; color: #5b6960; }
.import-box { display: flex; flex-direction: column; gap: 8px; }
.dev-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.dev { display: flex; flex-direction: column; gap: 8px; }
.dev .actions { margin: 0; }
.dev.done { opacity: .6; }

/* ---------- Laufbildschirm ---------- */
.run-screen { position: fixed; inset: 0; z-index: 1500; display: flex; flex-direction: column; background: var(--bg); }
.run-map { flex: 1; min-height: 0; }
.run-center { position: absolute; right: 12px; top: calc(12px + env(safe-area-inset-top)); z-index: 1600; }
.nav-banner {
  position: absolute; left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top)); z-index: 1600;
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 14px;
  background: #14532d; color: #fff; box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
}
.nav-banner.off { background: #a61e1e; }
.nav-banner.done { background: #1f6f43; }
.nav-banner div { display: flex; flex-direction: column; min-width: 0; }
.nav-banner b { font-size: 1.6rem; line-height: 1.1; }
.nav-banner span { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-arrow { width: 44px; height: 44px; flex: none; fill: #fff; transition: transform .3s; }
.run-panel { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.run-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.run-stats span { display: block; font-size: .75rem; color: var(--muted); }
.run-stats b { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .run-stats { grid-template-columns: repeat(2, 1fr); } }
.run-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.run-row .btn { flex: 1; max-width: 220px; min-height: 48px; font-size: 1.05rem; }
.pos-dot { width: 18px; height: 18px; border-radius: 50%; background: #1c7ed6; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(28, 126, 214, .25); }
.splits { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
.splits td, .splits th { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: left; }

/* ---------- Wunschpunkte ---------- */
.via-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.via-list:empty { display: none; }
.via-list li { display: flex; align-items: center; gap: 8px; font-size: .88rem; }
.via-list li .via-num {
  flex: none; width: 22px; height: 22px; border-radius: 50%; background: #7048e8; color: #fff;
  display: grid; place-items: center; font-size: .75rem; font-weight: 700;
}
.via-list li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.via-list li button { border: 0; background: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: 0 4px; }
.pin-via span {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: #7048e8; color: #fff; font: 700 12px/1 system-ui, sans-serif; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}
.map.via { cursor: crosshair; }
.rate-pop .via-btns { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.rate-pop .via-btns button { border: 1px solid #dde4dc; background: #fff; border-radius: 8px; padding: 7px 8px; font-weight: 600; cursor: pointer; color: #17201a; text-align: left; }
.rate-pop .via-btns button:hover { background: #f1eefe; border-color: #7048e8; }

/* ---------- Runde bearbeiten ---------- */
.edit-bar {
  position: absolute; left: 56px; right: 60px; top: 10px; z-index: 460; display: flex; flex-wrap: wrap;
  gap: 8px 12px; align-items: center; justify-content: space-between; padding: 8px 12px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.edit-stats { display: flex; gap: 12px; align-items: baseline; font-size: .9rem; color: var(--muted); }
.edit-stats b { font-size: 1.1rem; color: var(--text); }
.pin-handle span {
  display: block; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid #1f6f43;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35); cursor: grab;
}
.map.editing path.leaflet-interactive { cursor: copy; }
.finder-editing .map-tools { display: none; }
.edit-stats .diff-off { color: var(--danger); font-weight: 600; }
.edit-stats .diff-ok { color: var(--primary); font-weight: 600; }
.progress span b { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Begrüßung, Rechtliches, Konto ---------- */
.welcome .steps { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.welcome h2 { margin-top: 0; }
.legal-nav { display: flex; flex-wrap: wrap; gap: 8px 16px; font-weight: 600; }
.legal h3 { font-size: 1rem; margin: 16px 0 4px; }
.legal p, .legal li { line-height: 1.55; }
.legal ul { padding-left: 20px; }
#accountCard .tabs { margin: 4px 0 8px; }
details.card > summary { cursor: pointer; }
details.card[open] > summary { margin-bottom: 8px; }

/* ---------- Lauf-Dashboard ---------- */
.run-main { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: center; }
.run-main > div > span, .run-grid > div > span { display: block; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.run-main b { font-size: 2.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.run-main b small { font-size: 1rem; color: var(--muted); font-weight: 600; }
.run-main b em { font-style: normal; }
.run-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.run-grid > div { background: var(--surface-2); border-radius: 10px; padding: 6px 4px; min-width: 0; }
.run-grid b { font-size: 1.25rem; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
@media (max-width: 520px) { .run-grid { grid-template-columns: repeat(2, 1fr); } .run-main b { font-size: 2.2rem; } }
.gps { display: inline-flex !important; align-items: center; justify-content: center; gap: 6px; font-size: 1rem !important; }
.gps i { width: 10px; height: 10px; border-radius: 50%; background: #adb5bd; flex: none; }
.gps em { font-style: normal; overflow: hidden; text-overflow: ellipsis; }
.gps.good i { background: #2f9e44; } .gps.ok i { background: #82c91e; } .gps.weak i { background: #f59f00; } .gps.bad i { background: #e03131; }
.run-splits summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.run-splits .splits { margin-top: 6px; }
.run-splits td.bar { width: 40%; }
.run-splits td.bar i { display: block; height: 8px; border-radius: 4px; background: #2f9e44; }
.run-splits td.bar i.slow { background: #f08c00; }
.run-splits tr.cur td { color: var(--muted); font-style: italic; }
.run-splits { max-height: 30vh; overflow-y: auto; }
.run-screen.map-big .run-grid, .run-screen.map-big .run-splits { display: none; }
.run-status-warn { color: var(--danger) !important; }

/* ---------- Konto / Anmeldung ---------- */
.account-page { max-width: 560px; }
.auth-card h2 { margin: 0; }
/* Nicht angemeldet: nur Anmeldung und Rechtstexte, ohne Navigation */
body.gated .tabbar, body.gated #profileBtn, body.gated .hide-gated { display: none; }
/* Anmeldeseite: Kartenausschnitt als Titelbild, Text darüber */
.auth-hero { display: none; position: relative; height: 230px; border-radius: 18px; overflow: hidden; background: var(--surface-2); }
body.gated .auth-hero { display: block; }
.auth-map { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.auth-map .leaflet-control-attribution { pointer-events: auto; font-size: 10px; }
.auth-hero-text { position: absolute; left: 0; right: 0; bottom: 0; z-index: 500; padding: 48px 18px 16px; color: #fff;
  background: linear-gradient(to top, rgba(8, 20, 12, .88) 0%, rgba(8, 20, 12, .6) 55%, transparent 100%); }
.auth-hero-text h1 { margin: 0 0 4px; color: #fff; }
.auth-hero-text p { margin: 0; color: rgba(255, 255, 255, .88); }
.auth-hero .leaflet-bottom.leaflet-right { top: 0; bottom: auto; }
.pw-wrap { display: flex; gap: 6px; align-items: stretch; }
.pw-wrap input { flex: 1; min-width: 0; }
.pw-toggle { border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); border-radius: 8px; padding: 0 10px; font-size: .8rem; cursor: pointer; }
.pw-meter { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; }
.pw-meter .bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.pw-meter .bar i { display: block; height: 100%; width: 0; background: #e03131; transition: width .2s, background .2s; }
.pw-meter[data-score="2"] .bar i { background: #f59f00; }
.pw-meter[data-score="3"] .bar i { background: #82c91e; }
.pw-meter[data-score="4"] .bar i { background: #2f9e44; }
.pw-meter ul { list-style: none; margin: 0; padding: 0; color: var(--muted); }
.pw-meter li.ok { color: var(--primary); }
.form-msg { margin: 0; padding: 8px 10px; border-radius: 8px; background: rgba(224, 49, 49, .12); color: var(--danger); font-size: .88rem; }
.form-msg.ok { background: var(--primary-soft); color: var(--primary); }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: .88rem; margin: 0; }
.code-input { letter-spacing: .3em; font-variant-numeric: tabular-nums; font-size: 1.2rem; max-width: 12em; }
.badge.warn { background: rgba(245, 159, 0, .18); color: #b06f00; }
.session-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.session-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.session-list li span.muted { display: block; }
.danger-text { color: var(--danger); }

/* =====================================================================
   Design-Überarbeitung 0.9: klarere Navigation, Startseite, Laufen-Akzent
   ===================================================================== */
:root {
  --bg: #f3f5f1;
  --surface: #ffffff;
  --surface-2: #edf1ea;
  --text: #142019;
  --muted: #5d6b62;
  --line: #e0e6de;
  --primary: #178450;
  --primary-ink: #ffffff;
  --primary-soft: #dcf0e4;
  --run: #10b26c;      /* frisches „Los!“-Grün für alles rund ums Laufen */
  --run-ink: #ffffff;
  --run-soft: #d6f5e6;
  --shadow: 0 1px 2px rgba(16, 24, 18, .05), 0 6px 20px rgba(16, 24, 18, .07);
  --shadow-lift: 0 2px 4px rgba(16, 24, 18, .06), 0 12px 28px rgba(16, 24, 18, .12);
  --radius: 16px;
  --topbar-h: 58px;
  --tabbar-h: 66px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d120f;
    --surface: #151c17;
    --surface-2: #1d2620;
    --text: #e8eee9;
    --muted: #9aa9a0;
    --line: #26312a;
    --primary: #40b97a;
    --primary-ink: #06130b;
    --primary-soft: #183326;
    --run: #2fd28a;
    --run-ink: #04150c;
    --run-soft: #143426;
    --shadow: 0 1px 2px rgba(0, 0, 0, .45);
    --shadow-lift: 0 4px 18px rgba(0, 0, 0, .55);
  }
}
body { font-size: 15.5px; -webkit-font-smoothing: antialiased; }
h1 { font-size: 1.55rem; font-weight: 800; letter-spacing: -.015em; }
h2 { font-size: 1.12rem; font-weight: 750; letter-spacing: -.01em; }

/* Kopfzeile */
.topbar { padding: 0 14px; }
.brand { font-weight: 800; letter-spacing: -.01em; }
.brand img { border-radius: 8px; }
.avatar-btn {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; text-decoration: none;
  background: var(--surface-2); color: var(--text); font-weight: 800; border: 2px solid var(--line);
}
.avatar-btn.linked { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.avatar-btn:hover { filter: brightness(.97); }

/* Navigation unten (Handy): großer Laufen-Knopf in der Mitte */
.tabbar a { position: relative; gap: 3px; font-size: .72rem; }
.tabbar a.active { color: var(--primary); }
.tabbar a.active::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary); }
.tabbar .tab-run::before { display: none; }
.run-fab {
  width: 54px; height: 54px; margin-top: -24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--run); color: var(--run-ink); box-shadow: 0 6px 18px color-mix(in srgb, var(--run) 45%, transparent);
  border: 4px solid var(--surface);
}
.run-fab svg { width: 22px !important; height: 22px !important; fill: currentColor !important; stroke: none !important; margin-left: 3px; }
.tabbar .tab-run { color: var(--run); }
.tabbar .tab-run.active { color: var(--run); }

/* Navigation oben (Laptop): Mitte der Kopfzeile, Laufen als oranger Knopf */
@media (min-width: 960px) {
  body { grid-template-columns: 1fr; grid-template-areas: "top" "main"; }
  .topbar { grid-area: top; display: grid; grid-template-columns: 1fr auto 1fr; }
  .topbar .avatar-btn { grid-column: 3; justify-self: end; }
  .tabbar {
    position: fixed; top: 0; left: 50%; transform: translateX(-50%); height: var(--topbar-h);
    display: flex; justify-content: center; gap: 6px; align-items: center; background: transparent; border: 0; padding: 0; z-index: 600;
  }
  .tabbar a { height: 40px; border-radius: 999px; padding: 0 16px; font-size: .92rem; }
  .tabbar a:hover { background: var(--surface-2); }
  .tabbar a.active { background: var(--primary-soft); }
  .tabbar a.active::before { display: none; }
  .run-fab { width: auto; height: auto; margin: 0; border: 0; box-shadow: none; background: none; color: inherit; }
  .run-fab svg { width: 16px !important; height: 16px !important; margin: 0; }
  .tabbar .tab-run { background: var(--run); color: var(--run-ink); font-weight: 750; }
  .tabbar .tab-run:hover, .tabbar .tab-run.active { background: var(--run); filter: brightness(1.06); color: var(--run-ink); }
}

/* Knöpfe */
.btn { border-radius: 12px; font-weight: 650; transition: background .15s, filter .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 88%, #fff), var(--primary)); box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 30%, transparent); }
.btn.run { background: var(--run); border-color: var(--run); color: var(--run-ink); box-shadow: 0 2px 8px color-mix(in srgb, var(--run) 30%, transparent); }
.btn.run:hover { background: var(--run); filter: brightness(1.06); }
.btn.big { min-height: 52px; font-size: 1.05rem; border-radius: 14px; }
.chip { transition: background .15s, border-color .15s; }
.chip:hover { border-color: var(--primary); }
.presets .chip { padding: 6px 13px; }

/* Karten */
.card { border-radius: var(--radius); }
.cand, .route-card, .tip, .action-tile { transition: transform .12s, box-shadow .12s, border-color .12s; }
.cand:hover, .route-card:hover, .tip:hover { box-shadow: var(--shadow-lift); }
.cand.active { border-color: var(--run); box-shadow: 0 0 0 2px color-mix(in srgb, var(--run) 30%, transparent), var(--shadow); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.section-head h2 { margin: 0; }
.list.tight { margin-top: 0; gap: 8px; }
.tiles.flat { margin: 0; }
.tiles.flat .tile { background: var(--surface-2); border: 0; }

/* Planen: Panel-Kopf und aufklappbare Gruppen */
.panel-head h1 { margin-bottom: 2px; }
.panel-head p { margin: 0; }
.form-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0; box-shadow: var(--shadow); }
.form-group > summary {
  list-style: none; padding: 14px 16px; font-size: 1rem; font-weight: 750; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.form-group > summary::-webkit-details-marker { display: none; }
.form-group > summary::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform .15s; }
.form-group:not([open]) > summary::after { transform: rotate(-90deg); }
.form-group > summary small { font-weight: 500; color: var(--muted); font-size: .8rem; }
.form-group > .stack { padding: 0 16px 16px; }
.seg { border-radius: 12px; padding: 4px; }
.seg span { border-radius: 9px; padding: 8px 4px; }
.seg input:checked + span { color: var(--primary); }
.map-tools .chip { background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(6px); }

/* Startseite */
.hero {
  border-radius: 22px; padding: 22px 20px 20px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #2bb673 0%, #178450 45%, #0f5c38 100%);
  box-shadow: 0 10px 30px rgba(15, 92, 56, .25);
}
.hero h1 { color: #fff; font-size: 1.6rem; margin: 2px 0 14px; }
.hero-kicker { margin: 0; font-weight: 650; opacity: .9; }
.hero-sub { margin: 12px 0 0; font-size: .85rem; opacity: .85; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-chip {
  border: 0; border-radius: 999px; padding: 10px 16px; font-weight: 750; font-size: .95rem; cursor: pointer;
  background: rgba(255, 255, 255, .18); color: #fff; backdrop-filter: blur(4px); transition: background .15s, transform .05s;
}
.quick-chip:hover { background: #fff; color: #0f5c38; }
.quick-chip:active { transform: scale(.97); }
.start-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.start-actions.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) { .start-actions.four { grid-template-columns: repeat(2, 1fr); } }
.action-tile {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; padding: 16px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; color: var(--text); font: inherit;
}
.action-tile:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.action-tile .ico {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; margin-bottom: 6px;
  background: var(--primary-soft); color: var(--primary);
}
.action-tile.run .ico { background: var(--run); color: var(--run-ink); }
.action-tile b { font-size: 1rem; }
.action-tile small { color: var(--muted); font-size: .8rem; }
.tip { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--text); border-left: 4px solid var(--primary); }

/* Runden-Karte mit Laufen-Knopf */
.route-run { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; }
.rr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.rr-main strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-run .btn { flex: none; }

/* Seitenbreite, Abstände */
.page-inner { padding: 22px 16px 48px; }
.page-inner.stack { gap: 18px; }

.action-tile .ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.action-tile .ico svg.fill { fill: currentColor; stroke: none; margin-left: 2px; }
.import-box.compact .section-head { align-items: center; flex-wrap: wrap; }
.import-box.compact .section-head > div { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 200px; }

/* Grün statt Orange: Startpunkt-Pin dunkelgrün mit weißem Rand, gut sichtbar auf hellen und grünen Karten */
.pin-start span { background: #0f5c38; box-shadow: 0 0 0 3px rgba(16, 178, 108, .45), 0 1px 4px rgba(0, 0, 0, .4); }

/* ---------- Marke Vasgo ---------- */
:root { --brand: #22c77f; --brand-ink: #0b3b26; }
.brand img { border-radius: 9px; }
.wordmark { font-weight: 900; font-style: italic; font-size: 1.35rem; letter-spacing: -.02em; line-height: 1; }
.wordmark b { color: var(--brand); font-weight: 900; margin-left: 1px; }

/* ---------- Freunde (v0.11) ---------- */
.seg-links { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; margin-bottom: 12px; }
.seg-links a { padding: 6px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 650; font-size: .88rem; white-space: nowrap; }
.seg-links a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.social-page h1 { margin: 0; }
.social-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.social-head p { margin: 4px 0 0; }
.social-head .btn svg, .chip-btn svg, .badge svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.badge svg { width: 12px; height: 12px; margin-right: 3px; vertical-align: -1px; }
.btn .count, .news summary .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px;
  border-radius: 999px; background: var(--run, var(--primary)); color: #fff; font-size: .75rem; font-weight: 800; }
.section-title { font-size: 1.1rem; margin: 18px 0 0; }
.center { display: flex; justify-content: center; text-align: center; }
.hero-soft { background: linear-gradient(160deg, var(--primary-soft), var(--surface) 70%); }
.hero-soft h2 { margin: 0; }
.check-list { margin: 0; padding-left: 20px; display: grid; gap: 4px; }

.p-avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; text-decoration: none; font-weight: 800;
  background: var(--primary-soft); color: var(--primary); border: 2px solid color-mix(in srgb, var(--primary) 25%, transparent); }
.p-avatar.xl { width: 72px; height: 72px; font-size: 1.8rem; }

.act-card { display: flex; flex-direction: column; gap: 8px; }
.act-head { display: flex; align-items: center; gap: 10px; }
.act-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.act-name { font-weight: 700; color: var(--text); text-decoration: none; }
.act-name:hover { text-decoration: underline; }
.act-title { margin: 2px 0 0; font-size: 1.05rem; }
.act-title .linkish { color: var(--text); font-size: inherit; }
.act-map-btn { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.act-map { display: block; width: 100%; height: auto; max-height: 190px; border-radius: 10px; background: var(--surface-2); }
.act-map .trk polyline { fill: none; stroke: var(--run, var(--primary)); stroke-width: 3.5; stroke-linejoin: round; stroke-linecap: round; }
.act-map circle { stroke: #fff; stroke-width: 2; }
.act-map circle.s { fill: var(--primary); }
.act-map circle.e { fill: #0b3b26; }
.act-actions { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-weight: 650; font-size: .88rem; cursor: pointer; }
.chip-btn:hover:not(:disabled) { border-color: var(--primary); }
.chip-btn:disabled { cursor: default; opacity: .75; }
.chip-btn.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.chip-btn.on svg { fill: currentColor; fill-opacity: .25; }
.chip-btn.go { margin-left: auto; color: var(--run, var(--primary)); border-color: color-mix(in srgb, var(--run, var(--primary)) 45%, var(--line)); }
.chip-btn.go svg { fill: currentColor; stroke: none; }
.act-detail-map { height: 300px; border-radius: 12px; margin: 10px 0; }
.split-list { columns: 3; font-variant-numeric: tabular-nums; margin: 6px 0; }

.person-list { display: flex; flex-direction: column; }
.person-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.person-row:last-child { border-bottom: 0; }
.person-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.person-info a { color: var(--text); text-decoration: none; }
.person-act { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; }
.person-act .btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.req-card { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.req-card h3 { margin: 0; }

.news summary { cursor: pointer; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.news summary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.news-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.news-list li { padding: 6px 8px; border-radius: 8px; }
.news-list li.unread { background: var(--primary-soft); }
.news-item { color: var(--text); font-weight: 400; text-decoration: none; }

.profile-card { display: flex; gap: 16px; align-items: flex-start; position: relative; }
.profile-main { flex: 1; min-width: 0; }
.profile-main h1 { font-size: 1.5rem; }
.profile-main p { margin: 4px 0 10px; }
.profile-main .person-act { justify-content: flex-start; }
.more-menu { position: absolute; top: 10px; right: 10px; }
.more-menu summary { list-style: none; cursor: pointer; font-size: 1.4rem; line-height: 1; padding: 2px 8px; border-radius: 8px; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-menu .menu { position: absolute; right: 0; top: 30px; z-index: 5; min-width: 200px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; padding: 4px; }
.more-menu .menu button { background: none; border: 0; text-align: left; padding: 9px 10px; border-radius: 8px; cursor: pointer; color: var(--text); font: inherit; }
.more-menu .menu button:hover { background: var(--surface-2); }
.more-menu .menu .danger { color: var(--danger); }
.invite-card { align-items: center; text-align: center; }
.invite-card h2 { margin: 0; }
.invite-box input { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }

.zone-map { height: 240px; border-radius: 12px; }
.zone-row { display: flex; gap: 8px; align-items: center; }
.zone-row input { flex: 1; min-width: 0; }
.zone-row select { width: auto; }
.vis-select { width: auto; padding: 4px 8px; font-size: .85rem; min-height: 32px; }
.form-msg-inline { color: var(--danger); }
.tab-dot { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: #e5484d; color: #fff; font-size: .65rem; font-weight: 800; display: grid; place-items: center; line-height: 1; }
.tab-dot[hidden] { display: none; }
@media (min-width: 960px) { .tab-dot { top: 6px; left: auto; right: 2px; } }
@media (max-width: 560px) {
  .profile-card { flex-direction: column; align-items: center; text-align: center; }
  .profile-main .person-act { justify-content: center; }
  .chip-btn.go { margin-left: 0; }
  .split-list { columns: 2; }
}
