/* ===== GeoMonitor 7.0: оболочка страницы и карта =====
   Шапка, навигация, рабочая область, панели списков рядом с картой, элементы управления карты,
   проигрыватель пути. Что занимает экран и как его делят панели, решает GM (js/app/layout.js) и
   записывает на <html>: data-layout (ultra, wide, tablet, mobile), data-orient, data-view, data-panel.
   Цвета - только из схемы mdui (переменные --gm-* заданы в css/base.css), поэтому тёмная тема
   получается сама. Журналы и карточки - css/journal.css, настройки - css/settings.css. */

:root {
  --gm-top-h: 56px;        /* высота шапки */
  --gm-rail-w: 80px;       /* ширина боковой навигации */
  --gm-bar-h: 64px;        /* высота нижней навигации на телефоне */
  --gm-panel-w: 400px;     /* панель сотрудников */
  --gm-panel-wide: 600px;  /* панели журналов: посещения, заявки */
  --gm-surface: rgb(var(--mdui-color-surface));
  --gm-brand: #c8441c;
}

html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { background: var(--gm-bg); }
.hidden { display: none !important; }

/* ---------- Каркас ---------- */
.gm-app {
  display: grid; grid-template-rows: auto auto minmax(0, 1fr);
  height: var(--gm-vh, 100vh); height: 100dvh;
}
/* Строки заданы явно: пустое сообщение под шапкой скрыто и своей строки в сетке не занимает */
.gm-top { grid-row: 1; }
#div-info { grid-row: 2; }
.gm-work { grid-row: 3; display: grid; grid-template-columns: var(--gm-rail-w) minmax(0, 1fr); min-height: 0; }
.gm-main { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--gm-bg); }

/* ---------- Шапка ---------- */
.gm-top {
  display: flex; align-items: center; gap: 12px; height: var(--gm-top-h); padding: 0 8px 0 16px;
  background: var(--gm-surface); border-bottom: 1px solid var(--gm-line);
  position: relative; z-index: 30;
}
.gm-top__brand { flex: none; display: flex; align-items: center; }
#logo { display: block; height: 36px; width: auto; }
.mdui-theme-dark #logo { filter: brightness(1.9) saturate(.85); }
@media (prefers-color-scheme: dark) { .mdui-theme-auto #logo { filter: brightness(1.9) saturate(.85); } }
.gm-top__portal {
  flex: 0 1 auto; min-width: 0; padding-left: 12px; border-left: 1px solid var(--gm-line);
  font-size: 13px; line-height: 16px; color: var(--gm-muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.gm-top__portal:empty { display: none; }
.gm-top__portal b, .gm-top__portal .gm-portal__name { display: block; font-weight: 500; color: var(--gm-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-top__utils { flex: none; display: flex; align-items: center; gap: 4px; min-width: 0; }
.gm-top__utils:empty { display: none; }
.gm-top__space { flex: 1 1 auto; }
.gm-top__tool { flex: none; display: flex; align-items: center; }
.gm-top__tool:empty { display: none; }

/* Локация: кнопка-чип с меню */
.gm-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; max-width: 240px; padding: 0 10px 0 12px;
  border: 1px solid var(--gm-line); border-radius: 18px; background: none; color: var(--gm-text);
  font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer;
}
.gm-chip:hover { background: rgba(var(--mdui-color-on-surface), .06); }
.gm-chip .material-icons { font-size: 20px; color: var(--gm-primary); }
.gm-chip .material-icons.gm-chip__more { color: var(--gm-muted); margin-left: -2px; }
.gm-chip__text { overflow: hidden; text-overflow: ellipsis; }
.gm-chip--static { cursor: default; }
.gm-chip--static:hover { background: none; }

/* Кнопка-переключатель в шапке (геозоны, конструктор) */
.gm-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; min-width: 36px; padding: 0 8px;
  border: 0; border-radius: 18px; background: none; color: var(--gm-muted); font-size: 14px; font-weight: 500; cursor: pointer;
}
.gm-toggle:hover { background: rgba(var(--mdui-color-on-surface), .06); }
.gm-toggle .material-icons { font-size: 22px; }
.gm-toggle.is-on { background: var(--gm-second-cont); color: var(--gm-on-second-cont); }
.gm-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.gm-toggle:has(input:checked) { background: var(--gm-second-cont); color: var(--gm-on-second-cont); }
.gm-toggle--warn.is-on { background: var(--gm-accent-cont); color: var(--gm-on-accent-cont); }

/* Пользователь и меню */
.gm-user {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 4px 0 6px;
  border: 0; border-radius: 22px; background: none; color: var(--gm-text); cursor: pointer; text-align: left;
}
.gm-user:hover { background: rgba(var(--mdui-color-on-surface), .06); }
.gm-user__avatar {
  flex: none; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--gm-primary-cont); color: var(--gm-on-primary-cont); font-size: 15px; font-weight: 500;
}
.gm-user__avatar:empty::before { content: "person"; font-family: "Material Icons"; font-size: 20px; }
.gm-user__text { display: flex; flex-direction: column; min-width: 0; max-width: 220px; line-height: 16px; }
.gm-user__name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-user__role { font-size: 12px; color: var(--gm-muted); }
.gm-user__role:empty { display: none; }
.gm-user > .material-icons { font-size: 20px; color: var(--gm-muted); }
html[data-logged="1"] .for-guest, html:not([data-logged="1"]) .for-logged { display: none !important; }
html:not([data-tarif="2"]):not([data-tarif="3"]) .need-t2, html:not([data-tarif="3"]) .need-t3 { display: none !important; }
html:not([data-rights="1"]) .need-admin { display: none !important; }

/* Сообщение под шапкой (срок подписки и подобное) */
#div-info { text-align: center; font-size: 13px; }
#div-info:empty { display: none; }
#div-info > * { padding: 6px 16px; }
.note-error { background: rgb(var(--mdui-color-error-container)); color: rgb(var(--mdui-color-on-error-container)); }
.note-warning { background: var(--gm-warn-cont); color: var(--gm-on-warn-cont); }

/* ---------- Навигация ---------- */
.gm-rail {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 0;
  background: var(--gm-surface); border-right: 1px solid var(--gm-line); min-height: 0; overflow: hidden auto;
  position: relative; z-index: 20;
}
.gm-rail__space { flex: 1 1 auto; }
.gm-rail__item {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 72px; padding: 4px 0 6px;
  border: 0; background: none; color: var(--gm-muted); font-size: 12px; line-height: 16px; font-weight: 500; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.gm-rail__item .material-icons {
  display: flex; align-items: center; justify-content: center; width: 56px; height: 32px; border-radius: 16px; font-size: 24px;
  transition: background-color .15s;
}
.gm-rail__item:hover .material-icons { background: rgba(var(--mdui-color-on-surface), .08); }
.gm-rail__item.is-active { color: var(--gm-text); }
.gm-rail__item.is-active .material-icons { background: var(--gm-second-cont); color: var(--gm-on-second-cont); }
.gm-rail__item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html:not([data-logged="1"]) .gm-rail__item:not([data-nav="map"]) { opacity: .45; }

/* ---------- Карта и панели списков ---------- */
/* Область карты: панель списка (если открыта) и блок карты */
.gm-main--map { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.gm-mapbox { position: relative; grid-column: 2; grid-row: 1; min-width: 0; min-height: 0; overflow: hidden; }
#map { position: absolute; inset: 0; z-index: 0; background: rgb(var(--mdui-color-surface-container-high)); }

.gm-panel {
  display: none; flex-direction: column; grid-column: 1; grid-row: 1; width: var(--gm-panel-w); max-width: 100%; min-width: 0; min-height: 0;
  background: var(--gm-surface); border-right: 1px solid var(--gm-line); position: relative; z-index: 10;
}
.gm-panel.visible { display: flex; }
.gm-panel--wide { width: var(--gm-panel-wide); }
.gm-panel__head { flex: none; display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 8px 8px 8px 16px; }
.gm-panel__title { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 20px; line-height: 28px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-badge { display: inline-block; min-width: 24px; margin-left: 6px; padding: 0 8px; border-radius: 12px; background: var(--gm-second-cont); color: var(--gm-on-second-cont); font-size: 13px; line-height: 24px; font-weight: 500; text-align: center; vertical-align: 2px; }
.gm-badge:empty { display: none; }
.gm-panel__opt { flex: none; display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--gm-muted); cursor: pointer; }
.gm-panel__tools { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 12px 10px 16px; position: relative; }
.gm-panel__body { flex: 1 1 auto; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.gm-panel__empty { padding: 32px 24px; text-align: center; color: var(--gm-muted); }

/* Круглая кнопка со значком (в панелях, карточках, таблицах) */
.gm-ibtn {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--gm-muted); cursor: pointer;
}
.gm-ibtn:hover { background: rgba(var(--mdui-color-on-surface), .08); color: var(--gm-text); }
.gm-ibtn .material-icons { font-size: 22px; }
.gm-ibtn--tonal { background: var(--gm-second-cont); color: var(--gm-on-second-cont); }
.gm-ibtn:disabled, .gm-ibtn.is-disabled { opacity: .38; pointer-events: none; cursor: default; }

/* Гость: вход не выполнен */
.gm-guest { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; height: 100%; padding: 24px; text-align: center; color: var(--gm-muted); }
.gm-guest .material-icons { font-size: 64px; color: var(--gm-line); }
.gm-guest h2 { margin: 0; font-size: 22px; color: var(--gm-text); }

/* Карточка правки геозоны поверх карты (конструктор) */
#object-edit-place {
  display: none; position: absolute; z-index: 1001; top: 12px; right: 12px; width: min(440px, calc(100% - 24px)); max-height: calc(100% - 24px);
  padding: 16px; overflow-y: auto; border-radius: 16px; background: var(--gm-surface); box-shadow: var(--mdui-elevation-level3);
}
#object-edit-place.visible { display: block; }

/* ---------- Leaflet на цветах схемы ---------- */
.leaflet-container { font-family: var(--gm-font); font-size: 13px; }
.leaflet-touch .leaflet-bar, .leaflet-bar { border: 0; border-radius: 12px; overflow: hidden; box-shadow: var(--mdui-elevation-level2); }
.leaflet-bar a, .leaflet-bar a:hover, .leaflet-touch .leaflet-bar a {
  width: 40px; height: 40px; line-height: 40px; border-bottom: 1px solid var(--gm-line);
  background-color: var(--gm-surface); color: var(--gm-text);
}
.leaflet-bar a:hover { background-color: rgb(var(--mdui-color-surface-container-high)); }
.leaflet-bar a.leaflet-disabled { background-color: var(--gm-surface); color: var(--gm-line); }
.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out { font-size: 22px; }
.leaflet-control-layers { border: 0 !important; border-radius: 12px; background: var(--gm-surface); color: var(--gm-text); box-shadow: var(--mdui-elevation-level2); }
.leaflet-control-attribution { background: rgba(var(--mdui-color-surface), .8) !important; color: var(--gm-muted); font-size: 11px; }
.leaflet-control-attribution a { color: var(--gm-muted); }
.leaflet-control-scale-line { border-color: var(--gm-muted); background: rgba(var(--mdui-color-surface), .7); color: var(--gm-text); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--gm-surface); color: var(--gm-text); box-shadow: var(--mdui-elevation-level3); }
.leaflet-popup-content-wrapper { border-radius: 16px; }
.leaflet-popup-content { margin: 14px 18px; font-size: 13px; line-height: 19px; }
.leaflet-container a.leaflet-popup-close-button { top: 6px; right: 6px; width: 28px; height: 28px; line-height: 26px; color: var(--gm-muted); }
.leaflet-tooltip { border: 0; border-radius: 8px; background: var(--gm-surface); color: var(--gm-text); box-shadow: var(--mdui-elevation-level1); font-size: 12px; }
.leaflet-tooltip-top::before { border-top-color: var(--gm-surface); }
.custom-tooltip { padding: 2px 8px; font-weight: 500; white-space: nowrap; }
/* Меню карты по правой кнопке и долгому нажатию */
.leaflet-contextmenu { padding: 6px 0; border-radius: 12px; background: var(--gm-surface); box-shadow: var(--mdui-elevation-level3); }
.leaflet-contextmenu a.leaflet-contextmenu-item { padding: 0 16px; line-height: 36px; border: 0; color: var(--gm-text); font-size: 14px; }
.leaflet-contextmenu a.leaflet-contextmenu-item.over, .leaflet-contextmenu a.leaflet-contextmenu-item:hover { border: 0; background: rgba(var(--mdui-color-on-surface), .08); }
.leaflet-contextmenu-separator { margin: 6px 0; border-bottom-color: var(--gm-line); }
/* Панель рисования геозон */
.leaflet-draw-actions a { background-color: rgb(var(--mdui-color-inverse-surface)); color: rgb(var(--mdui-color-inverse-on-surface)); border-left-color: rgba(255, 255, 255, .2); }
.leaflet-draw-toolbar a { background-color: var(--gm-surface); }

/* Поиск по адресу: поле поверх карты */
.leaflet-top.leaflet-right { max-width: calc(100% - 64px); }
#map-find-div {
  display: flex; align-items: center; gap: 4px; width: 320px; max-width: 100%; height: 44px; padding: 0 6px 0 14px;
  border-radius: 22px; background: var(--gm-surface); box-shadow: var(--mdui-elevation-level2);
}
#map-find-div::before { content: "search"; font-family: "Material Icons"; font-size: 22px; color: var(--gm-muted); }
#map-find-div.expanded { width: 520px; }
#map-find-div .fleft, #map-find-div br { display: none; }
#map-find-div .suggestions-wrapper { position: static; }
#map-find-div .suggestions-suggestions { left: 0 !important; right: 0; top: 48px !important; width: auto !important; }
#map-find-text { flex: 1 1 auto; min-width: 0; height: 40px; border: 0; outline: 0; background: none; color: var(--gm-text); font-size: 15px; }
#map-find-arrow { flex: none; display: none; width: 36px; height: 36px; border-radius: 50%; color: var(--gm-muted); font-size: 0; text-align: center; cursor: pointer; }
#map-find-arrow::before { content: "close"; font-family: "Material Icons"; font-size: 20px; line-height: 36px; }
.suggestions-suggestions { border: 0 !important; border-radius: 12px; background: var(--gm-surface) !important; color: var(--gm-text); box-shadow: var(--mdui-elevation-level3); overflow: hidden; }
.suggestions-suggestion { padding: 8px 14px !important; }
.suggestions-suggestion:hover, .suggestions-selected { background: rgba(var(--mdui-color-on-surface), .08) !important; }
.suggestions-hint { padding: 6px 14px !important; color: var(--gm-muted) !important; }

/* ---------- Просмотр пути (js/app/trackview.js) ----------
   Полоса внизу карты: сотрудник и сводка за день, выбор дня, кнопки вида; ниже - пуск, время, ползунок,
   скорость. В режиме просмотра на <html> стоит data-track, высота полосы - в --gm-track-h.
   Полоса приподнята над нижним краем карты: под ней остаются на своих обычных местах подпись карты с
   авторскими правами (справа) и линейка масштаба (слева). */
.gm-track {
  position: absolute; z-index: 1000; left: 12px; right: 12px; bottom: 28px; max-width: 980px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 24px;
  background: var(--gm-surface); color: var(--gm-text); box-shadow: var(--mdui-elevation-level3);
}
.gm-track__head, .gm-track__play { display: flex; align-items: center; gap: 4px; min-width: 0; }
.gm-track__icon { flex: none; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--gm-primary-cont); color: var(--gm-on-primary-cont); font-size: 22px; }
.gm-track__who { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; padding: 0 8px; line-height: 18px; }
.gm-track__who b { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-track__who span { font-size: 12px; color: var(--gm-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.gm-track__who span:empty { display: none; }
.gm-track__day { flex: none; display: flex; align-items: center; }
/* Кнопка дня (открывает календарь GMTrackCal) и список скорости проигрывания */
.gm-track__date, .gm-track__speed {
  flex: none; height: 36px; border: 1px solid var(--gm-line); border-radius: 18px; background-color: var(--gm-surface); color: var(--gm-text);
  font-family: inherit; font-size: 13px; line-height: 34px; outline: none; cursor: pointer;
}
.gm-track__date { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px 0 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gm-track__date .material-icons { font-size: 18px; color: var(--gm-muted); }
/* Список скорости: свой вид вместо системного - системный берёт цвета из настроек системы, а не из темы портала,
   и в тёмной теме оставался белым. Список вариантов красится под тему через color-scheme */
.gm-track__speed {
  -webkit-appearance: none; appearance: none; padding: 0 28px 0 12px; color-scheme: light;
  background-image: linear-gradient(45deg, transparent 50%, var(--gm-muted) 50%), linear-gradient(135deg, var(--gm-muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.gm-track__speed option { background-color: var(--gm-surface); color: var(--gm-text); }
.mdui-theme-dark .gm-track__speed { color-scheme: dark; }
@media (prefers-color-scheme: dark) { .mdui-theme-auto .gm-track__speed { color-scheme: dark; } }
.gm-track__date:hover, .gm-track__speed:hover { background-color: rgb(var(--mdui-color-surface-container-high)); }
.gm-track__date:focus-visible, .gm-track__date[aria-expanded="true"], .gm-track__speed:focus-visible { border-color: var(--gm-primary); }
.gm-track .gm-ibtn.is-on { background: var(--gm-second-cont); color: var(--gm-on-second-cont); }
.gm-track button:disabled, .gm-track select:disabled, .gm-track input:disabled { opacity: .38; pointer-events: none; }
.gm-track__main {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%;
  background: var(--gm-primary); color: var(--gm-on-primary); cursor: pointer;
}
.gm-track__main:hover { filter: brightness(1.08); }
.gm-track__main .material-icons { font-size: 28px; }
.gm-track__clock { flex: none; display: flex; flex-direction: column; min-width: 88px; padding: 0 8px; font-variant-numeric: tabular-nums; }
.gm-track__clock b { font-size: 17px; line-height: 22px; font-weight: 500; }
.gm-track__clock span { min-height: 14px; font-size: 11px; line-height: 14px; color: var(--gm-muted); white-space: nowrap; }
.gm-track__slider { flex: 1 1 120px; min-width: 80px; height: 36px; margin: 0 4px; accent-color: var(--gm-primary); cursor: pointer; }
.gm-track__note { padding: 6px 12px 4px; font-size: 13px; line-height: 18px; color: var(--gm-muted); text-align: center; }
.gm-track[data-state="error"] .gm-track__note { color: var(--gm-error); }
.gm-track:not([data-state="ready"]) .gm-track__play { display: none; }
/* Начало и конец пути, метка сотрудника со стрелкой направления */
.gm-track-dot { border: 3px solid #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(0, 0, 0, .45); }
.gm-track-dot--start { background: #2e7d32; }
.gm-track-dot--end { background: #c62828; }
.gm-track-marker { border: 0; background: none; }
.gm-track-marker__in {
  display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 3px solid #fff; border-radius: 50%;
  background: var(--gm-primary); color: var(--gm-on-primary); box-shadow: 0 2px 6px rgba(0, 0, 0, .45);
}
.gm-track-marker__in .material-icons { font-size: 20px; }

/* Календарь выбора дня (GMTrackCal в js/app/trackview.js). Блок лежит в body и ставится у кнопки дня: вниз, а
   если вниз не помещается - вверх. Под числом дня - полоска на всю ячейку высотой 4 точки: 24 часа суток,
   серая часть - точек пути за час нет, зелёная - есть (четыре ступени насыщенности, --gm-cal-1 … --gm-cal-4) */
:root { --gm-cal-0: rgba(var(--mdui-color-on-surface), .16); --gm-cal-1: #b5dfb7; --gm-cal-2: #74c279; --gm-cal-3: #2f9e3a; --gm-cal-4: #14691d; }
.mdui-theme-dark { --gm-cal-0: rgba(var(--mdui-color-on-surface), .2); --gm-cal-1: #2a5a30; --gm-cal-2: #368a40; --gm-cal-3: #4cb858; --gm-cal-4: #86f090; }
@media (prefers-color-scheme: dark) {
  .mdui-theme-auto { --gm-cal-0: rgba(var(--mdui-color-on-surface), .2); --gm-cal-1: #2a5a30; --gm-cal-2: #368a40; --gm-cal-3: #4cb858; --gm-cal-4: #86f090; }
}
.gm-cal {
  position: fixed; z-index: 1030; top: 0; left: 0; box-sizing: border-box; width: 364px; max-width: calc(100vw - 16px); padding: 8px 10px 10px;
  border-radius: 20px; background: var(--gm-surface); color: var(--gm-text); box-shadow: var(--mdui-elevation-level3); overflow-y: auto;
  font-size: 14px; line-height: 20px; user-select: none; -webkit-user-select: none;
}
.gm-cal__head { display: flex; align-items: center; gap: 4px; }
.gm-cal__title { flex: 1 1 auto; text-align: center; font-size: 15px; font-weight: 500; }
.gm-cal__head button:disabled { opacity: .38; pointer-events: none; }
.gm-cal__week, .gm-cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); column-gap: 3px; }
.gm-cal__week { padding: 2px 0 4px; color: var(--gm-muted); font-size: 12px; text-align: center; }
.gm-cal__grid { row-gap: 3px; }
.gm-cal__day {
  display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; min-width: 0; height: 42px; padding: 5px 0 0;
  border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; font-variant-numeric: tabular-nums; cursor: pointer; overflow: hidden;
}
.gm-cal__num { text-align: center; line-height: 24px; }
.gm-cal__bar { display: block; height: 4px; margin: 0 1px 3px; border-radius: 2px; background-color: var(--gm-cal-0); background-repeat: no-repeat; }
.gm-cal__day:hover { background: rgba(var(--mdui-color-on-surface), .08); }
.gm-cal__day:focus-visible { outline: 2px solid var(--gm-primary); outline-offset: -2px; }
.gm-cal__day.is-today .gm-cal__num { font-weight: 700; color: var(--gm-primary); }
.gm-cal__day.is-picked, .gm-cal__day.is-picked:hover { background: var(--gm-second-cont); color: var(--gm-on-second-cont); box-shadow: inset 0 0 0 1px var(--gm-primary); }
.gm-cal__day:disabled { cursor: default; pointer-events: none; }
.gm-cal__day:disabled .gm-cal__num { opacity: .38; }
.gm-cal__day:disabled .gm-cal__bar { visibility: hidden; }
.gm-cal__foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 6px 2px 0 6px; border-top: 1px solid var(--gm-line); }
.gm-cal__legend { flex: 1 1 auto; min-width: 0; color: var(--gm-muted); font-size: 11px; line-height: 14px; }
.gm-cal__scale { display: inline-flex; gap: 1px; margin-left: 6px; vertical-align: middle; }
.gm-cal__scale i { display: block; width: 9px; height: 4px; background: var(--gm-cal-0); }
.gm-cal__scale i:first-child { border-radius: 2px 0 0 2px; }
.gm-cal__scale i:last-child { border-radius: 0 2px 2px 0; }
.gm-cal__scale i:nth-child(2) { background: var(--gm-cal-1); }
.gm-cal__scale i:nth-child(3) { background: var(--gm-cal-2); }
.gm-cal__scale i:nth-child(4) { background: var(--gm-cal-3); }
.gm-cal__scale i:nth-child(5) { background: var(--gm-cal-4); }
.gm-cal__today {
  flex: none; height: 32px; padding: 0 12px; border: 0; border-radius: 16px; background: none; color: var(--gm-primary); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.gm-cal__today:hover { background: rgba(var(--mdui-color-primary), .08); }
/* Служебной таблицы в базе аккаунта нет: календарь без полосок и пояснения к ним */
.gm-cal--nomarks .gm-cal__bar, .gm-cal--nomarks .gm-cal__legend { visibility: hidden; }
.gm-cal--nomarks .gm-cal__day { height: 38px; justify-content: center; padding: 0; }
.gm-cal--nomarks .gm-cal__bar { display: none; }
/* Низкое окно (телефон в альбомной ориентации): ячейки ниже, пояснение убрано - календарь помещается целиком */
@media (max-height: 480px) {
  .gm-cal { padding: 4px 10px 6px; }
  .gm-cal__day { height: 34px; padding-top: 2px; }
  .gm-cal__num { line-height: 22px; }
  .gm-cal__grid { row-gap: 1px; }
  .gm-cal__legend { display: none; }
  .gm-cal__foot { justify-content: flex-end; margin-top: 2px; padding-top: 2px; }
}

/* ---------- Всплывающие сообщения «сохранено» ---------- */
#edit-message, #save-hint {
  position: fixed; z-index: 10000; left: 50%; bottom: 24px; transform: translate(-50%, 12px); padding: 12px 20px; border-radius: 8px;
  background: rgb(var(--mdui-color-inverse-surface)); color: rgb(var(--mdui-color-inverse-on-surface)); font-size: 14px;
  box-shadow: var(--mdui-elevation-level3); visibility: hidden; opacity: 0; transition: opacity .25s, transform .25s, visibility .25s; pointer-events: none;
}
#edit-message.edit-visible, #save-hint.hint-visible { visibility: visible; opacity: 1; transform: translate(-50%, 0); }
html[data-layout="mobile"][data-orient="portrait"] #edit-message, html[data-layout="mobile"][data-orient="portrait"] #save-hint { bottom: calc(var(--gm-bar-h) + 16px); }

/* Крупный QR-код сотрудника */
#qr-code-big { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .5); }
#qr-code-big img, #qr-code-img { max-width: min(80vw, 80vh, 480px); height: auto; padding: 16px; border-radius: 16px; background: #fff; }

/* ====================== Раскладки ====================== */

/* Сверхширокий экран: панели шире, карточка заявки или посещения - третьей колонкой рядом со списком */
html[data-layout="ultra"] { --gm-panel-w: 460px; --gm-panel-wide: 760px; }

/* Планшет: панель списка выезжает поверх карты, карта под ней остаётся на весь экран */
html[data-layout="tablet"] { --gm-rail-w: 72px; --gm-panel-w: 380px; --gm-panel-wide: min(620px, 86%); }
html[data-layout="tablet"] .gm-main--map { display: block; }
html[data-layout="tablet"] .gm-mapbox { position: absolute; inset: 0; }
html[data-layout="tablet"] .gm-panel { position: absolute; left: 0; top: 0; bottom: 0; box-shadow: var(--mdui-elevation-level3); border-right: 0; }
html[data-layout="tablet"] .gm-top__portal { display: none; }

/* Телефон */
html[data-layout="mobile"] { --gm-top-h: 52px; }
html[data-layout="mobile"] .gm-top { gap: 6px; padding: 0 4px 0 10px; }
html[data-layout="mobile"] #logo { height: 30px; width: 27px; object-fit: cover; object-position: left center; }   /* от логотипа остаётся значок */
html[data-layout="mobile"] .gm-toggle__text { display: none; }
html[data-layout="mobile"] .gm-top__portal { display: none; }
html[data-layout="mobile"] .gm-user__text, html[data-layout="mobile"] .gm-user > .material-icons { display: none; }
html[data-layout="mobile"] .gm-user { padding: 0 6px; }
html[data-layout="mobile"] .gm-chip { max-width: 44vw; }
html[data-layout="mobile"] #map-find-div, html[data-layout="mobile"] #map-find-div.expanded { width: min(320px, calc(100vw - 84px)); }

/* Телефон, книжная ориентация: навигация внизу; открытая панель делит экран с картой (карта сверху) */
html[data-layout="mobile"][data-orient="portrait"] .gm-work { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
html[data-layout="mobile"][data-orient="portrait"] .gm-rail {
  grid-row: 2; flex-direction: row; justify-content: space-around; align-items: stretch; gap: 0; height: calc(var(--gm-bar-h) + env(safe-area-inset-bottom, 0px));
  padding: 6px 4px env(safe-area-inset-bottom, 0px); border-right: 0; border-top: 1px solid var(--gm-line); overflow: hidden;
}
html[data-layout="mobile"][data-orient="portrait"] .gm-rail__space { display: none; }
html[data-layout="mobile"][data-orient="portrait"] .gm-rail__item { flex: 1 1 0; width: auto; min-width: 0; font-size: 11px; }
html[data-layout="mobile"][data-orient="portrait"] .gm-main--map { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
html[data-layout="mobile"][data-orient="portrait"] .gm-mapbox { grid-column: 1; grid-row: 1; }
html[data-layout="mobile"][data-orient="portrait"][data-panel] .gm-main--map { grid-template-rows: minmax(140px, 38%) minmax(0, 1fr); }
html[data-layout="mobile"][data-orient="portrait"] .gm-panel {
  grid-column: 1; grid-row: 2; width: auto; border-right: 0; border-top: 1px solid var(--gm-line);
  border-radius: 16px 16px 0 0; margin-top: -14px; box-shadow: 0 -2px 8px rgba(0, 0, 0, .12);
}
html[data-layout="mobile"][data-orient="portrait"] .gm-panel__head { min-height: 48px; padding: 4px 4px 4px 16px; }
html[data-layout="mobile"][data-orient="portrait"] .gm-panel__title { font-size: 18px; }

/* Телефон, альбомная ориентация: навигация сбоку (высоты мало), панель слева от карты пополам */
html[data-layout="mobile"][data-orient="landscape"] { --gm-rail-w: 64px; --gm-top-h: 44px; }
html[data-layout="mobile"][data-orient="landscape"] .gm-rail { padding: 4px 0; gap: 0; }
html[data-layout="mobile"][data-orient="landscape"] .gm-rail__item { width: 60px; padding: 2px 0; font-size: 10px; line-height: 12px; gap: 0; }
html[data-layout="mobile"][data-orient="landscape"] .gm-rail__item .material-icons { width: 44px; height: 26px; font-size: 20px; }
html[data-layout="mobile"][data-orient="landscape"][data-panel] .gm-main--map { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
html[data-layout="mobile"][data-orient="landscape"][data-panel="orders"] .gm-main--map,
html[data-layout="mobile"][data-orient="landscape"][data-panel="visits"] .gm-main--map { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
html[data-layout="mobile"][data-orient="landscape"] .gm-panel { width: auto; }
html[data-layout="mobile"][data-orient="landscape"] .gm-panel__head { min-height: 40px; padding: 2px 4px 2px 12px; }
html[data-layout="mobile"][data-orient="landscape"] .gm-panel__title { font-size: 16px; }

/* Просмотр пути на телефоне: сводка и выход - первой строкой, день и кнопки вида - второй; ползунок - отдельной строкой */
html[data-layout="mobile"] .gm-track { left: 6px; right: 6px; bottom: 28px; padding: 6px 8px; border-radius: 20px; }
html[data-layout="mobile"][data-orient="portrait"] .gm-track__head { flex-wrap: wrap; row-gap: 2px; }
html[data-layout="mobile"][data-orient="portrait"] .gm-track__who { flex: 1 1 calc(100% - 96px); order: 1; }
html[data-layout="mobile"][data-orient="portrait"] .gm-track__icon { order: 0; }
/* Сводка за день на узком экране - в две строки: в одну не помещается вместе с наибольшей скоростью */
html[data-layout="mobile"][data-orient="portrait"] .gm-track__who span { white-space: normal; line-height: 15px; }
html[data-layout="mobile"][data-orient="portrait"] #close-playback-btn { order: 2; }
html[data-layout="mobile"][data-orient="portrait"] .gm-track__day { order: 3; flex: 1 1 auto; }
html[data-layout="mobile"][data-orient="portrait"] .gm-track__date { flex: 1 1 auto; min-width: 0; justify-content: center; }
html[data-layout="mobile"][data-orient="portrait"] .gm-track__opt { order: 4; }
html[data-layout="mobile"][data-orient="portrait"] .gm-track__play { flex-wrap: wrap; }
html[data-layout="mobile"][data-orient="portrait"] .gm-track__clock { flex: 1 1 auto; }
html[data-layout="mobile"][data-orient="portrait"] .gm-track__slider { order: 9; flex: 1 1 100%; margin: 0 6px; }
/* Альбомная ориентация телефона: высоты мало - значок и подпись под временем убраны */
html[data-layout="mobile"][data-orient="landscape"] .gm-track { gap: 0; }
html[data-layout="mobile"][data-orient="landscape"] .gm-track__icon, html[data-layout="mobile"][data-orient="landscape"] .gm-track__clock span { display: none; }
html[data-layout="mobile"][data-orient="landscape"] .gm-track__main { width: 40px; height: 40px; }
html[data-layout="mobile"][data-orient="landscape"] .gm-track__date { padding: 0 10px 0 8px; }
