:root {
  /* ----- Marka Cellfast ----- */
  --cyan: #00A6D6;       /* akcent podstawowy (stonowany brand) */
  --cyan-d: #0089b3;
  --cyan-soft: #eef8fc;
  --navy: #212748;       /* kolor strukturalny */
  --navy-2: #2c3358;
  --ink: #1d2236;
  --muted: #626a7d;      /* tekst drugorzędny */
  --line: #dde1ea;       /* obrysy / separatory */
  --line-2: #c7cdda;
  --surface: #f6f7fa;    /* tło paneli pomocniczych */
  --white: #ffffff;
  --danger: #b3261e;
  --danger-soft: #f6dcda;
  --shadow: 0 6px 22px rgba(28, 33, 54, .12);
  --shadow-sm: 0 1px 3px rgba(28, 33, 54, .12);
  --r-lg: 12px;
  --r-md: 9px;
  --r-sm: 7px;
  /* ----- Krzywe ruchu (Emil: mocniejsze niż wbudowane) ----- */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body {
  margin: 0; height: 100%; height: 100dvh;  /* dvh: pasek URL na mobile nie ucina mapy/docka */
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--navy);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}

/* ----- Ikony liniowe (jednolita kreska) ----- */
.ic {
  width: 17px; height: 17px; flex: 0 0 auto; display: inline-block;
  stroke: currentColor; fill: none; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ----- Układ: mapa + boczny panel wyliczeń ----- */
#app { display: flex; height: 100%; width: 100%; }
#mapWrap { position: relative; flex: 1 1 auto; min-width: 0; }
#map { position: absolute; inset: 0; z-index: 0; background: var(--surface); }

#sidebar {
  flex: 0 0 0; width: 0; overflow: hidden;
  background: var(--white); box-shadow: -8px 0 28px rgba(28,33,54,.14);
  transition: flex-basis .42s var(--ease-drawer), width .42s var(--ease-drawer);
  display: flex; flex-direction: column;
}
#app.split #sidebar { flex-basis: 42%; width: 42%; max-width: 560px; }

.side-head {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  padding: 15px 18px; background: var(--navy); color: var(--white);
}
.side-title { font-weight: 700; font-size: 15.5px; letter-spacing: .2px; }
.side-sub { font-size: 12px; opacity: .72; margin-top: 3px; font-variant-numeric: tabular-nums; }
.side-sub b { color: var(--cyan); font-weight: 600; }
.side-head .btn.ghost { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #fff; }
.side-head .btn.ghost:hover { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.3); }

/* ----- Marka ----- */
.brand {
  position: absolute; top: calc(12px + env(safe-area-inset-top)); left: calc(14px + env(safe-area-inset-left)); z-index: 650;
  color: #fff; font-weight: 800; font-size: 15px; letter-spacing: .6px;
  text-shadow: 0 1px 4px rgba(0,0,0,.55); white-space: nowrap; pointer-events: none;
}
.brand span { font-weight: 500; opacity: .82; font-size: .8em; letter-spacing: .2px; }

/* ----- Celownik ----- */
#crosshair {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 500; pointer-events: none; filter: drop-shadow(0 1px 2px rgba(0,0,0,.45));
}

/* ----- Pasek narzędzi (pionowy, lewa krawędź) ----- */
#toolbar {
  position: absolute; left: calc(12px + env(safe-area-inset-left)); top: calc(46px + env(safe-area-inset-top)); z-index: 650;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 6px; box-shadow: var(--shadow);
}
.tbtn {
  width: 40px; height: 40px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--navy); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .13s, color .13s, transform .12s var(--ease-out);
}
.tbtn:hover { background: var(--surface); }
.tbtn:not(:disabled):active { transform: scale(.93); }
.tbtn:disabled { opacity: .35; cursor: not-allowed; }
.tbtn:disabled:hover { background: transparent; }
.tbtn.active { background: var(--cyan); color: #fff; }
.tbtn.ok { color: #1d7a44; }
.tbtn.danger:hover { background: #fdf3f2; color: var(--danger); }
.tsep { height: 1px; background: var(--line); margin: 2px 4px; }

/* ----- Wyszukiwarka (rozwijana lupką) ----- */
#searchPanel {
  position: absolute; left: calc(64px + env(safe-area-inset-left)); top: calc(46px + env(safe-area-inset-top));
  z-index: 650; width: min(420px, calc(100% - 80px));
}
#searchForm {
  display: flex; gap: 5px; background: var(--white);
  border-radius: var(--r-md); padding: 5px; box-shadow: var(--shadow); border: 1px solid var(--line);
}
#searchInput {
  flex: 1; border: 0; outline: 0; padding: 8px 12px; font-size: 15px;
  background: transparent; border-radius: var(--r-sm); color: var(--ink);
  font-family: inherit; min-width: 0;
}
#searchInput::placeholder { color: #9aa1b1; }
#searchForm button {
  border: 0; background: var(--surface); color: var(--navy);
  width: 38px; height: 38px; border-radius: var(--r-sm); flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .14s;
}
#searchForm button:hover { background: #e7ebf2; }

/* ----- Dock (dolny pasek narzędziowy) -----
   #dock = stos w kolumnie: hint NAD bottombarem. Hint i dock są w jednym
   przepływie, więc hint nigdy nie zasłania docka — nawet gdy dock się zawija. */
#dock {
  position: absolute; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 600;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: max-content; max-width: calc(100% - 20px); pointer-events: none;
}
#dock > * { pointer-events: auto; }
#bottombar {
  display: flex; gap: 8px; align-items: center;
  width: max-content; max-width: 100%;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 9px;
  box-shadow: 0 10px 30px rgba(28, 33, 54, .16);
}
.dsep { width: 1px; height: 22px; background: var(--line); flex: 0 0 auto; }
/* przełącznik ciśnienia w docku */
.dseg { display: inline-flex; gap: 2px; background: var(--surface); border-radius: 999px; padding: 2px; }
.dseg .seg-btn {
  border: 0; background: transparent; color: var(--muted); font-family: inherit;
  font-size: 12.5px; font-weight: 700; padding: 6px 11px; border-radius: 999px; cursor: pointer;
  font-variant-numeric: tabular-nums; transition: background .13s, color .13s;
  display: inline-flex; align-items: baseline; gap: 2px;
}
.dseg .seg-btn small { font-size: 9.5px; font-weight: 600; opacity: .8; }
.dseg .seg-btn:hover { color: var(--navy); }
.dseg .seg-btn.active { background: var(--cyan); color: #fff; }
/* przycisk-ikona (źródło wody) */
.dbtn {
  width: 36px; height: 36px; border: 0; border-radius: 999px; flex: 0 0 auto;
  background: transparent; color: var(--navy); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .13s, color .13s, transform .12s var(--ease-out);
}
.dbtn:hover { background: var(--surface); color: var(--navy); }
.dbtn:active { transform: scale(.92); }
.dbtn.set { background: var(--cyan-soft); color: var(--cyan-d); }
/* odczyt pola (instrument) */
#bottombar .area {
  margin: 0; padding: 0 4px; border: 0; background: transparent;
  color: var(--navy); font-size: 15px; font-weight: 800; letter-spacing: .3px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
/* akcje */
.dbtn-cta {
  display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px;
  background: var(--cyan); color: #fff; font-family: inherit; font-size: 13px; font-weight: 700;
  padding: 9px 15px; cursor: pointer; white-space: nowrap; transition: background .14s, transform .14s var(--ease-out);
}
.dbtn-cta:hover { background: #00b9ea; }
.dbtn-cta:not(:disabled):active { transform: scale(.96); }
.dbtn-cta:disabled { opacity: .35; cursor: not-allowed; }
.dbtn-ghost {
  border: 1px solid var(--line-2); border-radius: 999px; background: transparent;
  color: var(--navy); font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 14px; cursor: pointer; white-space: nowrap; transition: background .14s, border-color .14s;
}
.dbtn-ghost:hover { background: var(--surface); border-color: var(--cyan); }
.dbtn-ghost:disabled { opacity: .35; cursor: not-allowed; }

#hint {
  width: max-content; max-width: 100%; order: -1;  /* zawsze nad bottombarem */
  background: rgba(33,39,72,.92); color: #eef0f5; font-size: 12.5px; line-height: 1.4;
  padding: 8px 14px; border-radius: 999px; box-shadow: var(--shadow-sm); text-align: center;
}
#hint b { color: var(--cyan); font-weight: 600; }

/* ----- Przyciski ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 9px 13px; font-size: 13.5px; font-weight: 600; letter-spacing: .1px;
  font-family: inherit; cursor: pointer; background: var(--white); color: var(--navy);
  transition: background .14s, border-color .14s, color .14s, box-shadow .14s, transform .14s var(--ease-out);
}
.btn:hover { border-color: var(--line-2); }
.btn:not(:disabled):active { transform: scale(.97); }
.btn.icon-only { padding: 9px; }
.btn.primary { background: var(--cyan); border-color: var(--cyan); color: #fff; }
.btn.primary:hover { background: var(--cyan-d); border-color: var(--cyan-d); }
.btn.ok { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.ok:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { background: #eef1f6; color: var(--navy); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--line); }

.area {
  margin-left: auto; font-weight: 800; font-size: 16px; color: var(--navy);
  font-variant-numeric: tabular-nums; letter-spacing: .2px;
  background: var(--cyan-soft); border: 1px solid #cdeaf5;
  padding: 7px 13px; border-radius: var(--r-sm);
}

/* ----- Segmentowany przełącznik ciśnienia ----- */
.seg { display: inline-flex; align-items: center; gap: 6px; }
.seg-lbl { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.seg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px 3px 3px 9px; }
.seg-btn {
  border: 0; background: transparent; color: var(--muted); font-family: inherit;
  font-size: 13px; font-weight: 700; padding: 6px 10px; border-radius: 5px; cursor: pointer;
  font-variant-numeric: tabular-nums; transition: background .13s, color .13s;
}
.seg-btn:hover { color: var(--navy); }
.seg-btn.active { background: var(--cyan); color: #fff; box-shadow: var(--shadow-sm); }

/* ----- Przycisk źródła wody (stan aktywny po ustawieniu) ----- */
#sourceBtn.set { background: var(--cyan-soft); border-color: #cdeaf5; color: var(--cyan-d); }
.app-placing-source .leaflet-container { cursor: crosshair; }

/* ----- Znacznik źródła wody na mapie ----- */
.wsrc {
  width: 28px; height: 28px; border-radius: 50%; background: #fff;
  border: 2px solid var(--navy); box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center;
}
.wsrc svg { width: 16px; height: 16px; fill: var(--cyan); stroke: #fff; stroke-width: 1.4; }

/* ----- Linia info o źródle w panelu ręcznym ----- */
.msrc {
  display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--navy);
  background: var(--cyan-soft); border: 1px solid #cdeaf5; border-radius: var(--r-md); padding: 8px 11px;
}
.msrc b { font-variant-numeric: tabular-nums; }
.msrc svg { width: 15px; height: 15px; fill: var(--cyan); stroke: #fff; stroke-width: 1.4; flex: 0 0 auto; }

/* ----- Rysowanie obszarów ----- */
.drawing .leaflet-container { cursor: crosshair; }
.vtx { cursor: grab; }
.vtx:active { cursor: grabbing; }
/* Powiększony obszar chwytania uchwytów (wizualna kropka mniejsza, hit-box większy — dotyk) */
.vtx .hit, .sprk .hit, .rot-handle .hit { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.arealbl {
  background: rgba(33,39,72,.85); color: #fff; border: 0; box-shadow: none;
  font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums;
  padding: 3px 8px; border-radius: 6px;
}
.arealbl::before { display: none; }

/* Etykiety długości dominujących boków obszaru */
.edgelbl-wrap { background: none; border: 0; }
.edgelbl {
  display: inline-block; transform: translate(-50%, -50%); white-space: nowrap;
  background: rgba(254,254,254,.92); color: var(--navy); border: 1px solid var(--line-2);
  font-weight: 700; font-size: 11px; font-variant-numeric: tabular-nums;
  padding: 1px 6px; border-radius: 5px; box-shadow: 0 1px 2px rgba(0,0,0,.25);
}

/* Karta zraszacza w popupie mapy */
.sprk-popup .leaflet-popup-content-wrapper { border-radius: 12px; }
.sprk-popup .leaflet-popup-content { margin: 0; width: min(244px, calc(100vw - 48px)) !important; }
.spop { display: block; }
.spop-photo {
  width: 100%; height: 150px; border-radius: 11px 11px 0 0; overflow: hidden;
  background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
}
.spop-img { width: 100%; height: 100%; object-fit: contain; padding: 10px; display: block; }
.spop-name { font-weight: 700; color: var(--navy); font-size: 15px; margin: 11px 13px 0; }
.spop-sub { font-size: 11.5px; color: var(--muted); margin: 2px 13px 0; }
.spop-specs { list-style: none; margin: 9px 13px 12px; padding: 9px 0 0; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.spop-specs li { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.spop-specs span { color: var(--muted); }
.spop-specs b { color: var(--navy); font-variant-numeric: tabular-nums; }
/* gdy brak zdjęcia (onerror usuwa img) — schowaj pusty banner */
.spop-photo:empty { display: none; }

/* ----- Filtry-intencje (chipy pod nagłówkiem panelu) ----- */
.propfilters {
  display: flex; gap: 7px; padding: 11px 16px; overflow-x: auto; flex: 0 0 auto;
  border-bottom: 1px solid var(--line); background: var(--white); scrollbar-width: thin;
}
.propfilters .chip {
  flex: 0 0 auto; border: 1px solid var(--line-2); background: var(--white); color: var(--navy);
  border-radius: 999px; padding: 6px 13px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  font-family: inherit; white-space: nowrap; transition: background .13s, border-color .13s, color .13s;
}
.propfilters .chip:hover { background: var(--surface); border-color: var(--cyan); }
.propfilters .chip.active { background: var(--cyan); border-color: var(--cyan); color: #fff; }

/* ----- Wyniki / propozycje ----- */
.results { flex: 1; overflow-y: auto; padding: 16px; display: grid; gap: 11px; align-content: start; }
.prop {
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px 15px; cursor: pointer;
  background: var(--white); transition: border-color .15s, background .15s, box-shadow .15s;
}
.prop:hover { border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.prop.active { border-color: var(--cyan); background: var(--cyan-soft); box-shadow: inset 0 0 0 1px var(--cyan); }
.prop .row1 { display: flex; align-items: baseline; gap: 8px; }
.prop .label { font-weight: 700; color: var(--navy); font-size: 14.5px; letter-spacing: .1px; }
.prop .units { margin-left: auto; font-weight: 700; color: var(--cyan-d); font-size: 13px; font-variant-numeric: tabular-nums; }
.prop .tag { font-size: 11.5px; color: var(--muted); line-height: 1.4; margin-top: 3px; }
.prop .pick { font-size: 13px; margin: 8px 0 6px; line-height: 1.55; color: #41485c; }
.prop .pick b { color: var(--navy); font-weight: 600; }
.prop .meta {
  font-size: 11.5px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap;
  font-variant-numeric: tabular-nums; padding-top: 2px;
}
.prop .bar { height: 5px; border-radius: 3px; background: var(--line); margin-top: 10px; overflow: hidden; }
.prop .bar > span { display: block; height: 100%; background: var(--cyan); }
.disclaimer { font-size: 11px; color: #8a90a0; line-height: 1.5; padding-top: 4px; }
.disclaimer b { color: var(--muted); font-weight: 600; }

/* ----- Loader ----- */
#loader {
  position: absolute; inset: 0; z-index: 1000; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  background: rgba(246,247,250,.78); color: var(--navy); font-weight: 600; font-size: 14px;
}
.spin { width: 34px; height: 34px; border: 3px solid #cfe9f3; border-top-color: var(--cyan); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.leaflet-control-attribution { font-size: 10px; opacity: .75; }

/* ----- Tryb ręczny ----- */
.manual { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 11px; }
.mfull { width: 100%; }
.mstats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.mstat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 9px 11px; }
.mstat b { display: block; font-size: 18px; color: var(--navy); font-weight: 700; font-variant-numeric: tabular-nums; }
.mstat span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.mhint { font-size: 12px; color: var(--muted); line-height: 1.45; }
.mhint b { color: var(--navy); font-weight: 600; }
.psec {
  font-size: 10.5px; font-weight: 700; color: #97a0b1; text-transform: uppercase;
  letter-spacing: .7px; margin-top: 8px; padding-bottom: 3px; border-bottom: 1px solid var(--line);
}
.mpalette { display: flex; flex-direction: column; gap: 5px; }
.palp { font-size: 11.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 10px; line-height: 1.4; margin-bottom: 2px; }
.palp b { color: var(--navy); }
.pitem {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; background: var(--white);
  transition: border-color .13s, background .13s;
}
.pitem:hover { border-color: var(--line-2); background: var(--surface); }
.pitem.active { border-color: var(--cyan); background: var(--cyan-soft); box-shadow: inset 0 0 0 1px var(--cyan); }
.pitem .sw, .prow .sw { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 0 0 1px rgba(28,33,54,.12); }
/* Zdjęcia produktów (web/img/<SKU>.png) */
.thumb { width: 38px; height: 38px; border-radius: 8px; object-fit: contain; background: var(--surface); border: 1px solid var(--line); flex: 0 0 auto; padding: 2px; }
.thumb-sm { width: 26px; height: 26px; border-radius: 6px; object-fit: contain; background: var(--surface); border: 1px solid var(--line); vertical-align: middle; flex: 0 0 auto; }
.prop .pline { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.prop .pline .q { color: var(--navy); font-weight: 700; }
.thumb-pop { width: 48px; height: 48px; border-radius: 8px; object-fit: contain; background: var(--surface); border: 1px solid var(--line); float: left; margin: 0 9px 3px 0; padding: 2px; }
.pitem .pn, .prow .pn { font-weight: 600; font-size: 13px; color: var(--navy); }
/* Kod produktu (SKU) — mały monospace chip, do zamówień */
.code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 11px; font-weight: 600; color: var(--cyan-d);
  background: var(--cyan-soft); border: 1px solid #cdeaf5; border-radius: 4px;
  padding: 1px 5px; letter-spacing: .2px; white-space: nowrap; flex: 0 0 auto;
}
.prop .pick .code { font-size: 11.5px; }
.pitem .pd { font-size: 11px; color: var(--muted); margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mplaced { display: flex; flex-direction: column; gap: 4px; }
.mplaced .empty { font-size: 12px; color: #97a0b1; line-height: 1.45; padding: 4px 0; }
.prow { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 5px 2px; }
.prow small { color: var(--muted); }
.prow .act { margin-left: auto; display: flex; gap: 5px; }
.prow .act button {
  border: 1px solid var(--line); background: var(--white); color: var(--muted);
  border-radius: 6px; padding: 5px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: background .13s, border-color .13s, color .13s;
}
.prow .act button:hover { background: var(--surface); color: var(--navy); border-color: var(--line-2); }
.prow .act button .ic { width: 14px; height: 14px; }

.manual-mode .leaflet-container { cursor: crosshair; }

.popdel {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--danger-soft); background: var(--white); color: var(--danger);
  border-radius: 6px; padding: 6px 11px; cursor: pointer; font-weight: 600; font-size: 12.5px;
  font-family: inherit; margin-top: 6px;
}
.popdel:hover { background: #fdf3f2; }
.popdel .ic { width: 14px; height: 14px; }

/* ----- Obrót prostokąta ----- */
.grot { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.grot button {
  border: 1px solid var(--line); background: var(--white); color: var(--navy);
  border-radius: 6px; width: 34px; height: 30px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: background .13s, border-color .13s;
}
.grot button:hover { background: var(--surface); border-color: var(--line-2); }
.grot .rotval { font-weight: 700; color: var(--navy); min-width: 38px; text-align: center; font-variant-numeric: tabular-nums; }
.rot-handle { cursor: grab; }
.rot-handle:active { cursor: grabbing; }

/* ----- Desktop / dotyk ----- */
body.is-desktop #addBtn { display: none !important; }    /* na desktopie klikasz wprost na mapie */
/* Celownik: tylko dotyk i tylko w trybie wskazywania (rysowanie / ręczne / źródło) —
   wcześniej wisiał na środku mapy przez całą sesję i mylił. */
#crosshair { display: none; }
body.is-touch #app.drawing #crosshair,
body.is-touch #app.manual-mode #crosshair,
body.is-touch #app.app-placing-source #crosshair { display: block; }

/* ----- Mobile: split = stos (mapa góra / wyliczenia dół) ----- */
@media (max-width: 760px) {
  #app { flex-direction: column; }
  #sidebar { width: 100% !important; max-width: none; min-height: 0; box-shadow: 0 -8px 28px rgba(28,33,54,.14); transition: flex-basis .42s var(--ease-drawer); }
  #app.split #mapWrap { flex: 0 0 46%; min-height: 0; }
  #app.split #sidebar { flex-basis: 54%; width: 100% !important; }
  #app:not(.split) #sidebar { flex-basis: 0; }
  #app.split .results, #app.split .manual { min-height: 0; } /* przewijanie wewnątrz panelu */
  #searchPanel { left: calc(56px + env(safe-area-inset-left)); right: calc(12px + env(safe-area-inset-right)); width: auto; }
  #dock { max-width: calc(100% - 16px); }
  #bottombar { flex-wrap: wrap; justify-content: center; border-radius: 22px; }
  #bottombar .dsep { display: none; } /* pionowe separatory rozłażą się przy zawijaniu */
}

/* ----- Dotyk: cele dotykowe ~44px (palec, nie kursor) ----- */
@media (pointer: coarse) {
  .tbtn { width: 44px; height: 44px; }
  .dbtn { width: 44px; height: 44px; }
  #searchForm button { width: 44px; height: 44px; }
  .dseg .seg-btn { padding: 9px 13px; }
  .dbtn-cta { padding: 11px 16px; }
  .dbtn-ghost { padding: 10px 15px; }
  .grot button { width: 44px; height: 42px; }
  .prow .act button { padding: 9px; }
  .popdel { padding: 9px 13px; }
  .propfilters .chip { padding: 9px 15px; }
  .pitem { padding: 11px 12px; }
}

/* ----- Telefon w poziomie (niski ekran): wróć do układu obok siebie ----- */
@media (max-width: 900px) and (max-height: 480px) and (orientation: landscape) {
  #app { flex-direction: row; }
  #app.split #mapWrap { flex: 1 1 auto; min-height: 0; }
  #app.split #sidebar { flex-basis: 56%; width: 56% !important; max-width: 460px; box-shadow: -8px 0 28px rgba(28,33,54,.14); }
}

/* ----- Dostępność: szanuj prefers-reduced-motion ----- */
/* Usuwamy ruch (transformy/przesunięcia), zostawiamy opacity/kolor dla zrozumiałości. */
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; }
  #sidebar { transition: none !important; }
  .tbtn:active, .dbtn:active, .btn:active, .dbtn-cta:active { transform: none !important; }
  .spin { animation-duration: 1s; }
}
