:root {
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --black: #64748b;
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #111827);
  --hint: var(--tg-theme-hint-color, #6b7280);
  --card: var(--tg-theme-secondary-bg-color, #f3f4f6);
  --accent: var(--tg-theme-button-color, #2563eb);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; font-family: -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
#map { position: absolute; inset: 0; }

#topbar {
  position: absolute; top: 8px; left: 8px; right: 8px; z-index: 1000;
  display: flex; flex-direction: column; gap: 6px;
}
#search { display: flex; gap: 6px; }
#search input {
  flex: 1; min-width: 0; border: none; border-radius: 18px; padding: 10px 14px;
  font-size: 15px; background: var(--bg); color: var(--text);
  box-shadow: 0 1px 6px rgba(0,0,0,.18);
}
#search button {
  flex: 0 0 auto; border: none; border-radius: 18px; padding: 0 16px;
  background: var(--accent); color: var(--accent-text); font-weight: 600; font-size: 14px;
  box-shadow: 0 1px 6px rgba(0,0,0,.18); cursor: pointer;
}
#filters {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 0;
}
.f-btn {
  flex: 0 0 auto; border: none; border-radius: 18px; padding: 8px 14px;
  background: var(--card); color: var(--text); font-size: 14px; font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,.15); cursor: pointer;
}
.f-btn.active { background: var(--accent); color: var(--accent-text); }

#locate {
  position: absolute; right: 12px; bottom: 24px; z-index: 1000;
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: var(--bg); font-size: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.25); cursor: pointer;
}

#overlay { position: absolute; inset: 0; z-index: 1100; background: rgba(0,0,0,.35); }
#card {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1200;
  background: var(--bg); border-radius: 18px 18px 0 0; padding: 16px 16px 24px;
  box-shadow: 0 -4px 24px rgba(0,0,0,.25); max-height: 80%; overflow-y: auto;
  transform: translateY(0); transition: transform .2s ease;
}
#card.hidden, #overlay.hidden { display: none; }

.card-title { font-size: 18px; font-weight: 700; margin: 0 0 2px; }
.card-sub { color: var(--hint); font-size: 13px; margin: 0 0 10px; }
.fuel-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--card); font-size: 15px; }
.fuel-row .st-ok { color: var(--green); font-weight: 600; }
.fuel-row .st-no { color: var(--red); font-weight: 600; }
.fuel-row .st-un { color: var(--hint); }
.meta { color: var(--hint); font-size: 13px; margin: 10px 0; line-height: 1.5; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.green { background: var(--green);} .dot.yellow{background: var(--yellow);} .dot.red{background: var(--red);} .dot.black{background: var(--black);}

.btn { display: block; width: 100%; border: none; border-radius: 12px; padding: 13px; margin-top: 8px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-ghost { background: var(--card); color: var(--text); }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.grid .btn { margin-top: 0; }
.toast { position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.85); color:#fff; padding:10px 16px; border-radius: 20px; z-index: 1300; font-size: 14px; }
.toast.hidden { display: none; }

/* Маркеры АЗС на Яндекс.Карте */
.pin {
  width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.4); cursor: pointer; box-sizing: border-box;
  transform: translate(-50%, -50%);
}
.pin.green { background: var(--green); }
.pin.yellow { background: var(--yellow); }
.pin.red { background: var(--red); }
.pin.black { background: var(--black); }
.pin.search { background: #2563eb; width: 20px; height: 20px; }
.cluster {
  min-width: 34px; height: 34px; padding: 0 8px; border-radius: 17px;
  background: #2563eb; color: #fff; border: 2.5px solid #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; cursor: pointer;
  box-shadow: 0 1px 5px rgba(0,0,0,.4); transform: translate(-50%, -50%);
}
