:root {
  --bg: #121417; --panel: #1a1d21; --panel2: #22262b; --line: #2f343a; --text: #e6e8ea; --muted: #949ba3;
  --accent: #7cc4a4; --open: #e06c5a; --work: #e3b341; --done: #57b97a; --skip: #8a8f96; --focus: #9ad1ff;
  --radius: 8px; --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; }
button:hover { border-color: #4a5058; }
button.primary { background: #2c5a47; border-color: #3d7a61; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
input, select, textarea { background: #0f1113; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; min-width: 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- Login */
body.login { display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; display: grid; gap: 12px; }
.login-card label { display: grid; gap: 4px; color: var(--muted); }
.login-card input { color: var(--text); }
.login-card button { padding: 8px; background: #2c5a47; border-color: #3d7a61; }
.err { color: var(--open); min-height: 1.2em; }
.brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.eye { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle, #1b4d3e 30%, #3aa57a 31%, #3aa57a 60%, #145c45 61%); display: inline-block; }

/* ---------- App-Layout */
.app { display: grid; grid-template-columns: 380px 1fr; height: 100%; }
.side { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.top { padding: 12px 14px 10px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.top .row { display: flex; align-items: center; gap: 8px; }
.top .brand { flex: 1; }
.progress { height: 8px; border-radius: 4px; background: var(--panel2); overflow: hidden; display: flex; }
.progress span { display: block; height: 100%; }
.stats { display: flex; gap: 12px; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 4px; padding: 8px 14px 0; flex-wrap: wrap; }
.tabs button { border-radius: 999px; padding: 3px 10px; font-size: 12.5px; background: transparent; }
.tabs button.on { background: var(--panel2); border-color: #4a5058; }
.filters { display: flex; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.filters input { flex: 1; }
.list { overflow-y: auto; flex: 1; min-height: 0; }
.item { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; padding: 7px 14px; border-bottom: 1px solid #23272c; cursor: pointer; }
.item:hover { background: #1f2327; }
.item.sel { background: #23302b; }
.num { width: 30px; height: 22px; border-radius: 5px; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #111; font-variant-numeric: tabular-nums; }
.item .t { font-size: 13px; }
.item .s { font-size: 12px; color: var(--muted); }
.dots { display: flex; gap: 3px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--done); }

/* ---------- Detail */
.detail { overflow-y: auto; flex: 1; min-height: 0; padding: 12px 14px 24px; display: none; }
.side.show-detail .detail { display: block; }
.side.show-detail .list, .side.show-detail .filters, .side.show-detail .tabs { display: none; }
.dhead { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.dhead h2 { margin: 0; font-size: 18px; flex: 1; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; color: #111; font-weight: 600; }
.card { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; }
.card h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.coord { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.coord:first-of-type { border-top: 0; padding-top: 0; }
.coord .lbl { font-size: 12.5px; color: var(--muted); }
.coord .val { font-family: var(--mono); font-size: 15px; }
.coord button { grid-row: span 2; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.task { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.task:first-of-type { border-top: 0; }
.task input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--done); }
.task label { flex: 1; cursor: pointer; }
.task .by { display: block; font-size: 11.5px; color: var(--muted); }
.task.done label span:first-child { text-decoration: line-through; color: var(--muted); }
.task .x { padding: 0 6px; background: transparent; border: 0; color: var(--muted); }
.addrow { display: flex; gap: 6px; margin-top: 8px; }
.addrow input { flex: 1; }
.comment { padding: 7px 0; border-top: 1px solid var(--line); white-space: pre-wrap; word-wrap: break-word; }
.comment:first-of-type { border-top: 0; }
.comment .by { font-size: 11.5px; color: var(--muted); display: flex; gap: 6px; }
.comment .by button { padding: 0 4px; border: 0; background: transparent; color: var(--muted); margin-left: auto; }
textarea { width: 100%; resize: vertical; min-height: 54px; }
.logline { font-size: 12.5px; padding: 5px 14px; border-bottom: 1px solid #23272c; cursor: pointer; }
.logline .muted { font-size: 11.5px; }

/* ---------- Karte */
.mapwrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: #0b0d10; }
.leaflet-container { font: inherit; }
.leaflet-tile { image-rendering: pixelated; }
.hud { position: absolute; z-index: 500; left: 12px; bottom: 12px; background: rgba(18,20,23,.88); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font: 12.5px var(--mono); pointer-events: none; }
.maptools { position: absolute; z-index: 500; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.maptools .box { background: rgba(18,20,23,.92); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; gap: 6px; font-size: 12.5px; }
.maptools summary { cursor: pointer; color: var(--muted); }
.maptools label { display: flex; align-items: center; gap: 6px; }
.shm { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 700 11px var(--font); color: #111; border: 2px solid #0b0d10; box-shadow: 0 0 0 1px rgba(255,255,255,.25); }
.shm.sel { box-shadow: 0 0 0 3px #fff; }
.mine { width: 14px; height: 14px; border-radius: 50%; background: var(--focus); border: 2px solid #0b0d10; box-shadow: 0 0 0 2px var(--focus); }
.toast { position: fixed; z-index: 2000; left: 50%; bottom: 24px; transform: translateX(-50%); background: #2c5a47; border: 1px solid #3d7a61; padding: 8px 14px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: calc(100% - 32px); }
.toast.on { opacity: 1; }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 18px; width: min(460px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.55); }
dialog label { display: grid; gap: 4px; margin-bottom: 10px; color: var(--muted); }
.mobile-toggle { display: none; }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .side { position: fixed; z-index: 1000; left: 0; right: 0; bottom: 0; height: 62%; border-right: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0; transform: translateY(calc(100% - 118px)); transition: transform .2s; }
  .side.open { transform: none; }
  .mapwrap { position: fixed; inset: 0; }
  .mobile-toggle { display: inline-block; }
  .hud { bottom: 128px; }
}
