        /* ===== ГЛОБАЛЬНЫЕ ===== */
        /* Фирменная палитра MapWay — тёмный чирок (морская волна) + чёрный,
           вместо прежнего фиолетового градиента */
        :root {
            --brand: #0f6f6c;
            --brand-rgb: 15, 111, 108;
            --brand-dark: #0b5451;
            --brand-darker: #072e2c;
            --ink: #0a0f0e;
            --ink-rgb: 10, 15, 14;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', sans-serif;
            background: #f5f5f5;
            overflow: hidden;
        }

        .app-container {
            display: none;
            width: 100%;
            height: 100vh;
            /* overflow:hidden всё равно разрешает менять scrollTop программно (например,
               браузерный scrollIntoView на фокусе внутри абсолютно спозиционированной
               панели) — из-за этого на мобильных шапка/карта иногда уезжали вверх.
               overflow:clip запрещает скролл контейнера вообще (fallback на hidden
               в браузерах, которые clip ещё не понимают). */
            overflow: hidden;
            overflow: clip;
        }

        .app-container.active {
            display: flex;
            flex-direction: column;
        }

        /* Лендинг — единственный экран без внутреннего скролл-контейнера (не грид/флекс
           панель, а обычная длинная страница), поэтому именно ему нужен собственный
           вертикальный скролл поверх общего overflow:hidden — иначе доп. блоки контента
           (картинки/видео), из-за которых страница стала выше 100vh, обрезаются снизу. */
        #landingScreen {
            overflow-y: auto;
        }

        /* ===== ЛЕНДИНГ ===== */
        .landing {
            /* Сплошной тёмный фон на всю (теперь прокручиваемую) страницу — так под
               дополнительными блоками контента никогда не проглянет белый фон body,
               даже когда общая высота страницы больше одного экрана. Само фото —
               только в первом экране, см. .landing-hero-section ниже. */
            background: var(--ink);
            color: white;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding-bottom: 60px;
        }

        .landing-hero-section {
            /* Фоновое фото + тёмный чирок/чёрный оверлей поверх — для контраста текста.
               Само фото — CSS-переменная --hero-image, чтобы админка могла подменить
               его на своё через настройки, не трогая градиент-оверлей инлайн-стилем.
               Ограничено высотой первого экрана — раньше фото растягивалось на
               background-attachment:fixed для всей страницы, что переставало работать,
               как только страница стала выше одного экрана (Хиро-редизайн, п.12/13). */
            width: 100%;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 24px 20px 40px;
            background: linear-gradient(160deg, rgba(var(--ink-rgb), 0.78) 0%, rgba(7, 46, 44, 0.82) 55%, rgba(11, 84, 81, 0.75) 100%), var(--hero-image, url('../img/hero.jpg'));
            background-size: cover;
            background-position: center;
            transition: background 0.5s;
        }

        .landing-nav {
            width: 100%;
            max-width: 1100px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 4px;
            margin-bottom: 10vh;
        }

        .landing-logo {
            font-size: 1.3rem;
            font-weight: 800;
            letter-spacing: 0.3px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .landing-logo i {
            color: var(--brand);
        }

        .landing-nav-actions {
            display: flex;
            gap: 10px;
        }

        .landing-hero {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
            max-width: 720px;
            margin: 0 auto;
        }

        .landing h1 {
            font-size: 2.8rem;
            font-weight: 800;
            line-height: 1.15;
            margin-bottom: 16px;
        }

        .landing p {
            font-size: 1.1rem;
            max-width: 600px;
            margin-bottom: 28px;
            opacity: 0.85;
        }

        .landing .btn {
            padding: 12px 32px;
            border: none;
            border-radius: 50px;
            font-size: 1rem;
            font-weight: 700;
            cursor: pointer;
            transition: 0.3s;
            background: var(--brand);
            color: white;
            margin: 6px;
        }

        .landing .btn:hover {
            transform: scale(1.05);
            background: var(--brand-dark);
        }

        .landing .btn-outline {
            background: transparent;
            border: 2px solid rgba(255, 255, 255, 0.6);
            color: white;
        }

        .landing .btn-outline:hover {
            background: rgba(255, 255, 255, 0.1);
            border-color: white;
        }

        .landing .btn-sm {
            padding: 8px 20px;
            font-size: 0.85rem;
            margin: 0;
        }

        .landing .btn-cta {
            background: var(--brand);
            font-size: 1.05rem;
            padding: 14px 40px;
            box-shadow: 0 8px 24px rgba(var(--brand-rgb), 0.4);
        }

        .landing .btn-cta:hover {
            background: var(--brand-dark);
        }

        .landing .features {
            display: flex;
            flex-wrap: wrap;
            gap: 20px;
            margin-top: 40px;
            justify-content: center;
        }

        .landing .feature {
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(4px);
            padding: 16px 24px;
            border-radius: 14px;
            max-width: 180px;
        }

        .landing .feature i {
            font-size: 2rem;
            margin-bottom: 6px;
            color: var(--brand);
        }

        .landing-about {
            width: 100%;
            max-width: 640px;
            margin-top: 50px;
            padding: 30px 20px 0;
            border-top: 1px solid rgba(255, 255, 255, 0.15);
            text-align: center;
            box-sizing: border-box;
        }

        .landing-about h2 {
            font-size: 1.4rem;
            margin-bottom: 10px;
        }

        .landing-about-text {
            font-size: 0.95rem;
            line-height: 1.6;
            opacity: 0.8;
        }

        /* Дополнительные блоки лендинга, настраиваемые из админки */
        .landing-blocks {
            width: 100%;
            max-width: 640px;
            margin-top: 10px;
            padding: 0 20px;
            display: flex;
            flex-direction: column;
            gap: 30px;
            box-sizing: border-box;
        }

        .landing-block {
            text-align: center;
        }

        .landing-block h2 {
            font-size: 1.3rem;
            margin-bottom: 10px;
        }

        .landing-block p {
            font-size: 0.95rem;
            line-height: 1.6;
            opacity: 0.85;
        }

        .landing-block img {
            max-width: 100%;
            border-radius: 14px;
            display: block;
            margin: 0 auto;
        }

        .landing-block video,
        .landing-block iframe {
            max-width: 100%;
            width: 100%;
            aspect-ratio: 16 / 9;
            border-radius: 14px;
            border: none;
            display: block;
        }

        .landing-block-caption {
            font-size: 0.8rem;
            opacity: 0.65;
            margin-top: 8px;
        }

        /* ===== ВЕРХНЯЯ ПАНЕЛЬ (полноширинный тёмный хедер) ===== */
        .app-header {
            flex-shrink: 0;
            height: 34px;
            background: rgba(var(--ink-rgb), 0.78);
            backdrop-filter: blur(10px);
            color: rgba(255, 255, 255, 0.9);
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 14px;
            z-index: 1001;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
        }

        .app-header-logo {
            font-size: 0.95rem;
            font-weight: 800;
            color: white;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .app-header-logo i {
            color: var(--brand);
        }

        .app-header-actions {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .app-header .tool-btn {
            width: 26px;
            height: 26px;
            font-size: 12px;
            border-radius: 7px;
            border: none;
            background: transparent;
            cursor: pointer;
            transition: 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            color: rgba(255, 255, 255, 0.8);
        }

        .app-header .tool-btn:hover {
            background: rgba(255, 255, 255, 0.1);
            color: white;
        }

        .app-header .tool-btn.end-edit {
            width: auto;
            padding: 0 10px;
            height: 24px;
            font-size: 11px;
            font-weight: 600;
            border-radius: 7px;
            background: rgba(255, 255, 255, 0.08);
        }

        .app-header .tool-divider {
            width: 1px;
            height: 18px;
            background: rgba(255, 255, 255, 0.15);
            margin: 0 2px;
        }

        /* ===== Выпадающее меню выбора формата скачивания (шапка карты + кабинет) ===== */
        .download-menu-wrap {
            position: relative;
            display: inline-flex;
        }

        .download-menu {
            display: none;
            /* position:fixed + координаты через JS (см. toggleDownloadMenu), а не
               absolute относительно обёртки — иначе меню зажимается overflow:hidden
               у .route-card в кабинете, когда карточка выше (длинное описание) и под
               кнопкой остаётся меньше места до нижнего края карточки. */
            position: fixed;
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
            z-index: 1500;
            min-width: 130px;
            overflow: hidden;
        }

        .download-menu.open {
            display: block;
        }

        .download-menu button {
            display: block;
            width: 100%;
            text-align: left;
            padding: 9px 14px;
            background: none;
            border: none;
            cursor: pointer;
            font-size: 13px;
            color: var(--ink);
        }

        .download-menu button:hover {
            background: rgba(var(--brand-rgb), 0.1);
            color: var(--brand);
        }

        #userInfo {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 11px;
            color: rgba(255, 255, 255, 0.85);
        }

        #userInfo #userAvatar {
            width: 20px;
            height: 20px;
            border-radius: 50%;
            display: none;
            object-fit: cover;
        }

        /* ===== ЛЕВАЯ ПАНЕЛЬ ===== */
        .left-toolbar {
            position: absolute;
            left: 16px;
            top: 50%;
            transform: translateY(-50%);
            background: white;
            border-radius: 14px;
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
            z-index: 1001;
            display: flex;
            flex-direction: column;
            padding: 6px 4px;
            gap: 2px;
        }

        .left-toolbar .tool-btn {
            width: 34px;
            height: 34px;
            font-size: 15px;
            border-radius: 8px;
            border: none;
            background: transparent;
            cursor: pointer;
            transition: 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #555;
        }

        .left-toolbar .tool-btn:hover {
            background: rgba(0, 0, 0, 0.06);
        }

        .left-toolbar .tool-btn.active {
            background: var(--brand);
            color: white;
        }

        .left-toolbar .tool-divider-vertical {
            width: 80%;
            height: 1px;
            background: rgba(0, 0, 0, 0.08);
            margin: 2px auto;
        }

        /* ===== ПРАВАЯ ПАНЕЛЬ ===== */
        .side-panel {
            /* Ширина настраивается в админке (вкладка "Контент сайта" → "Интерфейс
               карты"), а не перетаскиванием мышкой, как раньше — см. applySettings()
               в admin-content.js. 452px — запасное значение по умолчанию. */
            position: absolute;
            top: 16px;
            right: 16px;
            width: var(--side-panel-width, 452px);
            max-height: calc(100% - 32px);
            background: white;
            border-radius: 16px;
            box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
            z-index: 1000;
            padding: 12px;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        /* Ручка сворачивания правой панели в "шторку" снизу — значима только на
           мобильных (см. @media ниже), на десктопе панель всегда полностью открыта. */
        .side-panel-mobile-handle {
            display: none;
            border: none;
            background: none;
            padding: 0;
        }

        .side-panel .panel-tabs {
            display: flex;
            gap: 2px;
            margin-bottom: 10px;
            background: #eef1f1;
            border-radius: 10px;
            padding: 3px;
            flex-shrink: 0;
        }

        .side-panel .panel-tab {
            padding: 7px 4px;
            font-size: 10px;
            border-radius: 8px;
            border: none;
            background: transparent;
            cursor: pointer;
            transition: 0.2s;
            flex: 1;
            text-align: center;
            color: #666;
            font-weight: 600;
        }

        .side-panel .panel-tab:hover {
            color: var(--brand);
        }

        .side-panel .panel-tab.active {
            background: var(--brand);
            color: white;
            box-shadow: 0 2px 6px rgba(var(--brand-rgb), 0.35);
        }

        .side-panel .panel-content {
            display: none;
            flex: 1;
            overflow-y: auto;
            padding-right: 2px;
        }

        .side-panel .panel-content.active {
            display: block;
        }

        .side-panel .panel-title {
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.4px;
            color: #999;
            margin-bottom: 6px;
        }

        .panel-btn {
            width: 100%;
            padding: 8px;
            margin-bottom: 4px;
            border: none;
            border-radius: 10px;
            font-size: 11px;
            font-weight: 600;
            cursor: pointer;
            transition: 0.15s;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 4px;
            background: #f0f2f2;
            color: #333;
        }

        .panel-btn:hover {
            background: #e4e7e7;
            transform: translateY(-1px);
        }

        /* Только нейтральный серый и цвет темы — без красных/зелёных/оранжевых
           плашек. Акцент темой (чирок) — только у "Новый маршрут" (начало
           работы), остальные кнопки нейтральные (порядок и подтверждения через
           confirm() и так предупреждают о необратимых действиях). */
        .panel-btn.secondary,
        .panel-btn.success,
        .panel-btn.danger {
            background: #f0f2f2;
            color: #333;
        }

        .panel-btn.secondary:hover,
        .panel-btn.success:hover,
        .panel-btn.danger:hover {
            background: #e4e7e7;
        }

        .panel-btn.primary {
            background: var(--brand);
            color: white;
        }

        .panel-btn.primary:hover {
            background: var(--brand-dark);
        }

        .side-panel .panel-stats {
            font-size: 10px;
            font-weight: 600;
            color: #777;
            text-align: center;
            padding: 6px 0;
            background: #f5f6f6;
            border-radius: 8px;
            margin-top: 6px;
        }

        /* ===== ОПИСАНИЕ МАРШРУТА (панель "Упр.") ===== */
        .route-description-view {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .route-name-text {
            font-size: 13px;
            font-weight: 700;
            color: #222;
        }

        .route-description-text {
            font-size: 12px;
            color: #555;
            line-height: 1.4;
            white-space: pre-wrap;
            word-break: break-word;
        }

        .route-name-input {
            width: 100%;
            padding: 7px 9px;
            border: 1px solid #ddd;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 600;
            font-family: inherit;
            margin-bottom: 6px;
        }

        .route-description-edit-link {
            align-self: flex-start;
            border: none;
            background: none;
            color: var(--brand);
            font-size: 11px;
            font-weight: 600;
            cursor: pointer;
            padding: 0;
        }

        .route-description-edit-link:hover {
            text-decoration: underline;
        }

        .route-description-edit textarea {
            width: 100%;
            min-height: 60px;
            padding: 8px 9px;
            border: 1px solid #ddd;
            border-radius: 8px;
            font-size: 12px;
            font-family: inherit;
            resize: vertical;
        }

        .route-description-edit-actions {
            display: flex;
            gap: 8px;
            margin-top: 6px;
        }

        /* ===== ПОДСКАЗКА ПО ЦЕНТРУ (замена системного alert()) ===== */
        .hint-toast {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%) scale(0.95);
            z-index: 3000;
            background: rgba(var(--ink-rgb), 0.9);
            color: white;
            padding: 14px 22px;
            border-radius: 12px;
            font-size: 14px;
            font-weight: 600;
            text-align: center;
            box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.2s, transform 0.2s;
            max-width: 320px;
        }

        .hint-toast.active {
            opacity: 1;
            transform: translate(-50%, -50%) scale(1);
        }

        /* ===== СЕГМЕНТЫ ===== */
        .segment-list {
            margin-top: 4px;
        }

        .segment-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 5px 6px;
            background: #f7f8f8;
            border-radius: 8px;
            margin-bottom: 4px;
            font-size: 10px;
            transition: 0.15s;
        }

        .segment-item:hover {
            background: #eef1f1;
        }

        .segment-item .seg-left {
            display: flex;
            align-items: center;
            flex: 1;
            min-width: 0;
        }

        .segment-item .seg-color {
            width: 10px;
            height: 10px;
            border-radius: 3px;
            margin-right: 4px;
            flex-shrink: 0;
        }

        .segment-item .seg-info {
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        .segment-item .seg-name {
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            font-size: 10px;
        }

        .segment-item .seg-distance {
            font-size: 8px;
            color: #888;
        }

        .segment-item .seg-actions {
            display: flex;
            gap: 2px;
        }

        .segment-item .seg-actions button {
            background: none;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 10px;
            color: #888;
            padding: 3px 4px;
        }

        .segment-item .seg-actions button:hover {
            color: var(--brand);
            background: rgba(var(--brand-rgb), 0.1);
        }

        .segments-total {
            font-size: 10px;
            font-weight: 600;
            color: #333;
            margin-top: 4px;
            padding: 4px 0;
            border-top: 1px solid rgba(0, 0, 0, 0.06);
            text-align: right;
        }

        .segment-item.highlighted {
            background: rgba(var(--brand-rgb), 0.12);
            border-left: 2px solid var(--brand);
        }

        .segment-item.seg-excluded {
            opacity: 0.5;
        }

        /* ===== ИНФОРМАЦИЯ О МАРШРУТЕ (ВНИЗУ ПО ЦЕНТРУ) ===== */
        .track-info {
            /* left/top подобраны так, чтобы панель стояла правее поля поиска
               (.search-box, left:56px + width:300px) и не перекрывалась им и
               выпадающим списком результатов поиска, даже когда он открыт. */
            position: absolute;
            top: 8px;
            left: 372px;
            background: white;
            border-radius: 14px;
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
            z-index: 999;
            padding: 8px 12px;
            min-width: 220px;
            font-size: 13px;
        }

        /* Список меток — переиспользуется и в панели инфо о треке (метки трека),
           и в панели "Упр." (обычные метки маршрута), поэтому классы общие. */
        .mini-list {
            margin-top: 6px;
            max-height: 220px;
            overflow-y: auto;
            border-top: 1px solid rgba(0, 0, 0, 0.08);
        }

        .mini-list-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 6px 4px;
            font-size: 12px;
            color: #333;
            cursor: pointer;
            border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        }

        .mini-list-item:last-child {
            border-bottom: none;
        }

        .mini-list-item:hover {
            background: rgba(var(--brand-rgb), 0.08);
        }

        .mini-list-item i {
            color: var(--brand);
            font-size: 12px;
        }

        .track-info-name {
            font-size: 12px;
            font-weight: 600;
            color: #333;
            margin-bottom: 4px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .track-info .stats-row {
            display: flex;
            justify-content: space-around;
            gap: 8px;
        }

        .track-info .stat-item .value {
            font-size: 15px;
            font-weight: 700;
            color: #333;
        }

        .track-info .stat-item .label {
            font-size: 9px;
            color: #888;
        }

        .track-info .stat-item .icon {
            color: var(--brand);
            margin-right: 2px;
        }

        .route-info {
            position: absolute;
            bottom: 24px;
            left: 50%;
            transform: translateX(-50%);
            background: white;
            border-radius: 16px;
            box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
            z-index: 999;
            padding: 14px 28px;
            display: none;
            min-width: 360px;
            text-align: center;
            font-size: 14px;
        }

        .route-info.active {
            display: block;
        }

        .route-info .stats-row {
            display: flex;
            justify-content: space-around;
            align-items: center;
            gap: 18px;
            margin-bottom: 8px;
        }

        .route-info .stat-item .value {
            font-size: 20px;
            font-weight: 700;
            color: #333;
        }

        .route-info .stat-item .label {
            font-size: 11px;
            color: #888;
        }

        .route-info .stat-item .icon {
            color: var(--brand);
            margin-right: 2px;
        }

        .route-info .stat-item.time-stat .value {
            font-size: 30px;
            font-weight: 800;
            color: #333;
        }

        .route-info .stat-item.time-stat .label {
            font-size: 12px;
        }

        .route-info .activity-row {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 12px;
            font-size: 13px;
            color: #555;
            border-top: 1px solid rgba(0, 0, 0, 0.06);
            padding-top: 8px;
            margin-top: 2px;
        }

        .route-info .activity-row span i {
            margin-right: 4px;
            color: var(--brand);
        }

        .route-info .speed-control {
            display: inline-flex;
            align-items: center;
            gap: 3px;
        }

        .route-info .speed-control input {
            width: 60px;
            font-size: 15px;
            font-weight: 600;
            border: 1px solid rgba(0, 0, 0, 0.2);
            border-radius: 6px;
            padding: 3px 6px;
            text-align: center;
        }

        /* ===== МОДАЛКИ ===== */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 2000;
            display: none;
            align-items: center;
            justify-content: center;
            backdrop-filter: blur(4px);
        }

        .modal-overlay.active {
            display: flex;
        }

        .modal {
            background: white;
            border-radius: 14px;
            padding: 16px;
            width: 380px;
            max-width: 90vw;
            max-height: 80vh;
            overflow: auto;
        }

        /* Модалки с более объёмным содержимым (например, "Поделиться" с полем
           ссылки, тумблерами и кодом виджета) — шире и вручную растягиваемая
           (resize за нижний правый угол), чтобы было удобнее работать с текстом. */
        .modal.modal-wide {
            width: 520px;
            resize: both;
        }

        .modal-title {
            font-size: 16px;
            font-weight: 700;
            margin-bottom: 12px;
            text-align: center;
        }

        .modal input,
        .modal textarea {
            width: 100%;
            padding: 6px 8px;
            margin-bottom: 8px;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 13px;
            font-family: inherit;
        }

        /* Тумблеры (.seg-include-checkbox) внутри модалок иначе наследуют правило
           выше (.modal input) и растягиваются на всю ширину модалки вместо своих
           26x15px — сбрасываем инпутные стили обратно на стили тумблера. */
        .modal input.seg-include-checkbox {
            width: 26px;
            height: 15px;
            padding: 0;
            margin-bottom: 0;
            border: none;
            border-radius: 999px;
        }

        .modal .btn-row {
            display: flex;
            gap: 8px;
            margin-top: 10px;
        }

        .password-field-wrap {
            position: relative;
            margin-bottom: 8px;
        }

        .password-field-wrap input {
            margin-bottom: 0;
            padding-right: 32px;
        }

        .password-toggle-icon {
            position: absolute;
            right: 10px;
            top: 50%;
            transform: translateY(-50%);
            color: #999;
            cursor: pointer;
            font-size: 14px;
            user-select: none;
        }

        .password-toggle-icon:hover {
            color: var(--brand);
        }

        .modal .btn-row .btn {
            flex: 1;
            padding: 8px;
            border: none;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: 0.2s;
        }

        .modal .btn-row .btn-primary {
            background: var(--brand);
            color: white;
        }

        .modal .btn-row .btn-secondary {
            background: #f0f0f0;
            color: #333;
        }

        .help-guide-wrapper {
            display: none;
        }

        /* Крестик закрытия гайда — position:sticky, а не в конце содержимого:
           текст гайда длинный и .modal сам скроллится (overflow:auto), раньше
           единственная кнопка "Закрыть" была внизу под всем текстом — приходилось
           долистывать до конца, чтобы закрыть модалку. */
        .modal-close-x {
            position: sticky;
            top: 0;
            float: right;
            margin: -16px -16px 0 0;
            background: #fff;
            border: none;
            border-radius: 0 14px 0 8px;
            font-size: 22px;
            line-height: 1;
            width: 36px;
            height: 32px;
            cursor: pointer;
            color: #888;
            z-index: 2;
        }

        .modal-close-x:hover {
            color: #333;
            background: #f0f0f0;
        }

        .help-guide-wrapper hr {
            margin: 12px 0;
            border: none;
            border-top: 1px solid #eee;
        }

        .contact-links {
            display: flex;
            flex-direction: column;
            gap: 6px;
            margin-top: 14px;
            padding-top: 12px;
            border-top: 1px solid #eee;
        }

        .contact-link {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 10px;
            border-radius: 8px;
            background: #f5f6f7;
            color: #333;
            text-decoration: none;
            font-size: 13px;
            font-weight: 600;
        }

        .contact-link i {
            color: var(--brand);
        }

        .contact-link:hover {
            background: rgba(var(--brand-rgb), 0.1);
        }

        .modal-message {
            font-size: 13px;
            color: #555;
            text-align: center;
        }

        .modal .auth-toggle {
            margin-top: 8px;
            text-align: center;
            font-size: 13px;
            color: #888;
        }

        .modal .auth-toggle a {
            color: var(--brand);
            cursor: pointer;
        }

        .auth-divider {
            display: flex;
            align-items: center;
            text-align: center;
            font-size: 12px;
            color: #aaa;
            margin: 14px 0 2px;
        }

        .auth-divider::before,
        .auth-divider::after {
            content: '';
            flex: 1;
            border-bottom: 1px solid #eee;
        }

        .auth-divider::before {
            margin-right: 8px;
        }

        .auth-divider::after {
            margin-left: 8px;
        }

        .auth-forgot-link {
            text-align: right;
            font-size: 12px;
            margin: -4px 0 8px;
        }

        .auth-forgot-link a {
            color: var(--brand);
            cursor: pointer;
        }

        .auth-legal-notice {
            margin-top: 12px;
            padding-top: 10px;
            border-top: 1px solid #eee;
            font-size: 11px;
            line-height: 1.5;
            color: #888;
            text-align: center;
        }

        .auth-legal-notice a {
            color: var(--brand);
            cursor: pointer;
        }

        .legal-doc-content {
            font-size: 13px;
            line-height: 1.6;
            color: #333;
            max-height: 60vh;
            overflow-y: auto;
        }

        .legal-doc-content h1,
        .legal-doc-content h2,
        .legal-doc-content h3 {
            margin: 14px 0 6px;
        }

        /* ===== КНОПКА ПОМОЩИ ===== */
        .help-btn {
            position: absolute;
            bottom: 80px;
            left: 10px;
            z-index: 999;
            background: var(--brand);
            color: white;
            border: none;
            border-radius: 50%;
            width: 40px;
            height: 40px;
            font-size: 18px;
            cursor: pointer;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
            transition: 0.3s;
            animation: pulse 2s infinite;
        }

        .help-btn:hover {
            transform: scale(1.1);
        }

        /* Ссылки на соцсети — набор круглых кнопок-иконок (настраиваются в админке,
           renderSocialLinks() в admin-content.js), сколько включено, столько и рендерится. */
        .map-social-links {
            position: absolute;
            bottom: 130px;
            left: 10px;
            z-index: 999;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .map-social-links .social-icon-btn {
            width: 40px;
            height: 40px;
            font-size: 18px;
        }

        /* Та же иконка, но на лендинге — position:fixed, т.к. #landingScreen
           сам скроллится (единственный экран без внутреннего flex-контейнера),
           поэтому кнопка должна быть закреплена относительно окна, а не карты. */
        .landing-social-links {
            position: fixed;
            bottom: 24px;
            left: 24px;
            z-index: 999;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .landing-social-links .social-icon-btn {
            width: 44px;
            height: 44px;
            font-size: 20px;
        }

        .social-icon-btn {
            border-radius: 50%;
            background: var(--brand);
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            text-decoration: none;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
            transition: 0.3s;
        }

        .social-icon-btn:hover {
            transform: scale(1.1);
            background: var(--brand-dark);
        }

        @keyframes pulse {
            0% {
                box-shadow: 0 0 0 0 rgba(var(--brand-rgb), 0.5);
            }

            70% {
                box-shadow: 0 0 0 12px rgba(var(--brand-rgb), 0);
            }

            100% {
                box-shadow: 0 0 0 0 rgba(var(--brand-rgb), 0);
            }
        }

        /* ===== НИЖНЯЯ ПАНЕЛЬ ПРОФИЛЯ ВЫСОТ ===== */
        .elevation-toggle-btn {
            position: absolute;
            bottom: 20px;
            right: 20px;
            z-index: 999;
            background: var(--brand);
            color: white;
            border: none;
            border-radius: 50%;
            width: 40px;
            height: 40px;
            font-size: 16px;
            cursor: pointer;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
            transition: 0.3s;
        }

        .elevation-toggle-btn:hover {
            transform: scale(1.1);
        }

        .elevation-toggle-btn.active {
            background: #4CAF50;
        }

        .elevation-drawer {
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(255, 255, 255, 0.96);
            backdrop-filter: blur(8px);
            box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15);
            z-index: 1000;
            transform: translateY(100%);
            transition: transform 0.3s ease;
            max-height: min(300px, 60vh);
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            padding: 10px 16px;
        }

        .elevation-drawer.open {
            transform: translateY(0);
        }

        .elevation-drawer-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-weight: 600;
            font-size: 13px;
            color: #333;
            margin-bottom: 6px;
            flex-shrink: 0;
        }

        .elevation-drawer-close {
            background: none;
            border: none;
            cursor: pointer;
            font-size: 14px;
            color: #888;
            padding: 4px;
        }

        .elevation-drawer-close:hover {
            color: #333;
        }

        .elevation-drawer-body {
            flex: 1;
            min-height: 120px;
            position: relative;
        }

        .elevation-drawer-body canvas {
            width: 100% !important;
            height: 100% !important;
        }

        .elevation-drawer .profile-stats {
            flex-shrink: 0;
        }

        /* В нижней панели места по ширине хватает — держим все 5 плашек в один ряд,
           чтобы они не переносились и не съезжали за пределы экрана */
        .elevation-drawer .profile-stats .profile-stat {
            flex: 1 1 0;
            min-width: 0;
        }

        .elevation-drawer .profile-stat-label,
        .elevation-drawer .profile-stat-value {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .elevation-drawer-body {
            min-height: 90px;
        }

        /* ===== КМ-МЕТКИ (сегменты и маршрут) ===== */
        /* Полупрозрачные, без цветной (брендовой) заливки — чтобы не перекрывать
           карту и не спорить по цвету с линией маршрута, только тонкая обводка. */
        .km-label {
            background: rgba(255, 255, 255, 0.45);
            color: var(--ink);
            border-radius: 50%;
            width: 24px;
            height: 24px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            font-size: 7px;
            font-weight: 700;
            border: 1px solid rgba(255, 255, 255, 0.7);
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
            line-height: 1;
            opacity: 0.8;
        }

        .km-label .num {
            font-size: 10px;
            margin-top: -1px;
        }

        .km-label .unit {
            font-size: 5px;
            opacity: 0.8;
            margin-top: -2px;
        }

        /* ===== ПОДСКАЗКА ПРИ РИСОВАНИИ СЕГМЕНТА ===== */
        .segment-draw-hint {
            position: absolute;
            top: 60px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 6px 14px;
            border-radius: 8px;
            z-index: 1002;
            font-size: 13px;
            display: none;
            pointer-events: none;
        }

        .segment-draw-hint.active {
            display: block;
        }

        .segment-draw-hint kbd {
            background: rgba(255, 255, 255, 0.2);
            padding: 2px 6px;
            border-radius: 4px;
            margin: 0 4px;
        }

        /* ===== АДМИНКА ===== */
        .cabinet-nav-divider {
            border-top: 1px solid rgba(255, 255, 255, 0.1);
            margin: 8px 4px;
        }

        .admin-tab-content {
            display: none;
        }

        .admin-tab-content.active {
            display: block;
        }

        .admin-panel {
            background: white;
            border-radius: 12px;
            padding: 20px 24px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
            margin-bottom: 20px;
        }

        .setting-item {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 14px;
        }

        .setting-item:last-child {
            margin-bottom: 0;
        }

        .setting-item label,
        .setting-item-label {
            width: 140px;
            flex-shrink: 0;
            font-weight: 600;
            font-size: 13px;
            color: #333;
        }

        .setting-item.column {
            flex-direction: column;
            align-items: stretch;
        }

        .setting-item.column label,
        .setting-item.column .setting-item-label {
            width: auto;
        }

        .setting-item input[type="text"],
        .setting-item textarea {
            flex: 1;
            padding: 8px 10px;
            border: 1px solid #ddd;
            border-radius: 8px;
            font-size: 13px;
            font-family: inherit;
        }

        /* Textarea, растягиваемые по высоте контента через autoGrowTextarea() —
           без ручного изменения размера и внутренней прокрутки, чтобы весь текст
           было видно сразу, а не листать ползунком в маленьком окне.
           flex:none обязателен: унаследованный flex:1 (flex-basis:0%) во флекс-колонке
           .setting-item.column иначе пересчитывает высоту заново при каждом layout,
           перебивая высоту, выставленную через style.height в JS. */
        .setting-item textarea,
        .admin-block-card-fields textarea {
            flex: none;
            resize: none;
            overflow: hidden;
            min-height: 2.4em;
        }

        .audit-pagination {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 16px;
            margin-top: 16px;
            font-size: 13px;
            color: #666;
        }

        .audit-pagination button:disabled {
            opacity: 0.5;
            cursor: default;
        }

        .admin-empty-state {
            color: #888;
            text-align: center;
            padding: 40px 0;
            font-size: 14px;
        }

        .admin-btn {
            padding: 8px 20px;
            border: none;
            border-radius: 8px;
            background: var(--brand);
            color: white;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: 0.2s;
        }

        .admin-btn:hover {
            background: var(--brand-dark);
        }

        .admin-btn.secondary {
            background: #f0f0f0;
            color: #333;
        }

        .admin-btn-file {
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }

        .admin-panel-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 14px;
        }

        .admin-panel-header h3 {
            font-size: 15px;
            color: #333;
        }

        .admin-panel-hint {
            font-size: 12px;
            color: #888;
            margin: -6px 0 14px;
        }

        .admin-block-list {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-bottom: 14px;
        }

        .admin-block-card {
            border: 1px solid #e5e5e5;
            border-radius: 10px;
            padding: 12px 14px;
            display: flex;
            gap: 10px;
            align-items: flex-start;
        }

        .admin-block-card-fields {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 8px;
            min-width: 0;
        }

        .admin-block-card-fields input[type="text"],
        .admin-block-card-fields textarea,
        .admin-block-card-fields select {
            width: 100%;
            padding: 6px 8px;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 13px;
            font-family: inherit;
        }

        .admin-block-card-controls {
            display: flex;
            flex-direction: column;
            gap: 4px;
            flex-shrink: 0;
        }

        .admin-block-card-controls button {
            width: 28px;
            height: 28px;
            border: none;
            border-radius: 6px;
            background: #f0f0f0;
            color: #555;
            cursor: pointer;
            font-size: 12px;
        }

        .admin-block-card-controls button:hover {
            background: #e0e0e0;
        }

        .admin-block-card-controls button:disabled {
            opacity: 0.35;
            cursor: default;
        }

        .admin-block-card-controls button.remove {
            color: #f44336;
        }

        .admin-icon-row {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .admin-icon-row input[type="text"] {
            flex: 1;
        }

        .admin-icon-row select {
            width: auto;
            flex-shrink: 0;
        }

        .admin-icon-preview {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 30px;
            height: 30px;
            border-radius: 8px;
            background: rgba(var(--brand-rgb), 0.1);
            color: var(--brand);
            font-size: 14px;
            flex-shrink: 0;
        }

        .admin-upload-row {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
        }

        .admin-upload-row input[type="text"] {
            flex: 1;
            min-width: 120px;
        }

        .admin-media-preview {
            max-width: 160px;
            max-height: 90px;
            border-radius: 6px;
            display: block;
            margin-top: 4px;
            object-fit: cover;
        }

        .admin-hero-preview-row {
            display: flex;
            align-items: center;
            gap: 14px;
            flex-wrap: wrap;
        }

        /* ---- Дашборд ---- */
        .dash-stats {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
            gap: 14px;
            margin-bottom: 20px;
        }

        .admin-stat-card {
            background: white;
            border-radius: 12px;
            padding: 16px 18px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        }

        .dash-stat-value {
            font-size: 1.7rem;
            font-weight: 800;
            color: var(--ink);
        }

        .dash-stat-label {
            font-size: 12px;
            color: #888;
            margin-top: 2px;
        }

        .dash-stat-sub {
            font-size: 11px;
            color: var(--brand);
            font-weight: 700;
            margin-top: 6px;
        }

        .dash-charts-row {
            display: grid;
            grid-template-columns: 1.4fr 1fr;
            gap: 16px;
            margin-bottom: 20px;
        }

        .dash-chart-panel {
            min-width: 0;
        }

        .dash-period-toggle {
            display: flex;
            gap: 4px;
            flex-shrink: 0;
        }

        .dash-period-btn {
            padding: 4px 10px;
            border: 1px solid #ddd;
            border-radius: 8px;
            background: white;
            font-size: 12px;
            font-weight: 600;
            color: #666;
            cursor: pointer;
            transition: 0.15s;
        }

        .dash-period-btn:hover {
            border-color: var(--brand);
        }

        .dash-period-btn.active {
            border-color: var(--brand);
            background: rgba(var(--brand-rgb), 0.08);
            color: var(--brand);
        }

        /* Отдельный контейнер строго под сам canvas (не считая заголовка панели) —
           иначе высота, выставленная на всю .admin-panel, включала заголовок и
           смещала диаграмму вниз/обрезала её. */
        .dash-chart-canvas-wrap {
            position: relative;
            width: 100%;
            height: 220px;
        }

        .dash-usage-row {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
            gap: 14px;
        }

        .dash-usage-item {
            text-align: center;
            padding: 10px;
            background: #f7f8f8;
            border-radius: 10px;
        }

        .dash-usage-value {
            font-size: 1.3rem;
            font-weight: 800;
            color: var(--brand);
        }

        .dash-usage-label {
            font-size: 11px;
            color: #777;
            margin-top: 2px;
        }

        .dash-lists-row {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 16px;
            margin-bottom: 20px;
        }

        .dash-list {
            list-style: none;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .dash-list li {
            display: flex;
            justify-content: space-between;
            gap: 8px;
            font-size: 13px;
            padding-bottom: 8px;
            border-bottom: 1px solid #f0f0f0;
        }

        .dash-list li:last-child {
            border-bottom: none;
            padding-bottom: 0;
        }

        .dash-list .dash-list-name {
            color: #333;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .dash-list .dash-list-value {
            color: var(--brand);
            font-weight: 700;
            flex-shrink: 0;
        }

        .admin-hero-preview-row img {
            width: 160px;
            height: 90px;
            object-fit: cover;
            border-radius: 8px;
            border: 1px solid #eee;
        }

        /* ---- Редактор форматированного текста (Quill) ---- */
        .rich-editor {
            background: white;
            margin-bottom: 4px;
        }

        .rich-editor .ql-editor {
            min-height: 90px;
            font-size: 13px;
        }

        .admin-block-card-fields .rich-editor {
            width: 100%;
        }

        /* Quill не знает форматы "upper"/"lower" — свои кнопки регистра букв,
           подписываем текстом вместо иконки (которой для них нет). */
        .ql-toolbar .ql-upper,
        .ql-toolbar .ql-lower {
            width: auto !important;
            padding: 0 6px !important;
            font-size: 11px;
            font-weight: 700;
        }

        .ql-toolbar .ql-upper::before {
            content: "ABC";
        }

        .ql-toolbar .ql-lower::before {
            content: "abc";
        }

        .admin-user-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 13px;
        }

        .admin-user-table th,
        .admin-user-table td {
            padding: 6px 10px;
            border-bottom: 1px solid #eee;
            text-align: left;
        }

        .admin-user-table th {
            background: #f5f5f5;
        }

        .admin-user-table .btn-sm {
            padding: 4px 10px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 12px;
        }

        .admin-user-table .btn-sm.danger {
            background: #f44336;
            color: white;
        }

        .admin-user-table .btn-sm.danger:hover {
            background: #d32f2f;
        }

        .admin-user-table .btn-sm.primary {
            background: var(--brand);
            color: white;
        }

        .admin-user-table .btn-sm.primary:hover {
            background: var(--brand-dark);
        }

        .admin-user-table .role-select {
            padding: 2px 4px;
            border-radius: 4px;
            border: 1px solid #ddd;
        }

        /* ===== ЛИЧНЫЙ КАБИНЕТ ===== */
        .cabinet-layout {
            display: flex;
            height: 100vh;
            background: #f5f6f7;
        }

        .cabinet-sidebar {
            width: 220px;
            flex-shrink: 0;
            background: var(--ink);
            color: rgba(255, 255, 255, 0.85);
            display: flex;
            flex-direction: column;
            padding: 20px 14px;
        }

        /* Кнопка-гамбургер и подложка для мобильного off-canvas меню — значимы
           только на мобильных (см. @media ниже), на десктопе сайдбар всегда открыт. */
        .cabinet-mobile-toggle {
            display: none;
            position: fixed;
            top: 10px;
            left: 10px;
            width: 38px;
            height: 38px;
            border-radius: 8px;
            border: none;
            background: var(--ink);
            color: white;
            font-size: 16px;
            cursor: pointer;
            z-index: 2600;
            align-items: center;
            justify-content: center;
        }

        .cabinet-sidebar-backdrop {
            display: none;
        }

        .cabinet-logo {
            font-size: 1.15rem;
            font-weight: 800;
            color: white;
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 0 8px;
            margin-bottom: 24px;
        }

        .cabinet-logo i {
            color: var(--brand);
        }

        .cabinet-nav {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .cabinet-nav-item {
            display: flex;
            align-items: center;
            gap: 10px;
            width: 100%;
            padding: 10px 12px;
            border: none;
            border-radius: 8px;
            background: transparent;
            color: rgba(255, 255, 255, 0.75);
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: 0.2s;
            text-align: left;
        }

        .cabinet-nav-item i {
            width: 16px;
            text-align: center;
        }

        .cabinet-nav-item:hover {
            background: rgba(255, 255, 255, 0.08);
            color: white;
        }

        .cabinet-nav-item.active {
            background: var(--brand);
            color: white;
        }

        .cabinet-nav-count {
            margin-left: auto;
            background: rgba(255, 255, 255, 0.15);
            border-radius: 10px;
            padding: 1px 7px;
            font-size: 11px;
        }

        .cabinet-nav-item.active .cabinet-nav-count {
            background: rgba(0, 0, 0, 0.2);
        }

        /* ===== ПАПКИ МАРШРУТОВ (КАБИНЕТ) ===== */
        .cabinet-nav-section-label {
            font-size: 10px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: rgba(255, 255, 255, 0.4);
            padding: 4px 12px;
            margin-top: 2px;
        }

        .folder-item {
            padding-right: 6px;
        }

        .folder-item-name {
            display: flex;
            align-items: center;
            gap: 10px;
            flex: 1;
            min-width: 0;
            cursor: pointer;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .folder-icon-btn {
            background: transparent;
            border: none;
            color: inherit;
            opacity: 0.5;
            cursor: pointer;
            padding: 2px 4px;
            font-size: 11px;
        }

        .folder-icon-btn:hover {
            opacity: 1;
        }

        .route-folder-select {
            width: 100%;
            margin-top: 8px;
            padding: 5px 8px;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 11px;
            color: #666;
            background: #fafafa;
        }

        .cabinet-main {
            flex: 1;
            overflow-y: auto;
            padding: 28px 32px;
        }

        .cabinet-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 20px;
        }

        .cabinet-header h1 {
            font-size: 1.6rem;
            color: #1a1a1a;
        }

        .cabinet-sort {
            padding: 8px 14px;
            border: 1px solid #ddd;
            border-radius: 8px;
            background: white;
            font-size: 13px;
            font-weight: 600;
            color: #333;
            cursor: pointer;
        }

        .cabinet-sort:hover {
            border-color: var(--brand);
        }

        .route-list {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
            gap: 16px;
        }

        .route-card {
            background: white;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
            transition: 0.2s;
        }

        .route-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
        }

        /* transform на .route-card создаёт containing block для position:fixed
           потомков (.download-menu) — пока меню открыто, оно вместо viewport
           позиционируется от карточки и обрезается её overflow:hidden. Убираем
           transform на время открытого меню. */
        .route-card.menu-open,
        .route-card.menu-open:hover {
            transform: none;
        }

        .route-thumb {
            height: 120px;
            /* Заливка-заглушка на случай пустой геометрии/пока грузится картинка карты */
            background: linear-gradient(135deg, var(--brand) 0%, var(--brand-darker) 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

        .route-thumb img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        .route-thumb i {
            font-size: 2.4rem;
            color: rgba(255, 255, 255, 0.5);
        }

        .route-card-body {
            padding: 10px 12px;
        }

        .route-card .route-name {
            font-weight: 700;
            font-size: 14px;
            color: #333;
        }

        .route-card .route-description {
            font-size: 12px;
            color: #666;
            margin: 3px 0;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
        }

        .route-card .route-meta {
            display: flex;
            gap: 12px;
            font-size: 11px;
            color: #888;
            flex-wrap: wrap;
            margin: 4px 0;
        }

        .route-card .route-actions {
            display: flex;
            gap: 6px;
            margin-top: 6px;
            justify-content: flex-end;
        }

        .route-card .route-actions button {
            background: none;
            border: none;
            color: #888;
            cursor: pointer;
            font-size: 13px;
            padding: 2px 6px;
            border-radius: 4px;
        }

        .route-card .route-actions .restore-btn {
            color: var(--brand);
        }

        .route-card .route-actions .restore-btn:hover {
            background: rgba(var(--brand-rgb), 0.1);
        }

        .route-card .route-actions .delete-btn {
            color: #f44336;
        }

        .route-card .route-actions .delete-btn:hover {
            background: rgba(244, 67, 54, 0.1);
        }

        .route-card .route-actions .share-btn {
            color: #4CAF50;
        }

        .route-card .route-actions .share-btn:hover {
            background: rgba(76, 175, 80, 0.1);
        }

        .route-card .route-actions .edit-btn {
            color: #FF9800;
        }

        .route-card .route-actions .edit-btn:hover {
            background: rgba(255, 152, 0, 0.1);
        }

        .route-card .route-actions .download-btn {
            color: var(--brand);
        }

        .route-card .route-actions .download-btn:hover {
            background: rgba(var(--brand-rgb), 0.1);
        }

        /* ===== ТОЧКА МАРШРУТА (маленький кружок с точкой внутри, без редактирования) ===== */
        .route-point-icon {
            background: none !important;
            border: none !important;
        }

        .route-point-dot {
            width: 14px;
            height: 14px;
            border-radius: 50%;
            background: #fff;
            border: 2px solid var(--brand);
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
            position: relative;
        }

        .route-point-dot::after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 5px;
            height: 5px;
            border-radius: 50%;
            background: var(--brand);
            transform: translate(-50%, -50%);
        }

        /* ===== МАРКЕР МЕТКИ (убраны квадратики) ===== */
        .custom-marker .leaflet-marker-icon {
            background: none !important;
            border: none !important;
            box-shadow: none !important;
        }

        .custom-marker {
            background: none !important;
            border: none !important;
        }

        /* ===== ПОПАП МЕТКИ (редизайн) ===== */
        .mark-popup {
            display: flex;
            flex-direction: column;
            gap: 10px;
            min-width: 230px;
        }

        .mark-color-row {
            display: flex;
            gap: 6px;
            flex-wrap: wrap;
        }

        .mark-color-swatch {
            width: 22px;
            height: 22px;
            border-radius: 50%;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 10px;
            padding: 0;
            box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.6);
            transition: transform 0.15s;
        }

        .mark-color-swatch:hover {
            transform: scale(1.1);
        }

        .mark-color-swatch.selected {
            box-shadow: 0 0 0 2px white, 0 0 0 3.5px var(--ink);
        }

        .mark-type-select {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 10px;
            border: 1px solid #ddd;
            border-radius: 8px;
            cursor: pointer;
            font-size: 13px;
            color: #333;
        }

        .mark-type-select i.fas:first-child {
            color: var(--brand);
            width: 16px;
            text-align: center;
        }

        .mark-type-chevron {
            margin-left: auto;
            font-size: 10px;
            color: #999;
        }

        .mark-icon-picker {
            max-height: 180px;
            overflow-y: auto;
            border: 1px solid #eee;
            border-radius: 8px;
            padding: 8px;
            background: #fafafa;
        }

        .mark-icon-group-label {
            font-size: 11px;
            font-weight: 700;
            color: #888;
            margin: 6px 0 4px;
            text-transform: uppercase;
        }

        .mark-icon-group-label:first-child {
            margin-top: 0;
        }

        .mark-icon-grid {
            display: grid;
            grid-template-columns: repeat(6, 1fr);
            gap: 4px;
        }

        .mark-icon-option {
            width: 30px;
            height: 30px;
            border: none;
            border-radius: 6px;
            background: white;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #444;
            font-size: 13px;
            transition: background 0.15s;
        }

        .mark-icon-option:hover {
            background: rgba(var(--brand-rgb), 0.12);
            color: var(--brand);
        }

        .mark-popup input[type="text"],
        .mark-popup textarea {
            width: 100%;
            padding: 7px 9px;
            border: 1px solid #ddd;
            border-radius: 8px;
            font-size: 13px;
            font-family: inherit;
        }

        .mark-popup textarea {
            min-height: 50px;
            resize: vertical;
        }

        .mark-coords {
            font-size: 11px;
            color: #999;
        }

        .mark-popup-actions {
            display: flex;
            gap: 8px;
        }

        .mark-btn-primary,
        .mark-btn-secondary {
            flex: 1;
            padding: 8px;
            border: none;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
        }

        .mark-btn-primary {
            background: var(--brand);
            color: white;
        }

        .mark-btn-primary:hover {
            background: var(--brand-dark);
        }

        .mark-btn-secondary {
            background: #f5f5f5;
            color: #c62828;
        }

        .mark-btn-secondary:hover {
            background: #ffebee;
        }

        /* ===== КАРТА ===== */
        #map {
            height: 100%;
            width: 100%;
        }

        /* ===== ОСТАЛЬНОЕ (профиль, карта) ===== */
        .profile-container {
            width: 100%;
            max-height: 140px;
            margin-top: 4px;
            background: rgba(255, 255, 255, 0.8);
            border-radius: 8px;
            padding: 4px;
            overflow: hidden;
        }

        .profile-container canvas {
            width: 100% !important;
            height: 100px !important;
        }

        .profile-placeholder {
            color: #999;
            font-size: 11px;
            text-align: center;
            padding: 20px 0;
        }

        .profile-stats {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-top: 6px;
        }

        .profile-stat {
            flex: 1 1 40%;
            background: rgba(255, 255, 255, 0.8);
            border-radius: 6px;
            padding: 4px 6px;
            text-align: center;
            color: #333;
        }

        .profile-stat-label {
            font-size: 9px;
            color: #888;
            white-space: nowrap;
        }

        .profile-stat-value {
            font-size: 13px;
            font-weight: 700;
        }

        .profile-stat i {
            color: var(--brand);
            margin-right: 3px;
        }

        .profile-source-switch {
            display: flex;
            gap: 4px;
            margin: 4px 0;
        }

        .profile-switch-btn {
            flex: 1;
            padding: 4px 8px;
            font-size: 10px;
            font-weight: 600;
            border: none;
            border-radius: 6px;
            background: var(--brand);
            color: white;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 3px;
            white-space: nowrap;
            transition: 0.2s;
        }

        .profile-switch-btn:hover {
            background: var(--brand-dark);
        }

        .elevation-drawer-header .profile-source-switch {
            margin: 0 10px;
            flex: 1;
            max-width: 260px;
        }

        .profile-seg-toggles {
            display: flex;
            flex-wrap: wrap;
            gap: 4px;
            margin: 2px 0 6px;
            max-height: 60px;
            overflow-y: auto;
            flex-shrink: 0;
        }

        .profile-seg-toggle {
            display: flex;
            align-items: center;
            gap: 3px;
            font-size: 10px;
            background: rgba(0, 0, 0, 0.05);
            border-radius: 10px;
            padding: 2px 8px 2px 4px;
            cursor: pointer;
            white-space: nowrap;
            border-left: 3px solid var(--seg-color, var(--brand));
        }

        /* Переключатели-тумблеры в цвет темы (вместо стандартных чекбоксов
           браузера) — включение сегмента в общую статистику и в профиль высот */
        .seg-include-checkbox,
        .profile-seg-toggle input {
            appearance: none;
            -webkit-appearance: none;
            width: 26px;
            height: 15px;
            background: #dcdfdf;
            border-radius: 999px;
            position: relative;
            cursor: pointer;
            flex-shrink: 0;
            margin-right: 5px;
            transition: background 0.2s;
        }

        .seg-include-checkbox::before,
        .profile-seg-toggle input::before {
            content: '';
            position: absolute;
            top: 2px;
            left: 2px;
            width: 11px;
            height: 11px;
            background: white;
            border-radius: 50%;
            transition: transform 0.2s;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
        }

        .seg-include-checkbox:checked,
        .profile-seg-toggle input:checked {
            background: var(--brand);
        }

        .seg-include-checkbox:checked::before,
        .profile-seg-toggle input:checked::before {
            transform: translateX(11px);
        }

        .map-selector {
            display: flex;
            gap: 4px;
        }

        /* ===== ВИДЖЕТ ДЛЯ ВСТРАИВАНИЯ (?widget=shareId) ===== */
        #widgetScreen {
            position: relative;
        }

        .widget-stats-overlay {
            position: absolute;
            top: 12px;
            left: 12px;
            z-index: 999;
            background: rgba(255, 255, 255, 0.92);
            border-radius: 10px;
            padding: 10px 14px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
            font-size: 12px;
            color: #333;
            max-width: 220px;
        }

        .widget-stat-name {
            font-weight: 700;
            margin-bottom: 4px;
        }

        .widget-stat-row {
            display: flex;
            gap: 12px;
            color: #666;
        }

        .widget-branding {
            position: absolute;
            bottom: 8px;
            right: 8px;
            z-index: 999;
            background: rgba(255, 255, 255, 0.85);
            color: var(--brand-dark);
            font-size: 11px;
            font-weight: 700;
            padding: 3px 8px;
            border-radius: 6px;
            text-decoration: none;
        }

        .widget-error {
            display: flex;
            align-items: center;
            justify-content: center;
            height: 100%;
            color: #888;
            font-size: 14px;
        }

        /* ===== ТОЧКИ ИНТЕРЕСА (вода/перевалы/транспорт) ===== */
        .poi-marker-icon {
            background: none !important;
            border: none !important;
        }

        .poi-marker-dot {
            width: 22px;
            height: 22px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 11px;
            border: 2px solid white;
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
        }

        /* ===== ВКЛАДКА "НАСТРОЙКИ" (отображение меток/км-отметок на карте) ===== */
        .settings-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 12px;
            color: #333;
            padding: 6px 0;
        }

        .settings-radio-row {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 12px;
            color: #333;
            padding: 4px 0;
            cursor: pointer;
        }

        .settings-number-input {
            width: 60px;
            padding: 4px 8px;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 12px;
            text-align: center;
        }

        /* ===== ПОИСК МЕСТ И АДРЕСОВ ===== */
        .search-box {
            position: absolute;
            top: 8px;
            left: 56px;
            width: 300px;
            z-index: 1001;
        }

        .search-input-wrap {
            display: flex;
            align-items: center;
            gap: 8px;
            background: white;
            border-radius: 14px;
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
            padding: 0 12px;
            height: 42px;
        }

        .search-input-wrap i.fa-search {
            color: #888;
            font-size: 13px;
        }

        .search-input-wrap input {
            flex: 1;
            border: none;
            outline: none;
            background: transparent;
            font-size: 13px;
            height: 100%;
            font-family: inherit;
        }

        .search-clear-btn {
            border: none;
            background: transparent;
            color: #999;
            cursor: pointer;
            font-size: 13px;
            padding: 4px;
            display: flex;
            align-items: center;
        }

        .search-clear-btn:hover {
            color: #555;
        }

        .search-results {
            margin-top: 6px;
            background: white;
            border-radius: 14px;
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
            max-height: 320px;
            overflow-y: auto;
        }

        .search-result-item {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            padding: 10px 12px;
            cursor: pointer;
            border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        }

        .search-result-item:last-child {
            border-bottom: none;
        }

        .search-result-item:hover {
            background: rgba(var(--brand-rgb), 0.08);
        }

        .search-result-item i {
            color: var(--brand);
            margin-top: 3px;
            font-size: 13px;
        }

        .search-result-name {
            font-size: 13px;
            font-weight: 600;
            color: #333;
        }

        .search-result-address {
            font-size: 11px;
            color: #888;
        }

        .search-result-empty {
            padding: 12px;
            font-size: 12px;
            color: #999;
            text-align: center;
        }

        .map-btn {
            flex: 1;
            padding: 4px;
            border: 2px solid #ddd;
            border-radius: 6px;
            background: white;
            cursor: pointer;
            font-size: 10px;
            font-weight: 600;
            transition: 0.2s;
            text-align: center;
        }

        .map-btn:hover {
            border-color: var(--brand);
        }

        .map-btn.active {
            border-color: var(--brand);
            background: rgba(var(--brand-rgb), 0.08);
            color: var(--brand);
        }

        .map-layer-group-label {
            font-size: 10px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.4px;
            color: #999;
            margin: 10px 0 4px;
        }

        /* ===== КНОПКИ-ТРИГГЕРЫ ФЛАУТ-ПАНЕЛЕЙ "СЛОИ"/"МЕСТА" ===== */
        .map-layer-menu-btn {
            width: 100%;
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 11px 12px;
            border: 1px solid #eee;
            border-radius: 10px;
            background: white;
            font-size: 13px;
            font-weight: 600;
            color: #333;
            cursor: pointer;
            margin-bottom: 8px;
            transition: 0.15s;
        }

        .map-layer-menu-btn i:first-child {
            color: var(--brand);
            width: 16px;
            text-align: center;
        }

        .map-layer-menu-btn:hover {
            border-color: var(--brand);
        }

        .map-layer-menu-btn.active {
            border-color: var(--brand);
            background: rgba(var(--brand-rgb), 0.08);
            color: var(--brand);
        }

        .map-layer-menu-chevron {
            margin-left: auto;
            font-size: 11px;
            color: #bbb;
        }

        /* ===== ФЛАУТ-ПАНЕЛИ "СЛОИ"/"МЕСТА" (выезжают слева от правой панели) ===== */
        .map-flyout {
            display: none;
            position: absolute;
            width: 340px;
            min-width: 280px;
            min-height: 220px;
            background: white;
            border-radius: 16px;
            box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);
            z-index: 1001;
            flex-direction: column;
            overflow: hidden;
            /* Ручка растягивания в правом нижнем углу — панель маленькая по
               умолчанию не влезала под длинные списки слоёв/категорий. */
            resize: both;
        }

        .map-flyout.open {
            display: flex;
        }

        .flyout-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 12px 14px;
            font-size: 14px;
            font-weight: 700;
            border-bottom: 1px solid #eee;
            flex-shrink: 0;
        }

        .flyout-close-btn {
            border: none;
            background: none;
            color: #999;
            cursor: pointer;
            font-size: 14px;
            padding: 4px;
        }

        .flyout-close-btn:hover {
            color: #333;
        }

        .flyout-search {
            display: flex;
            align-items: center;
            gap: 8px;
            margin: 10px 14px 0;
            padding: 8px 10px;
            border: 1px solid #ddd;
            border-radius: 8px;
            color: #999;
            font-size: 12px;
            flex-shrink: 0;
        }

        .flyout-search input {
            border: none;
            outline: none;
            flex: 1;
            font-size: 13px;
            font-family: inherit;
            color: #333;
        }

        .flyout-filter-pills {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            padding: 10px 14px 0;
            flex-shrink: 0;
        }

        .flyout-pill {
            border: 1px solid #ddd;
            background: white;
            border-radius: 999px;
            padding: 5px 11px;
            font-size: 11px;
            font-weight: 600;
            color: #555;
            cursor: pointer;
            white-space: nowrap;
        }

        .flyout-pill:hover {
            border-color: var(--brand);
        }

        .flyout-pill.active {
            background: var(--brand);
            border-color: var(--brand);
            color: white;
        }

        .flyout-sort-row {
            padding: 8px 14px 0;
            flex-shrink: 0;
        }

        .flyout-sort-btn {
            border: none;
            background: none;
            color: var(--brand);
            font-size: 11px;
            font-weight: 600;
            cursor: pointer;
            padding: 2px 0;
        }

        .flyout-body {
            padding: 10px 14px 14px;
            overflow-y: auto;
            flex: 1;
        }

        .map-flyout .admin-panel-hint {
            padding: 0 14px 12px;
            margin: 0;
            flex-shrink: 0;
        }

        .poi-loading-indicator {
            display: flex;
            align-items: center;
            gap: 8px;
            margin: 10px 14px 0;
            font-size: 12px;
            color: var(--brand);
        }

        /* ========================================================================
           МОБИЛЬНАЯ АДАПТАЦИЯ (п.8 в статусе CLAUDE.md)
           ======================================================================== */
        @media (max-width: 768px) {

            /* ---- Лендинг ---- */
            .landing h1 {
                font-size: 2rem;
            }

            .landing p {
                font-size: 1rem;
            }

            .landing-nav {
                margin-bottom: 6vh;
            }

            .landing-hero-section {
                padding: 16px 14px 30px;
            }

            .landing .feature {
                max-width: 140px;
                padding: 12px 16px;
            }

            /* ---- Верхняя панель на карте ---- */
            .app-header {
                padding: 0 8px;
            }

            .app-header-actions {
                gap: 3px;
            }

            .app-header .tool-btn.end-edit {
                padding: 0 7px;
            }

            /* ---- Левая панель инструментов ---- */
            .left-toolbar {
                left: 8px;
            }

            .left-toolbar .tool-btn {
                width: 30px;
                height: 30px;
                font-size: 13px;
            }

            /* ---- Поиск мест — уже позиционтрован правее левой панели, просто
               уменьшаем ширину, чтобы не вылезать за экран ---- */
            .search-box {
                left: 48px;
                width: min(260px, calc(100vw - 64px));
            }

            /* ---- Инфо о загруженном треке — на десктопе стоит правее поиска,
               на мобильном места рядом уже нет, переносим под поиск ---- */
            .track-info {
                left: 48px;
                top: 58px;
                min-width: 0;
                width: min(260px, calc(100vw - 64px));
            }

            /* ---- Правая (боковая) панель управления — превращается в нижнюю
               "шторку" на всю ширину экрана вместо плавающего окна 452px ---- */
            .side-panel {
                top: auto;
                bottom: 0;
                left: 0;
                right: 0;
                width: 100%;
                max-height: 72vh;
                border-radius: 16px 16px 0 0;
                transition: transform 0.25s ease;
                padding-top: 6px;
            }

            /* Реальная область нажатия шире видимой полоски (5px не попасть пальцем) —
               полоска рисуется псевдоэлементом по центру настоящей высоты кнопки. */
            .side-panel-mobile-handle {
                display: block;
                width: 100%;
                height: 22px;
                background: none;
                cursor: pointer;
                flex-shrink: 0;
                position: relative;
            }

            .side-panel-mobile-handle::after {
                content: '';
                position: absolute;
                top: 50%;
                left: 50%;
                transform: translate(-50%, -50%);
                width: 40px;
                height: 5px;
                border-radius: 999px;
                background: #ddd;
            }

            /* Свёрнутое состояние по умолчанию — видны только ручка и вкладки,
               карта остаётся доступной под ней. Разворачивается тапом по ручке
               (toggleSidePanelMobile() в js/ui.js). */
            .side-panel.mobile-collapsed {
                transform: translateY(calc(100% - 54px));
            }

            /* ---- Нижняя информационная панель маршрута (дистанция/время) ---- */
            .route-info {
                min-width: 0;
                width: calc(100% - 24px);
                max-width: 360px;
                padding: 10px 14px;
                bottom: 12px;
            }

            .route-info .stat-item.time-stat .value {
                font-size: 24px;
            }

            /* ---- Флаут-панели "Слои"/"Места" ---- */
            .map-flyout {
                width: calc(100vw - 32px);
                max-width: 340px;
            }

            /* ---- Личный кабинет / Админка — боковое меню становится
               выезжающим off-canvas вместо постоянной колонки 220px ---- */
            .cabinet-mobile-toggle {
                display: flex;
            }

            .cabinet-sidebar {
                position: fixed;
                top: 0;
                left: 0;
                bottom: 0;
                width: 240px;
                transform: translateX(-100%);
                transition: transform 0.25s ease;
                z-index: 2500;
            }

            .cabinet-layout.sidebar-open .cabinet-sidebar {
                transform: translateX(0);
            }

            .cabinet-layout.sidebar-open .cabinet-sidebar-backdrop {
                display: block;
                position: fixed;
                inset: 0;
                background: rgba(0, 0, 0, 0.4);
                z-index: 2400;
            }

            .cabinet-main {
                padding: 60px 16px 24px;
            }

            .cabinet-header {
                flex-wrap: wrap;
                gap: 10px;
            }

            .route-list {
                grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
            }
        }

        @media (max-width: 480px) {

            /* Подписи текстом у кнопок шапки карты (Скачать/Поделиться/Кабинет) —
               на совсем узких экранах остаются только иконки. */
            .btn-label {
                display: none;
            }

            .app-header .tool-btn.end-edit {
                padding: 0 8px;
            }

            #userInfo #userName {
                display: none;
            }

            .landing h1 {
                font-size: 1.6rem;
            }

            .route-info {
                padding: 8px 10px;
            }

            .route-info .stats-row {
                gap: 8px;
            }

            .map-flyout {
                width: calc(100vw - 20px);
            }

            .side-panel {
                max-height: 78vh;
            }
        }
