/* ============================================================
   Наличие топлива — карта АЗС
   Сине-белая (светлая) и серо-синяя (тёмная) темы.
   ============================================================ */

:root {
  --brand:        #2563EB;   /* синий */
  --brand-deep:   #1D4ED8;
  --brand-light:  #60A5FA;

  --ok:      #16A34A;   /* есть топливо */
  --ok-bg:   #DCFCE7;
  --stale:   #D97706;   /* данные устарели */
  --stale-bg:#FEF3C7;
  --none:    #94A3B8;   /* нет данных */
  --none-bg: #EDF1F8;
  --danger:  #DC2626;
  --danger-bg: #FEE2E2;

  --ink:     #0F172A;   /* slate-900 */
  --muted:   #64748B;   /* slate-500 */
  --line:    #E3E9F2;

  --panel:      rgba(255, 255, 255, 0.86);
  --panel-solid:#FFFFFF;
  --panel-line: rgba(226, 232, 240, 0.9);
  --shadow:     0 10px 30px rgba(30, 58, 138, 0.13);
  --shadow-sm:  0 4px 14px rgba(15, 23, 42, 0.08);

  --radius:   18px;
  --radius-sm:12px;

  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --sheet-peek:  72px;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand:      #5B9CFF;
  --brand-deep: #3B82F6;
  --brand-light:#7DB0FF;

  --ok:      #34D399;  --ok-bg:   #0E3A24;
  --stale:   #FBBF24;  --stale-bg:#3A2C0C;
  --none:    #7C8AA5;  --none-bg: #22304A;
  --danger:  #F87171;  --danger-bg: #3A1A1E;

  --ink:     #E7EDF7;
  --muted:   #93A1B8;
  --line:    rgba(148, 163, 184, 0.16);

  --panel:      rgba(20, 29, 46, 0.82);   /* серо-синее стекло */
  --panel-solid:#151E2F;                  /* slate-800 blue */
  --panel-line: rgba(148, 163, 184, 0.14);
  --shadow:     0 12px 40px rgba(0, 0, 0, 0.5);
  --shadow-sm:  0 4px 16px rgba(0, 0, 0, 0.38);
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* Атрибут hidden должен скрывать элемент всегда.
   Без этого любое правило вида `display: flex` перебивает hidden,
   и «скрытый» блок остаётся на экране. */
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

#map {
  position: absolute; inset: 0;
  background: #E8EEF6;
  z-index: 0;
}
:root[data-theme="dark"] #map { background: #0E1626; }
/* тёмные тайлы приподнимаем до серо-синего, не чёрного */
:root[data-theme="dark"] .leaflet-tile-pane { filter: brightness(1.12) contrast(0.92) saturate(1.15); }

/* ------------------------------ Top bar ------------------------------ */
.topbar {
  position: fixed; z-index: 600;
  top: calc(12px + var(--safe-top)); left: 12px; right: 12px;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 8px; padding-left: 4px; flex-shrink: 0; }
.brand-mark { width: 28px; height: 28px; filter: drop-shadow(0 3px 6px rgba(29,78,216,0.35)); }
.brand-name { font-size: 16px; font-weight: 750; letter-spacing: -0.3px; }

.search {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 7px;
  padding: 0 12px; height: 42px;
  background: var(--none-bg);
  border-radius: 12px;
  border: 1px solid transparent;
  transition: border-color .15s, background .15s;
}
.search:focus-within { border-color: var(--brand-light); background: var(--panel-solid); }
.search-ico { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.search input {
  flex: 1; min-width: 0; border: none; background: transparent; outline: none;
  font-size: 15px; color: var(--ink);
}
.search input::placeholder { color: var(--muted); }

.icon-btn {
  flex-shrink: 0;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-solid);
  color: var(--muted);
  cursor: pointer;
  transition: transform .12s, color .15s, border-color .15s, background .15s;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { color: var(--brand); border-color: var(--brand-light); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.active { color: #fff; background: var(--brand); border-color: var(--brand); }

/* ------------------------------ Filters (один ряд: топливо + «ещё») ------------------------------ */
.filters {
  position: fixed; z-index: 590;
  top: calc(74px + var(--safe-top)); left: 12px; right: 12px;
  display: flex; align-items: center; gap: 8px;
  pointer-events: none;
}
.chips {
  pointer-events: auto; flex: 1; min-width: 0;
  display: flex; gap: 8px; overflow-x: auto;
  padding: 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent);
          mask-image: linear-gradient(90deg, #000 90%, transparent);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 8px 15px; border-radius: 999px;
  border: 1px solid var(--panel-line); background: var(--panel);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
  font-size: 13.5px; font-weight: 600; color: var(--ink);
  cursor: pointer; white-space: nowrap;
  transition: transform .12s, background .15s, color .15s;
}
.chip:active { transform: scale(0.95); }
.chip.active { background: var(--brand); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(37,99,235,0.38); }

.filter-btn {
  pointer-events: auto; position: relative; flex-shrink: 0;
  width: 42px; height: 42px; display: grid; place-items: center;
  border: 1px solid var(--panel-line); border-radius: 12px;
  background: var(--panel); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm); color: var(--muted); cursor: pointer;
  transition: transform .12s, color .15s;
}
.filter-btn svg { width: 20px; height: 20px; }
.filter-btn:active { transform: scale(0.94); }
.filter-btn.active { color: var(--brand); }
.filter-dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 2px var(--panel-solid); }

/* ------------------------------ Локация (FAB на карте) ------------------------------ */
.map-fab {
  position: fixed; z-index: 500;
  right: 14px; bottom: calc(var(--sheet-peek) + 24px + var(--safe-bottom));
  width: 46px; height: 46px; display: grid; place-items: center;
  border: 1px solid var(--panel-line); border-radius: 14px;
  background: var(--panel-solid); color: var(--muted); cursor: pointer;
  box-shadow: var(--shadow); transition: transform .12s, color .15s, background .15s;
}
.map-fab svg { width: 22px; height: 22px; }
.map-fab:active { transform: scale(0.93); }
.map-fab.active { color: #fff; background: var(--brand); border-color: var(--brand); }

/* ------------------------------ Шторка фильтров ------------------------------ */
.fsheet-backdrop { position: fixed; inset: 0; z-index: 720; background: rgba(15,23,42,0.42); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); animation: fade .2s ease; }
.fsheet {
  position: fixed; z-index: 721; left: 0; right: 0; bottom: 0;
  background: var(--panel-solid); border-radius: 22px 22px 0 0;
  box-shadow: 0 -16px 50px rgba(15,23,42,0.3);
  padding: 8px 18px calc(18px + var(--safe-bottom));
  animation: slideup .28s cubic-bezier(.3,.9,.3,1);
}
.fsheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 6px auto 12px; }
.fsheet-title { font-size: 17px; font-weight: 750; letter-spacing: -0.3px; margin-bottom: 14px; }
.fsheet-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.fsheet-field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.select-wrap { position: relative; }
.select-wrap::after {
  content: ""; position: absolute; right: 15px; top: 50%;
  width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
#brand-select {
  width: 100%; height: 48px; padding: 0 34px 0 15px;
  border-radius: 13px; border: 1px solid var(--line); background: var(--none-bg);
  font-size: 15px; font-weight: 600; color: var(--ink);
  appearance: none; -webkit-appearance: none; cursor: pointer;
}
.fsheet-toggle {
  width: 100%; display: flex; align-items: center; gap: 10px;
  height: 50px; padding: 0 16px; margin-bottom: 16px;
  border-radius: 13px; border: 1.5px solid var(--line); background: var(--panel-solid);
  font-size: 15px; font-weight: 650; color: var(--ink); cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.fsheet-toggle .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--none); }
.fsheet-toggle[aria-pressed="true"] { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.fsheet-toggle[aria-pressed="true"] .dot { background: var(--ok); }
.fsheet-apply {
  width: 100%; height: 52px; border: none; border-radius: 14px; cursor: pointer;
  background: var(--brand); color: #fff; font-size: 16px; font-weight: 700;
  box-shadow: 0 8px 20px rgba(37,99,235,0.35);
}
.fsheet-apply:active { transform: scale(0.99); }

/* ------------------------------ Legend ------------------------------ */
.legend {
  position: fixed; z-index: 500; bottom: calc(18px + var(--safe-bottom)); left: 12px;
  display: none; gap: 14px;
  padding: 9px 14px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--panel-line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  font-size: 12.5px; color: var(--muted);
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 11px; height: 11px; border-radius: 50%; }
.sw.ok { background: var(--ok); } .sw.stale { background: var(--stale); } .sw.none { background: var(--none); }

/* ------------------------------ Sheet / list ------------------------------ */
.sheet-dim {
  position: fixed; inset: 0; z-index: 549;
  background: rgba(15, 23, 42, 0.34);
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease;
}
.sheet-dim.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed; z-index: 550;
  left: 0; right: 0; bottom: 0;
  background: var(--panel-solid);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -12px 40px rgba(24,20,60,0.18);
  transform: translateY(calc(100% - var(--sheet-peek) - var(--safe-bottom)));
  transition: transform .34s cubic-bezier(.4,.9,.3,1);
  max-height: 78vh;
  display: flex; flex-direction: column;
  border-top: 1px solid var(--line);
}
.sheet.open { transform: translateY(0); }
.sheet-handle {
  all: unset;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 10px 16px 12px;
  cursor: grab; flex-shrink: 0;
  touch-action: none;   /* чтобы drag ручки не перехватывался прокруткой */
}
.sheet-handle:active { cursor: grabbing; }
.grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.summary { font-size: 14px; font-weight: 600; color: var(--ink); display: flex; gap: 10px 12px; align-items: center; flex-wrap: wrap; justify-content: center; }
.summary b { font-weight: 700; }
.summary .s-ok { color: var(--ok); } .summary .s-stale { color: var(--stale); } .summary .s-none { color: var(--none); }
.summary .s-live { color: var(--ok); font-weight: 700; }
.summary .s-demo { color: var(--stale); font-weight: 700; }

.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 12px calc(16px + var(--safe-bottom)); }
.list { display: flex; flex-direction: column; gap: 8px; }

.card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--panel-solid);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform .12s, border-color .15s, box-shadow .15s;
}
.card:hover { border-color: var(--brand-light); box-shadow: var(--shadow-sm); }
.card:active { transform: scale(0.99); }
.card.selected { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(107,91,230,0.25); }

.card-status { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 3px var(--none-bg); }
.card-status.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.card-status.stale { background: var(--stale); box-shadow: 0 0 0 3px var(--stale-bg); }
.card-status.none { background: var(--none); box-shadow: 0 0 0 3px var(--none-bg); }

.card-main { flex: 1; min-width: 0; }
.card-title { font-size: 14.5px; font-weight: 650; letter-spacing: -0.1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.card-fuels { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.fbadge { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; letter-spacing: 0.2px; }
.fbadge.ok { color: var(--ok); background: var(--ok-bg); }
.fbadge.stale { color: var(--stale); background: var(--stale-bg); }
.fbadge.none { color: var(--none); background: var(--none-bg); }
.card-right { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.card-dist { font-size: 12px; font-weight: 700; color: var(--brand); }
.card-fresh { font-size: 11px; color: var(--muted); white-space: nowrap; }

.list-empty { text-align: center; color: var(--muted); font-size: 14px; padding: 40px 20px; }

/* ------------------------------ Detail ------------------------------ */
.detail-backdrop {
  position: fixed; inset: 0; z-index: 700;
  background: rgba(15,12,40,0.42);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
.detail {
  position: fixed; z-index: 701;
  left: 0; right: 0; bottom: 0;
  background: var(--panel-solid);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -16px 50px rgba(24,20,60,0.3);
  padding: 8px 18px calc(20px + var(--safe-bottom));
  max-height: 82vh; overflow-y: auto;
  animation: slideup .3s cubic-bezier(.3,.9,.3,1);
}
@keyframes slideup { from { transform: translateY(100%); } }
.detail .d-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 6px auto 14px; }
.d-head { display: flex; align-items: flex-start; gap: 12px; }
.d-badge {
  width: 46px; height: 46px; border-radius: 13px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, var(--brand-light), var(--brand-deep));
  box-shadow: 0 6px 16px rgba(83,70,217,0.35);
}
.d-head-main { flex: 1; min-width: 0; }
.d-title { font-size: 18px; font-weight: 750; letter-spacing: -0.3px; }
.d-addr { font-size: 13px; color: var(--muted); margin-top: 2px; }
.d-close {
  all: unset; cursor: pointer; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; color: var(--muted); background: var(--none-bg); flex-shrink: 0;
}
.d-close:hover { color: var(--ink); }

.d-status {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 14px 0; padding: 8px 14px; border-radius: 12px;
  font-size: 13.5px; font-weight: 650;
}
.d-status.ok { color: var(--ok); background: var(--ok-bg); }
.d-status.stale { color: var(--stale); background: var(--stale-bg); }
.d-status.none { color: var(--none); background: var(--none-bg); }
.d-status .d-fresh { font-weight: 500; opacity: 0.8; }

.d-fuels { display: flex; flex-direction: column; gap: 1px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.frow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--panel-solid); }
.frow + .frow { border-top: 1px solid var(--line); }
.frow-name { font-size: 14.5px; font-weight: 700; width: 62px; flex-shrink: 0; }
.frow-mid { flex: 1; min-width: 0; }
.frow-status { font-size: 13px; font-weight: 650; }
.frow-status.ok { color: var(--ok); } .frow-status.stale { color: var(--stale); } .frow-status.none { color: var(--none); }
.frow-meta { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.frow-limit {
  font-size: 11px; font-weight: 700; color: var(--stale); background: var(--stale-bg);
  padding: 3px 8px; border-radius: 7px; flex-shrink: 0;
}
.frow-ind { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.frow-ind.ok { background: var(--ok); } .frow-ind.stale { background: var(--stale); } .frow-ind.none { background: var(--none); }

.d-actions { display: flex; gap: 10px; margin-top: 16px; }
.d-btn {
  flex: 1; height: 48px; border-radius: 14px; border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 15px; font-weight: 700; text-decoration: none;
}
.d-btn.primary { background: linear-gradient(135deg, var(--brand-light), var(--brand-deep)); color: #fff; box-shadow: 0 8px 20px rgba(83,70,217,0.4); }
.d-btn.ghost { background: var(--none-bg); color: var(--ink); }
.d-btn svg { width: 19px; height: 19px; }

.d-foot { margin-top: 14px; font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; }
.d-src { display: inline-flex; align-items: center; gap: 5px; }
.d-src .src-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }

/* ------------------------------ Краудсорс + статус «нет» ------------------------------ */
.card-status.empty { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.fbadge.empty { color: var(--danger); background: var(--danger-bg); }
.d-status.empty { color: var(--danger); background: var(--danger-bg); }
.frow-status.empty { color: var(--danger); }
.frow-ind.empty { background: var(--danger); }
.summary .s-empty { color: var(--danger); font-weight: 700; }
.sw.empty { background: var(--danger); }

.d-crowd { margin-top: 16px; padding: 14px; border-radius: 14px; background: var(--none-bg); }
.d-crowd-title { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.cv { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 7px; }
.cv.yes { color: var(--ok); background: var(--ok-bg); }
.cv.no { color: var(--danger); background: var(--danger-bg); margin-left: 4px; }
.cv.near { color: var(--brand); background: rgba(37,99,235,.12); margin-left: 4px; }
.cv-empty { font-weight: 600; color: var(--muted); opacity: 0.85; }

.d-vote { display: flex; gap: 10px; }
.vote { flex: 1; height: 46px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--panel-solid); cursor: pointer; font-size: 15px; font-weight: 700; color: var(--ink); transition: transform .12s, border-color .15s, color .15s; }
.vote:active { transform: scale(0.96); }
.vote.yes:hover { border-color: var(--ok); color: var(--ok); }
.vote.no:hover { border-color: var(--danger); color: var(--danger); }
.vote.sent { opacity: 0.55; pointer-events: none; }
.vote.yes.chosen { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.vote.no.chosen { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.mv-yes { color: var(--ok); } .mv-no { color: var(--danger); }

/* ------------------------------ Баннер об обработке данных ------------------------------ */
.consent {
  position: fixed; z-index: 800;
  left: 12px; right: 12px;
  bottom: calc(var(--sheet-peek) + 16px + var(--safe-bottom));   /* над свёрнутым списком */
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  /* без анимации: если она не проигрывается (фон/экономия энергии),
     баннер оставался смещённым и кнопки уезжали за край экрана */
}
.consent-text { flex: 1; min-width: 220px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.consent-text a { color: var(--brand); text-decoration: none; white-space: nowrap; }
.consent-btns { display: flex; gap: 8px; flex-shrink: 0; }
.consent-btn {
  height: 40px; padding: 0 16px; border-radius: 11px; cursor: pointer;
  font-size: 14px; font-weight: 650; white-space: nowrap; border: 1px solid var(--line);
  transition: transform .12s;
}
.consent-btn:active { transform: scale(0.96); }
.consent-btn.primary { background: var(--brand); color: #fff; border-color: transparent; }
.consent-btn.ghost { background: var(--panel-solid); color: var(--muted); }
@media (max-width: 520px) {
  .consent-btns { width: 100%; }
  .consent-btn { flex: 1; }
}
@media (min-width: 860px) {
  .consent { left: auto; right: 16px; bottom: 16px; max-width: 480px; }
}

.toast {
  position: fixed; z-index: 900; left: 50%; top: calc(var(--safe-top) + 70px);
  transform: translateX(-50%) translateY(-10px);
  background: var(--ink); color: var(--panel-solid);
  padding: 10px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 650;
  max-width: calc(100vw - 40px); text-align: center;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------------------------------ Demo badge ------------------------------ */
.demo-badge {
  position: fixed; z-index: 500; top: calc(12px + var(--safe-top)); right: 12px;
  transform: translateY(140px);
  display: none;
}

/* Leaflet marker pulse for selected */
.pulse-ring {
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(107,91,230,0.5);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 16px rgba(107,91,230,0); }
  100% { box-shadow: 0 0 0 0 rgba(107,91,230,0); }
}
.me-marker { width: 18px; height: 18px; border-radius: 50%; background: var(--brand); border: 3px solid #fff; box-shadow: 0 0 0 4px rgba(37,99,235,0.3), 0 3px 8px rgba(0,0,0,0.3); }

/* Точки-маркеры */
.pin { display: block; width: 100%; height: 100%; border-radius: 50%; border: 2px solid #fff; box-sizing: border-box; box-shadow: 0 1px 3px rgba(15,23,42,0.45); }
.pin.ok { background: var(--ok); } .pin.stale { background: var(--stale); } .pin.none { background: var(--none); } .pin.empty { background: var(--danger); }
.pin.sel { box-shadow: 0 0 0 3px rgba(37,99,235,0.5), 0 1px 4px rgba(0,0,0,0.4); }

/* Кластеры */
.cl-wrap { background: transparent !important; }
.cl { width: 100%; height: 100%; border-radius: 50%; position: relative; display: grid; place-items: center; box-shadow: 0 3px 12px rgba(15,23,42,0.28); }
.cl::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: var(--panel-solid); }
.cl-num { position: relative; z-index: 1; font-weight: 750; font-size: 13px; color: var(--ink); }

/* Tidy Leaflet controls */
.leaflet-control-zoom { border: none !important; box-shadow: var(--shadow) !important; border-radius: 14px !important; overflow: hidden; }
.leaflet-right .leaflet-control-zoom { margin-right: 14px; margin-bottom: 16px; }
/* на мобиле зум не нужен (щипок работает) — прячем, чтобы не мешал кнопке локации */
@media (max-width: 859px) { .leaflet-control-zoom { display: none !important; } }
.leaflet-control-zoom a { width: 44px !important; height: 44px !important; line-height: 42px !important; font-size: 20px !important; background: var(--panel-solid) !important; color: var(--ink) !important; border: none !important; }
.leaflet-control-zoom a:hover { background: var(--none-bg) !important; color: var(--brand) !important; }
.leaflet-control-attribution { background: rgba(255,255,255,0.7) !important; font-size: 10px !important; }
:root[data-theme="dark"] .leaflet-control-attribution { background: rgba(20,20,32,0.7) !important; color: #999 !important; }
:root[data-theme="dark"] .leaflet-control-attribution a { color: #aaa !important; }

/* ------------------------------ Desktop ------------------------------ */
@media (min-width: 860px) {
  .topbar { left: 16px; right: auto; width: 380px; }
  .filters { left: 16px; right: auto; width: 380px; top: calc(80px + var(--safe-top)); }
  .select-wrap { max-width: none; }

  .legend { display: flex; left: 412px; right: auto; bottom: 16px; }
  .map-fab { right: 14px; bottom: 132px; }   /* над зумом, ровным столбиком */
  .demo-badge {
    display: block; transform: none;
    padding: 6px 12px; border-radius: 999px;
    background: var(--panel); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border: 1px solid var(--panel-line); box-shadow: var(--shadow-sm);
    font-size: 11.5px; font-weight: 700; color: var(--stale); letter-spacing: 0.3px;
  }
  .demo-badge.is-live { color: var(--ok); }

  /* list becomes a docked left card */
  .sheet {
    left: 16px; right: auto; bottom: 16px;
    top: calc(130px + var(--safe-top));
    width: 380px;
    border-radius: var(--radius);
    transform: none !important;
    max-height: none;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
  }
  .sheet-handle { cursor: default; padding: 14px 16px 8px; align-items: stretch; }
  .grip { display: none; }
  .summary { justify-content: flex-start; }

  .detail {
    left: 412px; right: auto; bottom: 16px; top: auto;
    width: 380px; max-height: calc(100vh - 32px);
    border-radius: var(--radius);
    animation: slideleft .28s cubic-bezier(.3,.9,.3,1);
  }
  @keyframes slideleft { from { transform: translateX(-16px); opacity: 0; } }
  .detail .d-grip { display: none; }
  .detail-backdrop { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
}

@media (min-width: 860px) and (max-width: 1100px) {
  .detail { left: auto; right: 16px; }
}
