:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #1c1c1e);
  --hint: var(--tg-theme-hint-color, #8a8a8e);
  --card: var(--tg-theme-secondary-bg-color, #f2f2f7);
  --accent: var(--tg-theme-button-color, #2ea6ff);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --green: #1db954;
  --orange: #f5a623;
  --red: #e53935;
  --gray: #9e9e9e;
}

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

.card {
  background: var(--bg);
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,.16);
}

/* Легенда */
#legend {
  position: absolute; top: 10px; left: 10px; z-index: 600;
  padding: 8px 10px; font-size: 12px; line-height: 1.7;
}
.legend-row { display: flex; align-items: center; gap: 7px; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }

/* Кнопка геолокации */
.fab {
  position: absolute; right: 14px; bottom: 24px; z-index: 600;
  width: 50px; height: 50px; border-radius: 25px; border: none;
  background: var(--bg); color: var(--text);
  box-shadow: 0 4px 16px rgba(0,0,0,.22);
  font-size: 22px; cursor: pointer;
}
.fab:active { transform: scale(.94); }

/* Маркеры */
.pin {
  width: 26px; height: 26px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); border: 2px solid #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,.35);
}
.me-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: #2ea6ff; border: 3px solid #fff; box-shadow: 0 0 0 4px rgba(46,166,255,.3);
}

/* Нижний лист */
.overlay { position: absolute; inset: 0; background: rgba(0,0,0,.35); z-index: 700; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 800;
  background: var(--bg); border-radius: 18px 18px 0 0;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 86vh; overflow-y: auto;
  box-shadow: 0 -4px 24px rgba(0,0,0,.2);
  transition: transform .25s ease;
}
.sheet.hidden, .overlay.hidden, .gate.hidden, #legend.hidden { display: none; }
.sheet-handle { width: 38px; height: 4px; background: var(--hint); opacity: .4; border-radius: 2px; margin: 6px auto 12px; }

.st-title { font-size: 19px; font-weight: 700; margin: 0 0 2px; }
.st-sub { color: var(--hint); font-size: 13px; margin: 0 0 12px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; color: #fff; font-size: 13px; font-weight: 600; }

.fuel-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.fuel-item { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; background: var(--card); border-radius: 10px; }
.fuel-item .name { font-weight: 600; }
.fuel-item .state { font-size: 13px; font-weight: 600; }
.fuel-item .price { color: var(--hint); font-size: 13px; margin-left: 8px; }

.muted { color: var(--hint); font-size: 13px; }

/* Кнопки */
.btn {
  display: block; width: 100%; padding: 13px; border-radius: 12px;
  font-size: 16px; font-weight: 600; border: none; cursor: pointer;
  text-align: center; text-decoration: none; margin-top: 10px;
}
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn:active { opacity: .8; }

/* Форма отметки */
.report-fuel { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.report-fuel .fname { width: 64px; font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--hint); border-radius: 9px; overflow: hidden; }
.seg button { border: none; background: transparent; color: var(--text); padding: 7px 12px; font-size: 14px; cursor: pointer; }
.seg button.active[data-v="yes"] { background: var(--green); color: #fff; }
.seg button.active[data-v="no"] { background: var(--red); color: #fff; }
.seg button.active[data-v="skip"] { background: var(--hint); color: #fff; }
.price-input, .queue-select, .comment-input {
  border: 1px solid var(--hint); border-radius: 9px; padding: 8px 10px;
  font-size: 15px; background: var(--bg); color: var(--text);
}
.price-input { width: 80px; }
.price-input.hidden { display: none; }
.queue-select, .comment-input { width: 100%; margin-top: 8px; }
.section-label { font-size: 13px; color: var(--hint); margin: 16px 0 6px; }

/* Гейт */
.gate { position: absolute; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
.gate-card { padding: 28px 22px; text-align: center; max-width: 340px; width: 100%; }
.gate-emoji { font-size: 44px; }
.gate-card h2 { margin: 10px 0 6px; }
.gate-card p { color: var(--hint); margin: 0 0 18px; }

.toast {
  position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: rgba(0,0,0,.85); color: #fff; padding: 10px 16px; border-radius: 10px;
  z-index: 1100; font-size: 14px; max-width: 90%; text-align: center;
}
