        @import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700&display=swap');
        
        html { font-size: 80%; }
        
        body {
            font-family: 'Manrope', sans-serif;
            font-size: 11.2px;
        }
        
        .sidebar-text {
            font-size: 0.75rem;
            transition: opacity 0.3s ease;
        }
        
        .main-content-text {
            font-size: 0.85rem;
        }

        .sidebar-item:hover {
            background-color: rgba(255, 255, 255, 0.1);
        }
        
        .sidebar-item.active {
            background-color: rgba(59, 130, 246, 0.2);
            color: #60a5fa;
        }
        
        .sidebar-expanded {
            width: 260px;
        }
        
        .sidebar-collapsed {
            width: 80px;
        }
        
        .sidebar-collapsed .sidebar-text {
            opacity: 0;
            display: none;
        }
        
        .sidebar-collapsed .sidebar-header,
        .sidebar-collapsed .sidebar-footer {
            padding-left: 0.75rem;
            padding-right: 0.75rem;
        }
        
        .sidebar-collapsed .sidebar-header .flex,
        .sidebar-collapsed .sidebar-footer .flex {
            justify-content: center;
        }
        
        .sidebar-collapsed .sidebar-item {
            justify-content: center;
            padding-left: 0;
            padding-right: 0;
        }
        
        .sidebar-collapsed .sidebar-item .ml-3 {
            margin-left: 0;
        }
        
        .sidebar-collapsed nav {
            padding-top: 1rem;
            padding-bottom: 1rem;
        }
        
        .sidebar-expanded .sidebar-text {
            opacity: 1;
            display: inline;
        }
        
        .stat-card {
            transition: all 0.3s ease;
        }
        
        .stat-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        }
        
        .sidebar-toggle {
            position: absolute;
            right: -14px;
            top: 50%;
            transform: translateY(-50%);
            width: 28px;
            height: 28px;
            border: none;
            border-radius: 50%;
            background: #374151;
            color: #e5e7eb;
            cursor: pointer;
            z-index: 50;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
            transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
        }
        
        .sidebar-toggle:hover {
            background: #4b5563;
            color: white;
        }
        
        .sidebar-toggle:active {
            transform: translateY(-50%) scale(0.95);
        }
        
        .sidebar-toggle i {
            font-size: 1rem;
            transition: transform 0.3s ease;
        }
        
        .sidebar-toggle.collapsed i {
            transform: rotate(180deg);
        }

        .mobile-nav-backdrop {
            display: none;
            position: fixed;
            inset: 0;
            z-index: 190;
            background: rgba(15, 23, 42, 0.45);
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.25s ease, visibility 0.25s ease;
        }
        .mobile-nav-backdrop.active {
            opacity: 1;
            visibility: visible;
        }

        @media (max-width: 767px) {
            .mobile-nav-backdrop {
                display: block;
            }
            .app-shell {
                min-width: 0;
            }
            #sidebar {
                position: fixed !important;
                left: 0;
                top: 0;
                bottom: 0;
                height: 100vh;
                height: 100dvh;
                z-index: 200;
                width: min(280px, 88vw) !important;
                max-width: min(280px, 88vw) !important;
                flex: none !important;
                transform: translateX(-100%);
                box-shadow: 8px 0 32px rgba(0, 0, 0, 0.2);
            }
            #sidebar.mobile-nav-open {
                transform: translateX(0);
            }
            .sidebar-toggle {
                display: none !important;
            }
            body.mobile-drawer-open {
                overflow: hidden;
                touch-action: none;
            }
            body.mobile-drawer-open #appShell {
                overflow: hidden;
            }
        }

        @media (min-width: 768px) {
            .mobile-nav-backdrop {
                display: none !important;
            }
            #sidebar.mobile-nav-open {
                transform: none;
            }
        }

        #mainContent {
            caret-color: transparent;
        }

        #mainContent input,
        #mainContent textarea,
        #mainContent .chat-input-field,
        #mainContent .chat-search-input {
            caret-color: auto;
        }

        .kanban-board {
            display: flex;
            gap: 12px;
            overflow-x: auto;
            /* полоса как у sales-pipeline: скролл есть, виден не при перетаскивании и не отвлекает */
            scrollbar-width: none;
            -ms-overflow-style: none;
            padding-bottom: 20px;
            align-items: flex-start;
            scroll-snap-type: x proximity;
            cursor: grab;
        }

        .kanban-board::-webkit-scrollbar {
            display: none;
            height: 0;
        }

        .kanban-column {
            min-width: 280px;
            width: 280px;
            max-width: 280px;
            background: #ffffff;
            border: 1px solid #eef2f7;
            border-radius: 12px;
            padding: 12px;
            display: flex;
            flex-direction: column;
            flex: 0 0 280px;
            scroll-snap-align: start;
            transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
            box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
        }

        .kanban-column-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 12px;
            padding-bottom: 7px;
            border-bottom: 2px solid var(--kanban-stage-accent, #e5e7eb);
        }

        .kanban-column-title {
            display: flex;
            align-items: center;
            gap: 6px;
            font-weight: 600;
            color: #111827;
            font-size: 0.8rem;
        }

        .kanban-column-count {
            background: #f3f4f6;
            color: #9ca3af;
            padding: 1px 8px;
            border-radius: 10px;
            font-size: 0.68rem;
            font-weight: 600;
        }

        .kanban-column-header-right {
            display: flex;
            align-items: center;
            gap: 6px;
            flex-shrink: 0;
        }

        .kanban-stage-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            display: inline-block;
            flex-shrink: 0;
            vertical-align: middle;
        }

        .kanban-column-add {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 2px 6px;
            border: 0;
            background: transparent;
            color: #cbd5e1;
            border-radius: 6px;
            cursor: pointer;
            font-size: 1rem;
            line-height: 1;
        }

        .kanban-column-add:hover {
            color: #64748b;
            background: #f8fafc;
        }

        .kanban-priority {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 0.7rem;
            font-weight: 600;
            margin-bottom: 6px;
            line-height: 1.2;
        }

        .kanban-priority-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            flex-shrink: 0;
            background: currentColor;
        }

        .kanban-priority-urgent { color: #dc2626; }
        .kanban-priority-high { color: #ea580c; }
        .kanban-priority-medium { color: #ca8a04; }
        .kanban-priority-low { color: #16a34a; }

        .kanban-assignee-fallback {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            border: 2px solid white;
            object-fit: cover;
            margin-left: -6px;
            font-size: 0.65rem;
            font-weight: 600;
            color: #fff;
            box-sizing: border-box;
        }

        .kanban-assignee-fallback:first-child {
            margin-left: 0;
        }

        .kanban-cards {
            flex: 1;
            overflow-y: auto;
            overflow-x: hidden;
            min-height: 150px;
        }

        .kanban-card {
            background: white;
            border-radius: 8px;
            padding: 12px;
            margin-bottom: 10px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
            border: 1px solid #e5e7eb;
            cursor: grab;
            transition: all 0.2s ease;
        }

        .kanban-card:hover {
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            transform: translateY(-2px);
        }

        .kanban-card.dragging {
            opacity: 0.75;
            cursor: grabbing;
            transform: rotate(1deg) scale(1.02);
            box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
        }

        .kanban-card.kanban-card-overdue {
            border-left: 4px solid #dc2626;
            background: linear-gradient(to right, #fef2f2 0%, #fff 12%);
        }
        .kanban-card.kanban-card-overdue .kanban-card-meta span:first-of-type { color: #dc2626; font-weight: 500; }

        .kanban-column.drag-over .kanban-cards {
            background: #f8fafc;
            border-radius: 8px;
            min-height: 60px;
        }
        .kanban-drop-marker {
            height: 8px;
            border-radius: 9999px;
            margin: 4px 0 8px;
            background: linear-gradient(90deg, rgba(59, 130, 246, 0.28), rgba(37, 99, 235, 0.55), rgba(59, 130, 246, 0.28));
            box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
            animation: kanbanDropMarkerPulse 0.9s ease-in-out infinite;
        }
        .kanban-card.drop-before {
            margin-top: 4px;
            transition: margin-top 0.12s ease;
        }
        @keyframes kanbanDropMarkerPulse {
            0%, 100% { opacity: 0.55; transform: scaleX(0.985); }
            50% { opacity: 1; transform: scaleX(1); }
        }
        .kanban-column.drag-over {
            transform: translateY(-1px);
            box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25), 0 8px 18px rgba(59, 130, 246, 0.08);
        }
        body.task-card-dragging .kanban-column:not(.drag-over) {
            opacity: 0.97;
        }

        /* Клон для setDragImage: без этого превью у курсора часто бледное (ОС + полупрозрачные классы внутри карточки) */
        .crm-dnd-drag-ghost,
        .crm-dnd-drag-ghost * {
            opacity: 1 !important;
        }
        .crm-dnd-drag-ghost {
            filter: none !important;
            -webkit-filter: none !important;
        }

        /* Зона удаления задач — еле заметная, внизу экрана */
        .task-delete-zone {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            z-index: 500;
            height: 0;
            max-height: 0;
            padding: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #b91c1c;
            font-size: 0.8rem;
            font-weight: 500;
            overflow: hidden;
            opacity: 0;
            pointer-events: none;
            transition: max-height 0.35s ease, opacity 0.3s ease;
        }
        body.task-card-dragging .task-delete-zone {
            height: 56px;
            max-height: 80px;
            padding: 0 1rem;
            opacity: 0.92;
            pointer-events: auto;
            background: linear-gradient(135deg, rgba(255,255,255,0.97) 0%, rgba(254,242,242,0.6) 50%, rgba(254,202,202,0.35) 100%);
        }
        /* Зона архива — справа, появляется при перетаскивании карточки */
        .task-archive-zone {
            position: fixed;
            top: 0;
            bottom: 0;
            right: 0;
            z-index: 500;
            width: 0;
            max-width: 0;
            padding: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 0.35rem;
            color: #92400e;
            font-size: 0.75rem;
            font-weight: 600;
            letter-spacing: 0.02em;
            overflow: hidden;
            opacity: 0;
            pointer-events: none;
            transition: max-width 0.35s ease, opacity 0.3s ease, width 0.35s ease;
            box-shadow: -4px 0 24px rgba(0,0,0,0.06);
        }
        body.task-card-dragging .task-archive-zone {
            width: 56px;
            max-width: 72px;
            padding: 0.75rem 0.35rem;
            opacity: 0.95;
            pointer-events: auto;
            background: linear-gradient(200deg, rgba(255,251,235,0.98) 0%, rgba(254,243,199,0.75) 45%, rgba(253,230,138,0.45) 100%);
        }
        .task-archive-zone .task-archive-zone-text {
            position: relative;
            z-index: 2;
            opacity: 0.9;
            text-align: center;
            line-height: 1.2;
            writing-mode: vertical-rl;
            text-orientation: mixed;
            transform: rotate(180deg);
            max-height: 70vh;
        }
        .task-archive-zone.drag-over {
            background: linear-gradient(200deg, rgba(254,243,199,0.95) 0%, rgba(252,211,77,0.55) 50%, rgba(245,158,11,0.35) 100%);
            color: #78350f;
        }
        /* Архив продаж — та же полоса справа при перетаскивании сделки */
        .deal-archive-zone {
            position: fixed;
            top: 0;
            bottom: 0;
            right: 0;
            z-index: 500;
            width: 0;
            max-width: 0;
            padding: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 0.35rem;
            color: #92400e;
            font-size: 0.75rem;
            font-weight: 600;
            letter-spacing: 0.02em;
            overflow: hidden;
            opacity: 0;
            pointer-events: none;
            transition: max-width 0.35s ease, opacity 0.3s ease, width 0.35s ease;
            box-shadow: -4px 0 24px rgba(0,0,0,0.06);
        }
        body.deal-card-dragging .deal-archive-zone {
            width: 56px;
            max-width: 72px;
            padding: 0.75rem 0.35rem;
            opacity: 0.95;
            pointer-events: auto;
            background: linear-gradient(200deg, rgba(255,251,235,0.98) 0%, rgba(254,243,199,0.75) 45%, rgba(253,230,138,0.45) 100%);
        }
        .deal-archive-zone .deal-archive-zone-text {
            position: relative;
            z-index: 2;
            opacity: 0.9;
            text-align: center;
            line-height: 1.2;
            writing-mode: vertical-rl;
            text-orientation: mixed;
            transform: rotate(180deg);
            max-height: 70vh;
        }
        .deal-archive-zone.drag-over {
            background: linear-gradient(200deg, rgba(254,243,199,0.95) 0%, rgba(252,211,77,0.55) 50%, rgba(245,158,11,0.35) 100%);
            color: #78350f;
        }
        .task-delete-zone .task-delete-zone-text { position: relative; z-index: 2; opacity: 0.85; }
        .task-delete-zone.drag-over {
            background: linear-gradient(135deg, rgba(254,242,242,0.85) 0%, rgba(254,202,202,0.5) 50%, rgba(252,165,165,0.4) 100%);
        }
        .task-delete-zone.drag-over .red-wave { opacity: 0.5; }
        .red-wave {
            position: absolute;
            inset: 0;
            z-index: 1;
            opacity: 0.25;
            pointer-events: none;
            background: linear-gradient(
                90deg,
                transparent 0%,
                rgba(248, 113, 113, 0.08) 15%,
                rgba(239, 68, 68, 0.12) 35%,
                rgba(220, 38, 38, 0.1) 50%,
                rgba(239, 68, 68, 0.12) 65%,
                rgba(248, 113, 113, 0.08) 85%,
                transparent 100%
            );
            background-size: 200% 100%;
            animation: red-wave-flow 2.5s ease-in-out infinite;
        }
        .red-wave::after {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(
                90deg,
                transparent 0%,
                rgba(255, 255, 255, 0.08) 20%,
                rgba(220, 38, 38, 0.06) 50%,
                rgba(255, 255, 255, 0.08) 80%,
                transparent 100%
            );
            background-size: 200% 100%;
            animation: red-wave-flow 3s ease-in-out infinite reverse;
        }
        @keyframes red-wave-flow {
            0%, 100% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
        }

        .kanban-card-title {
            font-weight: 600;
            color: #1f2937;
            margin-bottom: 6px;
            font-size: 0.85rem;
        }
        .kanban-card-title-btn {
            font-weight: 600;
            color: #1f2937;
            margin-bottom: 6px;
            font-size: 0.85rem;
            background: none;
            border: none;
            cursor: pointer;
            padding: 0;
        }

        .kanban-card-description {
            color: #6b7280;
            font-size: 0.75rem;
            margin-bottom: 10px;
            line-height: 1.4;
        }

        .kanban-card-tags {
            display: flex;
            gap: 4px;
            flex-wrap: wrap;
            margin-bottom: 10px;
        }

        .kanban-tag {
            padding: 2px 8px;
            border-radius: 10px;
            font-size: 0.65rem;
            font-weight: 600;
        }

        .tag-urgent { background: #fef2f2; color: #dc2626; }
        .tag-high { background: #fff7ed; color: #ea580c; }
        .tag-medium { background: #fefce8; color: #ca8a04; }
        .tag-low { background: #f0fdf4; color: #16a34a; }
        .tag-design { background: #eff6ff; color: #2563eb; }
        .tag-development { background: #f5f3ff; color: #7c3aed; }
        .tag-marketing { background: #fdf2f8; color: #db2777; }
        .tag-call { background: #ecfdf5; color: #059669; }

        .kanban-card-footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding-top: 10px;
            border-top: 1px solid #f3f4f6;
        }

        .kanban-card-assignees { display: flex; }

        .kanban-assignee {
            width: 24px;
            height: 24px;
            border-radius: 50%;
            border: 2px solid white;
            object-fit: cover;
            margin-left: -6px;
        }
        .kanban-assignee:first-child { margin-left: 0; }

        .kanban-card-meta {
            display: flex;
            align-items: center;
            gap: 8px;
            color: #9ca3af;
            font-size: 0.7rem;
        }

        .add-card-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            padding: 8px;
            border: 1px dashed #e5e7eb;
            border-radius: 8px;
            color: #6b7280;
            cursor: pointer;
            transition: all 0.2s ease;
            margin-top: 8px;
            font-size: 0.75rem;
        }

        .add-card-btn:hover {
            border-color: #3b82f6;
            color: #3b82f6;
            background: #eff6ff;
        }

        /* Карточка сделки: основное действие на всю ширину тела вкладки (оплата, доставка, задачи) */
        .deal-card-tab-primary-action {
            width: 100%;
        }
        .deal-card-tab-primary-action .add-card-btn {
            width: 100%;
        }
        .modal-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1000;
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s ease;
        }

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

        /* Модалки добавления/форм — поверх карточек (сделка, клиент, задача) */
        #addModal,
        #addSubtaskModal,
        #addPaymentModal,
        #addDeliveryModal,
        #commentModal,
        #organizationModal,
        #invoiceChoiceModal {
            z-index: 1050;
        }

        .modal-content {
            background: white;
            border-radius: 16px;
            width: 100%;
            max-width: 450px;
            padding: 24px;
            transform: scale(0.95);
            transition: transform 0.3s ease;
        }

        .modal-overlay.active .modal-content { transform: scale(1); }

        /* Модалка создания/редактирования задачи — те же размеры, что у карточки задачи */
        #addModal.modal--task .modal-content {
            width: min(960px, calc(100vw - 32px));
            max-width: min(960px, calc(100vw - 32px));
            height: 90vh;
            max-height: min(90vh, 100dvh);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            box-sizing: border-box;
        }
        @media (max-width: 767px) {
            #addModal.modal--task.modal-overlay {
                padding: 0;
                align-items: stretch;
                justify-content: stretch;
            }
            #addModal.modal--task .modal-content {
                width: 100% !important;
                max-width: 100% !important;
                height: 100dvh;
                max-height: 100dvh;
                border-radius: 0;
                padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
            }
        }
        #addModal.modal--task #addModalBody { flex: 1; min-height: 0; overflow-y: auto; }
        #addModal.modal--task .task-form-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 1rem;
            height: 100%;
            align-content: start;
        }
        @media (min-width: 768px) {
            #addModal.modal--task .task-form-grid {
                grid-template-columns: 1fr 280px;
            }
            #addModal.modal--task .task-form-grid > *:first-child { grid-column: 1; }
            #addModal.modal--task .task-form-grid > *:last-child { grid-column: 2; }
        }

        /* Панель оповещений (dropdown у колокольчика) */
        #notificationPanelOverlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            z-index: 350;
            display: none;
        }
        #notificationPanelOverlay.active { display: block; }
        #notificationPanel {
            position: fixed;
            top: max(56px, calc(48px + env(safe-area-inset-top)));
            right: max(12px, env(safe-area-inset-right));
            left: auto;
            width: min(360px, calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)));
            max-width: calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right));
            max-height: min(70vh, calc(100dvh - 72px - env(safe-area-inset-top)));
            background: white;
            border-radius: 12px;
            box-shadow: 0 10px 40px rgba(0,0,0,0.15);
            z-index: 400;
            display: none;
            flex-direction: column;
            border: 1px solid #e5e7eb;
            box-sizing: border-box;
        }
        @media (max-width: 767px) {
            #notificationPanel {
                top: max(52px, calc(44px + env(safe-area-inset-top)));
                right: max(8px, env(safe-area-inset-right));
                left: max(8px, env(safe-area-inset-left));
                width: auto;
                max-width: none;
            }
        }
        #notificationPanel.active { display: flex; }
        #notificationPanel .notification-panel-title {
            padding: 8px 12px;
            font-size: 11px;
            font-weight: 600;
            color: #111827;
            border-bottom: 1px solid #e5e7eb;
        }
        #notificationPanel .notification-panel-list {
            overflow-y: auto;
            flex: 1;
            min-height: 0;
        }
        #notificationPanel .notification-panel-list::-webkit-scrollbar {
            width: 6px;
        }
        #notificationPanel .notification-panel-list::-webkit-scrollbar-track {
            background: #f3f4f6;
            border-radius: 3px;
        }
        #notificationPanel .notification-panel-list::-webkit-scrollbar-thumb {
            background: #9ca3af;
            border-radius: 3px;
        }
        #notificationPanel .notification-panel-list::-webkit-scrollbar-thumb:hover {
            background: #6b7280;
        }
        #notificationPanel .notification-panel-footer {
            padding: 8px 12px;
            border-top: 1px solid #e5e7eb;
            font-size: 11px;
        }
        #notificationPanel .notification-item {
            display: flex;
            align-items: flex-start;
            gap: 8px;
            padding: 8px 12px;
            border-bottom: 1px solid #f3f4f6;
            cursor: pointer;
            transition: background 0.15s;
        }
        #notificationPanel .notification-item:hover {
            background: #f9fafb;
        }
        #notificationPanel .notification-item-icon {
            width: 32px;
            height: 32px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            font-size: 14px;
        }
        #notificationPanel .notification-item-icon.chat { background: #dbeafe; color: #2563eb; }
        #notificationPanel .notification-item-icon.task { background: #fef3c7; color: #d97706; }
        #notificationPanel .notification-item-icon.deal { background: #d1fae5; color: #059669; }
        #notificationPanel .notification-item-body {
            flex: 1;
            min-width: 0;
        }
        #notificationPanel .notification-item-title {
            font-size: 11px;
            font-weight: 600;
            color: #111827;
            margin-bottom: 1px;
        }
        #notificationPanel .notification-item-text {
            font-size: 10px;
            color: #6b7280;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        #notificationPanel .notification-item-time {
            font-size: 10px;
            color: #9ca3af;
            margin-top: 1px;
        }
        .notification-item-read { opacity: 0.75; }
        .notification-item-read .notification-item-title { color: #6b7280; font-weight: 500; }
        /* Те же стили карточек на странице «Оповещения» — компактный список, элементы не пропадают */
        .notifications-feed .notification-item {
            display: flex;
            align-items: flex-start;
            gap: 8px;
            padding: 6px 10px;
            border-bottom: 1px solid #f3f4f6;
            cursor: pointer;
            transition: background 0.15s;
            background: white;
            border-radius: 6px;
            margin-bottom: 4px;
            border: 1px solid #e5e7eb;
            min-height: 44px;
        }
        .notifications-feed .notification-item:hover { background: #f9fafb; }
        .notifications-feed .notification-item-icon {
            width: 28px;
            height: 28px;
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            font-size: 12px;
        }
        .notifications-feed .notification-item-icon.chat { background: #dbeafe; color: #2563eb; }
        .notifications-feed .notification-item-icon.task { background: #fef3c7; color: #d97706; }
        .notifications-feed .notification-item-icon.deal { background: #d1fae5; color: #059669; }
        .notifications-feed .notification-item-body { flex: 1; min-width: 0; }
        .notifications-feed .notification-item-title { font-size: 11px; font-weight: 600; color: #111827; margin-bottom: 1px; }
        .notifications-feed .notification-item-text { font-size: 10px; color: #6b7280; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .notifications-feed .notification-item-time { font-size: 10px; color: #9ca3af; margin-top: 1px; }
        .notifications-page-list {
            overflow-y: auto;
            max-height: none;
            min-height: 200px;
        }
        #mainContent .notifications-page-list {
            padding-right: 4px;
        }
        .notifications-page-list::-webkit-scrollbar { width: 6px; }
        .notifications-page-list::-webkit-scrollbar-track { background: #f3f4f6; border-radius: 3px; }
        .notifications-page-list::-webkit-scrollbar-thumb { background: #9ca3af; border-radius: 3px; }
        .notifications-page-list::-webkit-scrollbar-thumb:hover { background: #6b7280; }
        #notificationBellBadge {
            position: absolute;
            top: 0;
            right: 0;
            min-width: 16px;
            height: 16px;
            padding: 0 4px;
            font-size: 10px;
            font-weight: 700;
            color: #fff;
            background: #dc2626;
            border-radius: 8px;
            display: none;
            align-items: center;
            justify-content: center;
        }
        #notificationBellBadge[data-count]:not([data-count="0"]) { display: flex; }

        .modal-content.modal-content-wide {
            max-width: 720px;
            max-height: 90vh;
            overflow-y: auto;
        }

        .modal-content.modal-content-wide.modal-content-task {
            width: min(960px, calc(100vw - 32px));
            max-width: min(960px, calc(100vw - 32px));
            height: 90vh;
            max-height: min(90vh, 100dvh);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            box-sizing: border-box;
        }

        /* Карточка продажи: больше вкладок в один ряд (Позиции, Взаимодействие, … История) */
        .modal-content.modal-content-wide.modal-content-task.modal-content-deal,
        #dealCardModal .modal-content.modal-content-wide.modal-content-task {
            width: min(1120px, calc(100vw - 32px));
            max-width: min(1120px, calc(100vw - 32px));
        }

        /* Карточка клиента: расширяем, чтобы вкладки влезали в одну строку */
        #clientCardModal .modal-content.modal-content-wide.modal-content-task {
            width: min(1060px, calc(100vw - 32px));
            max-width: min(1060px, calc(100vw - 32px));
        }

.interaction-toast-host {
    position: fixed;
    top: 0;
    right: 1rem;
    bottom: 0;
    z-index: 2200;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 0.75rem;
    width: min(480px, calc(100vw - 2rem));
    box-sizing: border-box;
    padding: 1rem 0;
    pointer-events: none;
    perspective: 1200px;
}
.interaction-toast {
    pointer-events: all;
    width: 100%;
    min-height: 5.5rem;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 0.75rem 1rem 0.85rem;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.85rem;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    cursor: default;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transform-origin: right center;
    transform: rotateY(-90deg) scale(0.72) translateX(60px);
    opacity: 0;
    animation: interactionToast3DIn 0.58s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 4px 12px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.interaction-toast.interaction-toast-sticky {
    border-color: rgba(251, 191, 36, 0.45);
    box-shadow: 0 16px 48px rgba(180, 83, 9, 0.35), 0 4px 14px rgba(0, 0, 0, 0.14);
}
.interaction-toast.interaction-toast-sticky.tone-custom {
    border-color: rgba(254, 202, 202, 0.55);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.75), 0 4px 16px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.interaction-toast.interaction-toast-sticky.tone-warning {
    background: linear-gradient(150deg, #1c0a00 0%, #422006 35%, #78350f 60%, #292524 100%);
    border-color: rgba(253, 230, 138, 0.55);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.7), 0 4px 16px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.interaction-toast.interaction-toast-sticky.tone-warning .interaction-toast-title,
.interaction-toast.interaction-toast-sticky.tone-warning .interaction-toast-text {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 1px rgba(0, 0, 0, 0.9);
}
.interaction-toast-actions--sticky {
    justify-content: stretch;
}
.interaction-toast-actions--sticky .toast-open-btn {
    justify-content: center;
}
/* После входа JS добавляет .interaction-toast-entered — иначе при смене animation на float теряется fill и тост откатывается к opacity:0 из базового правила */
.interaction-toast.interaction-toast-entered {
    opacity: 1;
    transform: rotateY(0deg) scale(1) translateX(0);
}
.interaction-toast.removing {
    animation: interactionToast3DOut 0.44s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
}
.interaction-toast.swiping {
    cursor: grabbing;
    user-select: none;
}
.interaction-toast-particle {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 4;
    opacity: 0;
    transform: translate(-50%, -50%);
    animation: interactionToastParticleFly 0.65s ease-out forwards;
}
.interaction-toast.interaction-toast-float {
    animation: interactionToastFloat 8s ease-in-out infinite;
}
@keyframes interactionToastParticleFly {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--particle-tx, 0px)), calc(-50% + var(--particle-ty, 0px))) scale(0.15);
    }
}
@keyframes interactionToastFloat {
    0%, 100% {
        box-shadow: 0 14px 42px rgba(0, 0, 0, 0.22), 0 4px 14px rgba(0, 0, 0, 0.14);
    }
    50% {
        box-shadow: 0 18px 52px rgba(0, 0, 0, 0.28), 0 6px 20px rgba(0, 0, 0, 0.18);
    }
}
.interaction-toast::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(ellipse at 28% 0%, rgba(255, 255, 255, 0.07) 0%, transparent 52%);
    pointer-events: none;
}
/* Насыщённые тёмные градиенты (референс: assets/reference/toast-reference.html) */
.interaction-toast.tone-info {
    background: linear-gradient(128deg, #0f172a 0%, #1e1b4b 28%, #312e81 55%, #1e1b4b 100%);
    border-color: rgba(165, 180, 252, 0.45);
}
.interaction-toast.tone-info::before {
    background: radial-gradient(ellipse at 15% 0%, rgba(129, 140, 248, 0.25) 0%, transparent 50%);
}
.interaction-toast.tone-warning {
    background: linear-gradient(128deg, #1c0a00 0%, #422006 30%, #92400e 55%, #451a03 100%);
    border-color: rgba(251, 191, 36, 0.45);
}
.interaction-toast.tone-warning::before {
    background: radial-gradient(ellipse at 15% 0%, rgba(251, 191, 36, 0.18) 0%, transparent 50%);
}
.interaction-toast.tone-success {
    background: linear-gradient(128deg, #022c22 0%, #064e3b 32%, #047857 58%, #0f3029 100%);
    border-color: rgba(52, 211, 153, 0.45);
}
.interaction-toast.tone-success::before {
    background: radial-gradient(ellipse at 15% 0%, rgba(52, 211, 153, 0.2) 0%, transparent 50%);
}
.interaction-toast.tone-info .interaction-toast-title,
.interaction-toast.tone-info .interaction-toast-text,
.interaction-toast.tone-warning .interaction-toast-title,
.interaction-toast.tone-warning .interaction-toast-text,
.interaction-toast.tone-success .interaction-toast-title,
.interaction-toast.tone-success .interaction-toast-text {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75), 0 2px 8px rgba(0, 0, 0, 0.45);
}
.interaction-toast.tone-info .interaction-toast-text,
.interaction-toast.tone-warning .interaction-toast-text,
.interaction-toast.tone-success .interaction-toast-text {
    font-weight: 500;
    opacity: 1;
}
/* tone-custom: не-sticky (напр. новый клиент) — фиолетовый; sticky (просрочено) — тёмно-красный */
.interaction-toast.tone-custom:not(.interaction-toast-sticky) {
    background: linear-gradient(128deg, #0f0720 0%, #2e1065 32%, #5b21b6 55%, #312e81 100%);
    border-color: rgba(196, 181, 253, 0.5);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.65), 0 4px 14px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.interaction-toast.tone-custom:not(.interaction-toast-sticky)::before {
    background: radial-gradient(ellipse at 20% 0%, rgba(167, 139, 250, 0.22) 0%, transparent 50%);
}
.interaction-toast.tone-custom.interaction-toast-sticky {
    background: linear-gradient(152deg, #0c0203 0%, #1f0709 18%, #450a0a 42%, #7f1d1d 58%, #3f0d12 78%, #0a0202 100%);
    border-color: rgba(252, 165, 165, 0.5);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.72), 0 4px 14px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.interaction-toast.tone-custom.interaction-toast-sticky::before {
    background: radial-gradient(ellipse at 25% 0%, rgba(255, 255, 255, 0.06) 0%, transparent 50%);
}
.interaction-toast.tone-custom .interaction-toast-title,
.interaction-toast.tone-custom .interaction-toast-text {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 2px 10px rgba(0, 0, 0, 0.65);
}
.interaction-toast.tone-custom .interaction-toast-text {
    font-weight: 600;
    opacity: 1;
    letter-spacing: 0.01em;
}
.interaction-toast-icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    margin: 0;
    align-self: center;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.35rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.interaction-toast.tone-info .interaction-toast-icon {
    background: rgba(15, 23, 42, 0.65);
    border-color: rgba(165, 180, 252, 0.4);
    color: #e0e7ff;
}
.interaction-toast.tone-success .interaction-toast-icon {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(110, 231, 183, 0.45);
    color: #ecfdf5;
}
.interaction-toast.tone-warning .interaction-toast-icon {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(253, 224, 71, 0.4);
    color: #fef9c3;
}
.interaction-toast.tone-custom .interaction-toast-icon {
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #ffffff;
}
.interaction-toast.tone-custom:not(.interaction-toast-sticky) .interaction-toast-icon {
    border-color: rgba(196, 181, 253, 0.45);
    color: #ede9fe;
}
.interaction-toast-content {
    flex: 1;
    min-width: 0;
    text-align: left;
}
.interaction-toast-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.4rem;
    position: relative;
    padding: 0 2.25rem 0 0;
    min-height: 1.5rem;
}
.interaction-toast-title > span {
    flex: 1;
    text-align: left;
    padding: 0;
}
.interaction-toast-close {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.interaction-toast-close:hover {
    background: rgba(255, 255, 255, 0.2);
}
.interaction-toast-text {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 0.15rem;
    line-height: 1.45;
    word-break: break-word;
}
.interaction-toast-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin-top: 0.45rem;
}
/* Глобально .btn-primary { width:100% } — в тосте обе кнопки в один ряд */
.interaction-toast .interaction-toast-actions .btn-primary,
.interaction-toast .interaction-toast-actions .btn-secondary {
    width: auto;
    flex: 0 0 auto;
}
.interaction-toast .interaction-toast-actions--sticky .toast-open-btn {
    width: 100%;
    flex: 1 1 auto;
}
.interaction-toast-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    transform-origin: left;
    animation: interactionToastProgress var(--toast-duration, 6s) linear forwards;
}
.interaction-toast.tone-info .interaction-toast-progress {
    background: linear-gradient(90deg, #6366f1, #818cf8);
}
.interaction-toast.tone-warning .interaction-toast-progress {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}
.interaction-toast.tone-success .interaction-toast-progress {
    background: linear-gradient(90deg, #10b981, #34d399);
}
.interaction-toast.tone-custom.interaction-toast-sticky .interaction-toast-progress {
    background: linear-gradient(90deg, #fecaca, #ffffff);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.35);
}
.interaction-toast.tone-custom:not(.interaction-toast-sticky) .interaction-toast-progress {
    background: linear-gradient(90deg, #a78bfa, #e9d5ff);
    box-shadow: 0 0 8px rgba(167, 139, 250, 0.45);
}
@keyframes interactionToast3DIn {
    0% { transform: rotateY(-90deg) scale(0.72) translateX(60px); opacity: 0; }
    30% { opacity: 1; }
    60% { transform: rotateY(7deg) scale(1.02) translateX(-3px); }
    80% { transform: rotateY(-2deg) scale(0.99) translateX(1px); }
    100% { transform: rotateY(0deg) scale(1) translateX(0); opacity: 1; }
}
@keyframes interactionToast3DOut {
    0% { transform: rotateY(0deg) scale(1) translateX(0); opacity: 1; }
    100% { transform: rotateY(82deg) scale(0.62) translateX(84px); opacity: 0; }
}
@keyframes interactionToastProgress {
    from { width: 100%; }
    to { width: 0%; }
}
@media (max-width: 480px) {
    .interaction-toast-host {
        right: 0.75rem;
        width: calc(100vw - 1.5rem);
        max-width: 100%;
    }
}

        .modal-content.modal-content-wide.modal-content-task .modal-header { flex-shrink: 0; }
        .modal-content.modal-content-wide.modal-content-task .task-card-layout { flex: 1; min-height: 0; }
        .task-card-layout { min-height: 300px; display: flex; gap: 1rem; }

        @media (max-width: 767px) {
            .modal-overlay {
                padding: 12px;
                align-items: center;
            }
            .modal-overlay:has(> .modal-content.modal-content-task),
            #addModal.modal--task.modal-overlay {
                padding: 0 !important;
                align-items: stretch !important;
                justify-content: stretch !important;
            }
            .modal-content.modal-content-wide.modal-content-task {
                width: 100% !important;
                max-width: 100% !important;
                height: 100dvh;
                max-height: 100dvh;
                border-radius: 0;
                padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
            }
            .task-card-layout {
                flex-direction: column;
                min-height: 0;
                gap: 0.75rem;
            }
            .task-card-tabs-area {
                flex: 1;
                min-height: 0;
                order: 1;
            }
            .task-card-info {
                width: 100% !important;
                max-height: min(36vh, 260px);
                flex-shrink: 0;
                order: 2;
                overflow-y: auto;
            }
            .task-chat-wrap {
                min-height: 220px;
                max-height: min(50dvh, 400px);
            }
            .modal-overlay .modal-content:not(.modal-content-wide) {
                max-width: 100%;
                width: 100%;
                padding: 18px;
                max-height: min(90dvh, 90vh);
                overflow-y: auto;
            }
            .modal-content.modal-content-wide:not(.modal-content-task) {
                max-height: min(92dvh, 92vh);
            }
        }
        /* Форма в модалке доставки: прокрутка слева (у .task-card-body-wrap по умолчанию overflow: hidden) */
        #addDeliveryModal .delivery-modal-form-scroll {
            overflow-y: auto !important;
            flex: 1;
            min-height: 0;
        }
        .deal-delivery-status-select {
            min-width: 10.5rem;
            max-width: 12rem;
            text-align: right;
            text-align-last: right;
            padding-right: 2rem;
        }
        .task-card-tabs-area { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
        .task-card-info { width: 280px; flex-shrink: 0; max-height: 68vh; overflow-y: auto; }
        .task-card-right { min-height: 0; flex: 1; display: flex; flex-direction: column; }
        .task-card-body-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
        .task-chat-wrap { max-height: 72vh; min-height: 300px; display: flex; flex-direction: column; overflow: hidden; }
        .task-card-tab {
            padding: 8px 14px;
            border-radius: 6px;
            font-size: 0.8rem;
            font-weight: 500;
            color: #6b7280;
            background: transparent;
            border: none;
            cursor: pointer;
            transition: background 0.15s, color 0.15s;
        }
        .task-card-tab:hover { background: #f3f4f6; color: #374151; }
        .task-card-tab.active { background: #eff6ff; color: #2563eb; }

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

        .modal-title { font-size: 1.1rem; font-weight: 600; color: #1f2937; }

        .modal-close {
            width: 28px; height: 28px;
            border-radius: 6px;
            border: none;
            background: #f3f4f6;
            color: #6b7280;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .form-group { margin-bottom: 16px; }

        .form-label {
            display: block;
            font-size: 0.8rem;
            font-weight: 500;
            color: #374151;
            margin-bottom: 6px;
        }

        .form-input, .form-select, .form-textarea {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid #e5e7eb;
            border-radius: 6px;
            font-size: 0.85rem;
        }

        .form-input:focus, .form-select:focus, .form-textarea:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
        }

        .btn-primary {
            background: #3b82f6;
            color: white;
            padding: 8px 16px;
            border-radius: 6px;
            font-weight: 500;
            border: none;
            cursor: pointer;
            width: 100%;
            font-size: 0.85rem;
        }

        .btn-primary:hover { background: #2563eb; }

        .btn-secondary {
            background: #f3f4f6;
            color: #374151;
            padding: 8px 16px;
            border-radius: 6px;
            font-weight: 500;
            border: 1px solid #e5e7eb;
            cursor: pointer;
            font-size: 0.85rem;
        }

        .btn-secondary:hover { background: #e5e7eb; }

        .data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
        .data-table th {
            background: #f9fafb;
            padding: 10px 14px;
            text-align: left;
            font-weight: 600;
            color: #6b7280;
            border-bottom: 2px solid #e5e7eb;
        }
        .data-table td {
            padding: 12px 14px;
            border-bottom: 1px solid #e5e7eb;
            color: #374151;
        }
        .data-table tr:hover { background: #f9fafb; }

        /* Кнопки действий в таблицах — не на всю ширину ячейки (глобально .btn-primary { width:100% }) */
        .data-table td .btn-primary,
        .data-table td .btn-secondary {
            width: auto;
            display: inline-block;
            vertical-align: middle;
        }

        /* Каталог модулей: компактные кнопки-иконки */
        .module-catalog-actions {
            display: inline-flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: flex-end;
            gap: 6px;
            max-width: 100%;
        }
        .module-catalog-icon-btn {
            width: 34px;
            height: 34px;
            padding: 0;
            margin: 0;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 8px;
            cursor: pointer;
            flex-shrink: 0;
            box-sizing: border-box;
            line-height: 1;
        }
        .module-catalog-icon-btn .ph {
            font-size: 1.15rem;
            pointer-events: none;
        }
        .module-catalog-icon-btn--primary {
            background: #3b82f6;
            color: #fff;
            border: none;
        }
        .module-catalog-icon-btn--primary:hover {
            background: #2563eb;
        }
        .module-catalog-icon-btn--secondary {
            background: #f3f4f6;
            color: #374151;
            border: 1px solid #e5e7eb;
        }
        .module-catalog-icon-btn--secondary:hover {
            background: #e5e7eb;
        }

        .status-badge {
            padding: 3px 10px;
            border-radius: 12px;
            font-size: 0.7rem;
            font-weight: 600;
        }
        .status-active { background: #f0fdf4; color: #16a34a; }
        .status-inactive { background: #fef2f2; color: #dc2626; }
        .status-pending { background: #fffbeb; color: #d97706; }
        .status-new { background: #eff6ff; color: #2563eb; }

        .action-btn {
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 0.75rem;
            cursor: pointer;
        }
        .action-btn-edit { background: #eff6ff; color: #2563eb; }
        .action-btn-delete { background: #fef2f2; color: #dc2626; }

        /* Chat Styles */
        .chat-container {
            display: grid;
            grid-template-columns: 260px 1fr;
            height: calc(100vh - 180px);
            background: white;
            border-radius: 12px;
            border: 1px solid #e5e7eb;
            overflow: hidden;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        }

        .chat-container.chat-unified-inbox {
            grid-template-columns: 260px 1fr 320px;
        }

        .chat-sidebar {
            width: auto;
            min-width: 0;
            border-right: 1px solid #e5e7eb;
            display: flex;
            flex-direction: column;
            flex-shrink: 0;
            background: #fff;
        }

        .chat-search {
            padding: 12px 16px;
            border-bottom: 1px solid #f3f4f6;
        }

        .chat-search-input {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid #e5e7eb;
            border-radius: 8px;
            font-size: 0.8rem;
            background: #f9fafb;
        }

        .chat-search-input:focus {
            outline: none;
            border-color: #3b82f6;
            background: #fff;
        }

        .chat-channels {
            padding: 10px 12px;
            border-bottom: 1px solid #f3f4f6;
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            background: #fff;
            justify-content: flex-start;
        }

        .channel-tab {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            width: 40px;
            height: 40px;
            border-radius: 10px;
            cursor: pointer;
            transition: all 0.2s ease;
            position: relative;
            background: #f9fafb;
            border: 1px solid transparent;
        }

        .channel-tab:hover { background: #f3f4f6; }

        .channel-tab.active {
            background: #eff6ff;
            border-color: #dbeafe;
        }
        
        .channel-tab.active .channel-icon-wrapper {
            background: #3b82f6;
            color: white;
            transform: scale(1.1);
        }

        .channel-icon-wrapper {
            width: 24px;
            height: 24px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.9rem;
            transition: all 0.2s;
            margin-bottom: 2px;
        }
        
        .channel-all { background: #f3f4f6; color: #4b5563; }
        .channel-internal { background: #e0e7ff; color: #4f46e5; }
        .channel-website { background: #dbeafe; color: #2563eb; }
        .channel-avito { background: #ffedd5; color: #ea580c; }
        .channel-vk { background: #e0f2fe; color: #2563eb; }

        .channel-badge {
            position: absolute;
            top: 2px;
            right: 2px;
            background: #ef4444;
            color: white;
            font-size: 0.6rem;
            font-weight: 700;
            padding: 1px 4px;
            border-radius: 8px;
            border: 2px solid white;
            min-width: 14px;
            text-align: center;
            line-height: 1;
        }

        .chat-list {
            flex: 1;
            overflow-y: auto;
        }

        .chat-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 16px;
            cursor: pointer;
            transition: all 0.2s ease;
            border-bottom: 1px solid #f9fafb;
        }

        .chat-item:hover { background: #f9fafb; }
        .chat-item.active { background: #eff6ff; border-left: 3px solid #3b82f6; }
        .chat-item.unread { background: #f0f9ff; }

        .chat-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            object-fit: cover;
            position: relative;
            flex-shrink: 0;
        }

        .chat-avatar.online::after {
            content: '';
            position: absolute;
            bottom: 1px;
            right: 1px;
            width: 10px;
            height: 10px;
            background: #10b981;
            border-radius: 50%;
            border: 2px solid white;
        }

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

        .chat-item-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 2px;
        }

        .chat-item-name {
            font-weight: 600;
            color: #1f2937;
            font-size: 0.85rem;
        }

        .chat-item-time {
            font-size: 0.7rem;
            color: #9ca3af;
        }

        .chat-item-preview {
            font-size: 0.75rem;
            color: #6b7280;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .chat-item.unread .chat-item-preview {
            color: #1f2937;
            font-weight: 600;
        }

        .chat-main {
            min-width: 0;
            display: flex;
            flex-direction: column;
        }

        .chat-context {
            border-left: 1px solid #e5e7eb;
            background: #fafafa;
            display: flex;
            flex-direction: column;
            min-width: 0;
            overflow: hidden;
        }

        .chat-context-inner {
            flex: 1;
            overflow-y: auto;
            padding: 12px 14px;
            font-size: 0.85rem;
        }

        .chat-context-section {
            margin-bottom: 14px;
            padding-bottom: 12px;
            border-bottom: 1px solid #e5e7eb;
        }

        .chat-context-section:last-child {
            border-bottom: none;
        }

        .chat-context-section-title {
            font-size: 0.7rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: #6b7280;
            margin-bottom: 6px;
        }

        .chat-context-meta,
        .chat-context-line {
            margin: 2px 0;
            color: #374151;
        }

        .chat-context-list {
            margin: 0;
            padding-left: 16px;
            color: #4b5563;
        }

        .chat-context-empty,
        .chat-context-empty-block {
            text-align: center;
            color: #6b7280;
            padding: 12px 4px;
        }

        .chat-context-btn-primary {
            display: inline-block;
            width: 100%;
            padding: 10px 12px;
            border-radius: 8px;
            background: #2563eb;
            color: #fff;
            font-weight: 600;
            font-size: 0.85rem;
            border: none;
            cursor: pointer;
        }

        .chat-context-btn-primary:hover {
            background: #1d4ed8;
        }

        .chat-context-btn-secondary {
            padding: 8px 10px;
            border-radius: 8px;
            border: 1px solid #d1d5db;
            background: #fff;
            cursor: pointer;
            font-size: 0.8rem;
        }

        .chat-context-btn-link {
            background: none;
            border: none;
            color: #2563eb;
            cursor: pointer;
            font-size: 0.8rem;
            padding: 0;
        }

        .chat-inbox-filters {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            padding: 8px 12px;
            border-bottom: 1px solid #f3f4f6;
            background: #fff;
        }

        .chat-inbox-chip {
            padding: 4px 10px;
            border-radius: 999px;
            font-size: 0.72rem;
            font-weight: 600;
            border: 1px solid #e5e7eb;
            background: #f9fafb;
            color: #4b5563;
            cursor: pointer;
        }

        .chat-inbox-chip.active {
            background: #eff6ff;
            border-color: #bfdbfe;
            color: #1d4ed8;
        }

        .chat-item-header {
            display: flex;
            align-items: center;
            gap: 6px;
            min-width: 0;
        }

        .chat-item-header .chat-item-name {
            flex: 1;
            min-width: 0;
        }

        .chat-row-channel {
            flex-shrink: 0;
            width: 22px;
            height: 22px;
            border-radius: 6px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 0.75rem;
        }

        .chat-row-channel-tg { background: #dbeafe; color: #2563eb; }
        .chat-row-channel-vk { background: #e0f2fe; color: #2563eb; }
        .chat-row-channel-avito { background: #ffedd5; color: #ea580c; }
        .chat-row-channel-website { background: #dcfce7; color: #15803d; }
        .chat-row-channel-internal { background: #e0e7ff; color: #4f46e5; }
        .chat-row-channel-max { background: #f3e8ff; color: #7c3aed; }
        .chat-row-channel-other { background: #f3f4f6; color: #6b7280; }

        @media (max-width: 767px) {
            .chat-container {
                grid-template-columns: 1fr;
                height: auto;
                min-height: min(420px, calc(100dvh - 148px));
                max-height: calc(100dvh - 120px);
            }
            .chat-container.chat-unified-inbox .chat-context {
                display: none !important;
            }
            .chat-sidebar {
                width: 100% !important;
                flex: 1;
                min-height: 0;
                max-height: none;
                border-right: none;
            }
            .chat-main {
                display: none;
                flex: 1;
                min-height: 0;
            }
            .chat-container.chat-mobile-thread-open .chat-sidebar {
                display: none;
            }
            .chat-container.chat-mobile-thread-open .chat-main {
                display: flex;
                min-height: min(380px, calc(100dvh - 160px));
            }
            .kanban-column {
                min-width: 240px;
                width: 240px;
                max-width: 240px;
                flex: 0 0 240px;
            }
        }

        .chat-header {
            padding: 12px 20px;
            border-bottom: 1px solid #e5e7eb;
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-shrink: 0;
            background: #fff;
        }

        .chat-header-info {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .chat-header-name {
            font-weight: 600;
            color: #1f2937;
            font-size: 0.9rem;
        }

        .chat-header-status {
            font-size: 0.75rem;
            color: #10b981;
        }

        .chat-header-actions {
            display: flex;
            gap: 6px;
        }

        .chat-action-btn {
            width: 32px;
            height: 32px;
            border-radius: 6px;
            border: none;
            background: #f3f4f6;
            color: #6b7280;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
        }

        .chat-action-btn:hover { background: #e5e7eb; color: #374151; }

        .chat-messages {
            flex: 1;
            min-height: 0;
            overflow-y: auto;
            padding: 20px;
            background: #f9fafb;
            scrollbar-width: none;
            -ms-overflow-style: none;
        }
        .chat-messages::-webkit-scrollbar {
            display: none;
        }

        .message {
            display: flex;
            gap: 10px;
            margin-bottom: 14px;
            width: 100%;
        }

        .message.incoming {
            flex-direction: row;
        }
        .message.outgoing {
            flex-direction: row;
        }

        .message-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            object-fit: cover;
            flex-shrink: 0;
        }

        .message-content {
            max-width: 65%;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
        }

        .message.incoming .message-content {
            margin-right: auto;
        }
        .message.outgoing .message-content {
            margin-left: auto;
            align-items: flex-end;
        }

        .message-bubble {
            padding: 10px 14px;
            border-radius: 12px;
            font-size: 0.85rem;
            line-height: 1.4;
        }

        .message.incoming .message-bubble {
            background: white;
            color: #1f2937;
            border: 1px solid #e5e7eb;
            border-bottom-left-radius: 4px;
        }

        .message.outgoing .message-bubble {
            background: #3b82f6;
            color: white;
            border-bottom-right-radius: 4px;
        }

        .message-time {
            font-size: 0.65rem;
            color: #9ca3af;
            margin-top: 4px;
            padding: 0 4px;
        }

        .chat-input {
            padding: 14px 20px;
            border-top: 1px solid #e5e7eb;
            background: white;
            flex-shrink: 0;
        }

        .chat-input-wrapper {
            display: flex;
            align-items: center;
            gap: 10px;
            background: #f3f4f6;
            border: 1px solid #e5e7eb;
            border-radius: 20px;
            padding: 6px 14px;
        }

        .chat-input-field {
            flex: 1;
            border: none;
            background: transparent;
            font-size: 0.85rem;
            padding: 4px 0;
        }

        .chat-input-field:focus { outline: none; }

        .chat-input-btn {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            border: none;
            background: transparent;
            color: #6b7280;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.1rem;
        }

        .chat-input-btn:hover { background: #e5e7eb; color: #374151; }

        .chat-send-btn {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            border: 1px solid rgba(255,255,255,0.25);
            background: #3b82f6;
            color: white;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.1rem;
        }

        .chat-send-btn:hover { background: #2563eb; }

        .no-chat-selected {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100%;
            color: #9ca3af;
        }

        .no-chat-selected i { font-size: 48px; margin-bottom: 12px; color: #d1d5db; }
        .no-chat-selected p { font-size: 0.9rem; }

        .funnel-wrap {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            gap: 5px;
            height: 220px;
            padding: 10px;
            box-sizing: border-box;
            border-radius: 16px;
            background: linear-gradient(165deg, #f1f5f9 0%, #e2e8f0 45%, #cbd5e1 100%);
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), inset 0 -1px 0 rgba(15, 23, 42, 0.06);
        }
        .funnel-segment {
            --funnel-c: #6366f1;
            flex: 1;
            min-height: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-size: 0.7rem;
            font-weight: 600;
            text-align: center;
            padding: 0 14px;
            box-sizing: border-box;
            border: none;
            cursor: pointer;
            -webkit-tap-highlight-color: transparent;
            /* Блик сверху + затемнение снизу поверх цвета стадии (без color-mix — работает везде) */
            background:
                linear-gradient(
                    168deg,
                    rgba(255, 255, 255, 0.38) 0%,
                    rgba(255, 255, 255, 0.1) 32%,
                    transparent 52%,
                    rgba(15, 23, 42, 0.2) 100%
                ),
                linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, transparent 45%),
                var(--funnel-c);
            box-shadow:
                inset 0 1px 0 rgba(255, 255, 255, 0.42),
                inset 0 -2px 8px rgba(15, 23, 42, 0.22),
                0 5px 18px -5px rgba(15, 23, 42, 0.35);
            transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
        }
        .funnel-segment-label {
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 0 12px rgba(0, 0, 0, 0.12);
            line-height: 1.25;
        }
        .funnel-segment:hover {
            filter: brightness(1.06) saturate(1.05);
            box-shadow:
                inset 0 1px 0 rgba(255, 255, 255, 0.5),
                inset 0 -2px 8px rgba(15, 23, 42, 0.18),
                0 10px 26px -4px rgba(15, 23, 42, 0.45);
        }
        .funnel-segment:active {
            transform: scale(0.992);
            filter: brightness(0.98);
        }
        .funnel-segment:focus-visible {
            position: relative;
            outline: 2px solid #3b82f6;
            outline-offset: 2px;
            z-index: 1;
        }
        /* Ровная воронка: один наклон сторон, зазоры между сегментами за счёт gap у .funnel-wrap */
        .funnel-segment:nth-child(1) { clip-path: polygon(0% 0%, 100% 0%, 93% 100%, 7% 100%); }
        .funnel-segment:nth-child(2) { clip-path: polygon(7% 0%, 93% 0%, 86% 100%, 14% 100%); }
        .funnel-segment:nth-child(3) { clip-path: polygon(14% 0%, 86% 0%, 79% 100%, 21% 100%); }
        .funnel-segment:nth-child(4) { clip-path: polygon(21% 0%, 79% 0%, 72% 100%, 28% 100%); }
        .funnel-segment:nth-child(5) { clip-path: polygon(28% 0%, 72% 0%, 65% 100%, 35% 100%); }
        .funnel-segment:nth-child(6) { clip-path: polygon(35% 0%, 65% 0%, 58% 100%, 42% 100%); }
        .funnel-segment:nth-child(7) { clip-path: polygon(42% 0%, 58% 0%, 51% 100%, 49% 100%); }
        .funnel-segment:nth-child(8) { clip-path: polygon(49% 0%, 51% 0%, 50.25% 100%, 49.75% 100%); }

        html.dark .funnel-wrap {
            background: linear-gradient(165deg, #1e293b 0%, #0f172a 55%, #020617 100%);
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 -1px 0 rgba(0, 0, 0, 0.35);
        }

        .funnel-wrap.funnel-wrap--3d {
            background: radial-gradient(ellipse 88% 72% at 50% 44%, #fafbfc 0%, #f1f5f9 50%, #e8edf3 100%);
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), inset 0 -1px 0 rgba(148, 163, 184, 0.1);
        }
        html.dark .funnel-wrap.funnel-wrap--3d {
            background: radial-gradient(ellipse 88% 72% at 50% 44%, #1e293b 0%, #172554 42%, #0f172a 100%);
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 -1px 0 rgba(0, 0, 0, 0.35);
        }

        .funnel-wrap--3d {
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 252px;
            height: auto;
            padding: 12px 12px 18px;
        }
        .funnel-svg-3d-host {
            width: 100%;
            max-width: min(100%, 368px);
            margin: 0 auto;
        }
        .funnel-svg-3d {
            width: 100%;
            height: auto;
            max-height: 308px;
            display: block;
            transform: translateZ(0);
            transition: filter 0.2s ease;
            filter: drop-shadow(0 4px 12px rgba(15, 23, 42, 0.06));
        }
        html.dark .funnel-svg-3d {
            filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.28));
        }
        .funnel-wrap--3d:hover .funnel-svg-3d {
            filter: drop-shadow(0 6px 16px rgba(15, 23, 42, 0.09));
        }
        html.dark .funnel-wrap--3d:hover .funnel-svg-3d {
            filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.32));
        }
        .funnel-svg-tier .funnel-tier-base {
            transition: filter 0.18s ease, stroke 0.18s ease;
        }
        .funnel-svg-tier:hover .funnel-tier-base {
            filter: brightness(1.05);
        }
        .funnel-svg-tier:active .funnel-tier-base {
            filter: brightness(0.98);
        }
        .funnel-svg-tier:focus-visible {
            outline: none;
        }
        .funnel-svg-tier:focus-visible .funnel-tier-base {
            stroke: rgba(59, 130, 246, 0.95);
            stroke-width: 1.75px;
        }

        .scrollbar-hide {
            overflow-y: auto;
            scrollbar-width: none;
            -ms-overflow-style: none;
        }
        .scrollbar-hide::-webkit-scrollbar {
            display: none;
        }

        .sales-pipeline {
            display: flex;
            gap: 12px;
            overflow-x: auto;
            /* горизонтальный скролл остаётся (колонок много), но полоса не показывается */
            scrollbar-width: none;
            -ms-overflow-style: none;
            padding-bottom: 12px;
            align-items: flex-start;
            scroll-snap-type: x proximity;
            cursor: grab;
        }

        .sales-pipeline::-webkit-scrollbar {
            display: none;
            height: 0;
        }

        .sales-pipeline.crm-pan-scroll--dragging,
        .kanban-board.crm-pan-scroll--dragging {
            cursor: grabbing;
        }

        body.crm-pan-scroll-active {
            cursor: grabbing;
        }

        .pipeline-stage {
            min-width: 300px;
            width: 300px;
            max-width: 300px;
            background: #ffffff;
            border: 1px solid #eef2f7;
            border-radius: 12px;
            padding: 12px;
            display: flex;
            flex-direction: column;
            flex: 0 0 300px;
            scroll-snap-align: start;
            transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
            box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
        }

        .pipeline-stage-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            margin-bottom: 12px;
            padding-bottom: 7px;
            border-bottom: 2px solid var(--kanban-stage-accent, #e5e7eb);
        }

        .pipeline-stage-title {
            display: flex;
            align-items: center;
            gap: 6px;
            font-weight: 600;
            color: #111827;
            font-size: 0.8rem;
            min-width: 0;
        }

        .pipeline-stage-title span {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .pipeline-stage-header-right {
            display: flex;
            align-items: center;
            gap: 6px;
            flex-shrink: 0;
        }

        .pipeline-stage-count {
            background: #f3f4f6;
            color: #9ca3af;
            padding: 1px 8px;
            border-radius: 10px;
            font-size: 0.68rem;
            font-weight: 600;
        }

        .pipeline-stage-sum {
            color: #2563eb;
            font-weight: 700;
            font-size: 0.72rem;
            white-space: nowrap;
        }

        .pipeline-deals {
            flex: 1;
            overflow-y: auto;
            overflow-x: hidden;
            min-height: 150px;
        }
        
        .pipeline-deal {
            background: white;
            border-radius: 8px;
            padding: 11px 12px;
            margin-bottom: 10px;
            border: 1px solid #e5e7eb;
            cursor: grab;
            font-size: 0.85rem;
            position: relative;
            transition: all 0.2s ease;
        }

        .pipeline-deal:hover {
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            transform: translateY(-2px);
        }

        .pipeline-deal-kanban {
            display: flex;
            gap: 10px;
            align-items: stretch;
        }

        .pd-k-left {
            flex: 1;
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .pd-k-right {
            flex: 0 0 auto;
            max-width: 48%;
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            text-align: right;
            line-height: 1.2;
        }

        .pd-k-status-stack {
            margin-top: auto;
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: 3px;
        }

        .pd-k-status-stack:empty {
            display: none;
        }

        .pipeline-deal-title-btn {
            display: block;
            width: 100%;
            padding: 0;
            margin: 0;
            background: transparent;
            border: none;
            cursor: pointer;
            line-height: 1.25;
            text-align: left;
        }

        .pipeline-deal.dragging {
            opacity: 0.9;
            cursor: grabbing;
            transform: rotate(2deg) scale(1.03);
            box-shadow: 0 14px 32px rgba(15, 23, 42, 0.24);
        }

        .pipeline-stage.drag-over {
            transform: translateY(-1px);
            box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25), 0 8px 18px rgba(59, 130, 246, 0.08);
            background: #f8fafc;
        }

        .pipeline-stage.drag-over .pipeline-deals {
            background: #f8fafc;
            border-radius: 8px;
            min-height: 60px;
        }

        body.deal-card-dragging .pipeline-stage:not(.drag-over) {
            opacity: 0.97;
        }

        .pipeline-deal.drop-before {
            margin-top: 4px;
            transition: margin-top 0.12s ease;
        }

        .report-card {
            background: white;
            border-radius: 12px;
            padding: 20px;
            border: 1px solid #e5e7eb;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .report-card:hover {
            border-color: #3b82f6;
            box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
        }

        .report-icon {
            width: 42px;
            height: 42px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 12px;
            font-size: 1.5rem;
        }

        /* Settings Styles */
        .settings-container {
            display: flex;
            gap: 24px;
        }

        .settings-nav {
            width: 240px;
            flex-shrink: 0;
        }

        .settings-nav-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 12px 16px;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.2s ease;
            color: #6b7280;
            font-size: 0.85rem;
            font-weight: 500;
            margin-bottom: 4px;
        }

        .settings-nav-item:hover {
            background: #f3f4f6;
            color: #374151;
        }

        .settings-nav-item.active {
            background: #eff6ff;
            color: #2563eb;
        }

        .settings-nav-item i {
            font-size: 1.1rem;
        }

        .settings-content {
            flex: 1;
            background: white;
            border-radius: 12px;
            border: 1px solid #e5e7eb;
            padding: 24px;
        }

        .settings-section {
            margin-bottom: 32px;
        }

        .settings-section-title {
            font-size: 1rem;
            font-weight: 600;
            color: #1f2937;
            margin-bottom: 16px;
            padding-bottom: 12px;
            border-bottom: 1px solid #e5e7eb;
        }

        .settings-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 16px 0;
            border-bottom: 1px solid #f3f4f6;
        }

        .settings-row:last-child {
            border-bottom: none;
        }

        .settings-row-info {
            flex: 1;
        }

        .settings-row-label {
            font-weight: 500;
            color: #374151;
            margin-bottom: 4px;
        }

        .settings-row-desc {
            font-size: 0.8rem;
            color: #6b7280;
        }

        /* Settings v2 */
        .settings-container-v2 {
            align-items: flex-start;
            flex-direction: column;
            gap: 12px;
        }
        .settings-nav-v2 {
            width: 100%;
            background: #ffffff;
            border: 1px solid #e5e7eb;
            border-radius: 14px;
            padding: 14px;
            box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
        }
        .settings-nav-horizontal {
            display: flex;
            align-items: center;
            gap: 8px;
            overflow-x: auto;
            overflow-y: visible;
            scrollbar-width: none;
            -ms-overflow-style: none;
            padding-bottom: 2px;
        }
        .settings-nav-horizontal::-webkit-scrollbar {
            display: none;
        }
        .settings-nav-horizontal .settings-nav-group {
            position: relative;
            width: auto;
            background: transparent;
            border: none;
            border-radius: 0;
            padding: 0;
            margin: 0;
            flex: 0 0 auto;
        }
        .settings-nav-group-head {
            width: auto;
            margin-bottom: 0;
            padding: 8px 12px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            text-align: left;
            background: transparent;
            border: 1px solid #e2e8f0;
            cursor: pointer;
            border-radius: 10px;
        }
        .settings-nav-group-head:hover {
            background: #eef2f7;
            border-color: #cbd5e1;
        }
        .settings-nav-group-title {
            font-size: 0.74rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: #334155;
        }
        .settings-nav-group-caret {
            font-size: 1rem;
            color: #64748b;
            transition: transform 0.2s ease;
            margin-left: 8px;
            flex-shrink: 0;
        }
        .settings-nav-group-items {
            display: none;
            margin-top: 8px;
        }
        .settings-nav-group:focus-within .settings-nav-group-items,
        .settings-nav-group:hover .settings-nav-group-items,
        .settings-nav-group.expanded .settings-nav-group-items {
            display: block;
        }
        .settings-nav-top-tab.active {
            background: #eff6ff;
            border-color: #bfdbfe;
        }
        .settings-nav-submenu {
            position: absolute;
            top: calc(100% + 6px);
            left: 0;
            min-width: 260px;
            max-width: 320px;
            background: #ffffff;
            border: 1px solid #e2e8f0;
            border-radius: 12px;
            padding: 8px;
            box-shadow: 0 14px 28px rgba(15, 23, 42, 0.14);
            z-index: 20;
        }
        .settings-nav-group.expanded .settings-nav-group-caret {
            transform: rotate(180deg);
        }
        .settings-nav-v2 .settings-nav-item {
            align-items: center;
            margin-bottom: 2px;
            padding: 8px 10px;
            border-radius: 10px;
            border: 1px solid transparent;
            gap: 8px;
            width: 100%;
            text-align: left;
            background: transparent;
        }
        .settings-nav-item-icon {
            width: 28px;
            height: 28px;
            border-radius: 8px;
            background: #f8fafc;
            color: #475569;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            margin-top: 1px;
        }
        .settings-nav-item-text {
            min-width: 0;
            display: block;
        }
        .settings-nav-item-title {
            font-size: 0.82rem;
            color: #111827;
            font-weight: 600;
            line-height: 1.25;
        }
        .settings-nav-v2 .settings-nav-item:hover {
            background: #f8fafc;
            border-color: #e2e8f0;
        }
        .settings-nav-v2 .settings-nav-item.active {
            background: linear-gradient(145deg, #eff6ff 0%, #e0edff 100%);
            border-color: #bfdbfe;
            color: #1d4ed8;
        }
        .settings-nav-v2 .settings-nav-item.active .settings-nav-item-icon {
            background: #dbeafe;
            color: #1d4ed8;
        }
        .settings-nav-v2 .settings-nav-item.active .settings-nav-item-subtitle {
            color: #64748b;
        }
        .settings-content-v2 {
            padding: 0;
            overflow: hidden;
        }
        .settings-page-head {
            padding: 22px 24px 18px;
            border-bottom: 1px solid #eef2f7;
            background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
        }
        .settings-page-badge {
            display: inline-flex;
            align-items: center;
            font-size: 0.68rem;
            font-weight: 700;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            color: #2563eb;
            background: #eff6ff;
            border: 1px solid #bfdbfe;
            border-radius: 9999px;
            padding: 2px 8px;
            margin-bottom: 8px;
        }
        .settings-page-title {
            margin: 0;
            font-size: 1.05rem;
            line-height: 1.3;
            font-weight: 700;
            color: #0f172a;
        }
        .settings-page-subtitle {
            margin: 8px 0 0;
            font-size: 0.82rem;
            line-height: 1.45;
            color: #64748b;
            max-width: 860px;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }
        .settings-page-body {
            padding: 24px;
        }
        @media (max-width: 1100px) {
            .settings-container-v2 {
                gap: 10px;
            }
            .settings-nav-v2 {
                width: 100%;
            }
        }

        /* Settings compact top-tabs */
        .settings-nav-compact {
            padding: 10px 12px;
        }
        .settings-top-groups {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            border-bottom: 1px solid #e5e7eb;
            padding-bottom: 10px;
        }
        .settings-top-group-tab {
            border: 1px solid #d1d5db;
            background: #fff;
            color: #374151;
            border-radius: 10px;
            padding: 7px 12px;
            font-size: 0.76rem;
            font-weight: 700;
            letter-spacing: 0.02em;
            text-transform: uppercase;
            cursor: pointer;
            transition: all 0.15s ease;
        }
        .settings-top-group-tab:hover {
            border-color: #93c5fd;
            background: #eff6ff;
            color: #1d4ed8;
        }
        .settings-top-group-tab.active {
            border-color: #3b82f6;
            background: #dbeafe;
            color: #1d4ed8;
        }
        .settings-sub-tabs {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            padding-top: 10px;
        }
        .settings-sub-tabs--inner {
            margin-bottom: 14px;
            padding-top: 0;
        }
        .settings-sub-tab {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            border: 1px solid transparent;
            background: #f8fafc;
            color: #475569;
            border-radius: 9px;
            padding: 7px 10px;
            font-size: 0.78rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.15s ease;
        }
        .settings-sub-tab i {
            font-size: 0.9rem;
        }
        .settings-sub-tab:hover {
            background: #eef2ff;
            color: #3730a3;
            border-color: #c7d2fe;
        }
        .settings-sub-tab.active {
            background: #e0edff;
            color: #1e40af;
            border-color: #bfdbfe;
        }
        .settings-action-bar {
            margin-top: 12px;
            display: flex;
            justify-content: flex-end;
            gap: 8px;
            flex-wrap: wrap;
        }
        .settings-content-v2 {
            width: 100%;
        }

        /* Lead forms editor v2 */
        .lf-editor-v2-head {
            box-shadow: 0 8px 24px rgba(79, 70, 229, 0.08);
        }
        .lf-editor-side-nav {
            border: 1px solid #e5e7eb;
            background: #ffffff;
            border-radius: 12px;
            padding: 10px;
            box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
        }
        .lf-editor-v2-nav {
            width: 100%;
        }
        .lf-editor-chip {
            display: inline-flex;
            align-items: center;
            border: 1px solid #dbeafe;
            background: #ffffff;
            color: #334155;
            padding: 5px 10px;
            border-radius: 9999px;
            font-weight: 600;
            text-decoration: none;
            transition: all 0.15s ease;
            cursor: pointer;
        }
        .lf-editor-v2-nav .lf-editor-chip {
            width: 100%;
            justify-content: flex-start;
            text-align: left;
        }
        .lf-editor-chip:hover {
            background: #eff6ff;
            border-color: #93c5fd;
            color: #1e40af;
        }
        .lf-editor-chip.active {
            background: #eef2ff;
            border-color: #c7d2fe;
            color: #3730a3;
        }
        .lf-editor-tab-section {
            display: none;
        }
        .lf-editor-tab-section.active {
            display: block;
        }
        @media (max-width: 1279px) {
            .lf-editor-side-nav {
                padding: 8px;
            }
            .lf-editor-v2-nav .lf-editor-chip {
                width: auto;
            }
        }
        .lf-editor-card {
            border: 1px solid #e5e7eb;
            border-radius: 14px;
            background: #ffffff;
            padding: 16px;
            box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
        }
        .lf-editor-card-head {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 12px;
        }
        .lf-editor-card-head h3 {
            margin: 0;
            font-size: 0.92rem;
            font-weight: 700;
            color: #0f172a;
        }
        .lf-editor-card-step {
            width: 24px;
            height: 24px;
            border-radius: 9999px;
            background: #eef2ff;
            color: #4338ca;
            border: 1px solid #c7d2fe;
            font-size: 0.73rem;
            font-weight: 700;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }
        .lf-editor-actions {
            margin-top: 14px;
            padding-top: 12px;
            border-top: 1px solid #e5e7eb;
            display: flex;
            gap: 8px;
            justify-content: flex-end;
            flex-wrap: wrap;
        }
        .lf-editor-actions .btn-secondary {
            margin-right: auto;
        }
        @media (max-width: 900px) {
            .lf-editor-actions .btn-secondary {
                margin-right: 0;
            }
        }

        /* Toggle Switch */
        .toggle-switch {
            position: relative;
            width: 44px;
            height: 24px;
            flex-shrink: 0;
        }

        .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: #e5e7eb;
            transition: 0.3s;
            border-radius: 24px;
        }

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

        input:checked + .toggle-slider {
            background-color: #3b82f6;
        }

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

        /* User Card */
        .user-card {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 16px;
            border: 1px solid #e5e7eb;
            border-radius: 8px;
            margin-bottom: 12px;
        }

        .user-card-avatar {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            object-fit: cover;
        }

        .user-card-info {
            flex: 1;
        }

        .user-card-name {
            font-weight: 600;
            color: #1f2937;
        }

        .user-card-email {
            font-size: 0.8rem;
            color: #6b7280;
        }

        .user-card-role {
            font-size: 0.75rem;
            padding: 2px 8px;
            border-radius: 12px;
            background: #eff6ff;
            color: #2563eb;
        }

        /* Integration Card */
        .integration-card {
            display: flex;
            align-items: center;
            gap: 16px;
            padding: 20px;
            border: 1px solid #e5e7eb;
            border-radius: 12px;
            margin-bottom: 12px;
        }

        .integration-icon {
            width: 48px;
            height: 48px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
        }

        .integration-info {
            flex: 1;
        }

        .integration-name {
            font-weight: 600;
            color: #1f2937;
            margin-bottom: 4px;
        }

        .integration-status {
            font-size: 0.8rem;
            color: #6b7280;
        }

        .integration-status.connected {
            color: #16a34a;
        }

        .btn-sm {
            padding: 6px 12px;
            font-size: 0.8rem;
            border-radius: 6px;
        }

        .field-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px;
            border: 1px solid #e5e7eb;
            border-radius: 8px;
            margin-bottom: 8px;
        }

        .field-drag-handle {
            cursor: grab;
            color: #9ca3af;
        }

        .field-name {
            flex: 1;
            font-weight: 500;
        }

        .field-type {
            font-size: 0.75rem;
            padding: 2px 8px;
            border-radius: 12px;
            background: #f3f4f6;
            color: #6b7280;
        }

        /* Dark theme */
        html.dark body { background-color: #111827 !important; }
        html.dark main { background-color: #1f2937 !important; }
        html.dark header { background-color: #1f2937 !important; border-color: #374151 !important; }
        html.dark header .text-gray-900 { color: #f9fafb !important; }
        html.dark header .text-gray-700 { color: #e5e7eb !important; }
        html.dark header .text-gray-500 { color: #9ca3af !important; }
        html.dark header .hover\:text-gray-700:hover { color: #e5e7eb !important; }
        html.dark header .hover\:bg-gray-100:hover { background-color: #374151 !important; }
        html.dark header .border-gray-200 { border-color: #374151 !important; }
        html.dark #mainContent { background-color: #1f2937 !important; }
        html.dark footer { background-color: #1f2937 !important; border-color: #374151 !important; }
        html.dark footer .text-gray-500 { color: #9ca3af !important; }
        html.dark footer .text-gray-600 { color: #d1d5db !important; }
        html.dark footer a:hover { color: #93c5fd !important; }
        html.dark .stat-card,
        html.dark .bg-white { background-color: #374151 !important; border-color: #4b5563 !important; }
        html.dark .text-gray-900 { color: #f9fafb !important; }
        html.dark .text-gray-800 { color: #f3f4f6 !important; }
        html.dark .text-gray-700 { color: #e5e7eb !important; }
        html.dark .text-gray-600 { color: #d1d5db !important; }
        html.dark .text-gray-500 { color: #9ca3af !important; }
        html.dark .border-gray-200 { border-color: #4b5563 !important; }
        html.dark .border-gray-100 { border-color: #374151 !important; }
        html.dark .bg-gray-50 { background-color: #374151 !important; }
        html.dark .bg-gray-100 { background-color: #4b5563 !important; }
        html.dark .hover\:bg-gray-100:hover { background-color: #4b5563 !important; }
        html.dark .kanban-column { background-color: #374151 !important; border: 1px solid #4b5563; }
        html.dark .kanban-column-header { border-bottom-color: var(--kanban-stage-accent, #4b5563) !important; }
        html.dark .kanban-column-title { color: #f3f4f6 !important; }
        html.dark .kanban-column-title .text-red-500 { color: #f87171 !important; }
        html.dark .kanban-column-title .text-blue-500 { color: #93c5fd !important; }
        html.dark .kanban-column-title .text-amber-500 { color: #fcd34d !important; }
        html.dark .kanban-column-title .text-green-500 { color: #6ee7b7 !important; }
        html.dark .kanban-column-count { background-color: #4b5563 !important; color: #e5e7eb !important; }
        html.dark .kanban-column-add { color: #9ca3af !important; }
        html.dark .kanban-column-add:hover { color: #93c5fd !important; background: rgba(59, 130, 246, 0.15) !important; }
        html.dark .kanban-priority-urgent { color: #fca5a5 !important; }
        html.dark .kanban-priority-high { color: #fdba74 !important; }
        html.dark .kanban-priority-medium { color: #fde047 !important; }
        html.dark .kanban-priority-low { color: #86efac !important; }
        html.dark .kanban-assignee-fallback { border-color: #4b5563 !important; }
        html.dark .kanban-column.drag-over .kanban-cards { background-color: #4b5563 !important; }
        html.dark .kanban-drop-marker {
            background: linear-gradient(90deg, rgba(96, 165, 250, 0.26), rgba(59, 130, 246, 0.68), rgba(96, 165, 250, 0.26));
            box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.32);
        }
        html.dark .form-input,
        html.dark .form-select,
        html.dark .form-textarea { background-color: #374151 !important; border-color: #4b5563 !important; color: #f9fafb !important; }
        html.dark .form-input::placeholder,
        html.dark .form-select option { color: #9ca3af; }
        html.dark .modal-content { background-color: #1f2937 !important; border-color: #374151 !important; }
        html.dark .modal-overlay { background-color: rgba(0,0,0,0.7); }
        html.dark .modal-title,
        html.dark .modal-header { color: #f9fafb; border-color: #374151; }
        html.dark .modal-close { color: #9ca3af !important; }
        html.dark .modal-close:hover { color: #f9fafb !important; }
        html.dark .data-table th { background-color: #374151 !important; color: #e5e7eb !important; border-color: #4b5563 !important; }
        html.dark .data-table td { border-color: #4b5563 !important; color: #e5e7eb !important; }
        html.dark .data-table tr:hover td { background-color: #4b5563 !important; }
        html.dark .settings-container { color: #e5e7eb; }
        html.dark .settings-nav { background-color: #374151; border-radius: 12px; padding: 8px; }
        html.dark .settings-nav-item { color: #d1d5db; }
        html.dark .settings-nav-item:hover { background-color: #4b5563 !important; color: #f3f4f6 !important; }
        html.dark .settings-nav-item.active { background-color: #1e3a8a !important; color: #93c5fd !important; }
        html.dark .settings-nav-v2 { background-color: #1f2937 !important; border-color: #374151 !important; }
        html.dark .settings-top-groups { border-bottom-color: #334155; }
        html.dark .settings-top-group-tab { background: #1f2937; border-color: #475569; color: #cbd5e1; }
        html.dark .settings-top-group-tab:hover { background: #334155; border-color: #64748b; color: #e2e8f0; }
        html.dark .settings-top-group-tab.active { background: rgba(30, 58, 138, 0.34); border-color: #3b82f6; color: #bfdbfe; }
        html.dark .settings-sub-tab { background: #243243; color: #cbd5e1; border-color: transparent; }
        html.dark .settings-sub-tab:hover { background: #334155; border-color: #475569; color: #e2e8f0; }
        html.dark .settings-sub-tab.active { background: rgba(30, 58, 138, 0.34); border-color: #3b82f6; color: #bfdbfe; }
        html.dark .settings-sub-tabs--inner { border-color: #334155; }
        html.dark .settings-nav-group-head { border-color: #334155; background-color: #1f2937; }
        html.dark .settings-nav-top-tab.active { background: rgba(30, 58, 138, 0.34); border-color: #3b82f6; }
        html.dark .settings-nav-group-head:hover { background-color: #334155; border-color: #475569; }
        html.dark .settings-nav-submenu { background-color: #1f2937; border-color: #334155; box-shadow: 0 14px 28px rgba(2, 6, 23, 0.45); }
        html.dark .settings-nav-group-caret { color: #94a3b8; }
        html.dark .settings-nav-group-title { color: #cbd5e1; }
        html.dark .settings-nav-item-title { color: #f3f4f6; }
        html.dark .settings-nav-item-icon { background-color: #334155; color: #cbd5e1; }
        html.dark .settings-nav-v2 .settings-nav-item:hover { background-color: #334155 !important; border-color: #475569; }
        html.dark .settings-nav-v2 .settings-nav-item.active { background: rgba(30, 58, 138, 0.34) !important; border-color: #3b82f6; }
        html.dark .settings-nav-v2 .settings-nav-item.active .settings-nav-item-title { color: #bfdbfe; }
        html.dark .profile-tab-item { color: #d1d5db !important; }
        html.dark .profile-tab-item:hover { background-color: #4b5563 !important; color: #f3f4f6 !important; }
        html.dark .profile-tab-item.border-blue-600 { border-color: #3b82f6 !important; color: #93c5fd !important; background-color: rgba(30, 58, 138, 0.3) !important; }
        html.dark .settings-content { background-color: #374151 !important; border: 1px solid #4b5563; color: #e5e7eb; }
        html.dark .settings-content-v2 { background-color: #1f2937 !important; border-color: #374151 !important; }
        html.dark .settings-page-head { border-bottom-color: #374151; background: linear-gradient(180deg, #1f2937 0%, #243041 100%); }
        html.dark .settings-page-badge { background-color: rgba(30, 58, 138, 0.3); border-color: #3b82f6; color: #93c5fd; }
        html.dark .settings-page-title { color: #f8fafc; }
        html.dark .settings-page-subtitle { color: #cbd5e1; }
        html.dark .lf-editor-v2-head { background: linear-gradient(120deg, rgba(30, 41, 59, 0.95), rgba(30, 58, 138, 0.28)) !important; border-color: #334155; }
        html.dark .lf-editor-side-nav { background-color: #1f2937; border-color: #334155; }
        html.dark .lf-editor-chip { background: #1f2937; border-color: #475569; color: #cbd5e1; }
        html.dark .lf-editor-chip:hover { background: #334155; border-color: #64748b; color: #e2e8f0; }
        html.dark .lf-editor-chip.active { background: rgba(51, 65, 85, 0.9); border-color: #60a5fa; color: #bfdbfe; }
        html.dark .lf-editor-card { background-color: #1f2937; border-color: #334155; }
        html.dark .lf-editor-card-head h3 { color: #f1f5f9; }
        html.dark .lf-editor-card-step { background: rgba(59, 130, 246, 0.2); border-color: #3b82f6; color: #93c5fd; }
        html.dark .lf-editor-actions { border-top-color: #334155; }
        html.dark .settings-section { border-color: #4b5563; }
        html.dark .settings-section-title { color: #f9fafb !important; border-bottom-color: #4b5563 !important; }
        html.dark .settings-row { border-bottom-color: #4b5563 !important; }
        html.dark .settings-row-info .settings-row-label { color: #f3f4f6 !important; }
        html.dark .settings-row-info .settings-row-desc { color: #9ca3af !important; }
        html.dark .user-card { background-color: #374151 !important; border-color: #4b5563 !important; }
        html.dark .integration-card { background-color: #374151 !important; border-color: #4b5563 !important; }
        html.dark .field-item { border-color: #4b5563 !important; color: #e5e7eb; }
        html.dark .btn-secondary { background-color: #4b5563 !important; border-color: #6b7280 !important; color: #e5e7eb !important; }
        html.dark .btn-secondary:hover { background-color: #6b7280 !important; }
        html.dark .module-catalog-icon-btn--secondary {
            background-color: #374151 !important;
            border-color: #4b5563 !important;
            color: #e5e7eb !important;
        }
        html.dark .module-catalog-icon-btn--secondary:hover {
            background-color: #4b5563 !important;
        }
        html.dark .task-card-info,
        html.dark .task-card-body-wrap { background-color: #374151 !important; border-color: #4b5563 !important; color: #e5e7eb; }
        html.dark .pipeline-stage { background-color: #374151 !important; border: 1px solid #4b5563; color: #e5e7eb; }
        html.dark .pipeline-stage-title { color: #f3f4f6 !important; }
        html.dark .pipeline-stage-count { background-color: #4b5563 !important; color: #e5e7eb !important; }
        html.dark .pipeline-stage-sum { color: #93c5fd !important; }
        html.dark .pipeline-stage.drag-over { background-color: #4b5563 !important; border-color: #3b82f6; }
        html.dark .pipeline-stage.drag-over .pipeline-deals { background-color: #4b5563 !important; }
        html.dark .pipeline-deal { background-color: #4b5563 !important; border-color: #6b7280 !important; color: #e5e7eb; }
        html.dark .pipeline-deal:hover { box-shadow: 0 8px 18px rgba(0,0,0,0.35) !important; }
        html.dark .pipeline-deal { background-color: #4b5563 !important; border-color: #6b7280 !important; color: #e5e7eb; }
        html.dark .pipeline-deal .text-gray-400 { color: #9ca3af !important; }
        html.dark .pipeline-deal .text-gray-500 { color: #9ca3af !important; }
        html.dark .pipeline-deal .text-blue-600 { color: #93c5fd !important; }
        html.dark .pipeline-deal .hover\:text-blue-600:hover { color: #93c5fd !important; }
        html.dark .report-card { background-color: #374151 !important; border-color: #4b5563 !important; color: #e5e7eb; }
        html.dark .report-card:hover { border-color: #3b82f6 !important; }
        html.dark .report-card.ring-2 { border-color: #3b82f6 !important; }
        html.dark #reportContentArea .bg-white { background-color: #374151 !important; border-color: #4b5563 !important; color: #e5e7eb; }
        html.dark #reportContentArea .text-gray-800 { color: #f3f4f6 !important; }
        html.dark #reportContentArea .text-gray-700 { color: #d1d5db !important; }
        html.dark #reportContentArea .text-gray-600 { color: #9ca3af !important; }
        html.dark #reportContentArea table th { background-color: #4b5563 !important; color: #e5e7eb !important; border-color: #6b7280 !important; }
        html.dark #reportContentArea table td { border-color: #4b5563 !important; color: #e5e7eb !important; }
        html.dark .kanban-card { background-color: #4b5563 !important; border-color: #6b7280 !important; color: #e5e7eb; }
        html.dark .kanban-card.kanban-card-overdue { border-left-color: #f87171 !important; background: linear-gradient(to right, rgba(127, 29, 29, 0.4) 0%, #4b5563 14%) !important; }
        html.dark .kanban-card.kanban-card-overdue .kanban-card-meta span:first-of-type { color: #fca5a5 !important; }
        html.dark .kanban-card-description { color: #9ca3af !important; }
        html.dark .kanban-card-meta { color: #9ca3af !important; }
        html.dark .kanban-card-title-btn { color: #f3f4f6 !important; }
        html.dark .kanban-card-title-btn:hover { color: #93c5fd !important; }
        html.dark .kanban-tag.tag-urgent { background: #7f1d1d !important; color: #fecaca !important; }
        html.dark .kanban-tag.tag-high { background: #7c2d12 !important; color: #fed7aa !important; }
        html.dark .kanban-tag.tag-medium { background: #713f12 !important; color: #fde68a !important; }
        html.dark .kanban-tag.tag-low { background: #14532d !important; color: #bbf7d0 !important; }
        html.dark .kanban-tag.tag-design { background: #1e3a8a !important; color: #bfdbfe !important; }
        html.dark .kanban-tag.tag-development { background: #4c1d95 !important; color: #e9d5ff !important; }
        html.dark .kanban-tag.tag-marketing { background: #831843 !important; color: #fbcfe8 !important; }
        html.dark .kanban-tag.tag-call { background: #14532d !important; color: #bbf7d0 !important; }
        html.dark .chat-container { background-color: #1f2937 !important; border-color: #4b5563 !important; }
        html.dark .chat-main { background-color: #1f2937 !important; }
        html.dark .chat-sidebar { background-color: #374151 !important; border-color: #4b5563 !important; }
        html.dark .chat-search { border-color: #4b5563 !important; }
        html.dark .chat-search-input { background-color: #4b5563 !important; border-color: #6b7280 !important; color: #f9fafb !important; }
        html.dark .chat-search-input::placeholder { color: #9ca3af; }
        html.dark .chat-search-input:focus { background-color: #4b5563 !important; border-color: #3b82f6; }
        html.dark .chat-context { background-color: #111827 !important; border-color: #4b5563 !important; }
        html.dark .chat-context-section { border-color: #4b5563 !important; }
        html.dark .chat-context-section-title { color: #9ca3af !important; }
        html.dark .chat-context-meta,
        html.dark .chat-context-line { color: #d1d5db !important; }
        html.dark .chat-context-list { color: #9ca3af !important; }
        html.dark .chat-context-btn-secondary { background: #374151 !important; border-color: #6b7280 !important; color: #e5e7eb !important; }
        html.dark .chat-inbox-filters { background: #374151 !important; border-color: #4b5563 !important; }
        html.dark .chat-inbox-chip { background: #4b5563 !important; border-color: #6b7280 !important; color: #e5e7eb !important; }
        html.dark .chat-inbox-chip.active { background: #1e3a8a !important; border-color: #3b82f6 !important; color: #dbeafe !important; }
        html.dark .chat-channels { background-color: #374151 !important; border-color: #4b5563 !important; }
        html.dark .channel-tab { background-color: #4b5563 !important; border-color: #6b7280 !important; color: #e5e7eb; }
        html.dark .channel-tab:hover { background-color: #6b7280 !important; }
        html.dark .channel-tab.active { background-color: #1e3a8a !important; border-color: #3b82f6 !important; }
        html.dark .channel-tab.active .channel-icon-wrapper { background: #3b82f6 !important; color: white !important; }
        html.dark .channel-all { background: #4b5563 !important; color: #d1d5db !important; }
        html.dark .channel-internal { background: #4338ca !important; color: #c7d2fe !important; }
        html.dark .channel-website { background: #1e40af !important; color: #bfdbfe !important; }
        html.dark .channel-avito { background: #9a3412 !important; color: #fed7aa !important; }
        html.dark .channel-vk { background: #0f172a !important; color: #bfdbfe !important; }
        html.dark .chat-item { border-color: #4b5563 !important; color: #e5e7eb; }
        html.dark .chat-item:hover { background-color: #4b5563 !important; }
        html.dark .chat-item.active { background-color: #1e3a8a !important; border-left-color: #3b82f6 !important; }
        html.dark .chat-item.unread { background-color: #374151 !important; }
        html.dark .chat-item-name { color: #f3f4f6 !important; }
        html.dark .chat-item-preview { color: #9ca3af !important; }
        html.dark .chat-item-time { color: #6b7280 !important; }
        html.dark .channel-badge { border-color: #374151 !important; }
        html.dark .no-chat-selected { color: #9ca3af !important; background-color: #1f2937 !important; }
        html.dark .no-chat-selected i { color: #6b7280 !important; }
        html.dark .no-chat-selected p { color: #9ca3af !important; }
        html.dark .chat-messages { background-color: #1f2937 !important; }
        html.dark .chat-input { background-color: #1f2937 !important; border-top-color: #4b5563 !important; }
        html.dark .chat-input-wrapper { background-color: #374151 !important; border: 1px solid #6b7280 !important; }
        html.dark .chat-input-field { background-color: transparent !important; border: none !important; color: #f9fafb !important; }
        html.dark .chat-input-field::placeholder { color: #9ca3af; }
        html.dark .chat-input-btn { color: #9ca3af !important; }
        html.dark .chat-send-btn { border: 1px solid rgba(255,255,255,0.3) !important; }
        html.dark .chat-list-item:hover { background-color: #4b5563 !important; }
        html.dark .message-bubble-out { background-color: #2563eb !important; }
        html.dark .message-bubble-in { background-color: #4b5563 !important; color: #e5e7eb; }
        html.dark .toggle-slider { background-color: #6b7280 !important; }
        html.dark .add-card-btn { background-color: #374151 !important; border-color: #4b5563 !important; color: #d1d5db !important; }
        html.dark .add-card-btn:hover { background-color: #4b5563 !important; }
        html.dark #profileModalBody .text-gray-900 { color: #f9fafb !important; }
        html.dark #profileModalBody .text-gray-600 { color: #d1d5db !important; }
        html.dark #profileModalBody .text-gray-500 { color: #9ca3af !important; }
        html.dark #profileModalBody .bg-gray-50 { background-color: #374151 !important; }
        html.dark #profileModalBody .border-gray-100 { border-color: #4b5563 !important; }
        html.dark #profileModalBody .border-gray-200 { border-color: #4b5563 !important; }

        /* Dark theme — читаемый текст, акценты Tailwind, панель оповещений, поля/интеграции */
        html.dark body {
            background-color: #0f172a !important;
            color: #e2e8f0 !important;
        }
        html.dark main,
        html.dark #mainContent,
        html.dark header,
        html.dark footer {
            background-color: #1e293b !important;
        }
        html.dark header,
        html.dark footer {
            border-color: #475569 !important;
        }
        html.dark #mainContent {
            color: #e2e8f0;
        }
        html.dark .stat-card,
        html.dark .bg-white {
            background-color: #334155 !important;
            border-color: #475569 !important;
        }
        html.dark .modal-content {
            background-color: #1e293b !important;
            border-color: #475569 !important;
        }
        html.dark .modal-title {
            color: #f8fafc !important;
        }
        html.dark .modal-header {
            color: #f8fafc;
            border-color: #475569 !important;
        }
        html.dark .modal-close {
            background: #475569 !important;
            color: #cbd5e1 !important;
        }
        html.dark .modal-close:hover {
            background: #64748b !important;
            color: #f8fafc !important;
        }
        html.dark .task-card-tab {
            color: #94a3b8 !important;
        }
        html.dark .task-card-tab:hover {
            background: #334155 !important;
            color: #e2e8f0 !important;
        }
        html.dark .task-card-tab.active {
            background: rgba(37, 99, 235, 0.28) !important;
            color: #93c5fd !important;
        }
        html.dark .field-name {
            color: #e2e8f0 !important;
        }
        html.dark .field-type {
            background: #475569 !important;
            color: #cbd5e1 !important;
        }
        html.dark .field-drag-handle {
            color: #94a3b8 !important;
        }
        html.dark .integration-name {
            color: #f1f5f9 !important;
        }
        html.dark .integration-status {
            color: #94a3b8 !important;
        }
        html.dark .integration-status.connected {
            color: #86efac !important;
        }
        html.dark .user-card-name {
            color: #f8fafc !important;
        }
        html.dark .user-card-email {
            color: #94a3b8 !important;
        }
        html.dark .user-card-role {
            background: rgba(37, 99, 235, 0.22) !important;
            color: #93c5fd !important;
        }
        html.dark .kanban-column {
            background-color: #334155 !important;
            border-color: #475569 !important;
        }
        html.dark .settings-nav {
            background-color: #334155 !important;
        }
        html.dark .settings-content {
            background-color: #334155 !important;
            border-color: #475569 !important;
        }
        html.dark .data-table th {
            background-color: #334155 !important;
            border-color: #475569 !important;
        }
        html.dark .data-table td {
            border-color: #475569 !important;
        }
        html.dark .task-card-info,
        html.dark .task-card-body-wrap {
            background-color: #334155 !important;
            border-color: #475569 !important;
            color: #e2e8f0;
        }
        html.dark #notificationPanel .notification-panel-footer {
            border-color: #475569 !important;
            color: #94a3b8;
        }
        html.dark #notificationPanel .notification-item {
            border-bottom-color: #334155 !important;
        }
        html.dark #notificationPanel .notification-item:hover {
            background: #334155 !important;
        }
        html.dark #notificationPanel .notification-item-title {
            color: #f1f5f9 !important;
        }
        html.dark #notificationPanel .notification-item-text {
            color: #94a3b8 !important;
        }
        html.dark #notificationPanel .notification-item-time {
            color: #64748b !important;
        }
        html.dark #notificationPanel .notification-item-read .notification-item-title {
            color: #94a3b8 !important;
        }
        html.dark .notifications-feed .notification-item {
            background: #334155 !important;
            border-color: #475569 !important;
        }
        html.dark .notifications-feed .notification-item:hover {
            background: #475569 !important;
        }
        html.dark .notifications-feed .notification-item-title {
            color: #f1f5f9 !important;
        }
        html.dark .notifications-feed .notification-item-text {
            color: #94a3b8 !important;
        }
        html.dark .notifications-feed .notification-item-time {
            color: #64748b !important;
        }
        html.dark .notification-item-read .notification-item-title {
            color: #94a3b8 !important;
        }
        html.dark .text-blue-600 {
            color: #93c5fd !important;
        }
        html.dark .text-blue-700 {
            color: #bfdbfe !important;
        }
        html.dark .text-green-600 {
            color: #6ee7b7 !important;
        }
        html.dark .text-red-600 {
            color: #f87171 !important;
        }
        html.dark .text-amber-600,
        html.dark .text-orange-600 {
            color: #fcd34d !important;
        }
        html.dark .text-slate-600 {
            color: #94a3b8 !important;
        }
        html.dark .text-gray-400 {
            color: #94a3b8 !important;
        }
        html.dark .text-gray-300 {
            color: #cbd5e1 !important;
        }
        html.dark .hover\:text-blue-600:hover {
            color: #93c5fd !important;
        }
        html.dark .hover\:text-blue-700:hover {
            color: #bfdbfe !important;
        }
        html.dark .hover\:bg-blue-50:hover {
            background-color: rgba(59, 130, 246, 0.15) !important;
        }
        html.dark .hover\:bg-red-50:hover {
            background-color: rgba(248, 113, 113, 0.12) !important;
        }
        html.dark .hover\:bg-gray-50:hover {
            background-color: #475569 !important;
        }
        html.dark .border-blue-200 {
            border-color: rgba(147, 197, 253, 0.35) !important;
        }
        html.dark .bg-blue-100 {
            background-color: rgba(37, 99, 235, 0.22) !important;
        }
        html.dark .bg-gray-200 {
            background-color: #475569 !important;
        }
        html.dark .text-gray-800 {
            color: #e2e8f0 !important;
        }
        html.dark .chat-header {
            background: #1e293b !important;
            border-bottom-color: #475569 !important;
        }
        html.dark .chat-header-name {
            color: #f1f5f9 !important;
        }
        html.dark .chat-action-btn {
            background: #334155 !important;
            color: #cbd5e1 !important;
        }
        html.dark .chat-action-btn:hover {
            background: #475569 !important;
            color: #f8fafc !important;
        }
        html.dark .chat-input-btn:hover {
            background: #475569 !important;
            color: #f8fafc !important;
        }
        html.dark .message.incoming .message-bubble {
            background: #475569 !important;
            color: #e2e8f0 !important;
            border-color: #64748b !important;
        }
        html.dark .chat-sidebar,
        html.dark .chat-channels {
            background-color: #334155 !important;
            border-color: #475569 !important;
        }
        html.dark .chat-container {
            background-color: #1e293b !important;
            border-color: #475569 !important;
        }
        html.dark .chat-main {
            background-color: #1e293b !important;
        }
        html.dark .no-chat-selected {
            background-color: #1e293b !important;
        }
        html.dark .chat-messages {
            background-color: #1e293b !important;
        }
        html.dark .chat-input {
            background-color: #1e293b !important;
            border-top-color: #475569 !important;
        }
        html.dark .user-card,
        html.dark .integration-card {
            background-color: #334155 !important;
            border-color: #475569 !important;
        }
        html.dark .pipeline-stage,
        html.dark .pipeline-deal,
        html.dark .report-card {
            background-color: #334155 !important;
            border-color: #475569 !important;
        }
        html.dark .kanban-card {
            background-color: #475569 !important;
            border-color: #64748b !important;
            color: #e2e8f0;
        }
        html.dark .kanban-card.kanban-card-overdue {
            background: linear-gradient(to right, rgba(127, 29, 29, 0.4) 0%, #475569 14%) !important;
        }

        /* Визуальный редактор писем (Quill) в настройках платформы */
        .platform-mail-quill-wrap {
            border: 1px solid #e5e7eb;
            border-radius: 0.5rem;
            background: #fff;
            overflow: hidden;
        }
        .platform-mail-quill-wrap .ql-toolbar {
            border: none;
            border-bottom: 1px solid #e5e7eb;
            background: #f9fafb;
        }
        .platform-mail-quill-wrap .ql-container {
            border: none;
            font-size: 0.875rem;
        }
        .platform-mail-quill-wrap .ql-editor {
            min-height: 200px;
        }
        html.dark .platform-mail-quill-wrap {
            border-color: #475569;
            background: #1e293b;
        }
        html.dark .platform-mail-quill-wrap .ql-toolbar {
            background: #334155;
            border-bottom-color: #475569;
        }
        html.dark .platform-mail-quill-wrap .ql-stroke {
            stroke: #e2e8f0;
        }
        html.dark .platform-mail-quill-wrap .ql-fill {
            fill: #e2e8f0;
        }
        html.dark .platform-mail-quill-wrap .ql-picker-label {
            color: #e2e8f0;
        }
        /* Аналоговые часы — дизайн как в timex.html (CRM Clock Widget) */
        .crm-clock-widget {
            position: fixed;
            bottom: 24px;
            right: 24px;
            width: 200px;
            height: 200px;
            z-index: 9999;
            opacity: 0.85;
            transition: opacity 0.35s ease, transform 0.35s ease;
            pointer-events: none;
            cursor: default;
        }
        .crm-clock-widget:hover {
            opacity: 1;
            transform: scale(1.1);
            pointer-events: auto;
        }
        .crm-clock-widget.hidden {
            display: none;
        }
        .crm-clock-widget svg {
            width: 100%;
            height: 100%;
            filter: drop-shadow(0 5px 16px rgba(0,0,0,0.2))
                    drop-shadow(0 2px 4px rgba(0,0,0,0.1));
        }
        .crm-clock-widget:hover svg {
            filter: drop-shadow(0 8px 24px rgba(0,0,0,0.28))
                    drop-shadow(0 2px 6px rgba(0,0,0,0.15));
        }
        .crm-clock-widget .hand-hour {
            transform-origin: 100px 100px;
            transition: transform 0.4s cubic-bezier(.4,0,.2,1);
        }
        .crm-clock-widget .hand-minute {
            transform-origin: 100px 100px;
            transition: transform 0.4s cubic-bezier(.4,0,.2,1);
        }
        .crm-clock-widget .hand-second {
            transform-origin: 100px 100px;
        }
