:root {
  --bg: #f4f1ea; --card: #fff; --ink: #1d2320; --muted: #6b726e; --line: #e2ddd2;
  --accent: #1f6f4a; --accent-ink: #fff; --top: #1f3b2d; --danger: #c0392b;
  --eryk: #e4572e; --dawid: #2e86de; --kacper: #27ae60;
  --r: 12px; --sheet: 46vh;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151917; --card: #1f2522; --ink: #e8ece9; --muted: #99a29d; --line: #333b37; --top: #0f1f17; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
small { font-size: 12px; }

#top { position: fixed; inset: 0 0 auto 0; height: 50px; z-index: 1000; display: flex; align-items: center;
  justify-content: space-between; padding: 0 12px; padding-top: env(safe-area-inset-top);
  background: var(--top); color: #fff; }
#top .muted { color: #b9cbbf; font-size: 13px; margin-left: 6px; }
.chip { border: 0; border-radius: 999px; padding: 5px 12px; background: #ffffff22; color: #fff; font-weight: 600; }

#layout { position: fixed; inset: 50px 0 0 0; display: flex; flex-direction: column; }
#mapWrap { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; }
#panel { height: var(--sheet); background: var(--bg); border-top: 1px solid var(--line);
  display: flex; flex-direction: column; transition: height .2s; box-shadow: 0 -4px 16px #0002; z-index: 500; }
#panel.big { --sheet: 82vh; }
#panel.small { --sheet: 64px; }
#grip { height: 18px; flex: none; cursor: ns-resize; position: relative; }
#grip::after { content: ""; position: absolute; left: 50%; top: 6px; width: 44px; height: 5px; margin-left: -22px;
  border-radius: 3px; background: var(--line); }
#tabs { display: flex; flex: none; border-bottom: 1px solid var(--line); }
#tabs button { flex: 1; border: 0; background: none; padding: 4px 0 8px; display: flex; flex-direction: column;
  align-items: center; font-size: 18px; color: var(--muted); border-bottom: 3px solid transparent; }
#tabs button span { font-size: 11px; font-weight: 600; }
#tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
#tabBody { flex: 1; overflow: auto; padding: 12px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

@media (min-width: 900px) {
  #layout { flex-direction: row-reverse; }
  #panel { height: auto !important; width: 430px; border-top: 0; border-right: 1px solid var(--line); }
  #grip { display: none; }
}

#searchBox { position: absolute; top: 10px; left: 56px; right: 10px; z-index: 600; max-width: 460px; }
#search { width: 100%; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--card); box-shadow: 0 2px 8px #0002; }
#results { background: var(--card); border-radius: var(--r); margin-top: 4px; overflow: hidden; box-shadow: 0 2px 8px #0003; }
#results button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line);
  background: none; padding: 9px 12px; }
#results button:hover { background: var(--bg); }
#mapHint { position: absolute; top: 62px; left: 50%; transform: translateX(-50%); z-index: 600; background: var(--accent);
  color: #fff; padding: 8px 14px; border-radius: 999px; box-shadow: 0 2px 8px #0003; font-weight: 600; white-space: nowrap; }
#mapHint button { margin-left: 8px; border: 0; background: #fff3; color: #fff; border-radius: 999px; padding: 2px 10px; }
#mapBtns { position: absolute; right: 10px; bottom: 16px; z-index: 600; display: flex; flex-direction: column; gap: 8px; }
.fab { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--card); font-size: 22px; box-shadow: 0 2px 10px #0004; }
#btnIdea { background: #ffd23f; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; margin-bottom: 10px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 7px 12px; font-weight: 600; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 3px 9px; font-size: 13px; }
.btn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.icon { border: 0; background: none; padding: 4px 6px; font-size: 16px; border-radius: 8px; }
.icon:hover { background: var(--bg); }
input[type=text], input[type=number], input[type=search], input[type=password], select, textarea {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--card); width: 100%; }
textarea { min-height: 70px; resize: vertical; }
label.f { display: block; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
label.f > * { margin-top: 3px; color: var(--ink); }
h3 { margin: 4px 0 8px; font-size: 16px; }
h4 { margin: 0; font-size: 15px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.stats b { display: block; font-size: 18px; }
.stats small { color: var(--muted); }
.who { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; color: #fff; background: #888; vertical-align: middle; }
.who.Eryk { background: var(--eryk); } .who.Dawid { background: var(--dawid); } .who.Kacper { background: var(--kacper); }

.day { border-left: 5px solid var(--dc, #888); }
.day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.stop { display: flex; align-items: center; gap: 6px; padding: 7px 0; border-top: 1px dashed var(--line); }
.stop:first-of-type { border-top: 0; }
.stop .em { font-size: 20px; width: 28px; text-align: center; flex: none; }
.stop .nm { flex: 1; min-width: 0; cursor: pointer; }
.stop .nm b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.leg { font-size: 12px; color: var(--muted); }
.dayfilter { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; }
.dayfilter .btn { white-space: nowrap; }

.idea .votes { display: flex; gap: 6px; align-items: center; }
.vote { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 3px 10px; }
.vote.mine { background: var(--accent); color: #fff; border-color: var(--accent); }

.item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.item.done .t { text-decoration: line-through; color: var(--muted); }
.item input[type=checkbox] { width: 20px; height: 20px; }
.item select { width: auto; padding: 4px 6px; font-size: 13px; }
.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 6px 0 10px; }
.progress div { height: 100%; background: var(--accent); }

/* Markery */
.pin { width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--card, #fff);
  border: 3px solid var(--c); display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px #0005; }
.pin span { transform: rotate(45deg); font-size: 17px; line-height: 1; }
.pin i { position: absolute; transform: rotate(45deg); top: -9px; right: -9px; background: var(--c); color: #fff; font-style: normal;
  font-size: 11px; font-weight: 700; border-radius: 999px; min-width: 17px; height: 17px; display: flex; align-items: center; justify-content: center; }
.pin.idea { border-style: dashed; opacity: .85; background: #fff8d6; }
.leaflet-popup-content { margin: 10px 12px; min-width: 210px; color: #1d2320; }
.pop h4 { margin-bottom: 2px; }
.pop .acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pop select { width: 100%; margin-top: 6px; padding: 5px; border-radius: 8px; border: 1px solid #ccc; background: #fff; color: #1d2320; }
.pop .btn { background: #fff; color: #1d2320; border-color: #ddd; }
.pop .btn.primary { background: var(--accent); color: #fff; }
.pop .vote { background: #fff; color: #1d2320; border-color: #ddd; }
.pop .vote.mine { background: var(--accent); color: #fff; }

#overlay { position: fixed; inset: 0; background: #0008; z-index: 2000; display: flex; align-items: flex-end; justify-content: center; }
#modal { background: var(--bg); width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0;
  padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
@media (min-width: 600px) { #overlay { align-items: center; } #modal { border-radius: 18px; } }
.users { display: grid; gap: 10px; margin-top: 12px; }
.users button { border: 0; border-radius: 14px; padding: 16px; font-size: 20px; font-weight: 700; color: #fff; }
.comment { padding: 6px 0; border-top: 1px solid var(--line); }

#toasts { position: fixed; left: 50%; transform: translateX(-50%); top: 60px; z-index: 3000; display: flex; flex-direction: column; gap: 6px; width: min(92vw, 420px); }
.toast { background: #222d; color: #fff; padding: 9px 14px; border-radius: 10px; font-size: 14px; animation: fade 4s forwards; }
@keyframes fade { 0%, 80% { opacity: 1 } 100% { opacity: 0 } }

/* ===== v2: prostszy interfejs ===== */
.fab-add { height: 52px; border: 0; border-radius: 999px; padding: 0 20px; background: var(--accent); color: #fff;
  font-size: 22px; font-weight: 700; box-shadow: 0 3px 12px #0005; display: flex; align-items: center; gap: 6px; }
.fab-add span { font-size: 15px; }
#mapBtns { align-items: flex-end; }
#mapHint { text-align: center; white-space: normal; width: max-content; max-width: 90%; border-radius: 16px; line-height: 1.3; }
.badge { font-style: normal; background: #ffd23f; color: #222; border-radius: 999px; padding: 0 6px; font-size: 10px; margin-left: 2px; }
.status { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.status.plan { background: var(--dc); color: #fff; }
.status.idea { background: #fff3c4; color: #6b5200; }
.pop .links { display: flex; gap: 12px; margin-top: 10px; font-size: 13px; flex-wrap: wrap; }
.pop .links a { color: #1f6f4a; text-decoration: none; }
.pop .links a.danger { color: var(--danger); }
.pop .acts .grow { flex: 1; }
.daypick { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.daypick button { border: 2px solid var(--line); border-left: 6px solid var(--dc); background: var(--card); border-radius: 12px;
  padding: 10px; text-align: left; display: flex; flex-direction: column; }
.daypick button.on { outline: 3px solid var(--dc); }
.daypick small { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chips label { cursor: pointer; }
.chips label.wide { flex-basis: 100%; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips span { display: inline-block; padding: 7px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); font-size: 14px; border-left: 4px solid var(--dc, var(--line)); }
.chips label.wide span { display: block; border-radius: 12px; }
.chips input:checked + span { background: var(--accent); color: #fff; border-color: var(--accent); }
.chips input:focus-visible + span { outline: 2px solid var(--accent); }
div.f { margin-bottom: 12px; font-size: 13px; color: var(--muted); }
details summary { cursor: pointer; font-size: 13px; }
.dayrow { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line);
  border-left: 6px solid var(--dc); border-radius: var(--r); padding: 10px; margin-bottom: 8px; }
.dayrow small.muted { display: inline; }
.dayrow .grow small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.dayrow .grow { min-width: 0; }
.dnum { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--dc); color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center; }
.chev { font-size: 22px; color: var(--muted); }
.legline { font-size: 12px; color: var(--muted); padding: 2px 0 2px 34px; border-left: 3px dotted var(--dc); margin-left: 13px; }
.timeline .stop { border-top: 0; }
.guide { border: 2px solid #ffd23f; }
.guide ol { margin: 6px 0; padding-left: 20px; }
.guide li { margin-bottom: 4px; }
a.btn { color: inherit; text-decoration: none; }
