* {
    box-sizing: border-box;
}

body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    font-family: 'Segoe UI', sans-serif;
    background: #0f172a;
    overflow: hidden;
}

#map {
    height: 100vh;
    width: 100vw;
}

/* ЕДИНЫЙ ПРАВЫЙ САЙДБАР СО СКРОЛЛОМ */
.right-sidebar {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 320px;
    max-height: calc(100dvh - 30px);
    max-height: calc(100vh - 30px);
    overflow-y: auto;
    /* Включает прокрутку при переполнении */
    pointer-events: auto;
    padding-right: 2px;
    padding-bottom: 50px;
    /* 👈 Запас снизу, чтобы элементы не перекрывались панелью браузера */
}

/* Стилизация полосы прокрутки сайдбара */
.right-sidebar::-webkit-scrollbar {
    width: 4px;
}

.right-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.right-sidebar::-webkit-scrollbar-thumb {
    background: rgba(243, 156, 18, 0.4);
    border-radius: 4px;
}

/* Общий стиль карточек */
.sidebar-card {
    flex-shrink: 0;
    /* Запрещает сжимать высоту блоков */
    background: rgba(26, 37, 47, 0.95);
    color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.toggle-btn {
    color: #bdc3c7;
    font-size: 12px;
    transition: transform 0.3s ease;
    padding: 2px;
}

.toggle-btn:hover {
    color: #ffffff;
}

/* ПРАВИЛА СВОРАЧИВАНИЯ КАРТОЧЕК */
.profile-card.collapsed .profile-card-body,
.devices-card.collapsed .device-search-box,
.devices-card.collapsed .devices-list,
.info-card.collapsed #details,
.info-card.collapsed .filter-section,
.info-card.collapsed #track-summary-box {
    display: none !important;
}

.sidebar-card.collapsed .toggle-btn {
    transform: rotate(180deg);
}

/* СТИЛИ БЛОКА ПРОФИЛЯ */
.profile-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.info-block {
    background: rgba(13, 20, 26, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 8px;
}

.block-label {
    font-size: 8.5px;
    color: #85929e;
    font-weight: bold;
}

.block-val-blue {
    color: #3498db;
    font-family: monospace;
    font-weight: bold;
    font-size: 12px;
}

.block-val-bold {
    color: #ffffff;
    font-weight: bold;
    font-size: 11px;
}

.balance-title {
    font-size: 10px;
    color: #bdc3c7;
    margin-top: 2px;
}

.balance-val {
    color: #2ecc71;
    font-weight: bold;
    font-size: 14px;
}

.btn-toggle-pair,
.btn-toggle-trio {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.toggle-btn-item {
    flex: 1;
    background: transparent;
    border: 1px solid #34495e;
    color: #85929e;
    padding: 5px;
    border-radius: 5px;
    font-size: 9px;
    font-weight: bold;
    cursor: pointer;
}

.toggle-btn-item.active {
    border-color: #f39c12;
    color: #f39c12;
    background: rgba(243, 156, 18, 0.1);
}

.app-banner {
    background: rgba(46, 204, 113, 0.08);
    border: 1px solid rgba(46, 204, 113, 0.25);
    padding: 6px 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
}

.app-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-icon-bg {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(52, 152, 219, 0.2);
    border: 1px solid #3498db;
    color: #3498db;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.app-icon-bg.green {
    background: rgba(46, 204, 113, 0.2);
    border-color: #2ecc71;
    color: #2ecc71;
}

.app-title {
    font-size: 10px;
    font-weight: bold;
    color: #fff;
}

.app-desc {
    font-size: 8.5px;
    color: #bdc3c7;
}

.app-download-btn {
    background: #2ecc71;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 9px;
    font-weight: bold;
    border: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.app-download-btn.disabled {
    background: #34495e;
    color: #85929e;
    cursor: not-allowed;
}

.action-buttons-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.btn-action-green {
    background: #2ecc71;
    color: #fff;
}

.btn-action-orange {
    background: #f39c12;
    color: #fff;
}

.btn-action-red {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid #e74c3c;
    color: #e74c3c;
}

/* СТИЛИ СПИСКА УСТРОЙСТВ */
.device-search-input {
    width: 100%;
    background: #0d141a;
    border: 1px solid #34495e;
    color: #fff;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 11px;
    outline: none;
}

.devices-list {
    overflow-y: auto;
    max-height: 150px;
    padding: 4px 6px;
}

.group-header {
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
    border-radius: 5px;
    color: #f39c12;
    font-size: 10px;
    font-weight: bold;
    margin: 4px 0 2px 0;
}

.group-count {
    background: rgba(255, 255, 255, 0.1);
    padding: 1px 5px;
    border-radius: 6px;
    font-size: 9px;
    margin-left: auto;
    margin-right: 4px;
    color: #bdc3c7;
}

.device-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 3px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
}

.device-item.active-device {
    background: rgba(243, 156, 18, 0.15);
    border-color: #f39c12;
}

.device-item-info {
    flex-grow: 1;
    margin-left: 6px;
    overflow: hidden;
}

.device-item-name {
    font-weight: bold;
    font-size: 11px;
    color: #fff;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.device-item-imei {
    font-size: 9px;
    color: #85929e;
}

.device-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
    opacity: 0.75;
    /* Видны всегда */
    transition: opacity 0.2s ease;
}

.device-item:hover .device-actions,
.device-item.active-device .device-actions {
    opacity: 1;
    /* Становятся максимально яркими при наведении или выборе */
}

.action-btn {
    color: #85929e;
    padding: 2px;
    font-size: 10px;
    cursor: pointer;
}

.dot-online {
    width: 7px;
    height: 7px;
    background: #2ecc71;
    border-radius: 50%;
    box-shadow: 0 0 5px #2ecc71;
    flex-shrink: 0;
}

.dot-offline {
    width: 7px;
    height: 7px;
    background: #95a5a6;
    border-radius: 50%;
    flex-shrink: 0;
}

/* СТИЛИ МОНИТОРИНГА И ТРЕКА */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #2ecc71;
    border-radius: 50%;
    margin-right: 6px;
    box-shadow: 0 0 6px #2ecc71;
}

.data-row {
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.4;
    color: #ecf0f1;
}

.filter-section {
    padding: 0 12px 12px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

label {
    font-size: 10px;
    color: #bdc3c7;
    text-transform: uppercase;
    display: block;
    margin-top: 6px;
}

input[type="datetime-local"] {
    width: 100%;
    background: #0d141a;
    border: 1px solid #34495e;
    color: #fff;
    padding: 6px;
    border-radius: 6px;
    font-size: 11px;
    margin-top: 2px;
}

.btn-group {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.btn {
    flex: 1;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 11px;
    transition: 0.2s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-danger {
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid #e74c3c;
    color: #e74c3c;
}

.arrow-icon {
    text-shadow: 1px 1px 2px #000;
    font-size: 12px;
    color: #ffffff;
    text-align: center;
}

.park-marker,
.stop-marker {
    color: white;
    border-radius: 50%;
    border: 2px solid #fff;
    font-weight: bold;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.park-marker {
    background: #3498db;
}

.stop-marker {
    background: #f1c40f;
    color: #1a252f;
}

.addr-btn {
    color: #3498db;
    cursor: pointer;
    text-decoration: underline;
    font-size: 11px;
    margin-top: 4px;
    display: inline-block;
}

.custom-user-marker {
    background: transparent !important;
    border: none !important;
}

.marker-person-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.marker-label-name {
    background: #1a252f;
    color: #ffffff;
    font-size: 12px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    margin-bottom: 2px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.marker-blue-circle {
    width: 35px;
    height: 35px;
    background: #3498db;
    border-radius: 50%;
    border: 2px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 11px;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: #1a252f !important;
    color: #ffffff !important;
    border: 1px solid #34495e;
    border-radius: 8px !important;
}

.leaflet-popup-content {
    margin: 8px 12px !important;
    line-height: 1.3 !important;
    font-size: 11px !important;
}

/* ОВЕРЛЕИ И МОДАЛКИ */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.custom-modal-overlay.active {
    display: flex !important;
}

.custom-modal-box {
    background: rgba(26, 37, 47, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    width: 310px;
    color: #ffffff;
    overflow: hidden;
}

.custom-modal-header {
    padding: 10px 14px;
    font-weight: bold;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.custom-modal-body {
    padding: 14px;
}

.custom-modal-label {
    font-size: 10px;
    color: #bdc3c7;
    text-transform: uppercase;
    margin-bottom: 4px;
    display: block;
}

.custom-modal-input {
    width: 100%;
    background: #0d141a;
    border: 1px solid #34495e;
    color: #ffffff;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12px;
    outline: none;
}

.custom-modal-footer {
    padding: 10px 14px;
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    background: rgba(13, 20, 26, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* 📱 МОБИЛЬНАЯ АДАПТАЦИЯ (экран < 600px) */
@media (max-width: 600px) {
    .right-sidebar {
        top: 10px;
        right: 10px;
        left: 10px;
        width: auto;
        max-height: calc(100vh - 20px);
        gap: 6px;
    }

    .devices-list {
        max-height: 120px;
    }

    input[type="datetime-local"],
    .device-search-input {
        font-size: 13px;
        padding: 8px;
    }

    .btn {
        padding: 10px 6px;
        font-size: 11px;
    }

    .device-actions {
        opacity: 1;
    }

    /* Скрытие кнопок Leaflet zoom (+ / -) на мобильных при развернутых блоках */
    body.has-open-blocks .leaflet-control-zoom {
        display: none !important;
    }
}

/* Перенос контейнера кнопок зума строго по центру левого края */
.leaflet-top.leaflet-left {
    top: 50% !important;
    transform: translateY(-50%) !important;
    left: 10px !important;
}

/* Пульсирующий маркер SOS на карте */
.sos-track-marker {
    background: transparent !important;
    border: none !important;
}

.sos-badge {
    background: #e74c3c;
    color: #ffffff;
    font-weight: bold;
    font-size: 11px;
    border: 2px solid #ffffff;
    border-radius: 6px;
    padding: 3px 8px;
    box-shadow: 0 0 15px #e74c3c;
    text-align: center;
    white-space: nowrap;
    animation: pulseSos 0.8s infinite alternate;
}

@keyframes pulseSos {
    from {
        transform: scale(1);
        box-shadow: 0 0 8px #e74c3c;
    }

    to {
        transform: scale(1.15);
        box-shadow: 0 0 22px #ff0000;
    }
}

/* Фиксированное окно предупреждения SOS */
.sos-banner-alert {
    position: fixed;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    background: #e74c3c;
    border: 2px solid #ffffff;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 12px;
    z-index: 3000;
    box-shadow: 0 10px 30px rgba(231, 76, 60, 0.7);
    display: flex;
    align-items: center;
    gap: 14px;
    animation: modalFadeIn 0.3s ease;
}

/* ☀️ СВЕТЛАЯ ТЕМА ИНТЕРФЕЙСА (ИСПРАВЛЕННАЯ) */
body.light-theme {
    background-color: #f1f5f9;
    color: #0f172a;
}

/* Карточки сайдбара */
body.light-theme .sidebar-card {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    color: #0f172a;
}

body.light-theme .card-header {
    background: #ffffff;
    color: #0f172a;
    border-bottom: 1px solid #e2e8f0;
}

body.light-theme .info-block,
body.light-theme .setting-group,
body.light-theme .app-banner {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

/* Исправление контрастности подписей и контрагента */
body.light-theme .block-label,
body.light-theme .filter-section label,
body.light-theme .custom-modal-label {
    color: #475569 !important;
}

body.light-theme .block-val-bold,
body.light-theme #profile-client {
    color: #0f172a !important;
}

/* Заголовки и описания приложений в баннерах */
body.light-theme .app-title {
    color: #0f172a !important;
}

body.light-theme .app-desc {
    color: #64748b !important;
}

/* Список устройств */
body.light-theme .device-item {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
}

body.light-theme .device-item:hover,
body.light-theme .device-item.active-device {
    background: #e2e8f0;
    border-color: #f39c12;
}

body.light-theme .device-item-name {
    color: #0f172a !important;
}

body.light-theme .device-item-imei {
    color: #64748b !important;
}

/* Блок GPS мониторинга */
body.light-theme #details {
    color: #334155 !important;
}

body.light-theme #details b {
    color: #0f172a !important;
}

body.light-theme label[for="filterSpikes"] {
    color: #334155 !important;
}

/* Итоговая статистика по треку */
body.light-theme #track-summary-box {
    background: #e2e8f0 !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

body.light-theme #track-summary-box div {
    color: #0f172a !important;
}

body.light-theme #track-summary-box span {
    color: #1e293b !important;
}

/* Поля ввода и кнопки */
body.light-theme .device-search-input,
body.light-theme input[type="datetime-local"],
body.light-theme .custom-modal-input {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

/* Модальное окно */
body.light-theme .custom-modal-box {
    background: #ffffff !important;
    color: #0f172a !important;
}

body.light-theme .custom-modal-header {
    border-bottom: 1px solid #e2e8f0 !important;
    color: #0f172a !important;
}

body.light-theme .custom-modal-footer {
    background: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
}

/* 🗺️ ВСПЛЫВАЮЩИЕ ОКНА НА КАРТЕ (LEAFLET POPUPS) */
body.light-theme .leaflet-popup-content-wrapper,
body.light-theme .leaflet-popup-tip {
    background: #ffffff !important;
    color: #0f172a !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
}

body.light-theme .leaflet-popup-content {
    color: #0f172a !important;
}

body.light-theme .point-popup-title {
    color: #f39c12 !important;
}

body.light-theme .point-popup-label {
    color: #64748b !important;
}

body.light-theme .leaflet-container a.leaflet-popup-close-button {
    color: #64748b !important;
}

/* 🗺️ ИСПРАВЛЕНИЕ ВСЕХ ВСПЛЫВАЮЩИХ ОКНО (POPUPS) В СВЕТЛОЙ ТЕМЕ */
body.light-theme .leaflet-popup-content-wrapper,
body.light-theme .leaflet-popup-tip {
    background: #ffffff !important;
    color: #0f172a !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15) !important;
}

body.light-theme .leaflet-popup-content {
    color: #0f172a !important;
}

/* Оранжевые заголовки карточек */
body.light-theme .point-popup-title {
    color: #d97706 !important;
}

/* Серые подписи полей ("Час:", "Заряд батареї:", "Швидкість:", "Ліміт:") */
body.light-theme .point-popup-label {
    color: #64748b !important;
}

/* Синие значения времени/координат */
body.light-theme .point-popup-val-blue {
    color: #2563eb !important;
}

/* Перехват жестко заданных белых цветов (#fff, #ffffff) — делаем их темными */
body.light-theme .leaflet-popup-content [style*="color: #fff"],
body.light-theme .leaflet-popup-content [style*="color:#fff"],
body.light-theme .leaflet-popup-content [style*="color: #ffffff"],
body.light-theme .leaflet-popup-content [style*="color:#ffffff"] {
    color: #0f172a !important;
}

/* Перехват светло-серых цветов (#bdc3c7, #aaa) — делаем их темно-серыми */
body.light-theme .leaflet-popup-content [style*="color: #bdc3c7"],
body.light-theme .leaflet-popup-content [style*="color:#bdc3c7"],
body.light-theme .leaflet-popup-content [style*="color: #aaa"],
body.light-theme .leaflet-popup-content [style*="color:#aaa"] {
    color: #64748b !important;
}

/* Кнопка закрытия окна (крестик) */
body.light-theme .leaflet-container a.leaflet-popup-close-button {
    color: #64748b !important;
}

/* 🟡 СТИЛИ ЛОГОТИПА PROFGPS */
.app-brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(26, 37, 47, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px 14px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    user-select: none;
    transition: all 0.25s ease;
}

.brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.1;
    letter-spacing: 0.5px;
}

.brand-subtitle {
    font-size: 8px;
    font-weight: 700;
    color: #f39c12;
    letter-spacing: 1.2px;
    margin-top: 2px;
}

/* 🖥️ ДЕСКТОП (экран > 768px): Логотип зафиксирован СЛЕВА ВВЕРХУ */
@media (min-width: 769px) {
    .app-brand-logo {
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1000;
        width: auto;
    }
}

/* 📱 МОБИЛЬНАЯ ВЕРСИЯ (экран ≤ 768px): Логотип СВЕРХУ НАД ПЕРВЫМ БЛОКОМ */
@media (max-width: 768px) {
    .app-brand-logo {
        position: relative;
        width: 100%;
        margin-bottom: 2px;
    }
}

/* ☀️ ПОДДЕРЖКА СВЕТЛОЙ ТЕМЫ ДЛЯ ЛОГОТИПА */
body.light-theme .app-brand-logo {
    background: rgba(255, 255, 255, 0.95) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12) !important;
}

body.light-theme .brand-title {
    color: #0f172a !important;
}

/* 🎨 СТИЛИЗАЦИЯ МОДАЛЬНОГО ОКНА PROFGPS */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(6px);
    z-index: 9999;
    display: none;
    /* 👈 ИСПРАВЛЕНО: по умолчанию все модалки скрыты */
    align-items: center;
    justify-content: center;
}

.custom-modal-overlay.active {
    display: flex !important;
}

.custom-modal-card {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    color: #ffffff;
    font-family: inherit;
}

.custom-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 18px;
}

.custom-modal-body label {
    display: block;
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 6px;
}

.custom-modal-body input {
    width: 100%;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 10px 12px;
    color: #ffffff;
    font-size: 14px;
    margin-bottom: 14px;
    outline: none;
    box-sizing: border-box;
}

.custom-modal-body input:focus {
    border-color: #f59e0b;
}

.custom-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

.modal-btn {
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-cancel {
    background: #334155;
    color: #94a3b8;
}

.btn-cancel:hover {
    background: #475569;
    color: #fff;
}

.btn-submit {
    background: #10b981;
    color: #ffffff;
}

.btn-submit:hover {
    background: #059669;
}

/* 📜 МЯГКАЯ И ПРИЯТНАЯ СТИЛИЗАЦИЯ ЧЕКБОКСА И ССЫЛОК */
.terms-checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 14px 0 18px 0;
    text-align: left;
}

.terms-checkbox-group input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: #f59e0b;
    flex-shrink: 0;
}

.terms-checkbox-group label {
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.4;
    cursor: pointer;
    user-select: none;
}

/* 🛠️ Исправлены пробелы + сброс синего цвета браузера */
.terms-checkbox-group label a,
.terms-checkbox-group label a:link,
.terms-checkbox-group label a:visited {
    color: #38bdf8 !important;
    text-decoration: none !important;
    border-bottom: 1px dashed rgba(56, 189, 248, 0.4);
    transition: all 0.2s ease;
}

.terms-checkbox-group label a:hover,
.terms-checkbox-group label a:active {
    color: #f59e0b !important;
    border-bottom-color: #f59e0b !important;
}

/* 🛰️ ЛОГОТИП В СТИЛЕ СТРАНИЦЫ ВХОДА */
.brand-icon-box {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 60%, #60a5fa 100%);
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 17px;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.device-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #f39c12;
    border-radius: 4px;
    background-color: transparent;
    cursor: pointer;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s ease;
}

.device-checkbox:checked {
    background-color: #f39c12;
}

.device-checkbox:checked::after {
    content: '✔';
    font-size: 12px;
    color: #1e293b;
    font-weight: bold;
}

.dot-standby {
    width: 10px;
    height: 10px;
    background-color: #f39c12;
    /* Желтый/Оранжевый */
    border-radius: 50%;
    box-shadow: 0 0 6px #f39c12;
    display: inline-block;
}

/* Тонкий оранжевый скроллбар для списка поездок */
.segments-scroll-box::-webkit-scrollbar {
    width: 4px;
}

.segments-scroll-box::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.segments-scroll-box::-webkit-scrollbar-thumb {
    background: #f39c12;
    border-radius: 4px;
}

/* Поддержка Firefox */
.segments-scroll-box {
    scrollbar-width: thin;
    scrollbar-color: #f39c12 rgba(0, 0, 0, 0.2);
}

/* Отключение горизонтального ползунка и расширение модального окна */
.custom-modal-box,
.custom-modal-card {
    width: 360px !important;
    max-width: 95vw !important;
}

#custom-alert-msg {
    overflow-x: hidden !important;
}

/* 🍔 Кнопка бургера — СТРОГО СКРЫТА НА ДЕСКТОПЕ И ПО УМОЛЧАНИЮ */
.mobile-burger-btn {
    display: none !important;
}

/* 📱 МОБИЛЬНАЯ АДАПТАЦИЯ (экран ≤ 768px) */
@media (max-width: 768px) {

    /* 1. Шапка фиксируется вверху с отступами по 10px от краев */
    .app-brand-logo {
        position: fixed !important;
        top: 10px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        z-index: 2000 !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin-bottom: 0 !important;
    }

    /* 2. Показываем кнопку бургера */
    .mobile-burger-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: rgba(243, 156, 18, 0.2);
        border: 1px solid #f39c12;
        color: #f39c12;
        width: 34px;
        height: 34px;
        border-radius: 8px;
        font-size: 16px;
        cursor: pointer;
        flex-shrink: 0;
    }

    /* 3. Сайдбар повторяет ширину шапки (left: 10px, right: 10px) и сдвигается за экран */
    .right-sidebar {
        position: fixed !important;
        top: 74px !important;
        /* Аккуратный отступ строго под шапкой */
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        /* Ширина один в один как у логотипа */
        max-height: calc(100dvh - 70px) !important;
        transform: translateX(calc(100vw + 20px)) !important;
        /* Полный уход вправо за экран */
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 1500 !important;
        padding-right: 0 !important;
    }

    /* 4. Выехавшее состояние — встает ровно под шапкой */
    .right-sidebar.mobile-open {
        transform: translateX(0) !important;
    }
}

/* 🎨 КАСТОМНЫЙ ОРАНЖЕВЫЙ СКРОЛЛБАР В СТИЛЕ PROFGPS */
#devicesList,
.group-items-container,
.panel-body {
    scrollbar-width: thin;
    scrollbar-color: #f59e0b transparent;
    /* Для Firefox */
}

/* Стили для Chrome / Safari / Edge */
#devicesList::-webkit-scrollbar,
.group-items-container::-webkit-scrollbar {
    width: 5px;
    /* Сделать его изящным и тонким */
}

#devicesList::-webkit-scrollbar-track,
.group-items-container::-webkit-scrollbar-track {
    background: transparent;
}

#devicesList::-webkit-scrollbar-thumb,
.group-items-container::-webkit-scrollbar-thumb {
    background-color: #f59e0b;
    /* Фирменный оранжевый цвет */
    border-radius: 10px;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
    /* Легкое свечение */
}

#devicesList::-webkit-scrollbar-thumb:hover,
.group-items-container::-webkit-scrollbar-thumb:hover {
    background-color: #d97706;
    /* Чуть темнее при наведении */
}

/* Полностью убираем белые браузерные стрелки вверх/вниз */
#devicesList::-webkit-scrollbar-button,
.group-items-container::-webkit-scrollbar-button {
    display: none;
    height: 0;
    width: 0;
}

/* 🛠️ Голубая кнопка для Telegram */
.btn-action-blue {
    background: #0284c7;
    color: #fff;
}

.btn-action-blue:hover {
    background: #0369a1;
}