:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #111827; --muted: #6b7280; --line: #e5e7eb;
  --brand: #0f766e; --brand-2: #14b8a6; --brand-ink: #ffffff;
  --cash: #16a34a; --nocash: #dc2626; --queue: #f59e0b; --broken: #374151;
  --shadow: 0 10px 30px rgba(17, 24, 39, .12), 0 2px 6px rgba(17, 24, 39, .06);
  --r: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b1210; --panel: #111a18; --ink: #e5e7eb; --muted: #9ca3af; --line: #1f2b28; --broken: #9ca3af;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5); }
  .leaflet-tile-pane { filter: brightness(.82) contrast(1.05) saturate(.85); }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { display: flex; flex-direction: column; overflow: hidden; }
a { color: var(--brand); }
button { font: inherit; cursor: pointer; }

.top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--panel);
  border-bottom: 1px solid var(--line); z-index: 1000; position: relative; }
.logo { display: flex; align-items: center; gap: 8px; color: var(--brand); text-decoration: none; font-size: 20px; letter-spacing: -.02em; }
.logo span { color: var(--ink); font-weight: 600; } .logo b { color: var(--brand); }
.search { position: relative; flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; color: var(--muted); }
.search:focus-within { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(20, 184, 166, .18); }
.search input { flex: 1; border: 0; background: transparent; color: var(--ink); font-size: 15px; padding: 10px 0; outline: none; min-width: 0; }
.sugg { position: absolute; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); z-index: 2000; }
.sugg li { padding: 9px 12px; border-radius: 8px; cursor: pointer; color: var(--ink); }
.sugg li.on, .sugg li:hover { background: var(--bg); }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); padding: 9px 14px; border-radius: 999px; white-space: nowrap; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: #0d6961; }
.live { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; }
.live.on i { background: var(--cash); box-shadow: 0 0 0 0 rgba(22, 163, 74, .6); animation: pulse 2s infinite; }
.live span::after { content: " на карте"; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.55); } 70% { box-shadow: 0 0 0 8px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }

.wrap { flex: 1; position: relative; display: flex; min-height: 0; }
#map { flex: 1; min-width: 0; background: #e8ecef; }
.panel { width: 340px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 900; }
.grip { display: none; }
.tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; background: none; border: 0; padding: 10px 6px; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--brand); }
.tabs em { font-style: normal; background: var(--nocash); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 6px; margin-left: 4px; }
.tab { display: none; padding: 14px 16px; overflow: auto; flex: 1; }
.tab.on { display: block; }
.tab h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.stats { font-size: 13px; color: var(--muted); background: var(--bg); padding: 10px 12px; border-radius: 10px; }
.stats b { color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 999px; padding: 5px 10px; font-size: 13px; }
.chip i { width: 10px; height: 10px; border-radius: 50%; }
.chip small { color: var(--muted); }
.chip.on { border-color: var(--brand); background: rgba(15, 118, 110, .08); }
.tgl { display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; font-size: 14px; }
.tgl input { display: none; }
.tgl span { width: 34px; height: 20px; border-radius: 999px; background: var(--line); position: relative; transition: .2s; flex: none; }
.tgl span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.tgl input:checked + span { background: var(--brand); }
.tgl input:checked + span::after { left: 16px; }
.legend { margin-top: 10px; font-size: 14px; }
.legend div { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.legend p, .hint { color: var(--muted); font-size: 13px; line-height: 1.45; }
.d { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.d.cash { background: var(--cash); } .d.nocash { background: var(--nocash); } .d.queue { background: var(--queue); } .d.broken { background: var(--broken); }
.feed, .near { list-style: none; margin: 0; padding: 0; }
.feed li, .near li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 8px; border-radius: 10px; cursor: pointer; }
.feed li:hover, .near li:hover { background: var(--bg); }
.feed li.new { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: rgba(20, 184, 166, .22); } to { background: transparent; } }
.feed .d, .near .d { margin-top: 4px; }
.feed b, .near b { display: block; font-weight: 600; font-size: 14px; }
.feed small, .near small { color: var(--muted); font-size: 12.5px; }
.near .dist { margin-left: auto; color: var(--brand); font-weight: 600; font-size: 13px; white-space: nowrap; }
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 30px 10px; }
.foot { padding: 10px 16px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.foot a { color: var(--muted); }

/* маркеры */
.m-atm { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35);
  display: grid; place-items: center; transition: transform .15s; }
.m-atm::after { content: ""; width: 8px; height: 5px; border-radius: 1px; background: rgba(255,255,255,.9); }
.m-atm.st { outline: 3px solid var(--sc); outline-offset: 1px; }
.m-atm.ping { animation: ping 1.4s ease-out 2; }
@keyframes ping { 0% { transform: scale(1); } 30% { transform: scale(1.6); } 100% { transform: scale(1); } }
.m-cl { border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px;
  background: radial-gradient(circle at 35% 30%, #2dd4bf, #0f766e); box-shadow: 0 0 0 5px rgba(20,184,166,.25), 0 2px 6px rgba(0,0,0,.25); }
.m-me { width: 16px; height: 16px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(37,99,235,.25); }

/* карточка банкомата */
.card { position: absolute; right: 16px; top: 16px; width: 360px; max-height: calc(100% - 32px); overflow: auto; background: var(--panel);
  border-radius: var(--r); box-shadow: var(--shadow); z-index: 1100; }
.card .x { position: absolute; right: 10px; top: 8px; border: 0; background: rgba(255,255,255,.25); color: #fff; width: 30px; height: 30px; border-radius: 50%; font-size: 20px; line-height: 1; }
.card-h { padding: 18px 18px 14px; color: #fff; border-radius: var(--r) var(--r) 0 0; }
.card-h small { opacity: .85; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.card-h h2 { margin: 4px 0 2px; font-size: 20px; }
.card-h p { margin: 0; opacity: .92; font-size: 14px; }
.card-b { padding: 14px 18px 18px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tags span { font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; }
.row { display: flex; gap: 8px; font-size: 14px; padding: 4px 0; color: var(--ink); }
.row b { color: var(--muted); font-weight: 500; min-width: 64px; }
.status { margin: 14px 0 10px; padding: 12px; border-radius: 12px; background: var(--bg); font-size: 14px; display: flex; gap: 10px; align-items: center; }
.status.cash { background: rgba(22,163,74,.1); } .status.nocash { background: rgba(220,38,38,.1); }
.status.queue { background: rgba(245,158,11,.14); } .status.broken { background: rgba(55,65,81,.12); }
.status small { display: block; color: var(--muted); }
.ask { font-size: 13px; color: var(--muted); margin: 14px 0 8px; }
.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.acts button { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 10px; padding: 10px; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.acts button:hover { border-color: var(--brand-2); }
.acts button:disabled { opacity: .5; cursor: default; }
.hist { list-style: none; padding: 0; margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.hist li { display: flex; gap: 8px; align-items: center; padding: 3px 0; }
.route { display: inline-block; margin-top: 12px; font-size: 14px; }

.conn { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: var(--ink); color: var(--panel);
  padding: 7px 14px; border-radius: 999px; font-size: 13px; z-index: 1200; }
.toast { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--panel);
  padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 1200; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: 11px; }

@media (max-width: 760px) {
  .top { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .logo span { display: none; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .live span::after { content: ""; }
  .btn.primary span { display: none; }
  .wrap { display: block; }
  #map { position: absolute; inset: 0; }
  .panel { position: absolute; left: 0; right: 0; bottom: 0; width: auto; height: 46%; border-right: 0; border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0; box-shadow: var(--shadow); transition: height .25s; }
  .panel.min { height: 58px; }
  .panel.min .tab, .panel.min .foot { display: none; }
  .grip { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; cursor: pointer; }
  .tabs { padding-top: 2px; }
  .card { left: 10px; right: 10px; top: auto; bottom: 10px; width: auto; max-height: 72%; }
}
