:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f2f3f5);
  --fg: var(--tg-theme-text-color, #111214);
  --hint: var(--tg-theme-hint-color, #7d828a);
  --link: var(--tg-theme-link-color, #1d8f8b);
  --btn: var(--tg-theme-button-color, #111214);
  --btn-fg: var(--tg-theme-button-text-color, #ffffff);
  --accent: #66D4D1;
  --line: color-mix(in srgb, var(--fg) 10%, transparent);
  --r: 12px;
  color-scheme: light dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font: 15px/1.4 -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  display: flex; flex-direction: column; overflow: hidden; }
button { font: inherit; color: inherit; }
#top { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--bg); }
#title { flex: 1; font-weight: 700; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon { border: 0; background: var(--bg2); border-radius: 10px; min-width: 38px; height: 36px; font-size: 18px; }
#searchbar { padding: 6px 12px; border-bottom: 1px solid var(--line); }
#q { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); color: var(--fg); font: inherit; }
main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 12px; }
#tabs { display: flex; border-top: 1px solid var(--line); background: var(--bg); padding-bottom: env(safe-area-inset-bottom); }
#tabs button { flex: 1; border: 0; background: none; padding: 6px 0 7px; display: flex; flex-direction: column; align-items: center;
  font-size: 11px; color: var(--hint); }
#tabs button b { font-size: 20px; font-weight: 400; line-height: 1.2; }
#tabs button.on { color: var(--fg); font-weight: 600; }
#tabs button.on b { filter: none; }
.sec { padding: 10px 14px 4px; color: var(--hint); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.card { margin: 8px 12px; padding: 12px; border-radius: var(--r); background: var(--bg2); }
.row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.row:active { background: var(--bg2); }
.row .main { flex: 1; min-width: 0; }
.row .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { color: var(--hint); font-size: 13px; }
.row .r { color: var(--hint); font-size: 13px; text-align: right; white-space: nowrap; }
.empty { padding: 28px 18px; text-align: center; color: var(--hint); }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--line); white-space: nowrap; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.b { border: 0; border-radius: 10px; padding: 10px 14px; background: var(--btn); color: var(--btn-fg); font-weight: 600; }
.b.alt { background: var(--bg); color: var(--fg); border: 1px solid var(--line); font-weight: 500; }
.b.ok { background: #30A46C; color: #fff; } .b.bad { background: #E5484D; color: #fff; }
.b.wide { width: 100%; }
.b:disabled { opacity: .5; }
input.f, select.f, textarea.f { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg);
  color: var(--fg); font: inherit; margin-top: 6px; }
textarea.f { min-height: 90px; resize: vertical; }
label.l { display: block; margin-top: 12px; font-size: 13px; color: var(--hint); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 7px 12px; }
.chip.on { background: var(--btn); color: var(--btn-fg); border-color: var(--btn); }
.media { display: flex; gap: 6px; overflow-x: auto; margin-top: 8px; }
.media img, .media video { height: 150px; border-radius: 8px; background: var(--line); }
.ans { margin-top: 8px; font-size: 13px; }
.muted { color: var(--hint); }
.small { font-size: 13px; }
.k { font-weight: 600; }
/* карта */
#map3d { position: relative; height: 52vh; min-height: 260px; background: linear-gradient(#f6f7f8, #e9ebee); touch-action: none; }
@media (prefers-color-scheme: dark) { #map3d { background: linear-gradient(#202326, #15171a); } }
#map3d canvas { display: block; width: 100%; height: 100%; }
#map3d .ov { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
#map3d .ov button { border: 0; border-radius: 9px; padding: 7px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  box-shadow: 0 1px 3px rgba(0,0,0,.15); font-size: 13px; }
#map3d .ov button.on { background: var(--btn); color: var(--btn-fg); }
#map3d .msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; color: var(--hint); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; padding: 8px 14px; font-size: 12px; color: var(--hint); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; background: var(--c); vertical-align: -1px; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
#toast { position: fixed; left: 12px; right: 12px; bottom: 74px; padding: 11px 14px; border-radius: 12px; background: #111214; color: #fff;
  opacity: 0; transform: translateY(8px); transition: .2s; pointer-events: none; z-index: 30; font-size: 14px; }
#toast.on { opacity: .95; transform: none; pointer-events: auto; }
#toast button { margin-left: 10px; border: 0; background: var(--accent); color: #111; border-radius: 8px; padding: 4px 10px; font-weight: 600; }
#sheet { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; display: flex; align-items: flex-end; }
#sheet[hidden] { display: none; }
.sheet-body { width: 100%; max-height: 86vh; overflow-y: auto; background: var(--bg); border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet-body h3 { margin: 0 0 6px; font-size: 17px; }
