/* ============================================================
   МАРШРУТИЗАТОР ЭТП — Основные стили (светлая тема)
   Современный dashboard (Linear / Notion стиль)
   ============================================================ */

/* === CSS ПЕРЕМЕННЫЕ === */
:root {
    /* Основные цвета */
    --bg-primary: #fafbfc;
    --bg-secondary: #f1f3f9;
    --bg-tertiary: #e8ebf2;
    --bg-sidebar: #1a1d23;
    --bg-sidebar-hover: #2a2d35;
    --bg-sidebar-active: #33363f;
    --bg-card: #ffffff;
    --bg-modal: #ffffff;
    --bg-input: #ffffff;
    --bg-overlay: rgba(0, 0, 0, 0.45);

    /* Текст */
    --text-primary: #1a1d23;
    --text-secondary: #64748b;
    /* 2026-07-15 (UI #1): было var(--text-faint) (контраст ~2.5:1 на белом — провал WCAG AA).
       Затемнено до slate-500 var(--text-secondary) (~4.6:1). Один токен чинит подписи/хинты/meta
       по всему приложению. Светло-серый оттенок для декора см. --text-faint ниже. */
    --text-muted: #64748b;
    --text-faint: #94a3b8;   /* только для НЕтекстового декора (палочки/разделители), не для читаемого текста */
    --text-sidebar: #a0a4b0;
    --text-sidebar-active: #ffffff;
    --text-inverse: #ffffff;

    /* Границы */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --border-focus: #4f46e5;

    /* Акценты */
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-light: rgba(99, 102, 241, 0.08);
    --accent-glow: rgba(99, 102, 241, 0.15);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.08);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.08);
    /* 2026-07-15 (UI #3): яркие статус-цвета как ТЕКСТ на белом проваливают контраст
       (success 2.5, warning 2.15). Тёмные -text-варианты для текста/чисел на светлом
       фоне (≈4.8:1, AA). Яркие оставляем для заливок/иконок. */
    --success-text: #047857;   /* emerald-700 */
    --warning-text: #b45309;   /* amber-700 */
    --danger-text: #b91c1c;    /* red-700 */

    /* ЭТП цвета */
    --etp-1: #E53935;
    --etp-2: #1E88E5;
    --etp-3: #43A047;
    --etp-4: #FB8C00;
    --etp-5: #8E24AA;
    --etp-6: #00ACC1;
    --etp-7: #F4511E;
    --etp-8: #6D4C41;
    --etp-9: #546E7A;

    /* Дни недели */
    --day-pn: #E53935;
    --day-vt: #1E88E5;
    --day-sr: #43A047;
    --day-cht: #FB8C00;
    --day-pt: #8E24AA;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-2xl: 32px;

    /* Typography */
    --text-xs: 10px;
    --text-sm: 11px;
    --text-base: 13px;
    --text-md: 14px;
    --text-lg: 16px;
    --text-xl: 18px;

    /* Размеры */
    --sidebar-width: 240px;
    --topbar-height: 52px;
    --filter-panel-width: 280px;
    /* 2026-07-15 (UI #5): полная шкала радиусов. Было 17 хардкод-значений (2..999px)
       вразнобой — сведены к этой шкале. */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 999px;

    /* Тени с цветовым оттенком */
    --shadow-sm: 0 1px 3px rgba(99, 102, 241, 0.04), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(99, 102, 241, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 8px 32px rgba(99, 102, 241, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 16px 48px rgba(99, 102, 241, 0.1), 0 8px 16px rgba(0, 0, 0, 0.06);

    /* Glass эффекты */
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-blur: blur(20px);
    --surface-elevated: rgba(255, 255, 255, 0.9);
    --surface-sunken: rgba(0, 0, 0, 0.02);

    /* Dashboard */
    --dashboard-height-collapsed: 48px;
    --dashboard-height-peek: 120px;
    --dashboard-height-normal: 300px;
    --dashboard-height-expanded: 65vh;

    /* Dashboard opening animations */
    --dashboard-transition-duration: 0.5s;
    --dashboard-transition-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --dashboard-transition-smooth: cubic-bezier(0.25, 0.8, 0.25, 1);

    /* Переходы */
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        --glass-blur: blur(0px) !important;
    }
}

/* === СБРОС И БАЗОВЫЕ === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Focus-visible для клавиатурной навигации.
   2026-07-15 (UI #4): !important — в коде 11 мест гасят outline (outline:none на :focus)
   и убивают клавиатурный фокус; в 4 из 5 CSS focus-visible вообще нет. Форсируем видимое
   кольцо на :focus-visible (срабатывает только с клавиатуры, мышь не триггерит), чтобы
   component-override его не съедал. */
*:focus-visible {
    outline: 2px solid var(--accent) !important;
    outline-offset: 2px;
}

button:focus-visible,
.btn:focus-visible {
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* Reduced motion для пользователей с настройкой "уменьшить движение" */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === КАСТОМНЫЙ SCROLLBAR === */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: var(--radius-xs);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* === ЛЭЙАУТ === */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* === SIDEBAR === */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition-slow);
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header .logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.sidebar-header .title {
    color: var(--text-sidebar-active);
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
}

.nav-divider {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 16px 16px 6px;
    margin-top: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    margin: 0 8px;
    color: var(--text-sidebar);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    font-weight: 500;
    border: none;
    background: none;
    width: calc(100% - 16px);
    text-align: left;
    position: relative;
    height: auto;
    border-radius: var(--radius-md);
}

.nav-item:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-sidebar-active);
    transform: translateX(4px);
}


.nav-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.2) 0%, rgba(99, 102, 241, 0.08) 100%);
    color: var(--text-sidebar-active);
    border-left: none;
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.3);
}

.nav-item i {
    width: 18px;
    height: 18px;
    text-align: center;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-footer {
    padding: 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-sidebar);
    font-size: 12px;
}

.sidebar-footer .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

/* Sidebar user info classes */
.sidebar-user-name {
    color: #e5e7eb;
    font-weight: 500;
    font-size: 13px;
}

.sidebar-user-login {
    font-size: 11px;
    color: #6b7280;
}

.sidebar-user-role {
    font-size: 10px;
    color: #9ca3af;
}

/* Notification bell */
.notif-bell {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    cursor: pointer;
    color: #9ca3af;
    font-size: 13px;
    transition: var(--transition);
}

.notif-bell:hover {
    color: var(--text-sidebar-active);
}

.notif-count {
    display: none;
    background: var(--danger);
    color: #fff;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    align-items: center;
    justify-content: center;
}

.notif-count.show {
    display: flex;
}

/* Logout button */
.logout-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    width: 100%;
    background: none;
    border: none;
    color: var(--text-sidebar);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 4px;
}

.logout-btn:hover {
    color: var(--danger);
}

.logout-btn i {
    width: 20px;
    text-align: center;
    font-size: 14px;
}

/* === MAIN CONTENT === */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* === TOPBAR === */
.topbar {
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    box-shadow: none;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 14px;
    z-index: 50;
}

.topbar-title {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.2px;
}

.topbar-title:hover {
    color: var(--accent);
}

.search-box {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 13px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all var(--transition);
    font-family: inherit;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 0 0 1px var(--accent);
    background: var(--bg-primary);
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    z-index: 200;
    display: none;
}

.search-results.show { display: block; }

.search-result-item {
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}

.search-result-item:hover {
    background: var(--bg-secondary);
}

.search-result-item:hover .search-edit-btn {
    background: var(--accent-hover) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3), 0 0 0 1px var(--accent-glow) !important;
}

.search-result-item .result-name {
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 4px;
}

.search-result-item .result-meta {
    font-size: 11px;
    color: var(--text-secondary);
}

.search-edit-btn {
    transition: all var(--transition) !important;
}

.search-edit-btn:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2) !important;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* === СТРАНИЦЫ / КОНТЕНТ === */
.page-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.page {
    display: none;
    height: 100%;
}

.page.active {
    display: flex;
    flex-direction: column;
}

/* Страница карты: панель фильтров рядом с картой (строка).
   kpi-strip + etp-detail-panel — absolute поверх карты. */
#page-map {
    flex-direction: row;
    position: relative;
}

.page-padded {
    padding: 24px;
}

/* === КАРТА === */
.map-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative; /* для absolute детей: kpi-strip, map-empty-state */
}

.map-filter-panel {
    width: var(--filter-panel-width);
    min-width: var(--filter-panel-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.map-container {
    flex: 1;
    position: relative;
    min-width: 0;
}

#ymap {
    width: 100%;
    height: 100%;
}

.filter-section {
    padding: 16px var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}

.filter-section:first-child {
    padding-top: 20px;
}

.filter-section:last-child {
    border-bottom: none;
    padding-bottom: 20px;
}

.filter-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

/* === ПАНЕЛЬ ЗОНИРОВАНИЯ === */
/* ================================================================
   ZONE PANEL — Modern Redesign
   ================================================================ */

/* ── Panel Layout ─────────────────────────────────────────── */
.zone-panel {
    width: 360px;
    min-width: 360px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* ── Header ───────────────────────────────────────────────── */
.zone-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
    gap: 8px;
}

.zone-panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.zone-panel-title-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), #a855f7);
    color: #fff;
    font-size: 13px;
}

.zone-panel-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.zone-header-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 13px;
}

.zone-header-btn:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.zone-header-btn--create {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.zone-header-btn--create:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
    transform: scale(1.05);
}

/* Dropdown menu */
.zone-header-dropdown {
    position: relative;
}

.zone-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    min-width: 190px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    padding: 4px;
    overflow: hidden;
}

.zone-dropdown-menu.show {
    display: block;
    animation: zoneDropdownIn 0.15s ease-out;
}

@keyframes zoneDropdownIn {
    from { opacity: 0; transform: translateY(-4px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.zone-dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border: none;
    background: transparent;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    text-align: left;
}

.zone-dropdown-menu button:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.zone-dropdown-menu button i {
    width: 16px;
    text-align: center;
    font-size: 12px;
}

/* Close button for mobile */
.zone-mobile-close {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 13px;
}

/* ── Search Bar ───────────────────────────────────────────── */
.zone-search-bar {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.zone-search-icon {
    position: absolute;
    left: 22px;
    color: var(--text-muted);
    font-size: 12px;
    pointer-events: none;
}

.zone-search-bar input {
    width: 100%;
    padding: 8px 30px 8px 32px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    font-size: 12px;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.zone-search-bar input::placeholder {
    color: var(--text-muted);
}

.zone-search-bar input:focus {
    border-color: var(--accent);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.zone-search-clear {
    position: absolute;
    right: 18px;
    width: 22px;
    height: 22px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: var(--transition);
}

.zone-search-clear:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ── Stats Panel ──────────────────────────────────────────── */
.zone-stats-panel {
    padding: 12px 14px 10px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.zone-stats-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}

.zone-stats-metric {
    display: flex;
    align-items: baseline;
    gap: 3px;
    padding: 2px 0;
}

.zone-stats-metric + .zone-stats-metric {
    padding-left: 10px;
    border-left: 1px solid var(--border-color);
}

.zone-stats-metric--success .zone-stats-value { color: var(--success); }
.zone-stats-metric--danger .zone-stats-value { color: var(--danger); }
.zone-stats-metric--info .zone-stats-value { color: var(--info); }

.zone-stats-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.zone-stats-label {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.2px;
}

.zone-stats-divider {
    width: 1px;
    height: 16px;
    background: var(--border-color);
    margin: 0 4px;
}

.zone-stats-progress {
    width: 100%;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-xs);
    overflow: hidden;
}

.zone-stats-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--success), #34d399);
    border-radius: var(--radius-xs);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
}

.zone-stats-progress-label {
    margin-top: 4px;
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.2px;
}

.zone-stats-progress-label strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ── Filter Toggle ────────────────────────────────────────── */
.zone-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
}

.zone-filters::-webkit-scrollbar {
    display: none;
}

.zone-filter-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border: 1px solid var(--border-light);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    flex: 1 1 auto;
    justify-content: center;
    min-width: 0;
}

.zone-filter-btn i {
    font-size: 10px;
    opacity: 0.7;
}

.zone-filter-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.zone-filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.zone-filter-btn.active i {
    opacity: 1;
}

.zone-filter-btn.active .zone-filter-badge {
    background: rgba(255,255,255,0.25);
    color: white;
}

.zone-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1;
}

/* ── Select Controls (legacy{
    display: none;
}

/* ── Bulk Actions ─────────────────────────────────────────── */
.zone-bulk-actions {
    border-bottom: 1px solid var(--border-color);
}

.zone-bulk-inner {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--accent-light);
}

.zone-bulk-left {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-right: 4px;
}

.zone-bulk-count {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
}

.zone-bulk-label {
    font-size: 11px;
    color: var(--accent);
    opacity: 0.8;
}

.zone-bulk-select {
    flex: 1;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-width: 0;
}

.zone-bulk-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 12px;
    flex-shrink: 0;
}

.zone-bulk-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

.zone-bulk-btn--apply:hover {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success);
}

.zone-bulk-btn--danger:hover {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger);
}

/* ── Zone List ────────────────────────────────────────────── */
.zone-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.zone-list-container::-webkit-scrollbar {
    width: 4px;
}

.zone-list-container::-webkit-scrollbar-track {
    background: transparent;
}

.zone-list-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-md);
}

.zone-list-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.zone-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.zone-empty-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 22px;
    opacity: 0.5;
}

.zone-empty-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.zone-empty-hint {
    font-size: 12px;
    opacity: 0.6;
}

.zone-empty-hint i {
    font-size: 10px;
}

/* ── Zone Card ────────────────────────────────────────────── */
.zone-card {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-left: 3px solid transparent;
    border-radius: var(--radius-sm);
    margin-bottom: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.zone-card.zone-card-nopoly {
    border-left-color: var(--danger);
    background: linear-gradient(90deg, rgba(239,68,68,0.04), var(--bg-card) 8px);
}

.zone-card:hover {
    border-color: var(--accent);
    border-left-color: var(--accent);
    box-shadow: 0 1px 6px rgba(99,102,241,0.08);
}

.zone-card:active {
    transform: scale(0.995);
}

.zone-card-selected {
    border-color: var(--accent);
    border-left-color: var(--accent);
    background: var(--accent-light) !important;
}

.zone-card.active {
    border-color: var(--accent);
    border-left-color: var(--accent);
    background: var(--accent-light) !important;
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Color indicator */
.zone-card-color {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
}

/* Checkbox */
.zone-card-checkbox {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
    opacity: 0;
    transition: opacity 0.15s;
}

.zone-card:hover .zone-card-checkbox,
.zone-card-selected .zone-card-checkbox {
    opacity: 1;
}

/* Card content */
.zone-card-info {
    flex: 1;
    min-width: 0;
    padding-left: 2px;
}

.zone-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.zone-card-second-line {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 3px;
    flex-wrap: wrap;
}

/* ETP badge */
.zone-card-etp-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 600;
    border-radius: var(--radius-xs);
    background: var(--info-bg);
    color: var(--info);
    line-height: 1.4;
}

.zone-card-etp-badge.no-etp {
    background: var(--warning-bg);
    color: var(--warning);
}

/* Polygon status indicator */
.zone-card-polygon-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 9px;
    flex-shrink: 0;
}

.zone-card-polygon-status.has-polygon {
    background: var(--success-bg);
    color: var(--success);
}

.zone-card-polygon-status.has-polygon-yandex {
    background: rgba(59,130,246,0.12);
    color: var(--info);
}

.zone-card-polygon-status.has-polygon-circle {
    background: rgba(245,158,11,0.12);
    color: var(--warning);
}

.zone-card-polygon-status.no-polygon {
    background: var(--danger-bg);
    color: var(--danger);
    animation: zonePulseStatus 2s ease-in-out infinite;
}

@keyframes zonePulseStatus {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Day pills */
.zone-card-days {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
}

.zone-day-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 5px;
    font-size: 9px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
    line-height: 1.5;
    letter-spacing: 0.3px;
}

/* Card hover actions */
.zone-card-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
    position: absolute;
    top: 6px;
    right: 8px;
}

.zone-card:hover .zone-card-actions {
    opacity: 1;
}

.zone-card-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 11px;
}

.zone-card-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.zone-card-btn.danger:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.zone-day-chip {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.zone-day-chip input {
    display: none;
}

.zone-day-chip span {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    transition: all 0.15s;
}

.zone-day-chip input:checked + span {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--success);
    color: var(--success);
}

.zone-day-chip:hover span {
    border-color: var(--accent);
}

/* ── Actions Bar ──────────────────────────────────────────── */
.zone-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 12px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.zone-action-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(16,185,129,0.25);
}

.zone-action-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16,185,129,0.35);
}

.zone-action-primary:active {
    transform: translateY(0);
}

.zone-action-row {
    display: flex;
    gap: 6px;
}

.zone-action-smart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent), #a855f7);
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.zone-action-smart:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

.zone-action-smart:active {
    transform: translateY(0);
}

/* Pulse when zones need polygons */
.zone-action-smart.needs-action {
    animation: zoneSmartPulse 2s ease-in-out infinite;
}

@keyframes zoneSmartPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.4); }
    50% { box-shadow: 0 0 0 8px rgba(99,102,241,0); }
}

.zone-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    flex-shrink: 0;
}

.zone-action-icon:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

/* ── Map Floating Action Buttons ──────────────────────────── */
.zone-map-fab-group {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10;
}

.zone-map-fab {
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.zone-map-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.zone-map-fab:active {
    transform: scale(0.95);
}

.zone-map-fab-smart {
    background: linear-gradient(135deg, var(--accent), #a855f7);
}

.zone-map-fab-apply {
    background: linear-gradient(135deg, var(--success), #059669);
}

.zone-map-fab-draw {
    background: linear-gradient(135deg, var(--warning), #d97706);
}

.zone-map-fab-smart.needs-action {
    animation: zoneFabPulse 2s ease-in-out infinite;
}

@keyframes zoneFabPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.5); }
    50% { box-shadow: 0 0 0 12px rgba(99,102,241,0); }
}

/* ── Zone Draw Hint ───────────────────────────────────────── */
.zone-draw-hint {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 10px 20px;
    font-size: 13px;
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    z-index: 10;
    white-space: nowrap;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .zone-panel {
        width: 100%;
        min-width: 100%;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .zone-panel.open {
        transform: translateX(0);
    }

    .zone-mobile-close {
        display: flex;
    }

    .zone-stats-row {
        flex-wrap: wrap;
    }

    .zone-filters {
        flex-wrap: wrap;
    }

    .zone-map-fab-group {
        bottom: 16px;
        right: 16px;
    }

    .zone-map-fab {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }
}

/* ── Drag & Drop зона загрузки файла ────────────────────────── */
.file-drop-zone {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    background: var(--bg-secondary);
    position: relative;
}
.file-drop-zone:hover,
.file-drop-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-bg, rgba(99,102,241,0.06));
}
.file-drop-zone.dragover {
    transform: scale(1.01);
}
.file-drop-zone.has-file {
    border-color: var(--success);
    border-style: solid;
    background: rgba(16,185,129,0.06);
}
.file-drop-zone__icon {
    font-size: 32px;
    color: var(--text-muted);
    margin-bottom: 10px;
    transition: color 0.25s;
}
.file-drop-zone:hover .file-drop-zone__icon,
.file-drop-zone.dragover .file-drop-zone__icon {
    color: var(--accent);
}
.file-drop-zone.has-file .file-drop-zone__icon {
    color: var(--success);
}
.file-drop-zone__text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.file-drop-zone__text strong {
    color: var(--accent);
}

/* ── Заголовок результатов парсинга ─────────────────────────── */
.import-parse-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(16,185,129,0.08);
    border: 1px solid rgba(16,185,129,0.2);
    border-radius: var(--radius-md);
    margin-bottom: 14px;
}
.import-parse-header__icon {
    font-size: 22px;
    color: var(--success);
    flex-shrink: 0;
}
.import-parse-header__text {
    flex: 1;
    min-width: 0;
}
.import-parse-header__text strong {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
}
.import-parse-header__file {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.import-parse-header__badge {
    flex-shrink: 0;
    padding: 4px 12px;
    border-radius: var(--radius-xl);
    background: var(--success);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Детали парсинга ───────────────────────────────────────── */
.import-parse-details {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    font-size: 12px;
    color: var(--text-secondary);
}
.import-parse-detail {
    display: flex;
    align-items: center;
    gap: 6px;
}
.import-parse-detail i {
    color: var(--text-muted);
    font-size: 12px;
}
.import-parse-detail strong {
    color: var(--text-primary);
}

/* ── Превью импорта графика ────────────────────────────────── */
.import-preview-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.import-preview-stat {
    flex: 1;
    min-width: 90px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    text-align: center;
}
.import-preview-stat__value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}
.import-preview-stat__label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 2px;
}
.import-schedule-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.import-schedule-table th,
.import-schedule-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
}
.import-schedule-table th {
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 1;
}
.import-schedule-table tbody tr:hover {
    background: var(--bg-secondary);
}
.import-schedule-table .schedule-days {
    display: flex;
    gap: 4px;
}
.import-schedule-table .schedule-day-badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    background: var(--accent-bg, rgba(99,102,241,0.1));
    color: var(--accent);
}
.import-schedule-table .schedule-day-badge.weekend {
    background: rgba(249,115,22,0.1);
    color: #f97316;
}
.import-schedule-table .sample-names {
    font-size: 11px;
    color: var(--text-muted);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.import-schedule-table .tp-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    padding: 0 8px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    font-weight: 600;
    font-size: 12px;
    color: var(--text-primary);
}

/* ── Модалка редактирования зоны ───────────────────────────── */
.zone-edit-modal .modal {
    max-width: 520px;
}
.zone-edit-modal .zone-edit-delivery-days {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.zone-edit-modal .zone-day-chip {
    flex: 0 0 auto;
}
.zone-edit-modal .zone-edit-extras {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}
.zone-edit-modal .zone-edit-extras .btn {
    width: 100%;
    justify-content: center;
    margin-bottom: 6px;
}
.zone-edit-modal .zone-edit-extras .btn:last-child {
    margin-bottom: 0;
}

/* Умная генерация — кнопка и статус */
#btnSmartGenZone {
    background: linear-gradient(135deg, #7c3aed, #6d28d9) !important;
    color: #fff !important;
    border: none !important;
    transition: all 0.2s ease;
}
#btnSmartGenZone:hover:not(:disabled) {
    background: linear-gradient(135deg, #6d28d9, #5b21b6) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(109, 40, 217, 0.3);
}
#btnSmartGenZone:disabled {
    opacity: 0.7;
    cursor: wait;
}
#smartGenZoneStatus {
    margin-top: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.6;
    animation: smartGenFadeIn 0.3s ease;
}
#smartGenZoneStatus b {
    font-weight: 600;
}
@keyframes smartGenFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.zone-edit-modal .form-hint {
    margin-top: 8px;
}

/* Минимизированное состояние модалки — оверлей прозрачный, не блокирует карту */
.zone-edit-modal.minimized {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    pointer-events: none;
}
.zone-edit-modal.minimized .modal {
    display: none;
}
.zone-edit-modal.minimized .modal-drag-handle {
    display: none;
}

/* Плавающий бар внизу экрана при редактировании на карте */
.zone-map-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    background: var(--bg-card, #fff);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
    padding: 10px 18px;
    display: none;
    align-items: center;
    gap: 10px;
    max-width: calc(100vw - 32px);
    animation: zoneMapBarIn 0.25s ease;
}
@keyframes zoneMapBarIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.zone-map-bar-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary, #1e293b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}
.zone-map-bar-title i {
    margin-right: 6px;
    opacity: 0.6;
}
.zone-map-bar .btn {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}
.zone-map-bar .btn-cancel {
    color: var(--text-secondary, var(--text-secondary));
    background: var(--bg-secondary, var(--border-light));
    border: none;
}
.zone-map-bar .btn-cancel:hover {
    background: var(--border-light, var(--border-color));
}

/* Hide the old inline zone edit form on all screens */
#zoneEditForm {
    display: none !important;
}

/* Кнопка закрытия зоны на мобильном */
.zone-mobile-close {
    display: none;
    width: 28px;
    height: 28px;
    border: none;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition);
}

.zone-mobile-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

/* === НИЖНЯЯ ПАНЕЛЬ — ДАШБОРД МАРШРУТОВ (РЕДИЗАЙН 2024) === */
.dashboard-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--glass-border);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: var(--dashboard-height-normal);
    overflow: hidden;
    transition: max-height var(--dashboard-transition-duration) var(--dashboard-transition-spring), box-shadow 0.3s ease;
    box-shadow: 0 -4px 24px rgba(99, 102, 241, 0.06), 0 -1px 4px rgba(0, 0, 0, 0.04);
    padding-top: 28px;
}

/* 2026-07-15 (fix): нижняя сводка не должна уходить ПОД правую панель ЭТП.
   Когда правая панель открыта (body.has-etp-detail), нижняя панель останавливается
   на её левом крае (ширина панели 380px). Только десктоп — на мобиле правая панель
   становится bottom-sheet (top:auto), там перекрытия нет. */
@media (min-width: 769px) {
    body.has-etp-detail .dashboard-panel { right: 380px; }
}
/* 2026-07-15 (P3): на мобиле правая панель ЭТП = bottom-sheet (bottom:0, во всю ширину)
   и наезжала на нижнюю сводку (тоже bottom:0). Пока лист открыт — прячем сводку (лист
   и так её перекрывает, данные ЭТП видны в самом листе). */
@media (max-width: 768px) {
    body.has-etp-detail .dashboard-panel { display: none; }
}

/* Свёрнутое состояние */
.dashboard-panel.collapsed {
    max-height: var(--dashboard-height-collapsed);
    box-shadow: none;
}

.dashboard-panel.collapsed .dashboard-header,
.dashboard-panel.collapsed .dashboard-stats,
.dashboard-panel.collapsed .dashboard-mode {
    display: none;
}

/* Peek состояние (промежуточное) */
.dashboard-panel.peek {
    max-height: var(--dashboard-height-peek);
    box-shadow: 0 -2px 12px rgba(99, 102, 241, 0.04), 0 -1px 2px rgba(0, 0, 0, 0.02);
}

.dashboard-panel.peek .dashboard-stats,
.dashboard-panel.peek .dashboard-mode {
    opacity: 0.5;
    pointer-events: none;
}

/* Развёрнутое состояние (максимум) */
.dashboard-panel.expanded {
    max-height: var(--dashboard-height-expanded);
    box-shadow: 0 -8px 40px rgba(99, 102, 241, 0.1), 0 -2px 8px rgba(0, 0, 0, 0.06);
}

.dashboard-panel.expanded .route-list-scroll {
    max-height: calc(60vh - 140px);
}

.dashboard-panel.expanded .unassigned-detail-body {
    max-height: calc(60vh - 120px);
}

.dashboard-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 30;
    -webkit-tap-highlight-color: transparent;
    pointer-events: none;
}

.dashboard-handle:hover {
    pointer-events: auto;
}

.dashboard-handle-bar {
    width: 36px;
    height: 4px;
    border-radius: var(--radius-xs);
    background: var(--text-muted);
    opacity: 0.3;
    transition: all var(--transition);
    pointer-events: auto;
}

.dashboard-handle:hover .dashboard-handle-bar {
    opacity: 0.6;
    width: 48px;
    background: var(--accent);
}

.dashboard-handle:active .dashboard-handle-bar {
    opacity: 0.8;
    width: 52px;
}

/* === DASHBOARD OPENING ANIMATIONS === */

/* Iteration 2: Progressive content reveal animations */
@keyframes slideInHeader {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInStats {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInContent {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Apply staggered animations when panel opens */
.dashboard-panel:not(.collapsed) .dashboard-header {
    animation: slideInHeader 0.5s var(--dashboard-transition-spring) 0.05s both;
}

.dashboard-panel:not(.collapsed) .dashboard-stats {
    animation: slideInStats 0.5s var(--dashboard-transition-spring) 0.15s both;
}

.dashboard-panel:not(.collapsed) .dashboard-mode {
    animation: slideInContent 0.5s var(--dashboard-transition-spring) 0.25s both;
}

.dashboard-mode {
    display: block;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg) var(--space-md);
    gap: var(--space-md);
}

.dashboard-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.dashboard-title-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent) 0%, #818cf8 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    flex-shrink: 0;
}

.dashboard-title i {
    color: var(--accent);
}

.dashboard-header-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(79, 140, 247, 0.1) 0%, rgba(139, 92, 246, 0.08) 100%);
    border-radius: var(--radius-xl);
    font-size: 12px;
    font-weight: 500;
    color: var(--accent);
}

.dashboard-summary-mini {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding: 0 var(--space-lg);
    flex-wrap: wrap;
}

.dashboard-summary-mini span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--surface-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    font-size: 11px;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.dashboard-summary-mini span:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.dashboard-summary-mini i {
    font-size: 11px;
    opacity: 0.7;
}

.dashboard-summary-mini b {
    color: var(--text-primary);
    font-weight: 600;
}

/* === STAT CARDS — НОВЫЙ ДИЗАЙН === */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-sm);
    padding: 0 var(--space-lg) var(--space-md);
}

.stat-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-left: 3px solid transparent;
    border-radius: var(--radius-md);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    cursor: default;
    min-width: 0;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.stat-card::before {
    display: none;
}

.stat-card:hover {
    border-color: var(--glass-border);
    border-left-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-glow), 0 4px 12px rgba(99, 102, 241, 0.15);
}

.stat-card.warning {
    border-left-color: var(--warning);
    background: var(--warning-bg);
}

.stat-card.danger {
    border-left-color: var(--danger);
    background: var(--danger-bg);
}

@keyframes danger-pulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(239, 68, 68, 0.1); }
    50% { box-shadow: 0 4px 16px rgba(239, 68, 68, 0.2); }
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent) 0%, #818cf8 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transition: all 0.2s ease;
}

.stat-card:hover .stat-icon {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.stat-card.warning .stat-icon {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.4) 0%, rgba(251, 191, 36, 0.3) 100%);
    color: var(--warning);
}

.stat-card.danger .stat-icon {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.4) 0%, rgba(248, 113, 113, 0.3) 100%);
    color: var(--danger);
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    min-width: 0;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-alert {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: none;
}

.stat-alert.show {
    display: block;
    animation: alert-pulse 1.5s ease-in-out infinite;
}

.stat-alert.warning {
    background: var(--warning);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.stat-alert.danger {
    background: var(--danger);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

@keyframes alert-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

/* === ROUTE LIST (scrollable) === */
.route-list-scroll {
    max-height: 180px;
    overflow-y: auto;
    padding: 0 var(--space-lg) var(--space-md);
}

.route-list-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--surface-elevated);
    border: 1px solid var(--border-light);
    border-left: 3px solid transparent;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    font-size: var(--text-base);
    transition: all 0.2s ease;
    cursor: pointer;
}

.route-list-item:hover {
    border-left-color: var(--accent);
    background: var(--accent-light);
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.route-list-item:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

.route-list-item:nth-child(even):hover {
    background: var(--accent-light);
}

.route-list-item .route-order {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.25);
}

.route-list-item .route-info {
    flex: 1;
    min-width: 0;
}

.route-list-item .route-name {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.route-list-item .route-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.route-list-item .route-distance {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.route-list-item.manual-override {
    border-left: 3px solid var(--warning);
}

/* === DETAIL GRID (for assigned point) === */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-sm);
    padding: 0 var(--space-lg) var(--space-md);
    max-height: 130px;
    overflow-y: auto;
}

.detail-item {
    padding: var(--space-sm);
    background: var(--surface-sunken);
    border-radius: var(--radius-sm);
    border-bottom: 1px solid var(--border-light);
}

.detail-item label {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.detail-item span {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
}

.dashboard-panel .detail-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

/* === UNASSIGNED DETAIL === */
.unassigned-detail-body {
    padding: 0 var(--space-lg) var(--space-md);
    max-height: 210px;
    overflow-y: auto;
}

.unassigned-detail-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.unassigned-info .detail-grid {
    padding: 0;
    margin-bottom: 8px;
    max-height: none;
    grid-template-columns: 1fr;
    gap: 6px;
}

.unassigned-info {
    font-size: 13px;
}

.unassigned-info .info-row {
    display: grid;
    grid-template-columns: 85px 1fr;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 1px;
    border-radius: var(--radius-sm);
    transition: background-color var(--transition);
    font-size: 12px;
}

.unassigned-info .info-row:hover {
    background: var(--bg-secondary);
}

.unassigned-reason-box {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, rgba(239, 68, 68, 0.08) 100%);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: 10px;
    backdrop-filter: blur(4px);
}

.unassigned-reason-box .reason-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--danger-text);
    margin-bottom: 4px;
    font-size: 12px;
}

.unassigned-reason-box .reason-label i {
    font-size: 12px;
}

.unassigned-reason-box .reason-text {
    color: #7f1d1d;
    font-size: 12px;
    line-height: 1.4;
}

.unassigned-reason-box .reason-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--danger);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.unassigned-reason-box .reason-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* === ТП-only detail (режим сравнения) === */
.tp-only-detail-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.tp-only-info {
    font-size: 13px;
}

.tp-only-info-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
}

.tp-only-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-md);
    font-size: 11px;
    font-weight: 700;
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tp-only-day-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-md);
    font-size: 11px;
    font-weight: 600;
    background: var(--accent-light);
    color: var(--accent);
    border: 1px solid var(--border-light);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tp-only-info .detail-grid {
    padding: 0;
    margin-bottom: 8px;
    max-height: none;
    grid-template-columns: 1fr;
    gap: 6px;
}

/* === СРАВНЕНИЕ ТП / ЭТП === */
.comparison-detail-body {
    padding: 0 var(--space-lg) var(--space-md);
    max-height: 210px;
    overflow-y: auto;
}

.comparison-detail-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.comparison-info {
    display: flex;
    flex-direction: column;
}

.comparison-status-box {
    border-radius: var(--radius-md);
    padding: 10px 12px;
    backdrop-filter: blur(4px);
}

.comparison-status-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comparison-status-label i {
    font-size: 13px;
}

.comparison-info .detail-grid {
    padding: 0;
    max-height: none;
    grid-template-columns: 1fr;
    gap: 6px;
}

.comparison-etp-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comparison-etp-info {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.05) 0%, rgba(79, 70, 229, 0.02) 100%);
    border: 1px solid rgba(79, 70, 229, 0.15);
    border-radius: var(--radius-md);
    padding: 12px;
    backdrop-filter: blur(4px);
}

.comparison-etp-header {
    font-weight: 700;
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tp-only-info .info-row {
    display: grid;
    grid-template-columns: 85px 1fr;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 1px;
    border-radius: var(--radius-sm);
    transition: background-color var(--transition);
    font-size: 12px;
}

.tp-only-info .info-row:hover {
    background: var(--bg-secondary);
}

.tp-only-reason-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tp-only-reason-box {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    backdrop-filter: blur(4px);
}

.tp-only-reason-box .reason-label {
    font-weight: 700;
    font-size: 11px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.tp-only-reason-box .reason-label i {
    font-size: 12px;
}

.tp-only-reason-box .reason-text {
    font-size: 12px;
    line-height: 1.4;
}

.tp-only-reason-excluded {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, rgba(239, 68, 68, 0.08) 100%);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #7f1d1d;
}

.tp-only-reason-excluded .reason-label {
    color: var(--danger-text);
}

.tp-only-reason-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(245, 158, 11, 0.08) 100%);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: #78350f;
}

.tp-only-reason-warning .reason-label {
    color: #d97706;
}

.tp-only-reason-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(59, 130, 246, 0.08) 100%);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: #1e3a8a;
}

.tp-only-reason-info .reason-label {
    color: #2563eb;
}

/* === UNASSIGNED SLIDER FILTER === */
.unassigned-slider-filter {
    padding: 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(99, 102, 241, 0.04) 100%);
    border-radius: var(--radius-md);
    margin: var(--space-md) var(--space-lg);
    border: 1px solid rgba(99, 102, 241, 0.1);
    backdrop-filter: blur(4px);
}

.unassigned-slider-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.unassigned-slider-label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.unassigned-slider-select {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
    font-size: var(--text-sm);
}

.unassigned-slider-select:hover {
    border-color: var(--accent);
}

.unassigned-slider-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.unassigned-filter-summary {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    padding: var(--space-md) 0;
    text-align: center;
    margin-top: var(--space-md);
}

.unassigned-slider-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) 0;
}

.unassigned-slider-input {
    width: 100%;
    height: 8px;
    border-radius: var(--radius-xs);
    background: var(--bg-tertiary);
    outline: none;
    -webkit-appearance: none;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.unassigned-slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4), 0 0 0 4px rgba(99, 102, 241, 0.2);
    transition: all 0.2s ease;
    border: 2px solid white;
}

.unassigned-slider-input::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5), 0 0 0 5px rgba(99, 102, 241, 0.25);
}

.unassigned-slider-input::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4), 0 0 0 4px rgba(99, 102, 241, 0.2);
    transition: all 0.2s ease;
}

.unassigned-slider-input::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5), 0 0 0 5px rgba(99, 102, 241, 0.25);
}

.unassigned-slider-hint {
    font-size: var(--text-xs);
    color: var(--text-muted);
    min-width: 30px;
    text-align: center;
}

.unassigned-slider-result {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    padding: var(--space-sm) 0;
    margin-top: var(--space-sm);
    text-align: center;
}

/* === DASHBOARD HEADER ACTIONS (кнопки справа в заголовке режимов 3, 3.1) === */
.dashboard-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* === RESPONSIVE === */
/* Tablet breakpoint: 600px-900px */
@media (max-width: 900px) and (min-width: 601px) {
    .dashboard-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-sm);
    }

    .stat-card {
        padding: var(--space-md);
    }
}

/* Desktop down to tablet: up to 900px */
@media (max-width: 900px) {
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .unassigned-detail-cols,
    .tp-only-detail-cols {
        grid-template-columns: 1fr;
    }

    .quick-assign-row {
        flex-wrap: wrap;
    }
    
    .quick-assign-row .form-group {
        flex: 1 1 45%;
    }
    
    .quick-assign-row .btn {
        flex: 1 1 100%;
    }
    
    /* Адаптация дашборда для планшетов */
    .dashboard-panel {
        max-height: 220px;
    }
    
    .dashboard-panel.expanded {
        max-height: 50vh;
    }
}

/* Мобильная адаптация дашборда */
@media (max-width: 600px) {
    /* Дашборд на мобильном: компактнее + safe area */
    .dashboard-panel {
        max-height: 200px;
        padding: 16px 12px;
        padding-top: 28px; /* место для кнопки */
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
    
    .dashboard-panel.collapsed {
        max-height: 44px;
        padding: 8px 12px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
    
    .dashboard-panel.expanded {
        max-height: 75vh;
    }
    
    /* Статистика в 2 колонки на мобильном */
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-xs);
    }

    .stat-card {
        flex-direction: column;
        align-items: flex-start;
        padding: var(--space-sm);
        gap: var(--space-xs);
    }

    .stat-icon {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .stat-content {
        flex: 1;
    }

    .stat-value {
        font-size: 14px;
    }

    .stat-label {
        font-size: 11px;
    }
    
    /* Заголовок дашборда на мобильном */
    .dashboard-panel .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .dashboard-panel .dashboard-title {
        font-size: 14px;
    }
    
    .dashboard-panel .dashboard-title-icon {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .dashboard-panel .dashboard-summary-mini {
        flex-wrap: wrap;
        gap: 6px;
        font-size: 11px;
    }
    
    .dashboard-panel .dashboard-summary-mini span {
        padding: 3px 8px;
    }
    
    /* Кнопка toggle на мобильном */
    .dashboard-toggle-btn {
        display: none; /* Скрываем стандартную кнопку на мобильном */
    }
    
    /* FAB кнопка для toggle дашборда на мобильном */
    .fab-add-point.fab-dashboard-toggle {
        background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%);
        box-shadow: 0 4px 16px rgba(79, 140, 247, 0.4);
        bottom: calc(220px + env(safe-area-inset-bottom, 0px)); /* Над дашбордом */
        transition: transform 0.2s, box-shadow 0.2s, bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* Когда дашборд свёрнут - кнопка опускается вниз */
    body:has(.dashboard-panel.collapsed) .fab-add-point.fab-dashboard-toggle {
        bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    }
    
    .fab-add-point.fab-dashboard-toggle:hover {
        transform: scale(1.08);
        box-shadow: 0 8px 24px rgba(79, 140, 247, 0.5);
    }
    
    .fab-add-point.fab-dashboard-toggle i {
        transition: transform 0.3s ease;
    }
    
    /* Режим маршрутного листа */
    .dashboard-panel .route-list-scroll {
        max-height: 100px;
    }
    
    .dashboard-panel.expanded .route-list-scroll {
        max-height: calc(75vh - 160px);
    }
    
    /* Детали ТТ на мобильном */
    .dashboard-panel .detail-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px 12px;
        max-height: 80px;
    }
    
    .dashboard-panel.expanded .detail-grid {
        max-height: 200px;
    }
    
    /* Нераспределённые на мобильном */
    .dashboard-panel .unassigned-detail-cols {
        grid-template-columns: 1fr;
    }
    
    .dashboard-panel .unassigned-detail-body {
        max-height: 140px;
    }
    
    .dashboard-panel.expanded .unassigned-detail-body {
        max-height: calc(70vh - 100px);
    }
    
    /* Форма быстрого назначения */
    .dashboard-panel .quick-assign-row {
        flex-direction: column;
        gap: 8px;
    }

    .dashboard-panel .quick-assign-row .form-group {
        flex: 1 1 100%;
    }

    /* Прокручиваемое тело сводки нераспределённых */
    .unassigned-summary-body {
        max-height: 120px;
    }

    .dashboard-panel.expanded .unassigned-summary-body {
        max-height: calc(70vh - 80px);
    }

    /* Навигатор: кнопки вертикально на узких экранах */
    .dashboard-nav-actions {
        flex-direction: column;
    }

    .dashboard-nav-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Кнопки в заголовке режимов: растянуть на мобильном */
    .dashboard-header-actions .btn {
        flex: 1;
        justify-content: center;
        min-height: 36px;
    }
}

/* === EDIT FORM (редактирование ТТ) === */
.edit-form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--surface-sunken);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    margin-bottom: var(--space-lg);
}

.edit-form-grid .form-input,
.edit-form-grid .form-select {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    height: 36px;
    transition: all var(--transition);
}

.edit-form-grid .form-input:hover,
.edit-form-grid .form-select:hover {
    border-color: var(--border-color);
}

.edit-form-grid .form-input:focus,
.edit-form-grid .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 0 0 1px var(--accent);
    background: var(--bg-card);
}

.edit-form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.form-group.compact {
    margin: 0;
}

.form-group.compact .form-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.form-group.compact .form-input,
.form-group.compact .form-select {
    padding: 6px 10px;
    font-size: 13px;
}

.edit-actions {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-lg);
    border-top: 1px solid var(--border-light);
    background: var(--bg-card);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.edit-actions button {
    flex: 1;
}

.edit-actions .btn-danger {
    margin-left: auto;
}

@media (max-width: 800px) {
    .edit-form-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* === COLUMN MAPPING GRID === */
.column-mapping-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
    padding: 4px;
}

.mapping-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mapping-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.mapping-select {
    font-size: 13px;
    padding: 6px 8px;
}

@media (max-width: 700px) {
    .column-mapping-grid {
        grid-template-columns: 1fr;
    }
}

/* === МОДАЛКА РЕДАКТИРОВАНИЯ ТТ === */
.edit-point-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.edit-section {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.edit-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.edit-section h4 i {
    color: var(--accent);
    font-size: 14px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

@media (max-width: 768px) {
    .edit-point-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* === КНОПКИ === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    height: 36px;
    line-height: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #818cf8 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}
.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--surface-elevated);
    color: var(--text-secondary);
    border-color: var(--border-light);
}
.btn-secondary:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-glow);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}
.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
    transform: translateY(-2px);
}
/* 2026-07-18 (fix вёрстки): .btn-warning использовался в 4 местах (кнопка блокировки ЭТП
   переключает его для состояния «разблокировать», rebuild-кнопка, geo), но стиля НЕ было —
   кнопка рендерилась голой, состояние не отличалось. Добавлен по паттерну btn-danger/success. */
.btn-warning {
    background: var(--warning);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}
.btn-warning:hover {
    background: #d97706;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.3);
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}
.btn-success:hover {
    background: #059669;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    height: 28px;
}

/* === Вкладки массовых операций === */
.bulk-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--radius-sm);
    width: fit-content;
}
.bulk-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.bulk-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}
.bulk-tab.active {
    background: var(--accent);
    color: white;
}
.bulk-tab i {
    font-size: 13px;
}

.btn-icon {
    padding: 6px 8px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


.filter-summary-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

/* === КАРТОЧКИ === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

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

.card-title {
    font-size: 15px;
    font-weight: 600;
}

/* === СЕТКА ЭТП КАРТОЧЕК === */
.etp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    padding: 24px;
}

.etp-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
}

.etp-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.etp-card-stripe {
    height: 4px;
}

.etp-card-body {
    padding: 16px;
}

.etp-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.etp-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.etp-card-name {
    font-weight: 600;
    font-size: 14px;
}

.etp-card-city {
    font-size: 12px;
    color: var(--text-secondary);
}

.etp-zones {
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 0;
    border-top: 1px solid var(--border-light);
    margin-top: 4px;
}

.etp-badge {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: var(--radius-md);
    font-size: 11px;
    font-weight: 600;
}

/* 2026-07-15 (UI #3): текст бейджа — тёмный -text на светлом тинте (было яркий на
   светлом = амбер-на-амбере, низкий контраст). */
.etp-badge.ok { background: var(--success-bg); color: var(--success-text); }
.etp-badge.warning { background: var(--warning-bg); color: var(--warning-text); }
.etp-badge.error { background: var(--danger-bg); color: var(--danger-text); }

.etp-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.etp-metric {
    text-align: center;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.etp-metric-value {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

.etp-metric-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.etp-day-bars {
    display: flex;
    gap: 4px;
    align-items: flex-end;
    height: 40px;
}

.etp-day-bar {
    flex: 1;
    border-radius: 3px 3px 0 0;
    position: relative;
    min-height: 4px;
    transition: var(--transition);
}

.etp-day-bar-label {
    position: absolute;
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: var(--text-muted);
}

/* === ТАБЛИЦЫ === */
.data-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    position: relative;
    box-shadow: var(--shadow-sm);
}

/* Градиент-индикатор скролла */
.data-table-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to right, transparent, var(--bg-primary));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.data-table-wrap.has-scroll::after {
    opacity: 1;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table th {
    background: var(--bg-secondary);
    padding: 12px 14px;
    text-align: left;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    position: sticky;
    top: 0;
    z-index: 10;
    transition: background-color var(--transition);
}

.data-table th:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background-color var(--transition);
}

.data-table tbody tr:hover {
    background: var(--accent-light);
}

.data-table tr.inactive {
    opacity: 0.5;
}

/* === DRAG & DROP ЗОНА === */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-light);
}

.drop-zone i {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.drop-zone .drop-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.drop-zone .drop-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* === МОДАЛЬНЫЕ ОКНА === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    padding: 70px 20px 20px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-slow);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-modal);
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(99, 102, 241, 0.12), 0 10px 24px rgba(0, 0, 0, 0.08);
    width: 90%;
    max-width: 560px;
    max-height: calc(100vh - 100px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.5);
    margin: auto;
}

.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1100px; }

/* Modal drag handle for mobile */
.modal-drag-handle {
    padding: 12px 0;
    text-align: center;
    cursor: grab;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drag-bar {
    width: 40px;
    height: 5px;
    background: var(--text-muted);
    border-radius: var(--radius-xs);
    margin: 0 auto;
    opacity: 0.4;
    transition: all var(--transition);
}

.modal-drag-handle:active .drag-bar {
    opacity: 0.8;
}

/* Hide drag handle on desktop, show only on mobile */
@media (min-width: 768px) {
    .modal-drag-handle {
        display: none !important;
    }
}

.modal-header {
    padding: 20px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all var(--transition);
    color: var(--text-secondary);
}

.modal-close:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

.modal-close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--border-light);
}

/* === TOAST УВЕДОМЛЕНИЯ === */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    font-size: 13px;
    font-weight: 500;
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--info); }

.toast .toast-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--info); }

.toast .toast-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 12px;
    padding: 2px;
}

/* === КНОПКА "НАВЕРХ" === */
.scroll-top-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 40;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    color: white;
    border: none;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    font-size: 18px;
}

.scroll-top-btn.show {
    display: flex;
    animation: slideInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-top-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

@media (max-width: 768px) {
    .scroll-top-btn {
        bottom: 16px;
        right: 16px;
    }
}

/* === ФОРМЫ === */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 8px 12px;
    /* 2026-07-15 (UI #10/P3): было --border-light var(--border-light) ≈ фон (поля «плавали» без
       границ). --border-color var(--border-color) — видимый контур. */
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all var(--transition);
    height: 36px;
    outline: none;
    font-family: inherit;
}

/* 2026-07-15 (UI #10): нативный <select> выглядел инородно среди кастомных инпутов —
   убираем OS-хром и рисуем свою стрелку (SVG data-uri, цвет slate-500). */
.form-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--border-color);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 0 0 1px var(--accent);
    background: var(--bg-card);
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
    height: auto;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 0;
}

.form-check input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}

.form-hint {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: -4px;
    margin-bottom: var(--space-md);
    line-height: 1.4;
}

/* === PROGRESS BAR === */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-xs);
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, #818cf8 100%);
    border-radius: var(--radius-xs);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.progress-bar-fill.success { background: var(--success); }
.progress-bar-fill.warning { background: var(--warning); }
.progress-bar-fill.danger { background: var(--danger); }

/* === АЛЕРТЫ / ПРЕДУПРЕЖДЕНИЯ === */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    margin-bottom: 12px;
    backdrop-filter: blur(4px);
}

.alert-warning {
    background: var(--warning-bg);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-success {
    background: var(--success-bg);
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-info {
    background: var(--info-bg);
    color: #1e40af;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.alert i {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* === МЕТРИКИ (большие карточки) === */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

/* === TIMELINE (История) === */
.timeline {
    padding: 0 24px;
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 39px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    display: flex;
    gap: 16px;
    padding: 12px 0;
    position: relative;
}

.timeline-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    z-index: 1;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
}

.timeline-icon.create { border-color: var(--success); color: var(--success); }
.timeline-icon.move { border-color: var(--info); color: var(--info); }
.timeline-icon.exclude { border-color: var(--danger); color: var(--danger); }
.timeline-icon.include { border-color: var(--warning); color: var(--warning); }
.timeline-icon.reorder { border-color: var(--accent); color: var(--accent); }
.timeline-icon.clone { border-color: var(--etp-5); color: var(--etp-5); }

.timeline-content {
    flex: 1;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.timeline-desc {
    font-size: 13px;
    font-weight: 500;
}

.timeline-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.timeline-details {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

/* === СВОДНАЯ ТАБЛИЦА ЭТП x ДНИ === */
.pivot-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.pivot-table th,
.pivot-table td {
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.pivot-table th {
    background: var(--bg-secondary);
    font-weight: 600;
}

.pivot-table .cell-ok { background: var(--success-bg); }
.pivot-table .cell-warn { background: var(--warning-bg); }
.pivot-table .cell-danger { background: var(--danger-bg); }

/* === СТРАНИЦА ЛОГИНА === */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-secondary);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-card .login-logo {
    width: 48px;
    height: 48px;
    background: var(--accent);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: 700;
    margin: 0 auto 16px;
}

.login-card h1 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-card .login-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.login-card .form-group {
    text-align: left;
}

.login-error {
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 12px;
    display: none;
}

.login-error.show { display: block; }

/* === АНИМАЦИИ === */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinner {
    animation: spin 1s linear infinite;
}

/* === BADGES === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-md);
    font-size: 11px;
    font-weight: 600;
    border: 1px solid;
    transition: all var(--transition);
}

.badge-a  { background: rgba(16, 185, 129, 0.1); color: var(--success); border-color: rgba(16, 185, 129, 0.3); }
.badge-a1 { background: rgba(52, 211, 153, 0.1); color: #059669; border-color: rgba(52, 211, 153, 0.3); }
.badge-b  { background: rgba(59, 130, 246, 0.1); color: var(--info); border-color: rgba(59, 130, 246, 0.3); }
.badge-b1 { background: rgba(99, 179, 237, 0.1); color: #2563eb; border-color: rgba(99, 179, 237, 0.3); }
.badge-c  { background: rgba(251, 191, 36, 0.1); color: #d97706; border-color: rgba(251, 191, 36, 0.3); }
.badge-c1 { background: var(--bg-secondary); color: var(--text-secondary); border-color: var(--border-light); }
/* 2026-07-15: прочие категории 1С (D/E/F/H/НОВАЯ, 1743+ ТТ с «F») — нейтральный
   читаемый бейдж вместо голого/бесцветного (стилей badge-d..h не было). */
.badge-d, .badge-e, .badge-f, .badge-g, .badge-h, .badge-новая {
    background: var(--bg-secondary); color: var(--text-secondary); border-color: var(--border-color);
}

.badge-etp {
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    color: white;
    font-size: 10px;
    font-weight: 600;
}

.badge-day {
    padding: 1px 6px;
    border-radius: var(--radius-xs);
    color: white;
    font-size: 10px;
    font-weight: 600;
}

.manual-override {
    color: var(--warning);
}

/* === IMPORT PAGE === */
.import-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    max-width: 1200px;
}

.import-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.import-section h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.import-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.import-stat {
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    text-align: center;
}

.import-stat-value {
    font-size: 20px;
    font-weight: 700;
}

.import-stat-label {
    font-size: 11px;
    color: var(--text-muted);
}

/* === SETTINGS PAGE === */

/* Settings header */
.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.settings-page-title {
    font-size: var(--text-xl);
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.settings-legend {
    margin-top: var(--space-xs);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.settings-legend-item {
    display: inline-flex;
    align-items: center;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.settings-legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    flex-shrink: 0;
}

.settings-legend-dot--hard { background: var(--danger); }
.settings-legend-dot--soft { background: var(--warning); }
.settings-legend-dot--info { background: var(--success); }

.settings-restore-wrapper {
    position: relative;
}

.settings-grid {
    display: grid;
    /* 2026-07-15 (UI): auto-fit (не fill) — на вкладках с 1-2 карточками (Интеграции/ABC/
       Геокодер) карточки заполняют ширину, а не оставляют пустые 2/3 из зарезервированных
       треков. Многоколоночные вкладки не меняются. */
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: var(--space-xl);
    max-width: 1400px;
}

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.settings-section:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* === ОВЕРЛЕЙ ПОСТРОЕНИЯ МАРШРУТОВ === */
#buildModal {
    z-index: 1100;   /* выше карты Яндекс (z-index ~1000) */
}

/* Hide buildModal when minimized (use class instead of inline display:none) */
#buildModal.minimized {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none;
}

.build-modal {
    max-width: 680px;
    width: 92%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 24px 24px 20px;
    gap: 0;
}


.settings-section h3 {
    font-size: var(--text-md);
    font-weight: 600;
    margin: 0 0 var(--space-lg) 0;
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-primary);
}

.settings-section h3 i {
    color: var(--accent);
    font-size: var(--text-md);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    border-radius: var(--radius-sm);
}

/* Убираем hover-эффект для полноширинной секции матрицы */
.pm-full-section:hover {
    transform: none;
}

/* === МАТРИЦА ПОТЕНЦИАЛОВ === */

/* Полная ширина в сетке настроек */
.pm-full-section {
    grid-column: 1 / -1;
}

/* Шапка секции: заголовок + кнопка "Добавить" */
.pm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 4px;
}
.pm-header h3 {
    margin: 0 !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
}
.pm-header-actions {
    flex-shrink: 0;
}

/* Описание */
.pm-description {
    font-size: 13px;
    color: var(--text-muted, #888);
    line-height: 1.5;
    margin: 0 0 16px 0;
}

/* Grid-шапка таблицы */
.pm-table-header,
.pm-row {
    display: grid;
    grid-template-columns: 2fr repeat(5, 1fr) 36px;
    gap: 0;
    align-items: center;
}
.pm-table-header {
    background: var(--bg-tertiary, #f5f6fa);
    border-radius: var(--radius-sm, 6px);
    border-bottom: 2px solid var(--border-color, #e0e4ec);
    margin-bottom: 0;
}
.pm-col {
    padding: 10px 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #555);
    white-space: nowrap;
    letter-spacing: 0;
    text-transform: none;
}
.pm-col-name {
    text-align: left;
    padding-left: 12px;
}
.pm-col-del {
    padding: 10px 4px;
}

/* Строки */
.pm-rows {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-light, #eef0f4);
    border-radius: 0 0 var(--radius-sm, 6px) var(--radius-sm, 6px);
    border-top: none;
}
.pm-row {
    border-bottom: 1px solid var(--border-light, #eef0f4);
    transition: background 0.15s ease;
}
.pm-row:last-child {
    border-bottom: none;
}
.pm-row:hover {
    background: var(--bg-hover, rgba(0,0,0,0.025));
}

/* Инпуты в ячейках */
.pm-input {
    width: 100%;
    max-width: 80px;
    padding: 7px 6px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius-sm, 4px);
    background: transparent;
    color: var(--text-primary, #1a1a2e);
    transition: all 0.15s ease;
    -moz-appearance: textfield;
}
.pm-input::-webkit-outer-spin-button,
.pm-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.pm-input:hover {
    background: var(--bg-tertiary, #f5f6fa);
    border-color: var(--border-light, #e0e4ec);
}
.pm-input:focus {
    outline: none;
    background: var(--bg-input, #fff);
    border-color: var(--accent, #4f6ef7);
    box-shadow: 0 0 0 3px var(--accent-light, rgba(79,110,247,0.12));
}

.pm-input-sub {
    width: 100%;
    padding: 7px 10px;
    text-align: left;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius-sm, 4px);
    background: transparent;
    color: var(--text-primary, #1a1a2e);
    transition: all 0.15s ease;
}
.pm-input-sub:hover {
    background: var(--bg-tertiary, #f5f6fa);
    border-color: var(--border-light, #e0e4ec);
}
.pm-input-sub:focus {
    outline: none;
    background: var(--bg-input, #fff);
    border-color: var(--accent, #4f6ef7);
    box-shadow: 0 0 0 3px var(--accent-light, rgba(79,110,247,0.12));
}

/* Кнопка удаления */
.pm-del {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted, #999);
    cursor: pointer;
    font-size: 12px;
    border-radius: var(--radius-sm, 4px);
    transition: all 0.15s ease;
    margin: 0 auto;
}
.pm-del:hover {
    color: #e74c3c;
    background: rgba(231,76,60,0.08);
    border-color: rgba(231,76,60,0.2);
}

/* Пустое состояние */
.pm-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 32px 16px;
    color: var(--text-muted, #999);
    font-size: 13px;
}
.pm-empty i {
    font-size: 28px;
    opacity: 0.4;
}

/* Редактор порогов */
.pm-table-header .pm-range-label {
    cursor: pointer;
    border-bottom: 1px dashed transparent;
    transition: border-color 0.15s ease;
}
.pm-table-header:hover .pm-range-label {
    border-bottom-color: var(--accent, #4f6ef7);
}
.pm-thresholds-editor {
    display: grid;
    grid-template-columns: 2fr repeat(5, 1fr) 36px;
    gap: 0;
    align-items: center;
    background: var(--accent-light, rgba(79,110,247,0.06));
    border-bottom: 1px solid var(--border-color, #e0e4ec);
}
.pm-threshold-input {
    width: 100%;
    max-width: 60px;
    padding: 5px 4px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border-color, #e0e4ec);
    border-radius: var(--radius-sm, 4px);
    background: var(--bg-input, #fff);
    color: var(--text-primary, #1a1a2e);
    transition: all 0.15s ease;
    -moz-appearance: textfield;
}
.pm-threshold-input::-webkit-outer-spin-button,
.pm-threshold-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.pm-threshold-input:focus {
    outline: none;
    border-color: var(--accent, #4f6ef7);
    box-shadow: 0 0 0 2px var(--accent-light, rgba(79,110,247,0.15));
}

/* Подвал */
.pm-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light, #eef0f4);
}
.pm-footer-left {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.pm-footer-left .btn {
    white-space: nowrap;
}
.pm-footer-status {
    font-size: 12px;
    color: var(--text-muted, #888);
    line-height: 1.4;
    text-align: right;
    max-width: 50%;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .pm-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .pm-header h3 {
        padding-bottom: var(--space-md, 10px) !important;
        border-bottom: 1px solid var(--border-light, #eef0f4) !important;
        width: 100%;
        margin-bottom: 0 !important;
    }
    .pm-table-header,
    .pm-row {
        grid-template-columns: 1fr repeat(5, 60px) 32px;
    }
    .pm-footer {
        flex-direction: column;
        align-items: stretch;
    }
    .pm-footer-left {
        flex-direction: column;
    }
    .pm-footer-left .btn {
        justify-content: center;
    }
    .pm-footer-status {
        text-align: left;
        max-width: 100%;
    }
}

/* Settings row with badge */
.sett-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}
.sett-field {
    flex: 1;
}
.sett-badge {
    font-size: var(--text-xs);
    padding: 4px 12px;
    border-radius: var(--radius-md);
    white-space: nowrap;
    font-weight: 600;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
}

.sett-badge.hard {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.2);
}

.sett-badge.soft {
    background: rgba(245, 158, 11, 0.08);
    color: #d97706;
    border-color: rgba(245, 158, 11, 0.2);
}

.sett-badge.info {
    background: rgba(16, 185, 129, 0.08);
    color: #16a34a;
    border-color: rgba(16, 185, 129, 0.2);
}

/* === RESPONSIVE === */
@media (max-width: 1200px) {
    .import-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    /* ETP grid - mobile */
    .etp-grid { grid-template-columns: 1fr; }
}
/* === НОВЫЙ UI: ЧИПЫ И ПЕРЕКЛЮЧАТЕЛИ === */

/* Режимы отображения (табы) */
.view-mode-tabs {
    display: flex;
    gap: 2px;
    background: var(--glass-bg);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.view-mode-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px var(--space-md);
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
    white-space: nowrap;
}

.view-mode-tab:hover {
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.05);
}

.view-mode-tab.active {
    background: var(--bg-card);
    color: var(--accent);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.2), 0 2px 8px rgba(99, 102, 241, 0.1);
}

.view-mode-tab.active i {
    background: linear-gradient(135deg, var(--accent), #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Чипы для ЭТП */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-lg);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.filter-chip:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.filter-chip:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.filter-chip.active {
    background: linear-gradient(135deg, var(--accent), #818cf8);
    color: white;
    border-color: var(--accent);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.filter-chip .chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.6;
    flex-shrink: 0;
}

.filter-chip .chip-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-chip.active .chip-dot {
    opacity: 1;
    background: white;
}

/* Чипы для дней недели */
.filter-chips-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.day-chip {
    padding: 7px 4px;
    text-align: center;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    letter-spacing: 0.2px;
    position: relative;
}

.day-chip:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

.day-chip.active {
    background: linear-gradient(135deg, var(--accent), #818cf8);
    color: white;
    font-weight: 700;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

/* SmartRoute H26: dow-chip (ПН-ВС) — цвет дня через CSS-переменную --day-color */
.day-chip.dow-chip.active {
    background: var(--day-color, var(--accent));
    border-color: var(--day-color, var(--accent));
    box-shadow: 0 3px 10px color-mix(in srgb, var(--day-color, var(--accent)) 35%, transparent);
}
.day-chip.dow-chip.weekend {
    opacity: 0.7;
}
.day-chip.dow-chip.weekend.active {
    opacity: 1;
}

/* SmartRoute H1.3 / H24: чипы недели месяца W1-W4 (radio) */
.week-chips {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.week-chip {
    padding: 8px 4px;
    text-align: center;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    background: var(--bg-secondary);
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    letter-spacing: 0.5px;
}
.week-chip:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}
.week-chip.active {
    background: linear-gradient(135deg, var(--accent-hover), #7c3aed);
    color: #fff;
    border-color: var(--accent-hover);
    box-shadow: 0 3px 10px rgba(79, 70, 229, 0.30);
}

/* SmartRoute H32: Empty state поверх карты — плейсхолдер «Выберите неделю и день» */
/* 2026-07-06: было — пелена на весь экран карты (blur + фон), из-за неё зоны
   не видны и «не кликаются». Теперь — компактная плашка-подсказка сверху. */
.map-empty-state {
    position: absolute;
    /* 2026-07-15 (UI #6): было top:12px — плашка попадала в полосу тулбара (табы/«Слои»)
       и обрезалась/налезала. Опущена ниже тулбара. */
    top: 64px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    background: rgba(30, 41, 59, 0.85);
    color: #fff;
    font-size: 13px;
    line-height: 1.4;
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: min(90%, 560px);
    text-align: left;
}
/* Mobile: убираем blur (он лагает на телефонах) + компактнее */
@media (max-width: 768px) {
    .map-empty-state {
        font-size: 12px;
        padding: 7px 12px;
        top: 8px;
    }
}
.map-empty-state i {
    flex: 0 0 auto;
    opacity: 0.85;
}

/* SmartRoute H4 / J11: иконки на чипах ЭТП ($ для Опт, 🔒 для locked) */
.chip-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    margin-left: 4px;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    flex-shrink: 0;
}
.chip-badge--locked {
    background: var(--danger);
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.18);
}
.chip-badge--locked i { font-size: 8px; }
.chip-badge--opt {
    background: var(--success);
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.18);
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
/* Mobile: filter-panel — drawer (fixed, вне flow), kpi-strip от 0 */
@media (max-width: 768px) {
    .kpi-strip { left: 0; }
}
@keyframes kpiSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* SmartRoute H5/H18: панель карточки ЭТП с мини-таблицей 7×4 */
.etp-detail-panel {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 380px;
    max-width: min(380px, calc(100vw - 24px));
    background: #fff;
    border-left: 1px solid var(--border-light, var(--border-color));
    box-shadow: -8px 0 24px rgba(15, 23, 42, 0.08);
    z-index: 700;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: etpDetailSlideIn 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes etpDetailSlideIn {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}
@keyframes etpDetailSlideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}
.etp-detail-panel[hidden] { display: none; }
/* Mobile: bottom-sheet — карта сверху, панель снизу 65vh */
@media (max-width: 768px) {
    .etp-detail-panel {
        top: auto;
        left: 0; right: 0; bottom: 0;
        width: 100vw;
        max-width: 100vw;
        height: 65vh;
        border-left: none;
        border-top: 1px solid var(--border-light, var(--border-color));
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.12);
        animation: etpDetailSlideUp 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    }
}
.etp-detail-panel__header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-light, var(--border-light));
}
.etp-detail-panel__title-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.etp-detail-panel__color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}
.etp-detail-panel__title-text { flex: 1; min-width: 0; }
.etp-detail-panel__title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
}
.etp-detail-panel__city {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--text-muted, var(--text-secondary));
}
.etp-detail-panel__badges {
    display: inline-flex;
    gap: 4px;
    margin-top: 4px;
}
.etp-detail-panel__close {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-light, var(--border-color));
    background: var(--bg-secondary, #f8fafc);
    color: var(--text-muted, var(--text-secondary));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}
.etp-detail-panel__close:hover {
    background: #fee2e2; color: #dc2626; border-color: #fca5a5;
}

.etp-detail-panel__stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light, var(--border-light));
}
.etp-detail-panel__stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.etp-detail-panel__stat-val {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    font-variant-numeric: tabular-nums;
}
.etp-detail-panel__stat-lbl {
    font-size: 10px;
    color: var(--text-muted, var(--text-secondary));
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.etp-detail-panel__section { padding: 16px 18px; }
.etp-detail-panel__section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted, var(--text-secondary));
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
/* 2026-07-13: «Все дни» — снять drill-down дня/недели */
.etp-detail-grid__all-btn {
    font: inherit;
    font-size: 10px;
    text-transform: none;
    letter-spacing: 0;
    padding: 3px 10px;
    border: 1px solid var(--border-color, #cbd5e1);
    border-radius: var(--radius-pill);
    background: var(--bg-tertiary, var(--border-light));
    color: var(--text-secondary, #475569);
    cursor: pointer;
}
.etp-detail-grid__all-btn:hover { background: var(--accent, var(--accent)); color: #fff; border-color: var(--accent, var(--accent)); }
/* Выбранная ячейка дня/недели — яркая рамка, видно что выбрано */
.etp-detail-grid__cell.is-selected {
    outline: 2px solid var(--accent, var(--accent));
    outline-offset: -2px;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.35);
    font-weight: 800;
}
.etp-detail-panel__hint {
    margin: 10px 0 0;
    font-size: 11px;
    color: var(--text-muted, var(--text-faint));
    line-height: 1.4;
}

/* Сетка 7×4 (1 row label + 7 days, 4 weeks) */
.etp-detail-grid {
    display: grid;
    grid-template-columns: 32px repeat(7, 1fr);
    gap: 4px;
}
.etp-detail-grid__corner {} /* пустая ячейка top-left */
.etp-detail-grid__head {
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted, var(--text-secondary));
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 4px 0;
}
.etp-detail-grid__head--weekend { color: var(--text-faint); }
.etp-detail-grid__row-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--accent-hover);
}
.etp-detail-grid__cell {
    aspect-ratio: 1 / 1;
    min-height: 32px;
    border: 1px solid var(--border-light, var(--border-light));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #fff;
    transition: all 0.12s ease;
    padding: 0;
}
.etp-detail-grid__cell:hover {
    transform: scale(1.06);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
    z-index: 1;
}
.etp-detail-grid__cell--weekend { background: rgba(241, 245, 249, 0.55); }
.etp-detail-grid__cell[data-heat="1"] { background: rgba(99, 102, 241, 0.10); border-color: rgba(99, 102, 241, 0.18); }
.etp-detail-grid__cell[data-heat="2"] { background: rgba(99, 102, 241, 0.20); border-color: rgba(99, 102, 241, 0.30); }
.etp-detail-grid__cell[data-heat="3"] { background: rgba(99, 102, 241, 0.35); border-color: rgba(99, 102, 241, 0.45); }
.etp-detail-grid__cell[data-heat="4"] { background: rgba(99, 102, 241, 0.55); border-color: rgba(79, 70, 229, 0.65); color: #fff; }
.etp-detail-grid__cell[data-heat="5"] { background: rgba(79, 70, 229, 0.85); border-color: #4338ca; color: #fff; }
.etp-detail-grid__num {
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.etp-detail-grid__zero {
    font-size: 12px;
    color: #cbd5e1;
}
.etp-detail-grid__loading {
    text-align: center;
    color: var(--text-muted, var(--text-secondary));
    font-size: 12px;
    padding: 20px;
}

.etp-detail-panel__actions {
    display: flex;
    gap: 8px;
    padding: 14px 18px;
    border-top: 1px solid var(--border-light, var(--border-light));
    margin-top: auto;
}
.etp-detail-panel__actions .btn { flex: 1; }

@media (max-width: 700px) {
    .etp-detail-panel { width: 100vw; }
}

/* SmartRoute H29: 8 вкладок страницы Настройки */
.settings-tabs {
    display: flex;
    gap: 4px;
    margin: 18px 0 14px;
    padding: 4px;
    background: var(--bg-secondary, #f8fafc);
    border: 1px solid var(--border-light, var(--border-color));
    border-radius: var(--radius-md);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}
.settings-tabs::-webkit-scrollbar { height: 6px; }
.settings-tabs::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: var(--radius-xs); }

.settings-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding: 9px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted, var(--text-secondary));
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    white-space: nowrap;
}
.settings-tab i { font-size: 13px; }
.settings-tab:hover {
    color: var(--text-primary, #0f172a);
    background: rgba(255, 255, 255, 0.65);
}
.settings-tab.is-active {
    background: #fff;
    color: var(--accent, var(--accent-hover));
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(79, 70, 229, 0.08);
}
.settings-tab.is-active i { color: var(--accent, var(--accent-hover)); }

.settings-tab-pane[hidden] { display: none; }
.settings-tab-pane.is-active { animation: settingsPaneFade 0.18s ease-out; }
@keyframes settingsPaneFade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 700px) {
    .settings-tabs { padding: 3px; gap: 2px; }
    .settings-tab { padding: 8px 12px; font-size: 12px; }
    .settings-tab span { display: none; }
    .settings-tab i { font-size: 14px; }
    .settings-tab.is-active span { display: inline; font-size: 11px; }
}

/* SmartRoute 5G+ Общие */
.general-info-row {
    display: flex;
    flex-direction: column;
    padding: 10px 14px;
    background: var(--bg-secondary, #f8fafc);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent, var(--accent-hover));
}
.general-info-row__label {
    font-size: 11px;
    color: var(--text-muted, var(--text-secondary));
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.general-info-row__value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
    font-variant-numeric: tabular-nums;
}
.general-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: var(--bg-secondary, #f8fafc);
    border-radius: var(--radius-md);
    text-align: center;
}
.general-stat-card__val {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent, var(--accent-hover));
    font-variant-numeric: tabular-nums;
}
.general-stat-card__lbl {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* SmartRoute 5G+ Пользователи */
.users-role-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--bg-secondary, #f8fafc);
    border: 1px solid var(--border-light, var(--border-color));
    border-radius: var(--radius-md);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.users-role-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}
.users-role-card__icon {
    width: 42px; height: 42px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.users-role-card__body {
    display: flex;
    flex-direction: column;
}
.users-role-card__count {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    line-height: 1.1;
}
.users-role-card__label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* SmartRoute 5G+ Интеграции */
.integration-card {
    padding: 16px;
    background: #fff;
    border: 1px solid var(--border-light, var(--border-color));
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
}
.integration-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}
.integration-card__head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}
.integration-card__icon {
    width: 44px; height: 44px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.integration-card__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    margin-bottom: 4px;
}
.integration-card__status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.integration-card__status--soon {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}
.integration-card__desc {
    margin: 0;
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.5;
}
body.ui-compact .settings-section { padding: 12px; }

.layer-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.layer-toggle:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.layer-toggle.active {
    background: var(--glass-bg);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
    box-shadow: 0 0 0 1px var(--accent-glow), inset 0 0 0 1px var(--accent-glow);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}


.layer-toggle i {
    font-size: 12px;
    width: 16px;
    text-align: center;
    opacity: 0.8;
}

.layer-toggle.active i {
    opacity: 1;
}

/* Сравнение ЭТП vs ТП */
.compare-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.compare-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    padding: 2px 0;
}

/* Единая иконка легенды */
.compare-legend-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

/* Статистика сравнения */
.compare-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.compare-stat {
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    text-align: center;
}

/* Страница ТП - улучшения */
.tp-detail-panel {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    padding: 24px;
}

/* Адаптивность */
@media (max-width: 900px) {
    .tp-detail-panel {
        grid-template-columns: 1fr;
    }
    
    .tp-comparison-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Активные состояния чипов с цветом */
.filter-chip.active {
    background: var(--chip-color, var(--accent));
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.day-chip.active {
    background: var(--day-color, var(--accent));
    color: white;
}

/* Кнопки действий в заголовках фильтров */

.filter-action-btn {
    margin-left: auto;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    background: var(--bg-primary);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.filter-action-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--accent);
}

/* ===== COLLAPSIBLE FILTER SECTIONS ===== */
.filter-collapsible {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-collapsible.has-active {
    border-color: rgba(79, 140, 247, 0.5);
    box-shadow: 0 0 0 3px rgba(79, 140, 247, 0.1);
}

/* Заголовок */
.filter-coll-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    cursor: pointer;
    user-select: none;
    background: var(--bg-secondary);
    transition: background 0.15s;
}

.filter-coll-header:hover {
    background: var(--bg-tertiary);
}

.filter-collapsible.has-active .filter-coll-header {
    background: rgba(79, 140, 247, 0.08);
}

.filter-coll-title {
    flex: 1;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.filter-collapsible.has-active .filter-coll-title {
    color: var(--accent);
}

/* Счётчик активных */
.filter-coll-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: var(--radius-xl);
    background: var(--accent);
    color: white;
    min-width: 20px;
    text-align: center;
    line-height: 16px;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.filter-collapsible.has-active .filter-coll-badge {
    opacity: 1;
    transform: scale(1);
}

/* Кнопки Все/None — видны только в открытом состоянии */
.filter-coll-controls {
    display: flex;
    gap: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}

.filter-collapsible.open .filter-coll-controls {
    opacity: 1;
    pointer-events: auto;
}

/* Chevron */
.filter-coll-chevron {
    font-size: 10px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s;
}

.filter-collapsible.open .filter-coll-chevron {
    transform: rotate(180deg);
}

.filter-collapsible.has-active .filter-coll-chevron {
    color: var(--accent);
}

/* Тело — max-height анимация */
.filter-coll-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-collapsible.open .filter-coll-body {
    /* Фикс 2026-07-05: было max-height:500px + overflow:hidden — при 238 ЭТП
       видны были только первые ~15 чипов, остальные обрезались без прокрутки. */
    max-height: 45vh;
    overflow-y: auto;
}

.filter-coll-body-inner {
    padding: 10px 12px 12px;
}

/* === 2026-07-05: комбобокс выбора ЭТП (поиск + список + чипы выбранных) === */
.etp-search-input {
    width: 100%;
    padding: 7px 10px;
    margin-bottom: 8px;
    border: 1px solid var(--border, #d1d5db);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--surface, #fff);
    color: inherit;
    outline: none;
}
.etp-search-input:focus {
    border-color: var(--accent, #4f8cf7);
    box-shadow: 0 0 0 2px rgba(79, 140, 247, 0.15);
}
/* Список ЭТП — вертикальные строки вместо облака чипов */
.filter-chips--list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.filter-chips--list .filter-chip {
    width: 100%;
    justify-content: flex-start;
    border-radius: var(--radius-sm);
}
.filter-chips--list .filter-chip.is-filtered-out {
    display: none;
}
/* Чипы выбранных ЭТП над поиском */
.etp-selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
    min-height: 0;
}
.etp-sel-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px 2px 8px;
    font-size: 12px;
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--chip-color, #6b7280) 15%, transparent);
    border: 1px solid var(--chip-color, #6b7280);
    line-height: 1.4;
}
.etp-sel-chip__x {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 4px;
    color: inherit;
    opacity: 0.6;
}
.etp-sel-chip__x:hover { opacity: 1; }
.etp-sel-summary {
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
    padding: 2px 0;
}
.etp-sel-summary--empty { color: var(--danger); }

/* === 2026-07-06: «Загрузка ЭТП» — распределение + выбросы === */
.etp-load-bar {
    display: flex;
    height: 10px;
    border-radius: var(--radius-xs);
    overflow: hidden;
    margin-bottom: 6px;
}
.etp-load-seg { height: 100%; min-width: 2px; }
.etp-load-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    font-size: 11px;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 8px;
}
.etp-load-leg { display: inline-flex; align-items: center; gap: 4px; }
.etp-load-leg i {
    width: 8px; height: 8px; border-radius: var(--radius-xs); display: inline-block;
}
.etp-load-group-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary, #6b7280);
    margin: 6px 0 3px;
}
.etp-load-outlier {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 4px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
}
.etp-load-outlier:hover { background: rgba(127, 127, 127, 0.10); }
.etp-load-outlier .etp-load-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.etp-load-dot {
    width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto;
}

/* === ДАШБОРД - РАСШИРЕННАЯ СТАТИСТИКА === */

.dashboard-warnings {
    margin-bottom: 20px;
}

.dashboard-warnings .alert {
    margin-bottom: 8px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-metrics {
    display: grid;
    /* 2026-07-15 (UI #2): было auto-fit minmax(140px) — 7 плиток вставали в притык
       (6-значное число 103px в 108px контента, ОМПК касался края). auto-fill+150px даёт
       воздух и чистый перенос; auto-fill (не fit) не растягивает одинокую плитку 2-го ряда. */
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
/* Число никогда не липнет к краям плитки */
.dashboard-metrics .metric-value { padding: 0 4px; }

/* Dashboard-specific metric card overrides */
.dashboard-metrics .metric-card {
    text-align: center;
    padding: 16px;
    /* 2026-07-15 (UI #2): было flex-row (метка+число в ряд) — 6-значное число не влезало
       в 166px и вылезало под соседа. Складываем в столбец: метка над числом, число на всю
       ширину карточки, ничего не режется. */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.metric-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.metric-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ABC Distribution */
.abc-distribution {
    padding: 16px;
}

.abc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.abc-card {
    padding: 20px;
    border-radius: var(--radius-md);
    text-align: center;
    border: 2px solid transparent;
}

.abc-card.abc-a {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
}

.abc-card.abc-a1 {
    background: rgba(52, 211, 153, 0.08);
    border-color: #34d399;
}

.abc-card.abc-b {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--info);
}

.abc-card.abc-b1 {
    background: rgba(99, 179, 237, 0.08);
    border-color: #60a5fa;
}

.abc-card.abc-c {
    background: rgba(251, 191, 36, 0.1);
    border-color: var(--warning);
}

.abc-card.abc-c1 {
    background: rgba(239, 68, 68, 0.08);
    border-color: var(--danger);
}

.abc-card.abc-none,
/* 2026-07-17 (deep z-биз): прочие категории 1С (D/E/F/G/H/НОВАЯ) — нейтральная карточка
   вместо голой (раньше эти 2696 ТТ прятались в «без ABC»). */
.abc-card.abc-d, .abc-card.abc-e, .abc-card.abc-f, .abc-card.abc-g,
.abc-card.abc-h, .abc-card.abc-новая {
    background: rgba(156, 163, 175, 0.1);
    border-color: #9ca3af;
}
.abc-d .abc-header, .abc-e .abc-header, .abc-f .abc-header, .abc-g .abc-header,
.abc-h .abc-header, .abc-новая .abc-header { color: var(--text-secondary); }

.abc-header {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 4px;
}

.abc-a  .abc-header { color: var(--success); }
.abc-a1 .abc-header { color: #34d399; }
.abc-b  .abc-header { color: var(--info); }
.abc-b1 .abc-header { color: #60a5fa; }
.abc-c  .abc-header { color: var(--warning); }
.abc-c1 .abc-header { color: var(--danger); }
.abc-none .abc-header { color: #9ca3af; }

.abc-count {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.abc-percent {
    font-size: 14px;
    color: var(--text-muted);
}

.abc-sales {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.abc-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Dashboard Grid 2 columns */
.dashboard-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

/* Stat box */
.stat-box {
    text-align: center;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.stat-box .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-box .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Import progress box */
#importProgressBox {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

#importResultBox {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
}

/* Cell status */
.cell-ok { background: rgba(16, 185, 129, 0.15); color: #059669; }
.cell-danger { background: rgba(239, 68, 68, 0.15); color: #dc2626; }
.cell-warn { background: rgba(245, 158, 11, 0.15); color: #d97706; }

/* ============================================================
   ИМПОРТ — Результат (улучшенный дизайн)
   ============================================================ */

.import-result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.import-result-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: #fff;
}

.import-result-icon {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.import-result-main {
    font-weight: 600;
    font-size: 17px;
}

.import-result-summary {
    font-size: 13px;
    opacity: 0.9;
    margin-top: 2px;
}

/* Статистика — сетка карточек */
.import-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border-color);
    margin: 1px;
    border-bottom: 1px solid var(--border-color);
}

.import-stat-card {
    background: var(--bg-card);
    padding: 18px 12px;
    text-align: center;
}

.import-stat-card .stat-card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.import-stat-card .stat-card-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 6px;
}

.import-stat-card.stat-card-success {
    background: var(--success-bg);
}

.import-stat-card.stat-card-success .stat-card-value {
    color: var(--success);
}

.import-stat-card.stat-card-info {
    background: var(--info-bg);
}

.import-stat-card.stat-card-info .stat-card-value {
    color: var(--info);
}

.import-stat-card.stat-card-danger {
    background: var(--danger-bg);
}

.import-stat-card.stat-card-danger .stat-card-value {
    color: var(--danger);
}

/* Секция координат */
.import-coords-section {
    padding: 14px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.coords-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.coords-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.coord-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.coord-value {
    font-size: 18px;
    font-weight: 700;
}

.coord-label {
    font-size: 12px;
    color: var(--text-muted);
}

.coord-success .coord-value { color: var(--success); }
.coord-info .coord-value { color: var(--info); }
.coord-warning .coord-value { color: var(--warning); }

/* Дополнительная информация */
.import-extra-info {
    padding: 12px 20px;
    background: var(--bg-card);
}

.extra-info-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    margin-right: 8px;
    margin-bottom: 4px;
}

.extra-info-abc {
    background: var(--info-bg);
    color: var(--info);
}

.extra-info-delete {
    background: var(--warning-bg);
    color: var(--warning-text);
}

/* Предупреждение о геокодировании */
.import-geocode-warning {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-bottom: 1px solid var(--warning);
}

.geocode-warning-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

.geocode-warning-icon {
    width: 44px;
    height: 44px;
    background: var(--warning);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
}

.geocode-warning-title {
    font-weight: 600;
    color: #92400e;
    font-size: 15px;
}

.geocode-warning-hint {
    font-size: 12px;
    color: #a16207;
    margin-top: 2px;
}

.btn-geocode {
    background: var(--warning);
    color: #fff;
    border: none;
    white-space: nowrap;
}

.btn-geocode:hover {
    background: #d97706;
    color: #fff;
}

/* Прогресс геокодирования */
.geocode-progress-box {
    padding: 16px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.geocode-progress-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.geocode-progress-icon {
    color: var(--warning);
    font-size: 16px;
}

.geocode-progress-title {
    font-weight: 500;
    flex: 1;
}

.geocode-progress-count {
    font-size: 13px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.geocode-progress-bar-wrap {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: var(--radius-xs);
    overflow: hidden;
}

.geocode-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--warning) 0%, #fbbf24 100%);
    border-radius: var(--radius-xs);
    transition: width 0.3s ease;
    width: 0%;
}

.geocode-progress-stats {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Результат геокодирования */
.geocode-result {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.geocode-result-icon {
    width: 36px;
    height: 36px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    flex-shrink: 0;
}

.geocode-result-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.geocode-result-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.geocode-stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.geocode-stat-success { color: var(--success); }
.geocode-stat-info { color: var(--info); }
.geocode-stat-danger { color: var(--danger); }

/* ============================================================
   Геокодирование — Модальное окно (geocode-modal.js)
   ============================================================ */

/* Overlay */
.geocode-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: geocodeFadeIn 0.2s ease;
}
@keyframes geocodeFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Modal */
.geocode-modal {
    width: 680px;
    max-width: 95vw;
    max-height: 90vh;
    background: var(--bg-card, #fff);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: geocodeSlideIn 0.25s ease;
}
@keyframes geocodeSlideIn {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Header */
.geocode-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    background: linear-gradient(135deg, var(--primary, var(--accent-hover)) 0%, var(--accent) 100%);
    color: #fff;
}
.geocode-modal-header-icon {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.geocode-modal-header-title {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}
.geocode-modal-header-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: var(--radius-md);
    font-weight: 600;
}
.badge-python {
    background: rgba(255,255,255,0.2);
    color: #fff;
}
.geocode-modal-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}
.geocode-modal-close:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* Progress */
.geocode-modal-progress {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border, #e5e7eb);
}
.geocode-progress-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.geocode-progress-pct {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary, var(--accent-hover));
    min-width: 52px;
    font-variant-numeric: tabular-nums;
}
.geocode-progress-bar-container {
    flex: 1;
    height: 8px;
    background: var(--bg, #f3f4f6);
    border-radius: var(--radius-xs);
    overflow: hidden;
}
.geocode-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary, var(--accent-hover)), #818cf8);
    border-radius: var(--radius-xs);
    transition: width 0.4s ease;
}
.geocode-progress-counter {
    font-size: 13px;
    color: var(--text-muted, #6b7280);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Stats grid */
.geocode-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.geocode-stat-card {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    text-align: center;
    background: var(--bg, #f9fafb);
}
.stat-color-found   { border-left: 3px solid var(--success, var(--success)); }
.stat-color-yandex  { border-left: 3px solid var(--info, var(--info)); }
.stat-color-miss    { border-left: 3px solid var(--warning, var(--warning)); }
.stat-color-error   { border-left: 3px solid var(--danger, var(--danger)); }
.geocode-stat-value {
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.stat-color-found  .geocode-stat-value { color: var(--success, var(--success)); }
.stat-color-yandex .geocode-stat-value { color: var(--info, var(--info)); }
.stat-color-miss   .geocode-stat-value { color: var(--warning, var(--warning)); }
.stat-color-error  .geocode-stat-value { color: var(--danger, var(--danger)); }
.geocode-stat-label {
    font-size: 11px;
    color: var(--text-muted, #6b7280);
    margin-top: 2px;
}

/* Toolbar */
.geocode-modal-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    background: var(--bg, #f9fafb);
}
.geocode-modal-toolbar-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted, #6b7280);
    margin-right: 8px;
}
.geocode-log-filter-btn {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border, #e5e7eb);
    background: transparent;
    color: var(--text-muted, #6b7280);
    cursor: pointer;
    transition: all 0.15s;
}
.geocode-log-filter-btn:hover {
    border-color: var(--primary, var(--accent-hover));
    color: var(--primary, var(--accent-hover));
}
.geocode-log-filter-btn.active {
    background: var(--primary, var(--accent-hover));
    color: #fff;
    border-color: var(--primary, var(--accent-hover));
}
.geocode-log-filter-btn.active-danger {
    background: var(--danger, var(--danger));
    color: #fff;
    border-color: var(--danger, var(--danger));
}
.geocode-log-filter-btn.active-warning {
    background: var(--warning, var(--warning));
    color: #fff;
    border-color: var(--warning, var(--warning));
}
.geocode-autoscroll-toggle {
    margin-left: auto;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border, #e5e7eb);
    background: transparent;
    color: var(--text-muted, #6b7280);
    cursor: pointer;
    transition: all 0.15s;
}
.geocode-autoscroll-toggle.active {
    background: var(--success, var(--success));
    color: #fff;
    border-color: var(--success, var(--success));
}

/* Log */
.geocode-modal-log {
    flex: 1;
    min-height: 200px;
    max-height: 350px;
    overflow-y: auto;
    background: var(--bg, #f9fafb);
    font-size: 12px;
}

/* Log entry */
.geocode-log-entry {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 20px;
    border-bottom: 1px solid var(--border-light, #f3f4f6);
    transition: background 0.15s;
}
.geocode-log-entry:hover {
    background: rgba(0,0,0,0.015);
}
.geocode-log-num {
    min-width: 24px;
    font-size: 10px;
    color: var(--text-muted, #9ca3af);
    text-align: right;
    padding-top: 2px;
    font-variant-numeric: tabular-nums;
}
.geocode-log-icon {
    min-width: 16px;
    font-size: 13px;
    padding-top: 1px;
}
.log-icon-found     { color: var(--success, var(--success)); }
.log-icon-not_found { color: var(--warning, var(--warning)); }
.log-icon-error     { color: var(--danger, var(--danger)); }
.geocode-log-content {
    flex: 1;
    min-width: 0;
}
.geocode-log-address {
    color: var(--text, #111827);
    word-break: break-word;
}
.geocode-log-detail {
    margin-top: 3px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.geocode-log-coords {
    font-family: monospace;
    font-size: 11px;
    color: var(--success, var(--success));
    background: rgba(16,185,129,0.08);
    padding: 1px 6px;
    border-radius: var(--radius-xs);
}
.geocode-log-source {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: var(--radius-xs);
    font-weight: 600;
}
.log-source-cache   { background: #dbeafe; color: #1d4ed8; }
.log-source-database { background: #e0e7ff; color: #4338ca; }
.log-source-yandex  { background: #fef3c7; color: #92400e; }
.geocode-log-error-msg {
    font-size: 11px;
    color: var(--danger, var(--danger));
}

/* Footer */
.geocode-modal-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border, #e5e7eb);
    background: var(--bg-card, #fff);
}
.geocode-modal-footer-info {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted, #6b7280);
}

/* Complete screen */
.geocode-complete-icon {
    text-align: center;
    font-size: 48px;
    margin-bottom: 12px;
}
.geocode-complete-icon.success { color: var(--success, var(--success)); }
.geocode-complete-icon.warning { color: var(--warning, var(--warning)); }
.geocode-complete-icon.error   { color: var(--danger, var(--danger)); }
.geocode-complete-title {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}
.geocode-complete-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
}
.geocode-complete-stat {
    text-align: center;
}
.geocode-complete-stat-value {
    font-size: 24px;
    font-weight: 700;
}
.geocode-complete-stat-label {
    font-size: 11px;
    color: var(--text-muted, #6b7280);
}

/* Spinner animation */
.geocode-modal-spinner {
    animation: geocodeSpin 1s linear infinite;
}
@keyframes geocodeSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Not found list (after batch geocoding) */
.geocode-notfound-row {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light, #f3f4f6);
}
.geocode-notfound-input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius-xs);
    font-size: 12px;
    background: var(--bg, #fff);
    color: var(--text, #111827);
}


/* ============================================================
   Умная генерация полигонов — Модальное окно (v2 — минимализм)
   ============================================================ */

/* Overlay */
.sgen-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: sgenFadeIn 0.15s ease;
}
@keyframes sgenFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Modal */
.sgen-modal {
    width: 520px;
    max-width: 95vw;
    max-height: 80vh;
    background: var(--bg-card, #fff);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 24px rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: sgenSlideIn 0.15s ease;
}
@keyframes sgenSlideIn {
    from { transform: translateY(8px); opacity: 0; }
    to   { transform: translateY(0);   opacity: 1; }
}

/* Header */
.sgen-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-card, #fff);
}
.sgen-header-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #111827);
    flex: 1;
}
.sgen-header-counter {
    font-size: 12px;
    color: var(--text-muted, #6b7280);
    font-variant-numeric: tabular-nums;
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    margin-right: 8px;
}
.sgen-close {
    background: none;
    border: none;
    color: var(--text-muted, #9ca3af);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    transition: color 0.15s, background 0.15s;
    line-height: 1;
}
.sgen-close:hover {
    color: var(--text-primary, #111827);
    background: var(--bg-secondary, #f3f4f6);
}

/* Progress bar — thin, no gradient */
.sgen-progress-bar {
    height: 2px;
    background: var(--border-light, var(--border-light));
    overflow: hidden;
}
.sgen-progress-fill {
    height: 100%;
    background: var(--accent, var(--accent));
    transition: width 0.3s ease;
    width: 0%;
}

/* Body */
.sgen-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Stats row — inline */
.sgen-stats-row {
    padding: 10px 16px 0;
    font-size: 12px;
    color: var(--text-secondary, var(--text-secondary));
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.sgen-stat-inline {
    font-variant-numeric: tabular-nums;
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    font-size: 12px;
}
.sgen-stat-inline span {
    font-weight: 600;
}
.sgen-stat-found { color: var(--success, var(--success)); }
.sgen-stat-notfound { color: var(--warning, var(--warning)); }
.sgen-stat-error { color: var(--danger, var(--danger)); }
.sgen-stat-sep {
    color: var(--border-color, #d1d5db);
    margin: 0 2px;
}

/* Time row */
.sgen-time-row {
    padding: 4px 16px 8px;
    font-size: 11px;
    color: var(--text-muted, var(--text-faint));
    display: flex;
    align-items: center;
    gap: 4px;
    font-variant-numeric: tabular-nums;
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
}

/* Log */
.sgen-log {
    flex: 1;
    min-height: 160px;
    max-height: 360px;
    overflow-y: auto;
    border-top: 1px solid var(--border-light, var(--border-light));
    margin-top: 4px;
}

/* Scrollbar */
.sgen-log::-webkit-scrollbar {
    width: 4px;
}
.sgen-log::-webkit-scrollbar-track {
    background: transparent;
}
.sgen-log::-webkit-scrollbar-thumb {
    background: var(--border-color, #d1d5db);
    border-radius: var(--radius-xs);
}

/* Log entry — single line, compact */
.sgen-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    height: 28px;
    font-size: 12px;
    border-bottom: 1px solid var(--border-light, #f8f9fa);
    transition: background 0.1s;
}
.sgen-entry:hover {
    background: var(--bg-secondary, #f9fafb);
}
.sgen-entry-name {
    color: var(--text-primary, #111827);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}
.sgen-entry-detail {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.sgen-entry-ok .sgen-entry-name { color: var(--text-primary, #111827); }
.sgen-entry-nf .sgen-entry-name { color: var(--text-muted, #9ca3af); }
.sgen-entry-er .sgen-entry-name { color: var(--text-muted, #9ca3af); }

.sgen-entry-err {
    font-size: 11px;
    color: var(--danger, var(--danger));
    white-space: nowrap;
}

/* Source badges */
.sgen-source-badge {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: var(--radius-xs);
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
}
.sgen-source-real {
    font-weight: 700;
}
.sgen-source-osm_boundaries    { background: rgba(99,102,241,0.1);  color: var(--accent); }
.sgen-source-osm_overpass      { background: rgba(59,130,246,0.1);  color: var(--info); }
.sgen-source-wikidata_osm      { background: rgba(139,92,246,0.1);  color: #8b5cf6; }
.sgen-source-nominatim_polygon { background: rgba(6,182,212,0.1);   color: #06b6d4; }
.sgen-source-yandex_ellipse    { background: rgba(34,197,94,0.1);   color: #22c55e; }
.sgen-source-yandex_circle     { background: rgba(245,158,11,0.1);  color: var(--warning); }
.sgen-source-nominatim_circle  { background: rgba(148,163,184,0.1); color: var(--text-faint); }

.sgen-entry-meta {
    font-size: 11px;
    color: var(--text-muted, #9ca3af);
    white-space: nowrap;
}

/* Footer */
.sgen-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-top: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-card, #fff);
}
.sgen-footer-info {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary, var(--text-secondary));
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

/* Buttons */
.sgen-btn {
    font-size: 12px;
    padding: 5px 14px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    border: 1px solid var(--border-color, #d1d5db);
    background: var(--bg-card, #fff);
    color: var(--text-primary, #374151);
    transition: all 0.15s;
    white-space: nowrap;
}
.sgen-btn:hover {
    background: var(--bg-secondary, #f3f4f6);
}
.sgen-btn-cancel {
    color: var(--text-secondary, #6b7280);
}
.sgen-btn-done {
    background: var(--accent, var(--accent));
    color: #fff;
    border-color: var(--accent, var(--accent));
}
.sgen-btn-done:hover {
    background: var(--accent-hover, var(--accent-hover));
    border-color: var(--accent-hover, var(--accent-hover));
}

/* Spinner */
.sgen-spin-icon {
    font-size: 11px;
    animation: sgenSpin 1s linear infinite;
    margin-right: 4px;
}
@keyframes sgenSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* FAB indicator */
.zone-map-fab-smart.sgen-active {
    position: relative;
}
.zone-map-fab-smart.sgen-active::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: var(--success, var(--success));
    border: 2px solid #fff;
    border-radius: 50%;
    animation: sgenPulse 1.5s ease-in-out infinite;
}
@keyframes sgenPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Mobile */
@media (max-width: 600px) {
    .sgen-modal {
        width: 100%;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    .sgen-stats-row {
        font-size: 11px;
    }
}

/* Адаптивность для импорта */
@media (max-width: 600px) {
    .import-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .import-geocode-warning {
        flex-direction: column;
        align-items: stretch;
    }
    
    .geocode-warning-content {
        margin-bottom: 12px;
    }
    
    .btn-geocode {
        width: 100%;
        justify-content: center;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .abc-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* Dashboard Tabs */
.dashboard-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dashboard-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.dashboard-tab.active {
    background: var(--accent);
    color: white;
}

.dashboard-tab i {
    font-size: 12px;
}

/* Unassigned Stats Grid */
.unassigned-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.unassigned-category-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid var(--border-color);
    transition: transform 0.2s;
}

.unassigned-category-card:hover {
    transform: translateX(4px);
}

.unassigned-category-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.unassigned-category-icon i {
    font-size: 16px;
    color: white;
}

.unassigned-category-content {
    flex: 1;
    min-width: 0;
}

.unassigned-category-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.unassigned-category-count {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.unassigned-category-metrics {
    display: flex;
    gap: 12px;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.unassigned-category-metrics span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Unassigned Exclude Toggle */
.unassigned-exclude-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: 0.3s;
    border-radius: var(--radius-xl);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 100px;
}

.unassigned-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    min-height: 36px;
}

.filter-btn i {
    font-size: 13px;
}

.filter-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.filter-btn.active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
    box-shadow: 0 0 0 1px var(--accent-glow);
}

.filter-btn .filter-count,
.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-sm);
    background: var(--accent-light);
    color: var(--accent);
    font-size: 10px;
    font-weight: 600;
}

.filter-btn.active .filter-count {
    background: var(--accent);
    color: white;
}

/* Supervisor Stats Grid */
.sv-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    padding: 16px;
}

.sv-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--border-color);
}

.sv-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sv-card-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.sv-card-zones {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.sv-card-status {
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    font-size: 11px;
    font-weight: 500;
}

.sv-card-status.ok {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.sv-card-status.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.sv-card-status.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.sv-card-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.sv-metric {
    text-align: center;
    padding: 8px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}

.sv-metric-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.sv-metric-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 2px;
}

.sv-warnings {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.sv-warning-item {
    font-size: 11px;
    padding: 4px 8px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-xs);
    margin-bottom: 4px;
    color: var(--danger);
}

/* Compact Warnings Table */
.warnings-compact {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.warnings-table th {
    font-weight: 500;
    text-align: center;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.warnings-table td {
    text-align: center;
}

/* ============================================================
   УЛУЧШЕННЫЕ МОДАЛЬНЫЕ ОКНА (Linear/Notion стиль)
   ============================================================ */

/* === Modal Header with Avatar === */
.modal-header-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.modal-header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.modal-header-text h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.modal-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}

/* === User Modal Avatar === */
.user-modal-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(79, 140, 247, 0.25);
}

/* === TP Modal Avatar === */
.tp-modal-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

/* === Modal Sections === */
.modal-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    margin-bottom: 16px;
    overflow: hidden;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}

.modal-section-header i {
    color: var(--accent);
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.modal-section-body {
    padding: 16px;
}

.section-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: var(--radius-md);
}

/* === Form Row 2 Column Layout === */
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-row-2 .form-group {
    margin-bottom: 12px;
}

.form-row-2 .form-group:last-child {
    margin-bottom: 12px;
}

/* === Input with Icon === */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
    transition: var(--transition);
}

.input-with-icon .form-input,
.input-with-icon .form-select {
    padding-left: 36px;
}

.input-with-icon .form-input:focus + i,
.input-with-icon .form-input:focus ~ i {
    color: var(--accent);
}

/* === Role Selector === */
.role-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.role-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.role-option:hover {
    border-color: var(--border-focus);
    background: var(--bg-secondary);
}

.role-option.selected {
    border-color: var(--accent);
    background: var(--accent-light);
}

.role-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.role-tp { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.role-supervisor { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.role-rop { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.role-admin { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.role-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.role-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.role-desc {
    font-size: 10px;
    color: var(--text-muted);
}

.role-option.selected .role-name {
    color: var(--accent);
}

/* === Checkbox Grid === */
.checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-size: 12px;
    font-weight: 500;
    user-select: none;
}

.checkbox-item:hover {
    border-color: var(--border-focus);
    background: var(--bg-secondary);
}

.checkbox-item.checked {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
}

.checkbox-item input[type="checkbox"] {
    display: none;
}

.checkbox-indicator {
    width: 16px;
    height: 16px;
    border-radius: var(--radius-xs);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.checkbox-item.checked .checkbox-indicator {
    background: var(--accent);
    border-color: var(--accent);
}

.checkbox-indicator i {
    color: white;
    font-size: 10px;
    opacity: 0;
    transition: var(--transition);
}

.checkbox-item.checked .checkbox-indicator i {
    opacity: 1;
}

/* ETP color indicators in checkboxes */
.etp-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* === Modal User Specific === */
.modal-user .modal-body {
    max-height: calc(80vh - 140px);
    overflow-y: auto;
}

.modal-tp .modal-body {
    padding: 20px 24px;
}

/* === ЭТП Модальное окно === */
.modal-etp {
    max-width: 480px;
}

.modal-etp .modal-body {
    padding: 20px 24px;
}

.etp-modal-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent), var(--success));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

/* === Responsive === */
@media (max-width: 600px) {
    /* Mobile-specific dashboard heights */
    :root {
        --dashboard-height-peek: 90px;
        --dashboard-height-normal: 180px;
        --dashboard-height-expanded: 70vh;
    }

    .dashboard-panel {
        max-height: var(--dashboard-height-normal);
        padding-bottom: env(safe-area-inset-bottom, 12px);
    }

    .dashboard-panel.expanded {
        max-height: var(--dashboard-height-expanded);
    }

    .dashboard-panel.expanded .route-list-scroll {
        max-height: calc(70vh - 140px);
    }

    .dashboard-panel.expanded .unassigned-detail-body {
        max-height: calc(70vh - 120px);
    }

    .form-row-2 {
        grid-template-columns: 1fr;
    }

    .role-selector {
        grid-template-columns: 1fr;
    }

    .modal-header-content {
        flex-direction: column;
        text-align: center;
    }

    .modal-header-text {
        align-items: center;
    }
}

/* ============================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ
   ============================================================ */

/* === Mobile Sidebar === */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

/* === Mobile Panel Toggles (hidden on desktop) === */
.panel-toggle {
    display: none;
}

.panel-backdrop {
    display: none;
}

/* Mobile Search Button */
.mobile-search-btn {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: var(--transition);
}

.mobile-search-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Mobile Search Overlay */
.mobile-search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 300;
    flex-direction: column;
}

.mobile-search-overlay.show {
    display: flex;
}

.mobile-search-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.mobile-search-input-wrap {
    flex: 1;
    position: relative;
}

.mobile-search-input-wrap input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 16px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
}

.mobile-search-input-wrap i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.mobile-search-close {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 20px;
}

.mobile-search-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.mobile-search-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

/* === Responsive Breakpoints === */
@media (max-width: 1024px) {
    /* Tables - horizontal scroll */
    .data-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table {
        min-width: 600px;
    }
    
    /* Cards grid - smaller cards */
    .etp-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        padding: 16px;
    }
    
    /* Dashboard stats */
    .dashboard-stats {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Settings grid */
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    /* Sidebar - hidden by default, slides in */
    .sidebar {
        position: fixed;
        left: -280px;
        transition: left 0.3s ease;
        z-index: 100;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .sidebar-toggle {
        display: flex;
    }
    
    .sidebar-backdrop.show {
        display: block;
    }
    
    /* User info - увеличенный шрифт */
    .sidebar-footer .user-info {
        font-size: 13px;
    }
    
    .sidebar-footer #userName {
        font-size: 13px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 180px;
    }
    
    .sidebar-footer #userRole,
    .sidebar-footer #userLogin {
        font-size: 11px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 180px;
    }
    
    .sidebar-footer .user-info > div {
        min-width: 0;
        overflow: hidden;
    }
    
    /* Main content - full width */
    .main-content {
        width: 100%;
    }
    
    /* Topbar */
    .topbar {
        padding: 0 16px;
        padding-left: 60px; /* Space for menu button */
    }
    
    .topbar-title {
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
        min-width: 0;
        flex: 1;
        max-width: calc(100vw - 200px);
    }
    
    .search-box {
        display: none;
    }
    
    .mobile-search-btn {
        display: flex;
    }
    
    .topbar-actions {
        gap: 6px;
        flex-shrink: 0;
    }
    
    .topbar-actions .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .topbar-actions .btn span {
        display: none;
    }
    
    /* Скрываем кнопку Экспорт на маленьких экранах */
    .topbar-actions .btn-secondary {
        display: none;
    }
    
    /* Page padding */
    .page-padded {
        padding: 16px;
    }
    
    /* Cards */
    .card {
        padding: 16px;
    }
    
    .card-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    /* Modals - fullscreen on mobile */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
        overscroll-behavior: contain;
    }
    
    .modal {
        width: 100%;
        max-width: 100%;
        max-height: calc(100dvh - env(safe-area-inset-top, 0px));
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        margin: 0;
    }
    
    .modal-header {
        padding: 16px 16px 0;
    }
    
    .modal-body {
        padding: 16px;
        max-height: calc(100dvh - 200px);
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-footer {
        padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px));
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* ETP grid */
    .etp-grid {
        grid-template-columns: 1fr;
        padding: 12px;
    }
    
    /* Dashboard stats */
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    
    .stat-card {
        padding: 8px 10px;
    }
    
    .stat-value {
        font-size: 14px;
    }
    
    /* Metrics */
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    /* Filter panel */
    .map-filter-panel {
        position: fixed;
        top: 0;
        bottom: 0;
        left: calc(-300px - env(safe-area-inset-left, 0px));
        width: 280px;
        max-width: 85vw;
        z-index: 80;
        overflow-y: auto;
        transition: left 0.3s ease;
    }

    .map-filter-panel.open {
        left: env(safe-area-inset-left, 0px);
    }

    /* Zone panel - mobile slide-in */
    .zone-panel {
        position: fixed;
        top: 0;
        bottom: 0;
        left: calc(-320px - env(safe-area-inset-left, 0px));
        width: 300px;
        max-width: 85vw;
        z-index: 80;
        transition: left 0.3s ease;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.2);
    }

    .zone-panel.open {
        left: env(safe-area-inset-left, 0px);
    }
    
    .zone-mobile-close {
        display: flex;
    }
    
    /* Panel toggle buttons */
    .panel-toggle {
        display: flex;
        position: fixed;
        bottom: calc(80px + env(safe-area-inset-bottom, 0px));
        z-index: 90;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--accent);
        color: white;
        border: none;
        cursor: pointer;
        box-shadow: var(--shadow-lg);
        align-items: center;
        justify-content: center;
        font-size: 20px;
        transition: transform 0.2s, box-shadow 0.2s;
    }
    
    .panel-toggle:hover {
        transform: scale(1.05);
        box-shadow: 0 8px 24px rgba(59, 130, 246, 0.5);
    }
    
    .panel-toggle:active {
        transform: scale(0.97);
    }
    
    .filter-toggle {
        left: 20px;
    }

    .zone-toggle {
        left: 88px;
    }
    
    /* Подписи к FAB-кнопкам */
    .panel-toggle::after {
        content: attr(data-label);
        position: absolute;
        bottom: -20px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 10px;
        white-space: nowrap;
        color: var(--text-muted);
        opacity: 0;
        transition: opacity 0.2s;
        pointer-events: none;
    }
    
    .panel-toggle:first-open::after {
        opacity: 1;
    }
    
    /* FAB для добавления ТТ */
    .fab-add-point {
        display: flex;
        position: fixed;
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
        right: 20px;
        z-index: 90;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--success);
        color: white;
        border: none;
        cursor: pointer;
        box-shadow: var(--shadow-lg);
        align-items: center;
        justify-content: center;
        font-size: 20px;
        transition: transform 0.2s, box-shadow 0.2s;
    }
    
    .fab-add-point:hover {
        transform: scale(1.05);
        box-shadow: 0 8px 24px rgba(34, 197, 94, 0.5);
    }
    
    .fab-add-point:active {
        transform: scale(0.97);
    }
    
    /* Panel backdrops */
    .panel-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 75;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .panel-backdrop.show {
        display: block;
        opacity: 1;
    }
    
    /* Dashboard panel - три состояния: свёрнуто, норма (60vh), развёрнуто (85vh) */
    .dashboard-panel {
        max-height: 60vh;
        padding: 12px;
        transition: max-height 0.3s ease;
    }

    .dashboard-panel.expanded {
        max-height: 85vh;
    }

    /* Синхронизируем calc() вложенных скролл-областей с 85vh */
    .dashboard-panel.expanded .route-list-scroll {
        max-height: calc(85vh - 140px);
    }

    .dashboard-panel.expanded .unassigned-detail-body {
        max-height: calc(85vh - 120px);
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .dashboard-summary-mini {
        flex-wrap: wrap;
        gap: 4px 12px;
        font-size: 11px;
    }
    
    .dashboard-panel.collapsed {
        max-height: 0;
        padding: 0 12px;
        overflow: hidden;
    }
    
    /* FAB-кнопки - позиция выше, чтобы не конфликтовали с fab-add-point */
    .panel-toggle {
        bottom: calc(80px + env(safe-area-inset-bottom));
    }
    
    /* Фильтры нераспределённых ТТ */
    .unassigned-filters {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-xs);
    }

    .filter-btn {
        padding: 10px 16px;
        font-size: 11px;
        min-height: 44px;
    }
    
    /* Timeline */
    .timeline {
        padding: 0 12px;
    }
    
    .timeline::before {
        left: 19px;
    }
    
    .timeline-icon {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    
    /* Filter chips - горизонтальный скролл */
    .filter-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        margin: 0 -16px;
        padding: 0 16px 4px;
        scrollbar-width: none;
    }
    
    .filter-chips::-webkit-scrollbar {
        display: none;
    }
    
    .filter-chip {
        flex-shrink: 0;
    }
    
    /* Data tables - улучшения для мобилок */
    .data-table-wrap {
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table-wrap.has-scroll::after {
        opacity: 1;
    }
    
    .data-table-wrap.scrolled-end::after {
        opacity: 0;
    }
    
    /* Forms */
    .form-row-2 {
        grid-template-columns: 1fr;
    }
    
    .edit-form-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Role selector */
    .role-selector {
        grid-template-columns: 1fr;
    }
    
    .role-option {
        padding: 8px 10px;
    }
    
    .role-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .role-name {
        font-size: 13px;
    }
    
    .role-desc {
        display: none;
    }
    
    /* Checkbox grid */
    .checkbox-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Modal sections */
    .modal-section {
        margin: 0 -16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .modal-section:first-child {
        margin-top: -16px;
    }
    
    /* Modal header with avatar */
    .modal-header-content {
        flex-direction: row;
    }
    
    .user-modal-avatar,
    .tp-modal-avatar,
    .etp-modal-avatar {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .modal-header-text {
        align-items: flex-start;
    }
    
    .modal-header-text h3 {
        font-size: 16px;
    }
    
    .modal-subtitle {
        font-size: 12px;
    }
    
    /* Pivot table */
    .pivot-table {
        font-size: 11px;
    }
    
    .pivot-table th,
    .pivot-table td {
        padding: 6px 4px;
    }
    
    /* Buttons */
    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .btn-sm {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    /* Toast - внизу на мобильном */
    .toast-container {
        top: auto;
        bottom: 16px;
        left: 16px;
        right: 16px;
    }
    
    .toast {
        max-width: 100%;
        font-size: 12px;
    }
    
    /* Settings sections */
    .settings-section {
        padding: 16px;
    }
    
    .sett-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .sett-badge {
        align-self: flex-start;
    }
    
    /* Import drop zone */
    .drop-zone {
        padding: 24px 16px;
    }
    
    .drop-zone i {
        font-size: 32px;
    }
    
    .drop-zone .drop-text {
        font-size: 13px;
    }
    
    /* Замена текста на мобильных */
    .drop-zone .desktop-text {
        display: none;
    }
    
    .drop-zone .mobile-text {
        display: block !important;
    }
    
    /* Login page - адаптация */
    .login-page {
        padding: 16px;
    }
    
    .login-card {
        width: auto;
        max-width: 100%;
        margin: 0;
    }
    
    /* Modal drag handle - visible on mobile */
    .modal-drag-handle {
        display: block;
    }
}

@media (max-width: 480px) {
    /* Extra small devices */
    .etp-grid {
        padding: 8px;
    }
    
    .page-padded {
        padding: 8px;
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }
    
    .card {
        padding: 12px;
        border-radius: var(--radius-md);
    }
    
    .topbar-title {
        font-size: 14px;
    }
    
    .dashboard-stats {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        grid-template-columns: unset;
    }
    
    .stat-card {
        min-width: 120px;
        flex-shrink: 0;
        flex-direction: column;
        text-align: center;
    }
    
    .stat-icon {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .stat-value {
        font-size: 13px;
    }
    
    .stat-label {
        font-size: 9px;
    }
    
    /* Buttons - icon only */
    .topbar-actions .btn {
        padding: 8px;
    }
    
    .topbar-actions .btn i {
        margin: 0;
    }
    
    /* Checkbox grid - single column */
    .checkbox-grid {
        grid-template-columns: 1fr;
    }
    
    /* Modal */
    .modal {
        max-height: 95vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
    
    .modal-footer {
        gap: 6px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
    
    /* Главное действие первым на мобильном */
    .modal-footer .btn-primary,
    .modal-footer .btn-success {
        order: -1;
    }
    
    /* Forms - single column */
    .edit-form-row {
        grid-template-columns: 1fr;
    }
    
    /* Tables */
    .pivot-table {
        font-size: 10px;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Toast - внизу экрана */
    .toast-container {
        top: auto;
        bottom: 20px;
        right: 8px;
        left: 8px;
    }
    
    /* Metrics - single column */
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .metric-card {
        padding: 16px;
    }
    
    /* Zone panel - fullscreen */
    .zone-panel {
        width: 100vw;
        max-width: 100vw;
        left: -100vw;
    }
    
    .zone-panel.open {
        left: 0;
    }
}

/* === Touch Optimizations === */
@media (hover: none) and (pointer: coarse) {
    /* Remove tap highlight */
    *,
    *::before,
    *::after {
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Larger touch targets */
    .nav-item {
        min-height: 48px;
    }
    
    .btn {
        min-height: 44px;
    }
    
    .btn:active {
        transform: scale(0.97);
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .modal-close {
        width: 44px;
        height: 44px;
    }
    
    .checkbox-item {
        min-height: 44px;
        padding: 12px;
    }
    
    .color-preset {
        width: 36px;
        height: 36px;
    }
    
    .role-option {
        min-height: 56px;
    }
    
    /* Smooth scrolling */
    .data-table-wrap,
    .zone-list-container,
    .modal-body,
    .page-content,
    [overflow-y="auto"] {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
}

/* === Landscape orientation fixes === */
@media (max-height: 500px) and (orientation: landscape) {
    .modal {
        max-height: 95vh;
    }
    
    .modal-body {
        max-height: 50vh;
        overflow-y: auto;
    }
    
    .login-card {
        padding: 24px;
    }
    
    .login-logo {
        font-size: 32px;
        height: 48px;
    }
    
    /* Dashboard panel - больше места в landscape */
    .dashboard-panel {
        max-height: 60vh;
    }
}

/* === Safe Area Insets for modern devices === */
@supports (padding: max(0px)) {
    .sidebar {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
    
    .sidebar-footer {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    
    .sidebar.open {
        width: calc(280px + env(safe-area-inset-left));
    }
    
    .topbar {
        padding-left: max(60px, calc(60px + env(safe-area-inset-left)));
        padding-right: max(16px, env(safe-area-inset-right));
    }
    
    /* panel-toggle position handled in 768px media query for mobile */
    
    .modal {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
    
    .dashboard-panel {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
    
    .mobile-search-header {
        padding-top: max(12px, env(safe-area-inset-top));
    }
    
    .mobile-search-results {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
}

/* === Торговые представители: карточки и табы === */
.tp-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.tp-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.tp-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tp-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.tp-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.tp-card-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.tp-card-info h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
}

.tp-card-info p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}

/* Табы в деталях ТП */
.tp-detail-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--radius-md);
    width: fit-content;
    margin-bottom: 16px;
}

.tp-detail-tab {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.tp-detail-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.tp-detail-tab.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tp-tab-content {
    /* Контент табов */
}

/* === Адаптивные классы для инлайн-стилей === */

/* Сетка статистики ТП - адаптивная */
.metrics-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

/* Select с адаптивной шириной */
.form-select-mobile {
    width: 180px;
}

/* Табы с горизонтальным скроллом на мобильном */
.tabs-scrollable {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--radius-md);
}

/* Шапка настроек - легенда */
.settings-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.settings-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Шапка настроек - кнопки */
.settings-actions {
    display: flex;
    gap: 10px;
}

/* Подсказка рисования зон */
.zone-draw-hint {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 8px 18px;
    border-radius: var(--radius-xl);
    font-size: 13px;
    z-index: 10;
    pointer-events: none;
    max-width: max-content;
    max-height: 40px;
    white-space: nowrap;
    overflow: hidden;
    line-height: 1.5;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

/* Zone actions */
.zone-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* === Мобильные стили для адаптивных классов === */
@media (max-width: 768px) {
    /* Сетка статистики ТП - 2 колонки на мобильном */
    .metrics-grid-5 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Select на всю ширину */
    .form-select-mobile {
        width: 100%;
    }
    
    /* Табы с горизонтальным скроллом */
    .tabs-scrollable {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .tabs-scrollable::-webkit-scrollbar {
        display: none;
    }
    
    /* Шапка настроек - легенда вертикально */
    .settings-legend {
        flex-direction: column;
        gap: 8px;
    }
    
    /* Шапка настроек - кнопки только иконки */
    .settings-actions .btn span {
        display: none;
    }
    
    .settings-actions .btn i {
        margin: 0;
    }
    
    /* Zone actions - wrap на мобильном */
    .zone-actions {
        flex-wrap: wrap;
    }
    
    /* Login card padding */
    .login-card {
        padding: 24px;
    }
    
    /* Индивидуальные настройки ЭТП - колонка */
    .etp-settings-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .etp-settings-header .form-group {
        width: 100%;
        min-width: unset;
    }
}

@media (max-width: 480px) {
    /* Сетка статистики ТП - 2 колонки на очень маленьких */
    .metrics-grid-5 {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

/* === Print styles === */
@media print {
    .sidebar,
    .topbar,
    .modal-overlay,
    .toast-container,
    .btn,
    .sidebar-toggle {
        display: none !important;
    }
    
    .main-content {
        margin: 0;
        padding: 0;
    }
    
    .page-content {
        overflow: visible;
    }
    
    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
.sales-preview-grid {
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.sales-preview-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-secondary, #f9fafb);
    border-radius: var(--radius-sm, 6px);
}
.sales-preview-label {
    font-size: 13px;
    color: var(--text-muted, #6b7280);
}
.sales-preview-value {
    font-size: 14px;
    font-weight: 600;
}

/* Metrics */
.sales-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}
.sales-metric-card {
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: var(--radius-md, 8px);
    padding: 20px;
    text-align: center;
}
.sales-metric-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary, #111827);
    margin-bottom: 4px;
}
.sales-metric-label {
    font-size: 13px;
    color: var(--text-muted, #6b7280);
}

/* Responsive */
@media (max-width: 768px) {
    .sales-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
    .sales-preview-grid {
        grid-template-columns: 1fr;
    }
    .sales-top-bar-wrap {
        display: none;
    }
    .sales-charts-grid {
        grid-template-columns: 1fr;
    }
    /* Двухколоночные grid на дашборде продаж — на мобилках в одну колонку */
    #dailySalesDashboard [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    .sales-forecast-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Статистика по дням недели — старые правила убраны, см. блок .wd-stat ниже */

/* ── Оверлей загрузки приложения ── */
.app-loader {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
}
.app-loader-card { text-align: center; padding: 40px; }
.app-loader-icon {
    font-size: 48px;
    color: var(--accent);
    margin-bottom: 16px;
    animation: loaderPulse 1.5s ease-in-out infinite;
}
@keyframes loaderPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.95); }
}
.app-loader-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.app-loader-status {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    min-height: 20px;
}
.app-loader-bar {
    width: 240px;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-xs);
    overflow: hidden;
    margin: 0 auto;
}
.app-loader-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), #7eb3ff);
    border-radius: var(--radius-xs);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.app-loader.fade-out {
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* ============================================================
   СТИЛИ ДЛЯ ИНДИВИДУАЛЬНЫХ НАСТРОЕК ЭТП
   ============================================================ */

/* Мини-статистика маршрута в модальном окне ЭТП */
.route-stats-mini {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.route-stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.route-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.route-stat-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.metric-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.metric-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Бейджи для типов маршрутов */
.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

/* Адаптивность для метрик */
@media (max-width: 768px) {
    .metrics-grid-3 {
        grid-template-columns: 1fr;
    }
    
    .metric-card {
        padding: 16px;
    }
    
    .metric-value {
        font-size: 24px;
    }
}

.etp-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    border-radius: var(--radius-sm);
}

/* ============================================================
   АНИМАЦИИ ПЕРЕХОДА СТРАНИЦ
   ============================================================ */

/* Страницы с анимацией появления */
.page {
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.page.active {
    opacity: 1;
    pointer-events: auto;
}

/* Анимация появления контента внутри страницы */
.page.active > * {
    animation: fadeInUp 0.35s ease forwards;
}

.page.active > *:nth-child(1) { animation-delay: 0.05s; }
.page.active > *:nth-child(2) { animation-delay: 0.1s; }
.page.active > *:nth-child(3) { animation-delay: 0.15s; }
.page.active > *:nth-child(4) { animation-delay: 0.2s; }
.page.active > *:nth-child(5) { animation-delay: 0.25s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Анимация для карточек */
.page.active .card,
.page.active .etp-card,
.page.active .tp-card {
    animation: scaleIn 0.3s ease forwards;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Анимация для элементов списков */
.page.active .data-table tbody tr {
    animation: slideInRight 0.25s ease forwards;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================================
   ОВЕРЛЕЙ ЗАГРУЗКИ
   ============================================================ */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 56px;
    height: 56px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: white;
    font-size: 14px;
    font-weight: 500;
    margin-top: 16px;
    text-align: center;
}

/* ============================================================
   УЛУЧШЕННЫЕ БАЛЛУНЫ ТТ НА КАРТЕ
   ============================================================ */

/* Стили для баллуна Яндекс.Карт - переопределение inline стилей */
.ymaps-2-1-79-balloon__content {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.tt-balloon {
    min-width: 280px;
    max-width: 360px;
}

.tt-balloon-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.tt-balloon-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.tt-balloon-title {
    flex: 1;
}

.tt-balloon-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 4px;
}

.tt-balloon-code {
    font-size: 11px;
    color: #6b7280;
    font-family: monospace;
}

.tt-balloon-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
}

.tt-balloon-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* 2026-07-15: компактный балун точки — метрики в РЯД + чипы вместо 9 длинных строк
   (раньше попап занимал пол-экрана). */
.tt-balloon--compact { min-width: 240px; max-width: 320px; }
.tt-balloon--compact .tt-balloon-header { padding-bottom: 8px; margin-bottom: 8px; gap: 10px; }
.tt-balloon--compact .tt-balloon-icon { width: 30px; height: 30px; font-size: 12px; }
.tt-balloon--compact .tt-balloon-name { font-size: 14px; margin-bottom: 2px; }
.tt-balloon--compact .tt-balloon-code { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-balloon-metrics { display: flex; gap: 6px; margin-bottom: 8px; }
.tt-balloon-metrics > div {
    flex: 1; min-width: 0; text-align: center;
    background: var(--bg-secondary); border-radius: var(--radius-sm); padding: 6px 2px;
}
.tt-balloon-metrics b { display: block; font-size: 14px; font-weight: 700; color: var(--text-primary); }
.tt-balloon-metrics span { font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.tt-balloon-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.tt-chip {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; padding: 3px 8px; border-radius: var(--radius-pill);
    background: var(--bg-secondary); color: var(--text-secondary); white-space: nowrap;
}
.tt-chip small { color: var(--text-muted); }
.tt-chip.abc-a  { background: var(--success-bg); color: var(--success-text); }
.tt-chip.abc-b  { background: var(--info-bg); color: #2563eb; }
.tt-chip.abc-c  { background: var(--warning-bg); color: var(--warning-text); }
.tt-chip--ok    { background: var(--success-bg); color: var(--success-text); }
.tt-chip--warn  { background: var(--warning-bg); color: var(--warning-text); }
.tt-chip--shift { background: var(--accent-light); color: var(--accent); }
.tt-chip--freq  { background: var(--accent-light); color: var(--accent-hover); }
.tt-balloon--compact .tt-balloon-address {
    font-size: 11px; color: var(--text-secondary); line-height: 1.4;
    display: flex; gap: 6px; align-items: flex-start;
    border-top: 1px solid var(--border-light); padding-top: 8px; margin-top: 0;
}

.tt-balloon-label {
    font-size: 10px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tt-balloon-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.tt-balloon-value.highlight {
    color: var(--info);
}

.tt-balloon-value.success {
    color: var(--success);
}

.tt-balloon-value.warning {
    color: var(--warning);
}

.tt-balloon-value.danger {
    color: var(--danger);
}

/* Бейджи в баллуне */
.tt-balloon-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    font-size: 11px;
    font-weight: 600;
}

.tt-balloon-badge.abc-a {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.tt-balloon-badge.abc-a1 {
    background: rgba(52, 211, 153, 0.1);
    color: #059669;
}

.tt-balloon-badge.abc-b {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.tt-balloon-badge.abc-b1 {
    background: rgba(99, 179, 237, 0.1);
    color: #2563eb;
}

.tt-balloon-badge.abc-c {
    background: rgba(251, 191, 36, 0.1);
    color: #d97706;
}

.tt-balloon-badge.abc-c1 {
    background: rgba(156, 163, 175, 0.15);
    color: #6b7280;
}

/* Адрес в баллуне */
.tt-balloon-address {
    grid-column: 1 / -1;
    padding: 10px 12px;
    background: #f8f9fb;
    border-radius: var(--radius-sm);
    margin-top: 4px;
}

.tt-balloon-address i {
    color: #9ca3af;
    margin-right: 6px;
    font-size: 12px;
}

/* Множественные ТТ по одному адресу */
.tt-balloon-multi {
    padding: 12px;
    background: #fef3c7;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    border-left: 3px solid var(--warning);
}

.tt-balloon-multi-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 8px;
}

.tt-balloon-multi-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tt-balloon-multi-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: white;
    border-radius: var(--radius-xs);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.tt-balloon-multi-item:hover {
    background: #fefce8;
}

.tt-balloon-multi-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* === STANDARDIZED DETAIL PANELS === */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    transition: all var(--transition);
}

.detail-item:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* ============================================================
   АДАПТИВНОСТЬ ДЛЯ АНИМАЦИЙ
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    .page {
        transition: opacity 0.15s ease;
    }
    
    .page.active > * {
        animation: none;
        opacity: 1;
    }
    
    .page.active .card,
    .page.active .etp-card,
    .page.active .version-card,
    .page.active .tp-card,
    .page.active .data-table tbody tr {
        animation: none !important;
        transition: none !important;
        opacity: 1;
    }
    
    .loading-spinner {
        animation: none;
        border-color: white;
        border-top-color: white;
    }
}

/* Мобильные устройства - более быстрая анимация */
@media (max-width: 768px) {
    .page {
        transition-duration: 0.2s;
    }
    
    .page.active > * {
        animation-duration: 0.25s;
    }
    
    .page.active > *:nth-child(n) {
        animation-delay: 0s !important;
    }
}

/* Python Optimizer result grid */
.bm-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin: 16px 0;
}
.bm-result-item {
    text-align: center;
    padding: 12px 8px;
    background: var(--bg-secondary, #f8fafc);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border, var(--border-color));
}
.bm-result-val {
    display: block;
    font-size: 1.4em;
    font-weight: 700;
    color: var(--primary, var(--info));
}
.bm-result-lbl {
    display: block;
    font-size: 0.8em;
    color: var(--text-secondary, var(--text-secondary));
    margin-top: 4px;
}


/* ============================================
   Weekday Statistics — финальный редизайн
   Namespace: .wd-stat (всё внутри)
   ============================================ */

.wd-stat {
    --wd-accent: #059669;
    --wd-accent-soft: rgba(5, 150, 105, 0.08);
    --wd-radius: 14px;
    --wd-radius-sm: 8px;
    --wd-border: #e5e7eb;
    --wd-border-soft: #f1f5f9;
    --wd-text: #0f172a;
    --wd-text-muted: #64748b;
    --wd-text-faint: #94a3b8;
    --wd-bg: #ffffff;
    --wd-bg-soft: #f8fafc;
    --wd-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.04);

    display: flex;
    flex-direction: column;
    background: var(--wd-bg);
    border: 1px solid var(--wd-border);
    border-radius: var(--wd-radius);
    box-shadow: var(--wd-shadow);
    margin-bottom: 16px;
    overflow: hidden;
}

/* === Header === */
.wd-stat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--wd-border-soft);
    flex-wrap: wrap;
}
.wd-stat__title-group {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.wd-stat__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--wd-accent-soft);
    color: var(--wd-accent);
    font-size: 16px;
    flex-shrink: 0;
}
.wd-stat__heading {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.wd-stat__title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--wd-text);
    line-height: 1.2;
}
.wd-stat__count {
    font-size: 12px;
    color: var(--wd-text-muted);
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}
.wd-stat__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.wd-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--wd-border);
    background: var(--wd-bg);
    color: var(--wd-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    font-size: 14px;
}
.wd-icon-btn:hover {
    color: var(--wd-accent);
    border-color: var(--wd-accent);
    background: var(--wd-accent-soft);
}
.wd-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 16px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--success), #059669);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    box-shadow: 0 1px 2px rgba(5, 150, 105, 0.2), 0 4px 12px rgba(5, 150, 105, 0.18);
}
.wd-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(5, 150, 105, 0.25), 0 6px 18px rgba(5, 150, 105, 0.25);
    filter: brightness(1.05);
}
.wd-cta:active { transform: translateY(0); filter: brightness(0.96); }
.wd-cta i { font-size: 12px; }

/* === Toolbar === */
.wd-stat__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
    background: var(--wd-bg-soft);
    border-bottom: 1px solid var(--wd-border-soft);
    flex-wrap: wrap;
}
.wd-segmented {
    display: inline-flex;
    background: var(--wd-bg);
    border: 1px solid var(--wd-border);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 2px;
}
.wd-seg {
    border: none;
    background: transparent;
    color: var(--wd-text-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.wd-seg:hover {
    color: var(--wd-text);
    background: var(--wd-bg-soft);
}
.wd-seg.is-active {
    background: var(--wd-accent);
    color: #fff;
    box-shadow: 0 1px 2px rgba(5, 150, 105, 0.25);
}
.wd-seg[data-count="-1"].is-active {
    background: linear-gradient(135deg, #fb7185, #e11d48);
    box-shadow: 0 1px 2px rgba(225, 29, 72, 0.25);
}

.wd-period {
    display: flex;
    align-items: center;
    gap: 8px;
}
.wd-period__quick {
    display: inline-flex;
    background: var(--wd-bg);
    border: 1px solid var(--wd-border);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 2px;
}
.wd-period__quick button {
    border: none;
    background: transparent;
    color: var(--wd-text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
}
.wd-period__quick button:hover {
    color: var(--wd-text);
    background: var(--wd-bg-soft);
}
.wd-period__dates {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--wd-bg);
    border: 1px solid var(--wd-border);
    border-radius: var(--radius-md);
    padding: 4px 10px;
    height: 30px;
}
.wd-period__icon {
    color: var(--wd-text-faint);
    font-size: 11px;
}
.wd-period__sep {
    color: var(--wd-text-faint);
    font-size: 11px;
}
.wd-date {
    border: none;
    background: transparent;
    font-size: 12px;
    color: var(--wd-text);
    padding: 0 2px;
    width: 110px;
    font-family: inherit;
}
.wd-date:focus { outline: none; }

/* === Hint === */
.wd-stat__hint {
    margin: 0;
    padding: 8px 20px;
    font-size: 11px;
    color: var(--wd-text-faint);
    background: var(--wd-bg);
    border-bottom: 1px solid var(--wd-border-soft);
    line-height: 1.5;
}
.wd-stat__hint:empty { display: none; }

/* === Body / Scroll === */
.wd-stat__body {
    background: var(--wd-bg);
}
.wd-scroll {
    max-height: 620px;
    overflow: auto;
}
.wd-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.wd-scroll::-webkit-scrollbar-track { background: transparent; }
.wd-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: var(--radius-xs);
    border: 2px solid var(--wd-bg);
}
.wd-scroll::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* === Table === */
.wd-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    background: var(--wd-bg);
    color: var(--wd-text);
    min-width: 880px;
}

/* Column widths */
.wd-th--num    { width: 44px; }
.wd-th--tt     { width: auto; min-width: 220px; }
.wd-th--day    { width: 72px; }
.wd-th--total  { width: 78px; }
.wd-th--freq   { width: 96px; }

/* Header */
.wd-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
}
.wd-table thead th {
    background: var(--wd-bg-soft);
    color: var(--wd-text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 12px 8px;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid var(--wd-border);
    transition: color 0.15s ease, background 0.15s ease;
}
.wd-table thead th:first-child { padding-left: 18px; }
.wd-table thead th:last-child { padding-right: 18px; }
.wd-th--tt { text-align: left !important; padding-left: 14px !important; }
.wd-th--weekend { color: var(--wd-text-faint); }
.wd-table thead th:hover {
    color: var(--wd-accent);
    background: #fff;
}

/* Body cells */
.wd-table tbody td {
    padding: 0;
    text-align: center;
    vertical-align: middle;
    border-bottom: 1px solid var(--wd-border-soft);
    font-variant-numeric: tabular-nums;
    height: 50px;
}
.wd-table tbody tr {
    position: relative;
    transition: background 0.12s ease;
}
.wd-table tbody tr:hover {
    background: rgba(5, 150, 105, 0.04);
}

/* ABC strip — left side stripe */
.wd-row__abc {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    border-radius: 0 2px 2px 0;
}
.wd-row__abc--A { background: var(--success); }
.wd-row__abc--B { background: var(--info); }
.wd-row__abc--C { background: var(--danger); }
.wd-row__abc--default { background: #cbd5e1; }

/* Number column */
.wd-cell--num {
    color: var(--wd-text-faint);
    font-size: 12px;
    font-weight: 500;
    padding-left: 18px !important;
    width: 44px;
}

/* TT info column */
.wd-cell--tt {
    text-align: left !important;
    padding: 8px 12px 8px 14px !important;
    overflow: hidden;
}
.wd-tt {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.wd-tt__name {
    font-size: 13px;
    font-weight: 500;
    color: var(--wd-text);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wd-tt__code {
    font-size: 10.5px;
    color: var(--wd-text-faint);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    margin-top: 2px;
    letter-spacing: 0.2px;
}

/* Day cells — таблетка-контейнер внутри td */
.wd-day {
    cursor: pointer;
    position: relative;
    padding: 5px 4px;
    transition: background 0.12s ease;
}
.wd-day--weekend { background: rgba(241, 245, 249, 0.4); }

/* Inner pill — здесь весь визуал */
.wd-day__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    line-height: 1.15;
    padding: 6px 4px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
    min-height: 32px;
    position: relative;
}
.wd-day:hover .wd-day__inner {
    background: rgba(5, 150, 105, 0.06);
}

/* Heatmap intensity — мягкая палитра */
.wd-day[data-heat="1"] .wd-day__inner { background: rgba(5, 150, 105, 0.05); }
.wd-day[data-heat="2"] .wd-day__inner { background: rgba(5, 150, 105, 0.09); }
.wd-day[data-heat="3"] .wd-day__inner { background: rgba(5, 150, 105, 0.14); }
.wd-day[data-heat="4"] .wd-day__inner { background: rgba(5, 150, 105, 0.20); }
.wd-day[data-heat="5"] .wd-day__inner { background: rgba(5, 150, 105, 0.27); }

.wd-day__count {
    font-size: 13px;
    font-weight: 600;
    color: var(--wd-text);
}
.wd-day__weight {
    font-size: 10px;
    color: var(--wd-text-muted);
    font-weight: 500;
}
.wd-day__zero {
    color: var(--wd-text-faint);
    opacity: 0.35;
    font-size: 14px;
    font-weight: 300;
}

/* Best day — мягкая заливка + цветная обводка */
.wd-day--best .wd-day__inner {
    background: rgba(5, 150, 105, 0.14) !important;
    box-shadow: inset 0 0 0 1.5px rgba(5, 150, 105, 0.55);
}
.wd-day--best .wd-day__count { color: var(--success-text); font-weight: 700; }
.wd-day--best .wd-day__weight { color: #059669; opacity: 0.85; }

.wd-day--best.wd-day--freq-2w .wd-day__inner {
    background: rgba(37, 99, 235, 0.13) !important;
    box-shadow: inset 0 0 0 1.5px rgba(37, 99, 235, 0.55);
}
.wd-day--best.wd-day--freq-2w .wd-day__count { color: #1d4ed8; }
.wd-day--best.wd-day--freq-2w .wd-day__weight { color: #2563eb; }

.wd-day--best.wd-day--freq-3w .wd-day__inner {
    background: rgba(124, 58, 237, 0.13) !important;
    box-shadow: inset 0 0 0 1.5px rgba(124, 58, 237, 0.55);
}
.wd-day--best.wd-day--freq-3w .wd-day__count { color: #6d28d9; }
.wd-day--best.wd-day--freq-3w .wd-day__weight { color: #7c3aed; }

.wd-day--best.wd-day--freq-half .wd-day__inner {
    background: rgba(225, 29, 72, 0.12) !important;
    box-shadow: inset 0 0 0 1.5px rgba(225, 29, 72, 0.5);
}
.wd-day--best.wd-day--freq-half .wd-day__count { color: #be123c; }
.wd-day--best.wd-day--freq-half .wd-day__weight { color: #e11d48; }

/* Manual override — самый сильный визуальный сигнал */
.wd-day--manual .wd-day__inner {
    background: linear-gradient(135deg, var(--success), #059669) !important;
    box-shadow:
        0 0 0 2px rgba(5, 150, 105, 0.18),
        0 2px 6px rgba(5, 150, 105, 0.28),
        inset 0 0 0 1px rgba(255, 255, 255, 0.18) !important;
    transform: scale(1.02);
}
.wd-day--manual .wd-day__count { color: #fff !important; font-weight: 700; }
.wd-day--manual .wd-day__weight { color: rgba(255, 255, 255, 0.82) !important; }
.wd-day--manual .wd-day__zero { color: rgba(255, 255, 255, 0.85) !important; opacity: 1; }
/* Чек-маркер в углу */
.wd-day--manual .wd-day__inner::after {
    content: '\f00c'; /* fa-check */
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", FontAwesome;
    font-weight: 900;
    position: absolute;
    top: 2px;
    right: 5px;
    font-size: 8px;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1;
}

/* Total cell */
.wd-cell--total {
    font-weight: 700;
    font-size: 13px;
    color: var(--wd-text);
    background: var(--wd-bg-soft);
    border-left: 1px solid var(--wd-border);
}
.wd-cell--total .wd-day__weight {
    display: block;
    font-size: 10px;
    color: var(--wd-text-muted);
    font-weight: 500;
    margin-top: 1px;
}

/* Frequency badge column */
.wd-cell--freq {
    padding: 6px 14px 6px 6px !important;
}
.wd-freq {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.2px;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
    white-space: nowrap;
}
.wd-freq--3w   { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.wd-freq--2w   { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.wd-freq--1w   { background: linear-gradient(135deg, #34d399, var(--success)); }
.wd-freq--half { background: linear-gradient(135deg, #fb7185, #e11d48); }

/* Empty/loading row */
.wd-empty {
    text-align: center;
    color: var(--wd-text-muted);
    padding: 40px 20px !important;
    font-size: 13px;
}

/* === Footer (sticky totals) === */
.wd-foot {
    position: sticky;
    bottom: 0;
    z-index: 4;
}
.wd-foot tr {
    background: linear-gradient(180deg, var(--wd-bg) 0%, var(--wd-bg-soft) 100%);
    box-shadow: 0 -1px 0 var(--wd-border), 0 -8px 18px rgba(15, 23, 42, 0.04);
}
.wd-foot td {
    background: transparent;
    padding: 14px 8px !important;
    text-align: center;
    vertical-align: middle;
    font-size: 12px;
    font-weight: 700;
    color: var(--wd-text);
    border-top: 2px solid var(--wd-accent);
}
.wd-foot__label {
    text-align: right !important;
    padding: 14px 14px 14px 18px !important;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--wd-accent);
}
.wd-foot__cell {
    line-height: 1.4;
}
.wd-foot__cell--weekend { opacity: 0.7; }
.wd-foot__cell--total {
    font-size: 14px;
    color: var(--wd-accent);
    font-weight: 800;
    background: rgba(5, 150, 105, 0.06) !important;
}
.wd-foot__weight {
    display: block;
    font-size: 10px;
    color: var(--wd-text-muted);
    font-weight: 500;
    margin-top: 2px;
}
.wd-foot__visits {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 6px;
    background: rgba(16, 185, 129, 0.12);
    color: var(--wd-accent);
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 600;
}
.wd-foot__cell--freq {
    font-size: 10px;
    color: var(--wd-text-muted);
    font-weight: 500;
}

/* Mobile */
@media (max-width: 768px) {
    .wd-stat__header { padding: 14px 16px; }
    .wd-stat__title { font-size: 14px; }
    .wd-cta span { display: none; }
    .wd-cta { padding: 0 12px; }
    .wd-stat__toolbar { padding: 10px 16px; gap: 10px; }
    .wd-period__dates { display: none; }
    .wd-stat__hint { padding: 8px 16px; font-size: 10px; }
}

/* ============================================
   Универсальный confirm-диалог (App.modal.confirm)
   ============================================ */
.modal-confirm-overlay {
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-confirm {
    --mc-accent: #059669;
    --mc-accent-soft: rgba(5, 150, 105, 0.12);
    --mc-accent-strong: #047857;

    max-width: 460px !important;
    width: 100%;
    padding: 32px 28px 24px;
    text-align: center;
    border-radius: var(--radius-lg) !important;
    border: none !important;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18), 0 8px 16px rgba(15, 23, 42, 0.08) !important;
    animation: mcPop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: visible !important;
}
@keyframes mcPop {
    from { opacity: 0; transform: scale(0.92) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Variant accents */
.modal-confirm--primary { --mc-accent: #059669; --mc-accent-soft: rgba(5, 150, 105, 0.12); --mc-accent-strong: var(--success-text); }
.modal-confirm--success { --mc-accent: var(--success); --mc-accent-soft: rgba(16, 185, 129, 0.12); --mc-accent-strong: var(--success-text); }
.modal-confirm--warning { --mc-accent: var(--warning); --mc-accent-soft: rgba(245, 158, 11, 0.13); --mc-accent-strong: var(--warning-text); }
.modal-confirm--danger  { --mc-accent: var(--danger); --mc-accent-soft: rgba(239, 68, 68, 0.12);  --mc-accent-strong: var(--danger-text); }

.modal-confirm__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mc-accent-soft);
    color: var(--mc-accent);
    font-size: 26px;
    position: relative;
}
.modal-confirm__icon::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: var(--mc-accent-soft);
    opacity: 0.4;
    z-index: -1;
}
.modal-confirm__title {
    margin: 0 0 10px;
    font-size: 19px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.2px;
}
.modal-confirm__message {
    margin: 0 auto 18px;
    font-size: 14px;
    line-height: 1.55;
    color: #475569;
    max-width: 380px;
}
.modal-confirm__message strong { color: #0f172a; font-weight: 700; }
.modal-confirm__message em { font-style: normal; color: var(--mc-accent-strong); font-weight: 600; }

.modal-confirm__summary {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin: 0 0 22px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.modal-confirm__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: #334155;
}
.modal-confirm__row strong {
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.modal-confirm__sum-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 2px;
}

/* Skipped section */
.modal-confirm__skip {
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px dashed #cbd5e1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.modal-confirm__skip-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.modal-confirm__skip-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    color: var(--text-secondary);
}
.modal-confirm__skip-row i {
    width: 16px;
    text-align: center;
    color: var(--text-faint);
    font-size: 11px;
}
.modal-confirm__skip-row span { flex: 1; }
.modal-confirm__skip-row strong {
    font-weight: 700;
    color: #475569;
    font-variant-numeric: tabular-nums;
}

.modal-confirm__actions {
    display: flex;
    gap: 10px;
    justify-content: stretch;
}
.modal-confirm__btn {
    flex: 1;
    height: 42px;
    padding: 0 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    line-height: 1;
}
.modal-confirm__btn--cancel {
    background: #fff;
    color: #475569;
    border-color: var(--border-color);
}
.modal-confirm__btn--cancel:hover {
    background: #f8fafc;
    color: #0f172a;
    border-color: #cbd5e1;
}
.modal-confirm__btn--confirm {
    background: linear-gradient(135deg, var(--mc-accent), var(--mc-accent-strong));
    color: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 6px 16px color-mix(in srgb, var(--mc-accent) 30%, transparent);
}
.modal-confirm__btn--confirm:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.1), 0 10px 22px color-mix(in srgb, var(--mc-accent) 40%, transparent);
}
.modal-confirm__btn--confirm:active { transform: translateY(0); filter: brightness(0.96); }
.modal-confirm__btn:focus-visible {
    outline: 2px solid var(--mc-accent);
    outline-offset: 2px;
}

@media (max-width: 480px) {
    .modal-confirm { padding: 24px 20px 20px; }
    .modal-confirm__icon { width: 56px; height: 56px; font-size: 22px; margin-bottom: 14px; }
    .modal-confirm__title { font-size: 17px; }
    .modal-confirm__message { font-size: 13px; }
    .modal-confirm__actions { flex-direction: column-reverse; }
}


/* 2026-07-07: API-ключи (не пароли) — визуальная маскировка без type="password",
   чтобы браузер не ругался «Password field is not contained in a form». */
.key-mask {
    -webkit-text-security: disc;
    text-security: disc;
}

/* ============================================================================
   2026-07-13: Стандартизация нижней панели #detailPanel (8 режимов).
   Единый вид — иконки-чипы по цветам, общий враппер тела, read-only блок,
   кнопка «К сводке» справа. Базовые .dashboard-title-icon/.stat-card уже на токенах.
   ============================================================================ */

/* Цветовые модификаторы иконки-чипа (вместо инлайн-градиентов в шаблоне) */
.dashboard-title-icon--green {
    background: linear-gradient(135deg, var(--success) 0%, #34d399 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.dashboard-title-icon--amber {
    background: linear-gradient(135deg, var(--warning) 0%, #fbbf24 100%);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}
.dashboard-title-icon--warn {
    background: linear-gradient(135deg, var(--danger) 0%, #f87171 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.28);
}
.dashboard-title-icon--blue {
    background: linear-gradient(135deg, var(--info) 0%, #60a5fa 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Единый враппер тела режима — консистентные отступы */
.dashboard-body {
    padding: var(--space-lg, 16px);
    padding-top: var(--space-md, 12px);
}
.dashboard-body--scroll {
    overflow-y: auto;
    min-height: 0;
    flex: 1;
}

/* Кнопка «К сводке» — всегда прижата вправо в шапке */
.dashboard-header-actions { margin-left: auto; }
.dashboard-header-actions .dashboard-back { order: 99; }

/* Read-only блок в «Редактировании ТТ» (вместо инлайн-стилей) */
.dashboard-readonly {
    padding: 12px;
    background: var(--bg-secondary, var(--border-light));
    border-radius: var(--radius-md, 8px);
    border-left: 3px solid var(--accent, var(--accent));
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    font-size: 12px;
}
.dashboard-readonly__item label {
    color: var(--text-muted, var(--text-secondary));
    font-weight: 500;
    display: block;
    margin-bottom: 4px;
}
.dashboard-readonly__item span { font-weight: 600; }

/* Мелкая гармонизация: mini-статы маршрутного листа не липнут к заголовку */
.dashboard-summary-mini { margin-left: 12px; }

/* 2026-07-15 (UI #8): комфортные тап-таргеты на мобиле. Поднимаем ВЫСОТУ тап-зоны
   (не ширину — чтобы не переполнять 390px) у мелких контролов тулбара/фильтров;
   кнопки «Все/Сброс» были 10px — делаем читаемыми. AA-минимум 24px перекрываем. */
@media (max-width: 480px) {
    .view-mode-tab { min-height: 44px; }
    .map-layers-fab__btn { min-height: 44px; }
    .filter-action-btn { padding: 8px 10px; font-size: 12px; min-height: 40px; }
    .day-chip { min-height: 36px; }
}

/* ============================================================
   2026-07-16: UX-полировка цикла «зона -> панель -> день -> закрытие»
   ============================================================ */
/* Панель ЭТП уезжает с анимацией (закрытие); на мобиле bottom-sheet уезжает вниз */
.etp-detail-panel.is-closing {
    animation: etpDetailSlideOutR 0.19s cubic-bezier(0.4, 0, 1, 1) forwards;
    pointer-events: none;
}
@keyframes etpDetailSlideOutR {
    to { transform: translateX(100%); opacity: 0.6; }
}
@media (max-width: 768px) {
    .etp-detail-panel.is-closing { animation-name: etpDetailSlideOutB; }
    @keyframes etpDetailSlideOutB {
        to { transform: translateY(100%); opacity: 0.6; }
    }
}
/* Нижняя панель мягко приглушается на время загрузки данных карты (нет белого флэша) */
.dashboard-panel { transition: opacity 0.25s ease, max-height var(--dashboard-transition-duration) var(--dashboard-transition-spring), box-shadow 0.3s ease, right 0.22s cubic-bezier(0.4, 0, 0.2, 1); }
body.map-data-loading .dashboard-panel { opacity: 0.45; }

/* ================================================================
   ЗДОРОВЬЕ ПЛАНА (страница health) — 2026-07-19
   ================================================================ */
.health-banner { display:flex; gap:14px; align-items:center; padding:14px 16px; background:var(--bg-card); border-radius:10px; box-shadow:0 1px 3px rgba(0,0,0,.06); }
.health-banner-icon { font-size:34px; line-height:1; }
.health-banner-big { font-size:28px; font-weight:700; line-height:1.1; }
.health-banner-label { font-size:13px; color:var(--text-secondary); margin-top:2px; }
.health-banner-sub { font-size:12px; color:var(--text-muted); margin-top:2px; }

/* Воронка */
.health-funnel-row { display:grid; grid-template-columns:minmax(180px,1.4fr) 2fr minmax(90px,auto) minmax(120px,1fr); gap:12px; align-items:center; padding:6px 0; }
.health-funnel-label { font-size:13px; font-weight:500; }
.health-funnel-bar { height:14px; background:var(--bg-secondary); border-radius:7px; overflow:hidden; }
.health-funnel-fill { height:100%; border-radius:7px; transition:width .4s ease; min-width:2px; }
.health-funnel-val { font-size:13px; font-weight:600; text-align:right; white-space:nowrap; }
.health-funnel-note { font-size:11px; color:var(--text-muted); }
.health-funnel-foot { display:flex; flex-wrap:wrap; gap:20px; margin-top:12px; padding-top:12px; border-top:1px solid var(--border); font-size:13px; color:var(--text-secondary); }
.health-hint { margin-top:10px; padding:10px 12px; background:var(--bg-secondary); border-radius:8px; font-size:12px; color:var(--text-secondary); }
.health-hint .fa-lightbulb { color:var(--warning); margin-right:6px; }

/* Очередь / общие */
.health-queue-head { font-size:14px; margin-bottom:10px; }
.health-sub-label { font-size:12px; font-weight:600; color:var(--text-secondary); text-transform:uppercase; letter-spacing:.03em; margin-bottom:6px; }
.health-split { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-top:14px; }

/* Дельта-метрики */
.health-metrics-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); gap:10px; }
.health-metric { background:var(--bg-secondary); border-radius:8px; padding:10px 12px; text-align:center; }
.health-metric-val { font-size:20px; font-weight:700; }
.health-metric-label { font-size:11px; color:var(--text-muted); margin-top:2px; }
.health-metric-delta { font-size:13px; margin-top:4px; }

/* Дни-бары */
.health-days { display:flex; gap:8px; align-items:flex-end; }
.health-day { flex:1; text-align:center; }
.health-day-bar-wrap { height:80px; display:flex; align-items:flex-end; }
.health-day-bar { width:100%; background:var(--accent); border-radius:5px 5px 0 0; min-height:3px; transition:height .4s ease; }
.health-day-val { font-size:12px; font-weight:600; margin-top:4px; }
.health-day-name { font-size:11px; color:var(--text-muted); }

/* Светофор проверок */
.health-check-row { display:grid; grid-template-columns:auto 1fr auto; gap:10px; align-items:center; padding:8px 10px; border-radius:8px; margin-bottom:6px; background:var(--bg-secondary); }
.health-check-label { font-size:13px; }
.health-check-count { font-size:13px; font-weight:600; white-space:nowrap; }
.health-check-warn { background:rgba(201,138,0,.10); }
.health-check-danger { background:rgba(192,57,43,.10); }

@media (max-width: 768px) {
  .health-funnel-row { grid-template-columns:1fr auto; grid-template-areas:"label val" "bar bar" "note note"; }
  .health-funnel-label { grid-area:label; } .health-funnel-val { grid-area:val; }
  .health-funnel-bar { grid-area:bar; } .health-funnel-note { grid-area:note; }
  .health-split { grid-template-columns:1fr; }
  #healthOverall > div { grid-template-columns:1fr !important; }
}
