в/* ===================================
   БАЗОВЫЕ СТИЛИ
=================================== */
html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

#map {
  height: 100vh;
}

.admin-only {
  display: none !important;
}

/* ===================================
   OVERLAY И ФОРМА ДОСТУПА
=================================== */
/* ===================================
   OVERLAY И ФОРМА ДОСТУПА (обновлён)
=================================== */
#overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: #121c24;
  background-image: 
    linear-gradient(rgba(134, 231, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(134, 231, 255, 0.05) 1px, transparent 1px);
  background-size: 50px 50px;
  display: grid;
  place-items: center;
}

#access-form {
  background: transparent;
  box-shadow: none;
  border: none;
  padding: 0;
  width: auto;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* компактное и прозрачное поле */
#access-form input {
  width: 200px;
  height: 40px;
  font-size: 16px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: transparent;              /* полностью прозрачное поле */
  color: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#access-form input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

#access-form input:focus {
  border-color: #fff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
}

/* кнопка под стиль поля */
#access-form button {
  height: 40px;
  padding: 0 14px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: #111;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.06s ease, opacity 0.2s ease;
}

#access-form button:active {
  transform: translateY(1px);
}

.round-btn {
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  line-height: 1;
}



/* ===================================
   ВЫБОР ГОРОДА
=================================== */
#citySelector {
  position: fixed;
  top: 1px;
  right: 1px;
  z-index: 1001;
  background-color: #fff;
  border: 1px solid #ccc;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

#cityDropdown {
  display: none;
  position: fixed;
  top: 50px;
  right: 30px;
  z-index: 1002;
  background-color: #fff;
  border: 1px solid #ccc;
  border-top: none;
  min-width: 120px;
}

.city-option {
  padding: 8px 12px;
  cursor: pointer;
}

.city-option:hover {
  background-color: #f0f0f0;
}



/* ===================================
   МЕТКИ И ПОДСКАЗКИ
=================================== */
.district-label {
  font-size: 16px;
  font-weight: bold;
  color: #000;
  background: none;
  border: none;
}

.reviewer-badge {
  color: #d00;
  font-size: 11px;
  margin-left: 4px;
}

/* ===================================
   POPUP И УВЕДОМЛЕНИЯ
=================================== */
.popup-button {
  margin-top: 5px;
  padding: 4px 8px;
  font-size: 14px;
  cursor: pointer;
}

.notification-dot {
  position: absolute;
  top: -2px;
  right: 18px;
  width: 12px;
  height: 12px;
  background-color: #dc3545;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
  z-index: 1006;
  display: none;
}

/* ===================================
   ПЛАВАЮЩИЕ КНОПКИ
=================================== */
.round-btn {
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 90px;
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 30px;
  cursor: pointer;
  z-index: 1003;
  box-shadow: 1px 1px 10px #616161,
              -1px -1px 30px rgba(95, 94, 94, 0.05),
              inset 0 0 0 #0e0e0e,
              inset 0 0 0 #5f5e5e;
}

.round-btn i {
  pointer-events: none;
}

.round-btn.greenbtn {
  bottom: 20px;
  right: 40px;
  background-color: #31aaeb;
}

.round-btn.template {
  bottom: 20px;
  left: 40px;
  background-color: #55d649;
}

.round-btn.trush {
  bottom: 120px;
  left: 50%;
  width: 40px;
  height: 40px;
  font-size: 18px;
  transform: translateX(-50%);
  background-color: #dc3545;
}

.round-btn.visibility {
  top: 31px;
  left: 40px;
  width: 30px;
  height: 30px;
  background-color: #fff;
  color: #333;
  font-size: 20px;
  border: 1px solid #ccc;
  box-shadow: 0.5px 0.5px 3px #0e0e0e,
              0.5px 0.5px 10px rgba(95, 94, 94, 0.25),
              inset 0 0 0 #0e0e0e,
              inset 0 0 0 #5f5e5e;
}

.round-btn.visibility:hover {
  background-color: #f9f9f9;
}


/* ===================================
   ПОИСКОВАЯ СТРОКА
=================================== */
.container {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  --size-button: 40px;
  color: white;
  z-index: 999;
  transition: transform ease 0.9s;
}

.container .icon {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--size-button);
  height: var(--size-button);
  padding: 8px;
  pointer-events: none;
  transition: transform ease 0.3s;
}

.container .icon svg {
  width: 60%;
  height: 60%;
}

.input {
  width: var(--size-button);
  min-width: var(--size-button);
  height: var(--size-button);
  padding-left: var(--size-button);
  padding-right: 0;
  font-size: 15px;
  border: none;
  border-radius: 50px;
  color: #fff;
  background-color: #191a1e;
  box-sizing: border-box;
  outline: none;
  cursor: pointer;
  transition: all ease 0.3s;
  box-shadow: 1.5px 1.5px 3px #0e0e0e,
              5px 5px 15px rgba(95, 94, 94, 0.25),
              inset 0 0 0 #0e0e0e,
              inset 0 0 0 #5f5e5e;
}

.input:focus,
.input:not(:invalid) {
  width: 130px;
  padding-right: 15px;
  cursor: text;
  box-shadow: inset 1.5px 1.5px 3px #0e0e0e,
              inset -1.5px -1.5px 3px #5f5e5e;
}

.suggestions {
  position: fixed;
  bottom: calc(var(--size-button) + 10px);
  left: 0;
  width: 200px;
  max-height: 120px;
  overflow-y: auto;
  background: #191a1e;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 10000;
}

.suggestions div {
  padding: 8px 12px;
  cursor: pointer;
  color: #fff;
  height: 20px;
  line-height: 24px;
}

.suggestions div:hover {
  background: #333;
}

/* ===================================
   СПИСОК НАЗНАЧЕННЫХ УЧАСТКОВ
=================================== */
/* === Контекстное меню удаления (Назначенные участки) === */
#assignedContextMenu {
  position: fixed;
  z-index: 25000;
  display: none;
  min-width: 220px;
  max-width: 320px;

  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(18, 28, 36, 0.96);
  color: rgba(255,255,255,.92);

  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  padding: 8px;
}

#assignedContextMenu .acm-title {
  font-size: 12px;
  opacity: .85;
  margin: 2px 6px 8px;
}

#assignedContextMenu .acm-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;

  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.92);

  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
}

#assignedContextMenu .acm-btn:hover {
  background: rgba(255,255,255,.09);
}

#assignedContextMenu .acm-btn.danger {
  border-color: rgba(220,53,69,.55);
  background: rgba(220,53,69,.12);
}

#assignedContextMenu .acm-btn.danger:hover {
  background: rgba(220,53,69,.18);
}

#assignedContextMenu .acm-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

#assignedContextMenu .acm-row .acm-btn {
  justify-content: center;
  text-align: center;
}


/* input для "Взял визиток" */
#assignedContextMenu #acmCutawaysRow {
  align-items: center;
}

#assignedContextMenu #acmCutawaysInput {
  flex: 1;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.92);
  padding: 0 10px;
  outline: none;
}

#assignedContextMenu #acmCutawaysInput::placeholder {
  color: rgba(255,255,255,.55);
}




#assignedHeader button i {
  font-size: 18px;
  vertical-align: middle;
}

/* Попап с колонкой адресов */
.one-popup {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.one-popup-main {
  min-width: 220px;
}

.one-popup-side {
  display: block;              /* будет скрываться/показываться JS-ом */
  max-width: 480px;
  max-height: 360px;
  overflow: auto;
  padding-left: 10px;
  border-left: 1px solid #eee;
}

.one-popup-side-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.one-popup-side-list {
  font-size: 14px;
  line-height: 1.4;
}

.one-popup-side-item {
  padding: 2px 0;
}

/* Чуть компактнее сам контент попапа */
.leaflet-popup-content {
  margin: 10px 12px;
}

/* Смещаем popup вправо */
.leaflet-popup.custom-popup {
  transform: translateX(50px); /* немного подвинем окно */
}

/* Переориентируем стрелочку popup */
.leaflet-popup.custom-popup .leaflet-popup-tip {
  left: auto !important;
  right: -10px !important;
  top: 50% !important;
  transform: translateY(-50%) rotate(90deg); /* стрелка сбоку, по центру */
}

.leaflet-popup-content-wrapper { max-width: none; }

.order-dot {
  background: #ff4db8;        /* ярко-розовый */
  border: 2px solid white;    /* белая окантовка, чтобы видно на карте */
  border-radius: 50%;
  box-shadow: 0 0 2px rgba(0,0,0,0.3);
}

.order-dot:hover {
  transform: scale(1.6);
  transition: transform 0.2s ease;
  z-index: 1000;
}


/* Крошечная кнопка "+" рядом с "Статистика" */
#statsPlusBtn {
  position: fixed;
  /* позиционирование выставляем из JS относительно #toggleStats */
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid #ccc;
  background: #fff;
  color: #333;
  display: none;              /* по умолчанию скрыта */
  z-index: 1002;
  box-shadow: 0.5px 0.5px 3px #0e0e0e,
              0.5px 0.5px 10px rgba(95, 94, 94, 0.25),
              inset 0 0 0 #0e0e0e,
              inset 0 0 0 #5f5e5e;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

#statsPlusBtn i {
  pointer-events: none;
  font-size: 12px;
}

#statsPlusBtn:hover {
  background-color: #f7f7f7;
}





/* === Попап добавления адресов для статистики (admin) === */
#statAddModalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 11000;
  display: none;
}

#statAddModal {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(560px, 92vw);
  max-height: 80vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 26px rgba(0,0,0,.25);
  z-index: 11001;
  padding: 16px;
  display: none;
}

#statAddModal h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

#statAddTextarea {
  width: 100%;
  height: 260px;
  resize: vertical;
  padding: 10px;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid #ddd;
  outline: none;
}

#statAddActions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}

.stat-btn {
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
}

.stat-btn.primary {
  background: #31aaeb;
  color: #fff;
  border-color: #31aaeb;
}

.stat-btn:disabled { opacity: .6; cursor: not-allowed; }

.one-popup-side-item {
  white-space: nowrap;     /* не переносить на пробелах */
}

#chatConversationContainer {
    display: none;
}


/* === Табель === */
#timesheetModal {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  display: none; align-items: center; justify-content: center; z-index: 3000;
}
#timesheetCard {
  background: #fff; border-radius: 10px; width: min(900px, 96vw);
  max-height: 90vh; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.2);
  display: flex; flex-direction: column;
}
#timesheetHeader {
  display:flex; align-items:center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid #eee;
}
#timesheetTitle { margin:0; font-size: 18px; }
#timesheetClose {
  margin-left:auto; border:0; background:#f3f3f3; border-radius: 6px; width:32px; height:32px; cursor:pointer;
}
#timesheetBody { padding: 12px 16px; overflow: auto; }
#timesheetTable {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
#timesheetTable th, #timesheetTable td {
  border: 1px solid #e6e6e6; padding: 6px 8px; text-align: left; vertical-align: top;
}
#timesheetTable th { background: #fafafa; }

/* свежие заказы (последние 2 недели) */
.order-dot-fresh {
  background-color: #00c853; /* зелёный */
  border-color: #000000 ;
}

/* Экранная шапка для печати (маленькая), будет и на экране, и в печати */
#timesheetPrintHeader { display:flex; justify-content:space-between; align-items:center; margin: 0 0 8px 0; }
#timesheetPrintHeader .title { font-weight:600; }
#timesheetPrintHeader .date { opacity:.8; }

/* Печатная версия */
/* ===================================
   ПЕЧАТЬ: по умолчанию — только карта
=================================== */
/* ===================================
   ПЕЧАТЬ: по умолчанию — карта (альбом)
=================================== */
@media print {
  /* Скрываем всё лишнее */
  
  #assignedList,
  #historyPanel,
  #timesheetModal,
  #timesheetHistoryModal,
  #chatWindow,
  #overlay,
  #citySelector,
  #cityDropdown,
  #toggleDistricts,
  #openLeaderboard,
  #toggleStats,
  #toggleColorButton,
  #toggleStory,
  #nav-style-13,
  .round-btn,
  .app-header,
  .container,
  .suggestions,
  .leaflet-control-container {
    display: none !important;
  }

  /* Оставляем только карту */
  #map {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body {
    margin: 0;
    padding: 0;
  }

  /* Альбомная ориентация + A4 */
  @page {
    
    margin: 10mm;
  }
}

/* ===================================
   ПЕЧАТЬ: табель (портрет)
=================================== */
@media print {
  /* Когда активен режим печати табеля — скрываем всё, кроме нужного контейнера */
  body.printing-timesheet #map,
  body.printing-timesheet .round-btn,
  body.printing-timesheet #assignedList,
  body.printing-timesheet .container,
  body.printing-timesheet .leaflet-control-container,
  body.printing-timesheet #timesheetModal,
  body.printing-timesheet #timesheetHistoryModal {
    display: none !important;
  }

  /* Печатаем ТОЛЬКО временный контейнер */
  body.printing-timesheet #temp-print-container {
    display: block !important;
    position: static !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Убедимся, что внутри всё отображается как на экране */
  body.printing-timesheet #temp-print-container #timesheetCard {
    width: 100% !important;
    max-width: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Скрываем кнопки в шапке табеля при печати */
  body.printing-timesheet #temp-print-container #timesheetClose,
  body.printing-timesheet #temp-print-container #timesheetPrint,
  body.printing-timesheet #temp-print-container #timesheetSave,
  body.printing-timesheet #temp-print-container #timesheetHistoryOpen {
    display: none !important;
  }
}

/* ====== Основные настройки таблицы Табеля ====== */
#timesheetTable {
  table-layout: fixed;     /* фиксированная сетка — ширина задается вручную */
  width: 100%;             /* таблица растягивается на всю ширину контейнера */
  border-collapse: collapse;
}

#timesheetTable th,
#timesheetTable td {
  padding: 6px 8px;        /* внутренние отступы */
  border: 1px solid #ddd;  /* границы ячеек */
  overflow: hidden;        /* обрезает переполненный текст */
  text-overflow: ellipsis; /* добавляет "..." если текст не помещается */
  white-space: nowrap;     /* запрещает перенос строк */
}

/* ====== Ширина столбцов ====== */

/* 1️⃣ Столбец № (номер по порядку) */
#timesheetTable th:nth-child(1),
#timesheetTable td:nth-child(1) {
  width: 18px;
}

/* 2️⃣ Столбец "Ф.И" (фамилия, имя) */
#timesheetTable th:nth-child(2),
#timesheetTable td:nth-child(2) {
  width: 100px;
}

/* 3️⃣ Столбец "Район" */
#timesheetTable th:nth-child(3),
#timesheetTable td:nth-child(3) {
  width: 100px;
}

/* 4️⃣ Столбец "Расшифровка района" (тянется, если есть свободное место) */
#timesheetTable th:nth-child(4),
#timesheetTable td:nth-child(4) {
  width: 140px;
}

/* 5️⃣ Столбец "Проверяющий" */
#timesheetTable th:nth-child(5),
#timesheetTable td:nth-child(5) {
  width: 100;
}


/* Основная карточка Табеля (контейнер) */
#timesheetCard {
  width: 600px;              /* занимает 90% ширины экрана */
  max-width: 900px;       /* ограничение, чтобы не расползался слишком широко */
  margin: 40px auto;       /* выравнивание по центру, небольшой отступ сверху */
  background: #fff;        /* фон карточки */
  border-radius: 10px;     /* закруглённые углы */
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
  overflow: hidden;        /* чтобы таблица не вылазила за края */
}

/* Тело модалки, где сама таблица */
#timesheetBody {
  padding: 20px;           /* отступы вокруг таблицы */
  overflow-x: auto;        /* добавляет горизонтальную прокрутку при узких экранах */
}

#monthFilterWrap {
position: fixed;
left: 100px; /* сдвиньте по необходимости */
background: #fff;
border: 1px solid #ddd;
border-radius: 8px;
padding: 6px 8px;
z-index: 1205;
box-shadow: 0 6px 20px rgba(0,0,0,0.12);
display: none; /* показываем когда загружены данные */
font-family: Arial, sans-serif;
font-size: 13px;
}
#monthFilterWrap{
  top: calc(var(--safe, 0px) + var(--hTopReal, var(--hTopDyn, var(--hTop, 56px))) + 12px);
}

#monthFilterWrap label{font-weight:600; margin-right:6px}
#monthSelect{padding:4px 6px; border-radius:6px; border:1px solid #ccc}
#clearMonthBtn{margin-left:8px; cursor:pointer; border:none; background:#f5f5f5; padding:4px 8px; border-radius:6px}




/* =========================
   TOP COMMAND BAR (w1-style)
   ========================= */

:root{
  --bg:#0d0f10;
  --panel:#121c24;
  --panel2:#121c24;
  --stroke: rgba(255,255,255,.10);
  --text: rgba(255,255,255,.92);
  --text2: rgba(255,255,255,.70);
  --accent:#86e7ff;
  --shadow2: 0 10px 26px rgba(0,0,0,.38);
  --r2: 18px;
  --safe: 0px;
  --hTop: 56px;
  --hTopDyn: 56px;     /* реальная высота topbar (JS обновит) */
  --hBottomDyn: 110px; /* реальная высота нижней панели (JS обновит) */
  --panel: #121c24;
  
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans";
}

html, body{ font-family: var(--font); }

/* сама верхняя панель */
.app-header{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--hTop);
  padding: 10px 12px;
  z-index: 3000;

  display: flex;
  align-items: center;
  gap: 10px;
  
  /* ПАНЕЛЬНЫЕ СТИЛИ - ЭТО ГЛАВНОЕ */
  background: rgba(18,28,36,.88);
  border: 1px solid rgba(255,255,255,.10);

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: rgba(255,255,255,.92);
}

/* профиль */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  white-space: nowrap;
  user-select: none;
}
.avatar{
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(134,231,255,.22);
  border: 1px solid rgba(134,231,255,.28);
  cursor: pointer;
  display:block;
}
.brand b{ font-size: 13px; font-weight: 700; letter-spacing:.2px; }

/* кнопки справа/слева */
.top-actions{ display:flex; align-items:center; gap: 8px; }
.iconbtn{
  width: 38px; height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.92);
  cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  user-select:none;
}
.iconbtn:hover{ background: rgba(134,231,255,.12); }
.iconbtn i{ pointer-events: none; } /* важно для кликов по кнопке */

/* поиск */
.search{
  flex:1;
  position: relative;
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.25);
  min-width: 160px;
}
.search .input{
  flex:1;
  border:0;
  outline: none;
  background: transparent;
  color: rgba(255,255,255,.92);
  font-size: 13px;
  min-width: 0;
  cursor: text;
  width: auto;
  height: auto;
  padding: 0;
  box-shadow: none;
}
.search .input::placeholder{ color: rgba(255,255,255,.50); }
.search-ico{ opacity: .9; }
.search-hint{ font-size: 12px; color: rgba(255,255,255,.55); white-space: nowrap; }

/* подсказки поиска: теперь выпадают из topbar */
.search .suggestions{
  position: absolute;
  top: calc(100% + 25px);
  left: 0;
  width: min(420px, 80vw);
  max-height: 220px;
  overflow-y: auto;
  background: rgba(18,28,36,.88);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 12px;
  box-shadow: var(--shadow2);
  display: none;
  z-index: 2000;
}
.search .suggestions div{
  padding: 10px 12px;
  cursor: pointer;
  color: rgba(255,255,255,.92);
}
.search .suggestions div:hover{
  background: rgba(134,231,255,.10);
}

/* селектор города (перенесён в topbar) */
.selectpill{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  font-size: 12px;
  white-space: nowrap;
  user-select:none;
  color: var(--text2);
}
.city-wrap{ position: relative; overflow: visible; }

/* убиваем старые fixed-стили, теперь это часть панели */
#citySelector{
  position: static !important;
  top: auto !important;
  right: auto !important;
  z-index: 9999 !important;
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  cursor: pointer;
  font-size: 12px;
  color: rgba(255,255,255,.92);
}

/* dropdown теперь привязан к селектору */
#cityDropdown{
  position: absolute !important;
  top: calc(100% + 35px) !important;
  right: 0 !important;
  z-index: 15000 !important;
  background: rgba(18,28,36,.88) !important;
  border: 1px solid rgba(255,255,255,.10) !important;
  border-radius: 12px !important;
  min-width: 180px !important;
  overflow: hidden;
}
#cityDropdown .city-option{
  padding: 10px 12px;
  cursor: pointer;
  color: rgba(255,255,255,.92);
}
#cityDropdown .city-option:hover{
  background: rgba(134,231,255,.10);
}

/* mobile */
@media (max-width: 520px){
  .app-header{
    height: auto;          /* шапка растягивается по контенту */
    padding: 5px;
    gap: 8px;
    flex-wrap: wrap;       /* разрешаем перенос строк */
    align-items: center;
  }

  /* поиск уходит на вторую строку и занимает всю ширину */
  .app-header .search{
    order: 10;
    flex: 1 1 100%;
    min-width: 0;
  }

  .app-header .iconbtn{
    width: 34px;
    height: 34px;
    border-radius: 12px;
  }
}
@media (max-width: 768px) {
  #timesheetBody {
    padding: 10px !important;
    overflow-x: auto !important;
  }
  
  #timesheetTable {
    font-size: 12px !important;
  
  }
  
  #timesheetTable th,
  #timesheetTable td {
    padding: 4px 6px !important;
  }
  
  /* Уменьшаем ширину столбцов для мобильных */
  #timesheetTable th:nth-child(2),
  #timesheetTable td:nth-child(2) {
    width: 80px !important;
  }
  
  #timesheetTable th:nth-child(3),
  #timesheetTable td:nth-child(3) {
    width: 70px !important;
  }
  #timesheetTable th:nth-child(4),
  #timesheetTable td:nth-child(4) {
    width: 90px !important;
  }  
  #timesheetTable th:nth-child(5),
  #timesheetTable td:nth-child(5) {
    width: 90px !important;
  }    
  
  
}


@media (max-width: 768px) {
  #timesheetCard {
    width: 96vw !important;
    margin: 20px auto !important;
    max-height: 85vh !important;
  }
  
  #statAddModal {
    width: 96vw !important;
    max-height: 90vh !important;
  }
  
  .one-popup {
    flex-direction: column;
    gap: 10px;
  }
  
  .one-popup-side {
    max-width: 100% !important;
    max-height: 200px !important;
  }
}

/* ===== Chat window: полноэкранный режим на мобильных ===== */
@media (max-width: 520px){
  #chatWindow{
    /* занимать всю “свободную” область между верхней и нижней панелью */
    top: calc(var(--safe) + var(--hTopReal, var(--hTop)) + 14px) !important;

    bottom: 98px !important; /* высота нижней панели (#nav-style-13 height: 68px) */

    left: 14px !important;
    right: 14px !important;

    width: auto !important;
    height: auto !important;

    border-radius: 18px !important;
    box-shadow: var(--shadow2) !important;

    /* на всякий случай */
    position: fixed !important;
    z-index: 1600 !important;
  }
}

/* Убедитесь, что все элементы верхней панели имеют правильные цвета */
.app-header .brand b,
.app-header .selectpill,
.app-header #citySelector,
.app-header .search .input,
.app-header .search-hint {
  color: rgba(255,255,255,.92);
}

i[class^="fa-"], i[class*=" fa-"]{
  font-family: var(--fa-font-family, "Font Awesome 6 Free") !important;
}
/* ===================================
   ЛЕВАЯ ВЕРТИКАЛЬНАЯ ПАНЕЛЬ ИНСТРУМЕНТОВ
=================================== */
#leftTools{
  position: fixed;
  left: 0;
  top: calc(var(--safe, 0px) + var(--hTopReal, var(--hTop, 56px)) + 44px);
  z-index: 1400;

  width: 30px;
  padding: 6px 4px;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;

  /* фон как у нижней панели (тёмный градиент) */
  background: linear-gradient(180deg, rgba(18,28,36,.88), rgba(18,28,36,.88));
  backdrop-filter: blur(10px);

  /* верхний бордер как у нижней навигации */
  border-top: 5px solid #86e7ff;

  /* скругление справа */
  border-radius: 0 16px 16px 0;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  transform: translateX(0);
  will-change: transform;
}

/* Мобильное поведение: #assignedList и #leftTools не должны быть вместе */
@media (max-width: 720px){
  #leftTools{
    transition: transform 220ms ease, opacity 220ms ease;
  }

  #leftTools.is-hidden{
    transform: translateX(-110%);
    opacity: 0;
    pointer-events: none;
  }
}


/* Важно: .round-btn по умолчанию fixed. В панели делаем нормальную раскладку */
#leftTools .round-btn,
#leftTools #toggleDistricts{
  position: static !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  left: auto !important;

  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  min-height: 30px !important;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 10px !important;
}

/* Чуть меньше иконки, чтобы не распирало 30px */
#leftTools i{
  font-size: 16px !important;
}

/* Чтобы div#toggleDistricts вёл себя как кнопка */
#leftTools #toggleDistricts{
  cursor: pointer;
}

/* Подсветка при наведении */
#leftTools .round-btn:hover,
#leftTools #toggleDistricts:hover{
  filter: brightness(1.15);
}

/* Печать: скрываем панель тоже */
@media print{
  #leftTools{ display: none !important; }
}




/* =========================
   CHAT (без зелёного, в стиле интерфейса)
   ========================= */

:root{
  --chat-accent: #86e7ff;
  --chat-bg: #121c24;
  --chat-text: rgba(255,255,255,.92);
  --chat-muted: rgba(255,255,255,.65);
}

#chatWindow{
  background: transparent !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;

  border-top: 5px solid var(--chat-accent);
  border-radius: 18px !important;
  box-shadow: 0 -10px 30px rgba(11, 12, 30, 0.5) !important;

  isolation: isolate;
  color: var(--chat-text);
}

#chatWindow::before{
  content:"";
  position:absolute;
  inset:0;
  z-index:0;
  background: linear-gradient(135deg, var(--chat-bg) 0%, var(--chat-bg) 100%);
  opacity: .88;
}

#chatWindow > *{
  position: relative;
  z-index: 1;
}

/* Шапка */
#chatHeader{
  background: rgba(255,255,255,.04);
  border-bottom: 1px solid rgba(255,255,255,.10);
  color: var(--chat-text);
}

/* Тело */
#chatBody{
  background: rgba(0,0,0,.08) !important;
  
  overflow-y: auto;

  /* Firefox */
  scrollbar-width: none;

  /* IE / Edge legacy */
  -ms-overflow-style: none;  
}
#chatBody::-webkit-scrollbar {
    width: 0;
    height: 0;
}
/* Подвал */
#chatFooter{
  background: rgba(255,255,255,.03) !important;
  border-top: 1px solid rgba(255,255,255,.10) !important;
}

/* Поле ввода */
#chatInput{
  background: rgba(255,255,255,.06) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  color: var(--chat-text) !important;
  border-radius: 10px !important;
}

#chatInput::placeholder{
  color: rgba(255,255,255,.45);
}

/* Кнопки в шапке */
#chatHeader button{
  color: var(--chat-text) !important;
  opacity: .9;
}

#chatHeader button:hover{
  opacity: 1;
}

/* Скрепка */
#chatAttach{
  color: var(--chat-text);
  opacity: .85;
}
#chatAttach:hover{ opacity: 1; }

/* Отправить */
#sendChat{
  background: var(--chat-accent) !important;
  color: #121c24 !important;
  border-radius: 10px !important;
  font-weight: 700;
  padding: 6px 12px !important;
}
#sendChat:hover{
  filter: brightness(1.05);
}

/* =========================
   CHAT BACKGROUND (ACTIVE CONVERSATION)
   ========================= */

#chatBody{
  background:
    linear-gradient(
      180deg,
      rgba(18,28,36,0.88),
      rgba(18,28,36,0.92)
    ) !important;
}

#chatConversationContainer{
  background: transparent;
}

#chatMessages{
  background:
    radial-gradient(
      circle at 30% 20%,
      rgba(134,231,255,0.06),
      transparent 45%
    ),
    linear-gradient(
      180deg,
      rgba(18,28,36,0.75),
      rgba(18,28,36,0.85)
    ) !important;

  border-radius: 12px;
  color: rgba(255,255,255,0.92);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* === Chat bubbles (как у людей в мессенджерах) === */
.chat-message{
  align-self: flex-start;
  max-width: 80%;
  padding: 8px;
  margin: 0;
  border-radius: 10px;
  word-wrap: break-word;
  position: relative;

  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
}

.chat-message--me{
  align-self: flex-end;
  background: rgba(134,231,255,0.16);
  border-color: rgba(134,231,255,0.22);
}

.chat-message__meta{
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  margin-bottom: 4px;
}

.chat-message--me .chat-message__meta{
  text-align: right;
}

.chat-message__body{
  color: rgba(255,255,255,0.92);
}

/* =========================
   CHAT LIST — CORRECT FINAL
   ========================= */

#chatList > .chat-list-item{
  padding: 14px 14px !important;
  height: 64px;
  min-height: 64px;
  max-height: 64px;
  box-sizing: border-box;

  display: flex;
  align-items: center;
  gap: 12px;

  overflow: hidden;
}


/* Левая часть: имя + превью */
#chatList > .chat-list-item > div:first-child{
  display: flex;
  flex-direction: column;
  align-items: flex-start;

  flex: 1 1 auto;   /* КЛЮЧ */
  min-width: 0;     /* КРИТИЧЕСКИ ВАЖНО */
}

/* Текст */
#chatList .chat-title,
#chatList .chat-last-message{
  width: 100%;
  text-align: left;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Красная точка */
#chatList .chat-unread-dot{
  flex: 0 0 auto;
  margin-left: auto;   /* ПРИЖАТИЕ ВПРАВО */
  align-self: center;
}

/* точная посадка точки напротив имени */
#chatList .chat-unread-dot{
  top: 22px !important;   /* крути 12–18px */
}

/* =========================
   ЧАТ: пузырьки слева/справа
   ========================= */

#chatBody {
  overflow-y: auto;
}

#chatMessages {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* базовый пузырёк */
.chat-message{
  display: flex;
  flex-direction: column;

  max-width: 80%;
  padding: 8px 10px;
  border-radius: 12px;

  word-wrap: break-word;
  overflow-wrap: anywhere;
}

/* мета: автор и время */
.chat-message__meta{
  font-size: 11px;
  opacity: 0.75;
  margin-bottom: 4px;
}

/* тело сообщения */
.chat-message__body{
  font-size: 13px;
  line-height: 1.35;
}

/* МОИ сообщения справа */
.chat-message--me{
  align-self: flex-end;
  background: rgba(134,231,255,0.18);
  border: 1px solid rgba(134,231,255,0.35);
}

/* ЧУЖИЕ сообщения слева */
.chat-message--other{
  align-self: flex-start;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
}

/* === Avatar picker modal === */
.modal-overlay{
  display:none;
  position:fixed; inset:0;
  background: rgba(0,0,0,0.45);
  z-index: 25000;
  align-items:center;
  justify-content:center;
}
.modal-card{
  width: min(760px, 96vw);
  max-height: 90vh;
  overflow: hidden;
  border-radius: 14px;
  background: #fff;  
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  display:flex;
  flex-direction:column;
}
.modal-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #eee;
}
.modal-title{ font-weight: 800; font-size: 18px; }
.modal-sub{ font-size: 12px; color: #666; margin-top: 2px; }
.modal-x{
  border:0; background:#f3f3f3;
  border-radius: 10px;
  width: 36px; height: 36px;
  cursor:pointer;
  font-size: 20px;
  line-height: 1;
}
.modal-body{ padding: 14px 16px; overflow:auto; }

.avatar-grid{
  display:grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 720px){
  .avatar-grid{ grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.avatar-tile{
  border: 1px solid #ddd;
  border-radius: 14px;
  overflow:hidden;
  background: rgba(0,0,0,0.03);
  cursor:pointer;
  aspect-ratio: 1 / 1;
  display:flex;
  align-items:center;
  justify-content:center;
}
.avatar-tile img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.avatar-tile.is-selected{
  outline: 3px solid rgba(134,231,255,0.8);
  outline-offset: 0px;
  border-color: transparent;
}

.avatar-error{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(220, 53, 69, 0.35);
  background: rgba(220, 53, 69, 0.10);
  color: #b00020;
  font-size: 13px;
  font-weight: 600;
}


.profile-meta{
  display:flex;
  flex-direction:column;
  line-height:1.05;
}
.profile-coins{
  font-size: 12px;
  opacity: .85;
}


/* ===== Bottom nav: красная точка уведомления на кнопке "Чат" ===== */
#nav-style-13 .nav-icon{
  position: relative;
}

#chatNotificationDot{
  position: absolute;
  top: 5px;
  right: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: red;
  display: none;
  pointer-events: none;
}

.chat-avatar{
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 34px;
}
.chat-list-item{
  margin-bottom: 10px;
}



/* ===== История участков: вертикальная шкала (45 дат) ===== */
.story-timeline{
  display: grid;
  grid-template-columns: 1fr 28px;
  gap: 0px;
  align-items: start;
}

.story-timeline-ticks{
  display: grid;
  grid-template-rows: repeat(60, 1fr);
  height: 740px;              /* 45 делений помещаются всегда */
  width: 50px;
}

.story-tick{
  display: flex;
  align-items: center;
  gap: 0px;
  font-size: 11px;
  line-height: 1;
  user-select: none;
  cursor: pointer;
}

.story-tick .label{
  opacity: .85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.story-tick.is-selected .label{
  font-weight: 700;
  opacity: 1;
}

.story-tick.is-in-range .label{
  opacity: 1;
}

.story-timeline-slider{
  height: 740px;
  width: 28px;
  padding: 0;
  margin: 0;

  /* было (удалить): -webkit-appearance: slider-vertical; */
  /* было (удалить): transform: rotate(180deg); */

  writing-mode: vertical-lr;
  direction: ltr;
}


/* =========================================================
   Окно "История участков"
   ВСЕ стили только здесь
   ========================================================= */

#historyPanel{
  position: fixed;

  /* Положение окна */
  top: calc(var(--safe, 0px) + var(--hTopReal, var(--hTopDyn, var(--hTop, 56px))) + 12px);
  left: 50px;

  /* Внешний вид */
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 10px;
  width: 70px;

  /* Поведение */
  z-index: 1200;
  display: none;

  /* Тень */
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

/* Заголовок внутри */
#historyPanel > div:first-child{
  font-weight: 600;
  margin-bottom: 8px;
}

/* =========================================================
   Панель статистики истории (если используется)
   ========================================================= */

#historyStatsPanel{
  position: fixed;

  /* Положение относительно historyPanel */
  top: calc(var(--safe, 0px) + var(--hTopReal, var(--hTopDyn, var(--hTop, 56px))) + 12px);
  left: 150px;

  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 8px 10px;

  z-index: 1200;
  display: none;

  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

@media (max-width: 600px) {
  /* Сводка по дате (historyStatsPanel) — мобильная версия */
  #historyStatsPanel{
    font-size: 14px;
    line-height: 1.2;
    padding: 6px 8px;
    left: 40px !important;         /* ← прижимаем к левому краю */
    right: auto !important;        /* ← отключаем привязку к правому */
    transform: none !important;    /* ← убираем центрирование */
    max-width: calc(100vw - 40px); /* ← ширина с учетом отступов */
    top: calc(var(--safe, 0px) + var(--hTopReal, var(--hTopDyn, var(--hTop, 56px))) + 12px);
  }

  /* Заголовок "Сводка по дате" */
  #historyStatsPanel > div:first-child{
    font-size: 14px;
    line-height: 1.2;
  }

  /* Контент сводки */
  #historyStatsContent{
    font-size: 14px;
    line-height: 1.2;
  }

  /* Цифры в <b> */
  #historyStatsContent b{
    font-size: 14px;
    line-height: 1.1;
  }
}

/* ===============================
   История: мобильный режим (3 даты у бегунка)
   =============================== */
@media (max-width: 600px) {
  /* делаем панель чуть шире, чтобы влезли подписи */
  #historyPanel{
    /* убираем "белое окно" */
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;

    /* убираем внутренние отступы и фиксированную ширину */
    padding: 0 !important;
    width: auto !important;
    min-width: 0 !important;

    /* фикс: прижимаем к правому краю */
    right: 0px !important;
    left: auto !important;
    top: calc(var(--safe, 0px) + var(--hTopReal, var(--hTopDyn, var(--hTop, 56px))) + 8px) !important;

  }
  /* Сводка по участкам (assignedSummaryBox) — мобильная версия */
  /* Сводка по участкам (assignedSummaryBox) — мобильная версия */
  #assignedList #assignedSummaryBox{
    font-size: 10px !important;
    line-height: 1.2 !important;
  }
  
  /* Цифры */
  #assignedList #assignedSummaryBox .stat-value{
    font-size: 12px !important;
    line-height: 1.1 !important;
  }
  
  /* Подписи */
  #assignedList #assignedSummaryBox .stat-label{
    font-size: 9px !important;
    line-height: 1.1 !important;
  }






  /* прячем заголовок и крестик "История" */


  /* на всякий случай: оставляем только сам таймлайн */
  #storyTimeline{
    display: block !important;
  }


  /* timeline становится в 1 колонку */
  #storyTimeline.story-timeline{
    grid-template-columns: 1fr;
    position: relative; /* якорь для плавающих подписей */
  }

  /* список дат скрываем */
  #storyTimelineTicks{
    display: none !important;
  }

  /* сам слайдер оставляем */
  #storyTimelineSlider.story-timeline-slider{
    width: 68px;
    height: 540px;
  }


  /* контейнер с тремя подписями */
  #storyMobileLabels{
    position: absolute;

    /* ставим лейблы СЛЕВА от бегунка */
    right: 56px;     /* отступ от правого края таймлайна (возле бегунка) */
    left: auto;

    top: 0;
    height: 540px;
    width: 105px;
    pointer-events: none;
  }


  .story-mobile-label {
      position: absolute;
      right: 0;
      background: none;
      padding: 0;
      border-radius: 0;
      box-shadow: none;
      font-size: 13px;
      white-space: nowrap;
      transform: translateY(-50%);
      color: #666;
  }



  .story-mobile-label.is-current{
    font-weight: 800;
    font-size: 15px;
    color: #121c24;
  }
}

/* Глобальный цвет всех чекбоксов на сайте */
:root{
  --checkbox-accent: #86e7ff; /* поставь любой цвет */
}

input[type="checkbox"]{
  accent-color: var(--checkbox-accent);
}

/* Переключатель заказов над попапом */
.stat-switch-outer {
  display: flex;
  gap: 4px;
  margin-bottom: 5px; /* ← ОТСТУП 5px ОТ ПОПАПА */
}

.stat-switch-outer .stat-sw-btn {
  display: inline-block;
  padding: 2px 6px;
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 4px;
  text-decoration: none;
  color: #000;
  background: #fff;
}

.stat-switch-outer .stat-sw-btn.active {
  background: #eee;
  border-color: #999;
}

/* === Статус сообщения (галочки) === */
.message-status {
    position: absolute;
    bottom: 4px;
    right: 8px;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;          /* расстояние между галочками */

    font-size: 10px;
    line-height: 1;
    opacity: 0.6;
}

.message-status span {
    display: block;
    padding: 0;
    margin: 0;
}
