:root {
  --primary: #1E3A5F; --on-primary: #fff;
  --fg: #0F172A; --muted: #475569; --line: #E4E7EB; --bg: #F8FAFC; --card: #fff; --soft: #F1F5F9;
  --k-supermarket: #15803D; --k-bank: #1D4ED8; --k-atm: #C2410C; --k-custom: #334155;
  --s-favorit: #B45309; --s-gemerkt: #7C3AED; --s-besucht: #0F766E; --s-meiden: #DC2626;
  --radius: 10px; --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --top: 60px; --filters: 48px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { font: 15px/1.45 var(--font); color: var(--fg); background: var(--bg); overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Topbar */
.topbar { height: var(--top); display: flex; align-items: center; gap: 12px; padding: 0 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand h1 { margin: 0; font-size: 17px; line-height: 1.1; letter-spacing: -.01em; }
.brand p { margin: 0; font-size: 12.5px; color: var(--muted); }
.search { flex: 1; display: flex; align-items: center; gap: 8px; max-width: 520px; margin-left: 12px; padding: 0 12px; height: 40px; border: 1px solid var(--line); border-radius: 999px; background: var(--soft); color: var(--muted); }
.search:focus-within { border-color: var(--primary); background: #fff; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--fg); font-size: 16px; }
.radius { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.radius select { height: 40px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--fg); font-size: 15px; cursor: pointer; }
.actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font-weight: 550; font-size: 14px; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.btn:hover { background: var(--soft); border-color: #CBD5E1; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: #16304F; }
.btn.danger { color: var(--s-meiden); border-color: #FECACA; }
.btn.danger:hover { background: #FEF2F2; }
.btn.icon { width: 40px; padding: 0; }
.btn.small { min-height: 34px; padding: 0 10px; font-size: 13px; }
.btn.wide { width: 100%; min-height: 46px; }
.btn[aria-busy="true"] { opacity: .6; pointer-events: none; }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: 46px; z-index: 1200; min-width: 230px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.menu-pop button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 6px; background: none; cursor: pointer; min-height: 44px; }
.menu-pop button:hover { background: var(--soft); }

/* Filter */
.filters { height: var(--filters); display: flex; align-items: center; gap: 8px; padding: 0 14px; background: var(--card); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; font-size: 13.5px; font-weight: 550; color: var(--muted); white-space: nowrap; transition: all .15s; }
.chip svg { width: 15px; height: 15px; }
.chip b { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); }
.chip.on { background: #EEF2F7; border-color: #9FB1C8; color: var(--fg); }
.chip.on b { color: var(--fg); }
.chip:not(.on) .dot { opacity: .35; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.k-supermarket { background: var(--k-supermarket); } .k-bank { background: var(--k-bank); } .k-atm { background: var(--k-atm); } .k-custom { background: var(--k-custom); }
.sep { width: 1px; height: 22px; background: var(--line); flex: none; }
.data-info { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; padding-left: 8px; }

/* Layout */
.layout { position: relative; display: grid; grid-template-columns: 380px 1fr; height: calc(100% - var(--top) - var(--filters)); }
.sidebar { display: flex; flex-direction: column; min-height: 0; background: var(--card); border-right: 1px solid var(--line); }
.list-head { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.list-head .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.list li button { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; width: 100%; padding: 10px 14px; border: 0; border-bottom: 1px solid #EEF1F4; background: none; text-align: left; cursor: pointer; min-height: 58px; }
.list li button:hover { background: var(--soft); }
.list li button.active { background: #EAF0F7; box-shadow: inset 3px 0 0 var(--primary); }
.list .ico { width: 34px; height: 34px; display: grid; place-items: center; position: relative; }
.list .t { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .s { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .note { font-size: 12.5px; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: italic; }
.list .d { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.list .more { padding: 14px; color: var(--muted); font-size: 13px; text-align: center; }
.list .empty { padding: 28px 18px; color: var(--muted); text-align: center; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: #fff; }
.b-favorit { background: var(--s-favorit); } .b-gemerkt { background: var(--s-gemerkt); } .b-besucht { background: var(--s-besucht); } .b-meiden { background: var(--s-meiden); }
.ico .st { position: absolute; right: -3px; top: -3px; width: 13px; height: 13px; border-radius: 50%; border: 2px solid #fff; }

.mapwrap { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: #E5E9EE; }

/* Detail */
.detail { position: absolute; left: 0; top: 0; bottom: 0; width: 380px; z-index: 900; background: var(--card); border-right: 1px solid var(--line); overflow-y: auto; box-shadow: var(--shadow); }
.detail .head { display: flex; gap: 12px; align-items: flex-start; padding: 16px 16px 10px; }
.detail .head .ico { width: 42px; height: 42px; display: grid; place-items: center; flex: none; }
.detail h2 { margin: 0; font-size: 18px; line-height: 1.25; }
.detail .kind { font-size: 13px; color: var(--muted); }
.detail .close { margin-left: auto; }
.detail .body { padding: 0 16px 20px; }
.detail dl { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; margin: 6px 0 14px; font-size: 14px; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; word-break: break-word; }
.detail dd a { color: var(--k-bank); }
.hintbox { padding: 9px 11px; border-radius: 8px; background: #FFF7ED; border: 1px solid #FED7AA; color: #7C2D12; font-size: 13px; margin-bottom: 14px; }
.section-t { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 8px; }
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.status-grid button { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font-weight: 550; font-size: 14px; transition: all .15s; }
.status-grid button:hover { background: var(--soft); }
.status-grid button[aria-pressed="true"] { color: #fff; border-color: transparent; }
.status-grid button[data-s="favorit"][aria-pressed="true"] { background: var(--s-favorit); }
.status-grid button[data-s="gemerkt"][aria-pressed="true"] { background: var(--s-gemerkt); }
.status-grid button[data-s="besucht"][aria-pressed="true"] { background: var(--s-besucht); }
.status-grid button[data-s="meiden"][aria-pressed="true"] { background: var(--s-meiden); }
.field-l { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; }
.detail textarea, .detail input[type=text] { width: 100%; padding: 10px 12px; border: 1px solid #CBD5E1; border-radius: 8px; font-size: 16px; background: #fff; }
.detail textarea { min-height: 130px; resize: vertical; }
.detail textarea:focus, .detail input[type=text]:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
.save-state { font-size: 12.5px; color: var(--muted); min-height: 18px; margin-top: 6px; }
.save-state.err { color: var(--s-meiden); }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.row-btns a.btn { text-decoration: none; color: var(--fg); }

/* Banner / Toast */
.banner { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; background: var(--primary); color: #fff; border-radius: 999px; box-shadow: var(--shadow); font-size: 14px; }
.banner .btn { background: #fff; color: var(--primary); border: 0; }
.toast { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 1000; padding: 10px 16px; background: var(--fg); color: #fff; border-radius: 8px; font-size: 14px; box-shadow: var(--shadow); max-width: 90%; }
.mapwrap.adding #map { cursor: crosshair; }

/* Marker – je Art eigene Form */
.pin { width: 30px; height: 30px; display: grid; place-items: center; color: #fff; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); position: relative; transition: transform .15s; box-sizing: border-box; }
.pin svg { width: 16px; height: 16px; }
.pin-supermarket { background: var(--k-supermarket); border-radius: 8px; }
.pin-bank { background: var(--k-bank); border-radius: 50%; }
.pin-atm { background: var(--k-atm); border-radius: 6px; width: 32px; height: 26px; }
.pin-atm svg { width: 17px; height: 17px; stroke-width: 2.6; }
.pin-atm.out { border: 3px solid #22C55E; box-shadow: 0 0 0 2px #fff, 0 1px 5px rgba(0,0,0,.4); }
.pin-custom { background: var(--k-custom); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
.pin-custom > span { transform: rotate(45deg); display: grid; place-items: center; }
.pin-custom.sel { transform: rotate(-45deg) scale(1.3); }
.pin .eur { position: absolute; right: -6px; bottom: -6px; width: 15px; height: 15px; border-radius: 4px; background: var(--k-atm); border: 1.5px solid #fff; font: 700 10px/12px var(--font); text-align: center; color: #fff; }
.pin .st { position: absolute; right: -6px; top: -6px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; }
.pin-custom .st { transform: rotate(45deg); }
.pin.sel { transform: scale(1.3); box-shadow: 0 0 0 4px rgba(30,58,95,.35), 0 2px 6px rgba(0,0,0,.4); z-index: 2; }
.pin.dim { opacity: .55; }
.pin.mini { width: 20px; height: 20px; border-width: 1.5px; box-shadow: none; flex: none; }
.pin.mini svg { width: 12px; height: 12px; }
.pin-atm.mini { width: 22px; height: 17px; }
.pin-atm.mini.out { border-width: 2px; box-shadow: none; }
.pin.mini .eur { width: 11px; height: 11px; font-size: 8px; line-height: 9px; right: -5px; bottom: -5px; border-width: 1px; }
.chip .pin.mini svg { width: 12px; height: 12px; }
.chip:not(.on) .pin { opacity: .4; }
.st-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin: 0 4px 0 0; vertical-align: -1px; }
.center-pin { width: 18px; height: 18px; border-radius: 50%; background: var(--primary); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--primary); }
.me-pin { width: 16px; height: 16px; border-radius: 50%; background: #2563EB; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(37,99,235,.25); }
.route-start { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font: 700 12px/20px var(--font); text-align: center; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.marker-cluster { background: rgba(30,58,95,.18); border-radius: 50%; }
.marker-cluster div { width: 32px; height: 32px; margin: 4px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; }
.leaflet-tooltip { font: 13px var(--font); }
.legend { background: rgba(255,255,255,.95); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); font: 13px/1.3 var(--font); color: var(--fg); }
.legend summary { cursor: pointer; padding: 8px 12px; font-weight: 600; min-height: 36px; list-style-position: inside; }
.legend ul { list-style: none; margin: 0; padding: 0 12px 10px; display: grid; gap: 7px; }
.legend li { display: flex; align-items: center; gap: 9px; }
.legend .pin-custom.mini { margin: 0 1px; }

/* Detail: Zugang, Google, Route */
.gm-btns, .route-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 2px 0 6px; }
.gm-btns .btn, .route-btns .btn { text-decoration: none; color: var(--fg); padding: 0 10px; }
.route-btns .btn.primary { color: #fff; }
.route-btns { margin-top: 12px; }
.access-now { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--soft); margin-bottom: 8px; }
.access-now svg { margin-top: 2px; }
.access-now b { display: block; font-size: 14px; }
.access-now small { display: block; color: var(--muted); font-size: 12.5px; }
.access-now.acc-aussen { background: #F0FDF4; border-color: #86EFAC; color: #14532D; }
.access-now.acc-vorraum { background: #FFFBEB; border-color: #FCD34D; color: #713F12; }
.access-now.acc-innen { background: #F8FAFC; border-color: #CBD5E1; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid #CBD5E1; border-radius: 8px; overflow: hidden; }
.seg button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; border: 0; border-left: 1px solid #CBD5E1; background: #fff; cursor: pointer; font-weight: 550; font-size: 14px; padding: 0 6px; }
.seg button:first-child { border-left: 0; }
.seg button:hover { background: var(--soft); }
.seg button[aria-pressed="true"] { background: var(--primary); color: #fff; }
.seg.modes { margin-bottom: 10px; }
.sel { width: 100%; height: 44px; padding: 0 10px; border: 1px solid #CBD5E1; border-radius: 8px; background: #fff; font-size: 16px; cursor: pointer; }
.addr-row { display: flex; gap: 8px; margin-top: 8px; }
.addr-row input { flex: 1; min-width: 0; }
.addr-results { list-style: none; margin: 6px 0 0; padding: 0; }
.addr-results button { width: 100%; text-align: left; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; margin-top: 6px; font-size: 13.5px; min-height: 44px; }
.addr-results button:hover { background: var(--soft); }
.muted { color: var(--muted); font-size: 13px; margin: 8px 0; }
.muted.err, .err { color: var(--s-meiden); }
.route-sum { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: #EEF2F7; border: 1px solid #C7D2E0; }
.route-sum b { font-size: 17px; }
.route-sum small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.steps { margin: 8px 0; }
.steps summary { cursor: pointer; font-weight: 600; font-size: 14px; padding: 8px 0; min-height: 36px; }
.steps ol { margin: 0; padding-left: 22px; font-size: 14px; }
.steps li { padding: 4px 0; border-bottom: 1px solid #EEF1F4; }
.steps li small { display: block; color: var(--muted); }

/* Standort-Panel */
.locpanel { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1150; width: min(420px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow-y: auto; padding: 12px 14px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.lp-head { display: flex; align-items: center; justify-content: space-between; font-size: 16px; }
.lp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.locpanel input[type=text] { width: 100%; height: 44px; padding: 0 12px; border: 1px solid #CBD5E1; border-radius: 8px; font-size: 16px; }
.locpanel #locClear { margin-top: 10px; }

/* Login */
.login { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; background: var(--bg); padding: 20px; }
.login-card { width: 100%; max-width: 360px; padding: 28px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.login-card h2 { margin: 10px 0 2px; } .login-card p { margin: 0 0 16px; color: var(--muted); }
.login-card label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 6px; }
.login-card input { width: 100%; height: 46px; padding: 0 12px; border: 1px solid #CBD5E1; border-radius: 8px; font-size: 16px; }
.login-card .err { color: var(--s-meiden); min-height: 20px; margin: 10px 0; font-size: 14px; }

.view-toggle { display: none; }

@media (max-width: 1000px) {
  .radius span, .actions .lbl { display: none; }
  .actions .btn:not(.icon) { width: 40px; padding: 0; }
}
@media (max-width: 760px) {
  :root { --top: 108px; }
  .topbar { flex-wrap: wrap; height: var(--top); padding: 8px 12px; gap: 8px; align-content: center; }
  .brand p { display: none; }
  .search { order: 3; flex: 1 1 100%; max-width: none; margin: 0; height: 42px; }
  .data-info { display: none; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: absolute; inset: 0; z-index: 800; display: none; border-right: 0; }
  body.show-list .sidebar { display: flex; }
  .view-toggle { display: inline-flex; position: absolute; bottom: calc(18px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 1100; border-radius: 999px; box-shadow: var(--shadow); min-height: 46px; padding: 0 20px; background: var(--primary); color: #fff; border: 0; }
  .detail { top: auto; width: auto; right: 0; max-height: 72%; border-right: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); z-index: 1150; }
  .detail dl { grid-template-columns: 95px 1fr; }
  body.detail-open .view-toggle { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
