:root {
  --fon: var(--tg-theme-bg-color, #ffffff);
  --fon2: var(--tg-theme-secondary-bg-color, #f1f3f6);
  --tekst: var(--tg-theme-text-color, #111827);
  --tusk: var(--tg-theme-hint-color, #6b7280);
  --akcent: var(--tg-theme-button-color, #2b8be6);
  --akcent-tekst: var(--tg-theme-button-text-color, #ffffff);
  --ssylka: var(--tg-theme-link-color, #2b8be6);
  --ten: 0 6px 24px rgba(0, 0, 0, .18);
  --radius: 14px;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--fon); color: var(--tekst);
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

/* верхняя панель */
#verh { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; background: var(--fon);
  padding: 8px 10px 6px; box-shadow: 0 1px 0 rgba(0,0,0,.08); }
#stroka1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
#schet { font-size: 13px; color: var(--tusk); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#vid-knopki { display: flex; background: var(--fon2); border-radius: 10px; padding: 2px; flex: none; }
.vkl { padding: 5px 10px; border-radius: 8px; font-size: 13px; color: var(--tusk); }
.vkl.aktiv { background: var(--fon); color: var(--tekst); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.chipy { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0; scrollbar-width: none; }
.chipy::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 5px 11px; border-radius: 16px; background: var(--fon2); font-size: 13px; white-space: nowrap; }
.chip.aktiv { background: var(--akcent); color: var(--akcent-tekst); }

/* карта */
#karta { position: fixed; left: 0; right: 0; bottom: 0; top: var(--verh, 110px); z-index: 1; }
.leaflet-container { background: var(--fon2); font: inherit; }
#gde-ya { position: fixed; right: 12px; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 900;
  width: 46px; height: 46px; border-radius: 50%; background: var(--fon); box-shadow: var(--ten);
  font-size: 24px; color: var(--akcent); }
.tochka { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 17px; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.tochka.v_rabote { opacity: .55; }
.tochka.moya { border-color: #f5b301; }
.tochka.vypolnena, .tochka.akt { opacity: .4; filter: grayscale(.6); }
.tochka.chernovik { border-style: dashed; }
.ya-tochka { width: 16px; height: 16px; border-radius: 50%; background: #2b8be6; border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(43,139,230,.25); }
.marker-cluster div { font-weight: 600; }

/* шторка с карточкой */
#shtorka { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100; background: var(--fon);
  border-radius: 18px 18px 0 0; box-shadow: var(--ten); max-height: 72vh; overflow-y: auto;
  padding: 6px 16px calc(16px + env(safe-area-inset-bottom)); transition: transform .25s ease; }
#shtorka-ruchka { width: 40px; height: 5px; border-radius: 3px; background: var(--fon2); margin: 4px auto 10px; }
.k-zag { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.k-vid { font-size: 18px; font-weight: 700; }
.metka { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--fon2); color: var(--tusk); white-space: nowrap; }
.metka.svobodna { background: #dcfce7; color: #166534; }
.metka.v_rabote { background: #fef3c7; color: #92400e; }
.k-zakazchik { font-weight: 600; margin: 4px 0 8px; }
.k-stroka { display: flex; gap: 8px; padding: 6px 0; border-top: 1px solid var(--fon2); font-size: 14px; }
.k-stroka b { flex: 0 0 96px; font-weight: 500; color: var(--tusk); }
.k-primerno { font-size: 12px; color: var(--tusk); margin-top: 2px; }
.k-summa { font-size: 17px; font-weight: 700; }
.k-knopki { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.knopka { flex: 1 1 140px; padding: 11px 12px; border-radius: 12px; background: var(--fon2); font-weight: 600; text-align: center; }
.knopka.glavnaya { background: var(--akcent); color: var(--akcent-tekst); }
.knopka[disabled] { opacity: .5; }

/* список */
#spisok { position: fixed; left: 0; right: 0; bottom: 0; top: var(--verh, 110px); z-index: 500; background: var(--fon);
  overflow-y: auto; padding: 8px 10px 90px; }
#poisk { width: 100%; padding: 10px 12px; border-radius: 12px; border: 0; background: var(--fon2); color: var(--tekst);
  font: inherit; margin-bottom: 8px; outline: none; }
.s-rabota { display: flex; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--fon2); align-items: flex-start; }
.s-ikonka { flex: none; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.s-tekst { flex: 1; min-width: 0; }
.s-zag { font-weight: 600; }
.s-pod { font-size: 13px; color: var(--tusk); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-km { flex: none; font-size: 13px; color: var(--tusk); }
.pusto { text-align: center; color: var(--tusk); padding: 40px 10px; }

/* техспецификация */
#ts { position: fixed; inset: 0; z-index: 1200; background: #525659; display: flex; flex-direction: column; }
#ts-verh { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--fon); }
#ts-zakryt { font-size: 20px; width: 36px; height: 36px; border-radius: 50%; background: var(--fon2); flex: none; }
#ts-fayly { flex: 1; display: flex; gap: 6px; overflow-x: auto; }
#ts-v-chat { flex: none; padding: 8px 12px; border-radius: 10px; background: var(--akcent); color: var(--akcent-tekst); font-weight: 600; }
#ts-stranicy { flex: 1; overflow: auto; padding: 10px; -webkit-overflow-scrolling: touch; }
#ts-stranicy canvas { display: block; width: 100%; height: auto; margin: 0 auto 10px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
#ts-stranicy .pusto { color: #eee; }

#soobshchenie { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 1300; background: rgba(20,20,20,.88); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px;
  max-width: 90vw; text-align: center; }
#zagruzka { position: fixed; inset: 0; z-index: 1400; display: flex; align-items: center; justify-content: center;
  background: var(--fon); color: var(--tusk); text-align: center; padding: 20px; }
