        /* ═══════════════════════════════════════════════════════
           SALESCONNECT DESIGN SYSTEM — CSS VARIABLES
           All components should use these for consistency
        ═══════════════════════════════════════════════════════ */
        :root {
            /* Brand colors */
            --sc-purple:        #9333ea;
            --sc-purple-dark:   #7c3aed;
            --sc-purple-light:  #a855f7;
            --sc-purple-faint:  #f5f3ff;
            --sc-pink:          #ec4899;

            /* Backgrounds */
            --sc-bg-page:       #f8faff;
            --sc-card-bg:       #ffffff;
            --sc-card-bg-alt:   #f7fafc;
            --sc-input-bg:      #ffffff;
            --sc-modal-bg:      #ffffff;
            --sc-section-bg:    #f8fafc;

            /* Borders */
            --sc-border:        #e2e8f0;
            --sc-border-dark:   #cbd5e0;

            /* Text */
            --sc-text:          #1a202c;
            --sc-text-secondary:#4a5568;
            --sc-text-muted:    #718096;
            --sc-text-faint:    #a0aec0;

            /* Status colors */
            --sc-success:       #059669;
            --sc-warning:       #d97706;
            --sc-danger:        #dc2626;
            --sc-info:          #2563eb;

            /* Shadows */
            --sc-shadow-sm:     0 1px 3px rgba(0,0,0,0.08);
            --sc-shadow-md:     0 4px 12px rgba(0,0,0,0.1);
            --sc-shadow-card:   0 2px 8px rgba(0,0,0,0.06);

            /* Radius */
            --sc-radius-sm:     8px;
            --sc-radius-md:     12px;
            --sc-radius-lg:     16px;
            --sc-radius-xl:     20px;

            /* Transitions */
            --sc-transition:    all 0.2s ease;
        }

        /* Global aliases for components using var(--card-bg) etc */
        :root {
            --card-bg:          var(--sc-card-bg);
            --border:           var(--sc-border);
            --text:             var(--sc-text);
            --text-secondary:   var(--sc-text-secondary);
            --input-bg:         var(--sc-input-bg);
            --modal-bg:         var(--sc-modal-bg);
        }

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

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #0f172a 0%, #581c87 50%, #0f172a 100%);
            min-height: 100vh;
            color: #333;
            position: relative;
            /* overflow-x:hidden removed — breaks position:fixed children (FAB, panels) in Chrome */
        }

        body::before {
            content: '';
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: 
                radial-gradient(circle at 20% 50%, rgba(168, 85, 247, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.1) 0%, transparent 50%);
            pointer-events: none;
            z-index: 0;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 20px;
            position: relative;
            z-index: 1;
        }

        .login-container {
            max-width: 480px;
            margin: 40px auto;
            position: relative;
            z-index: 1;
            animation: slideUp 0.6s ease-out;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .login-logo {
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 32px auto;
            padding: 0;
            background: transparent;
            width: 100%;
            max-width: 480px;
            text-align: center;
        }
        
        .login-logo img {
            height: 64px;
            width: auto;
            display: block;
            margin: 0 auto;
        }

        .login-logo-icon {
            width: 48px;
            height: 48px;
            background: linear-gradient(135deg, #f97316 0%, #ec4899 50%, #a855f7 100%);
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            font-size: 18px;
            color: white;
            box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
        }

        .login-logo-text {
            font-size: 28px;
            font-weight: 700;
            background: linear-gradient(135deg, #22d3ee 0%, #a855f7 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .login-tagline {
            text-align: center;
            color: rgba(255, 255, 255, 0.6);
            font-size: 12px;
            letter-spacing: 3px;
            text-transform: uppercase;
            margin-bottom: 30px;
        }

        .login-card {
            background: rgba(30, 41, 59, 0.8);
            backdrop-filter: blur(20px);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 20px;
            padding: 40px;
            box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
            width: 100%;
        }

        .login-card h2 {
            color: white;
            font-size: 28px;
            font-weight: 700;
            font-style: italic;
            margin-bottom: 8px;
        }

        .login-card-subtitle {
            color: rgba(255, 255, 255, 0.6);
            font-size: 14px;
            margin-bottom: 30px;
            line-height: 1.5;
        }

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

        .login-container .form-group {
            margin-bottom: 24px;
            position: relative;
        }

        .login-container label {
            display: block;
            margin-bottom: 10px;
            font-weight: 500;
            color: rgba(255, 255, 255, 0.7);
            font-size: 12px;
            text-transform: uppercase;
            letter-spacing: 1.5px;
        }

        .login-container input {
            width: 100%;
            padding: 16px 20px;
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 12px;
            font-size: 15px;
            transition: all 0.3s ease;
            background: rgba(15, 23, 42, 0.6);
            color: white;
        }

        .login-container input::placeholder {
            color: rgba(255, 255, 255, 0.4);
        }

        .login-container input:hover {
            border-color: rgba(255, 255, 255, 0.25);
            background: rgba(15, 23, 42, 0.8);
        }

        .login-container input:focus {
            outline: none;
            border-color: #a855f7;
            box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
            background: rgba(15, 23, 42, 0.9);
        }

        .login-container button[type="submit"] {
            width: 100%;
            padding: 16px;
            font-size: 16px;
            font-weight: 600;
            letter-spacing: 0.5px;
            margin-top: 10px;
            position: relative;
            overflow: hidden;
            background: linear-gradient(135deg, #ec4899 0%, #f97316 100%);
            border: none;
            border-radius: 30px;
            color: white;
            cursor: pointer;
            box-shadow: 0 4px 20px rgba(236, 72, 153, 0.4);
            transition: all 0.3s ease;
        }

        .login-container button[type="submit"]:hover {
            box-shadow: 0 6px 30px rgba(236, 72, 153, 0.5);
            transform: translateY(-2px);
        }

        .login-container button[type="submit"]:active {
            transform: translateY(0);
            box-shadow: 0 3px 15px rgba(236, 72, 153, 0.4);
        }

        .login-help {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 12px;
            margin-top: 24px;
            padding-top: 20px;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
        }

        .login-env-badge {
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: rgba(255, 255, 255, 0.7);
            padding: 6px 14px;
            border-radius: 20px;
            font-size: 11px;
            font-weight: 600;
            letter-spacing: 1.5px;
            text-transform: uppercase;
        }

        .login-help-text {
            color: rgba(255, 255, 255, 0.5);
            font-size: 13px;
        }

        .login-footer {
            text-align: center;
            color: rgba(255, 255, 255, 0.5);
            font-size: 13px;
            margin-top: 30px;
        }

        .login-footer a {
            color: #22d3ee;
            text-decoration: none;
        }

        #loginError {
            background: rgba(239, 68, 68, 0.2);
            border: 1px solid rgba(239, 68, 68, 0.4);
            color: #fca5a5;
            padding: 12px 16px;
            border-radius: 10px;
            margin-top: 16px;
            font-size: 14px;
        }

        .main-container {
            background: white;
            border-radius: 15px;
            padding: 30px;
            box-shadow: 0 15px 35px rgba(0,0,0,0.1);
            margin-top: 20px;
            position: relative;
            z-index: 1;
        }

        h1, h2, h3 {
            color: #4a5568;
            margin-bottom: 20px;
            text-align: center;
        }

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

        label {
            display: block;
            margin-bottom: 5px;
            font-weight: 600;
            color: var(--sc-text-secondary);
            font-size: 13px;
        }

        input, select, textarea {
            width: 100%;
            padding: 10px 12px;
            border: 1.5px solid var(--sc-border);
            border-radius: var(--sc-radius-sm);
            font-size: 14px;
            background: var(--sc-input-bg);
            color: var(--sc-text);
            transition: var(--sc-transition);
        }

        input:focus, select:focus, textarea:focus {
            outline: none;
            border-color: #9333ea;
            box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
        }

        button {
            background: linear-gradient(135deg, var(--sc-purple) 0%, var(--sc-pink) 100%);
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: var(--sc-radius-sm);
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            transition: var(--sc-transition);
            margin-right: 8px;
            margin-bottom: 8px;
        }

        button:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(168, 85, 247, 0.4);
        }

        .btn-secondary {
            background: linear-gradient(135deg, #6b7280 0%, #374151 100%);
        }

        .btn-danger {
            background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
        }

        .btn-success {
            background: linear-gradient(135deg, #34d399 0%, #059669 100%);
        }

        .btn-small {
            padding: 6px 12px;
            font-size: 14px;
        }

        /* Base styling for status filter buttons */
        .status-filter-btn {
            border: none;
            border-radius: 6px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            color: white;
        }

        /* Sold button - Green */
        .status-sold-btn {
            background: linear-gradient(135deg, #10b981 0%, #059669 100%);
            color: white;
            border: none;
        }
        .status-sold-btn:hover {
            background: linear-gradient(135deg, #059669 0%, #047857 100%);
            transform: translateY(-1px);
        }
        .status-sold-btn.active-status-filter {
            box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.5);
            transform: translateY(-2px) scale(1.05);
        }

        /* Quoted button - Purple */
        .status-quoted-btn {
            background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
            color: white;
            border: none;
        }
        .status-quoted-btn:hover {
            background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
            transform: translateY(-1px);
        }
        .status-quoted-btn.active-status-filter {
            box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.5);
            transform: translateY(-2px) scale(1.05);
        }

        /* Lost button - Red */
        .status-lost-btn {
            background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
            color: white;
            border: none;
        }
        .status-lost-btn:hover {
            background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
            transform: translateY(-1px);
        }
        .status-lost-btn.active-status-filter {
            box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.5);
            transform: translateY(-2px) scale(1.05);
        }

        .status-filter-btn.active-status-filter {
            box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.6);
            transform: translateY(-1px);
        }

        .tabs {
            display: flex;
            margin-bottom: 20px;
            border-bottom: 2px solid #e2e8f0;
            flex-wrap: nowrap;
            overflow-x: auto;
            scrollbar-width: none;
            -ms-overflow-style: none;
            -webkit-overflow-scrolling: touch;
            gap: 0;
        }

        .tabs::-webkit-scrollbar {
            display: none;
        }

        .tab {
            padding: 10px 11px;
            cursor: pointer;
            border-bottom: 3px solid transparent;
            transition: all 0.2s ease;
            font-weight: 600;
            white-space: nowrap;
            font-size: 0.78rem;
            letter-spacing: 0.01em;
            flex-shrink: 0;
            color: #4a5568;
            position: relative;
        }

        /* Pipe divider between tabs */
        .tab + .tab::before {
            content: '';
            position: absolute;
            left: 0;
            top: 25%;
            height: 50%;
            width: 1px;
            background: #e2e8f0;
        }

        /* Group separator — inserted between tab sections */
        .tab-group-divider {
            display: inline-flex;
            align-items: center;
            flex-shrink: 0;
            width: 1px;
            margin: 0 6px;
            align-self: stretch;
            background: #cbd5e0;
            border-bottom: 3px solid transparent;
            pointer-events: none;
            font-size: 0;
        }

        .tab:hover {
            color: #7c3aed;
            background: #f5f3ff;
        }

        .tab.active {
            border-bottom-color: #a855f7;
            color: #9333ea;
        }

        .tab-content {
            display: none;
        }

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

        /* Compact Prospect Card Styles */
        .prospect-card {
            background: var(--sc-card-bg);
            border: 1px solid var(--sc-border);
            border-radius: var(--sc-radius-md);
            padding: 9px 12px;
            margin-bottom: 5px;
            transition: var(--sc-transition);
            cursor: pointer;
            position: relative;
            box-shadow: var(--sc-shadow-sm);
        }

        .prospect-card:hover {
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
            transform: translateY(-1px);
            border-color: #cbd5e0;
        }

        .prospect-card.expanded {
            background: #ffffff;
            border-color: #a855f7;
        }

        .prospect-card.selected {
            background: #faf5ff;
            border-color: #a855f7;
        }

        /* Mobile badge row hidden on desktop */
        .mobile-badge-row {
            display: none;
        }

        .prospect-checkbox {
            position: absolute;
            top: 10px;
            left: 10px;
            width: 16px;
            height: 16px;
            cursor: pointer;
            z-index: 10;
        }

        .prospect-card .prospect-header {
            padding-left: 26px;
        }

        .bulk-actions-bar {
            background: linear-gradient(135deg, #9333ea 0%, #7c3aed 100%);
            color: white;
            padding: 15px 20px;
            border-radius: 12px;
            margin-bottom: 20px;
            display: none;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 15px;
            box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
        }

        .bulk-actions-bar.active {
            display: flex;
        }

        .bulk-actions-info {
            font-weight: 600;
            font-size: 16px;
        }

        .bulk-actions-buttons {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }

        .bulk-actions-bar button {
            background: white;
            color: #2d3748;
            padding: 8px 16px;
            font-size: 14px;
            margin: 0;
        }

        .bulk-actions-bar button:hover {
            background: #f7fafc;
        }

        .select-all-container {
            background: #f7fafc;
            border: 2px solid #e2e8f0;
            border-radius: 8px;
            padding: 12px 15px;
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .select-all-container label {
            margin: 0;
            font-weight: 600;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .select-all-container input[type="checkbox"] {
            width: 18px;
            height: 18px;
            cursor: pointer;
        }

        .prospect-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 10px;
        }

        .prospect-name {
            font-size: 14px;
            font-weight: 700;
            color: #2d3748;
        }

        .prospect-company {
            font-size: 12px;
            color: #718096;
            font-weight: 500;
        }

        /* Meta row: rep · phone · email · activities · source */
        .prospect-meta-row {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
            padding-left: 26px;
            margin-top: 3px;
        }

        .prospect-meta-link {
            color: #718096;
            text-decoration: none;
            font-size: 12px;
            white-space: nowrap;
        }
        .prospect-meta-link:hover { color: #2d3748; }

        .prospect-meta-text {
            color: #718096;
            font-size: 12px;
            white-space: nowrap;
        }

        .prospect-meta-email {
            max-width: 180px;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .prospect-meta-pending {
            color: #e53e3e;
            font-weight: 700;
            font-size: 12px;
            white-space: nowrap;
        }

        .prospect-source-badge {
            display: inline-block;
            font-size: 10px;
            padding: 2px 8px;
            border-radius: 10px;
            font-weight: 700;
            white-space: nowrap;
            color: #fff;
            margin-top: 3px;
            letter-spacing: 0.3px;
        }

        .status-badge {
            padding: 4px 10px;
            border-radius: 12px;
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            white-space: nowrap;
        }

        /* Contact status badge */
        .contact-status-badge {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            font-size: 11px;
            font-weight: 600;
            padding: 2px 8px;
            border-radius: 10px;
            margin-left: 6px;
        }
        .contact-status-badge.uncontacted {
            background: #fef3c7;
            color: #92400e;
            border: 1px solid #fde68a;
        }
        .contact-status-badge.contacted {
            background: #d1fae5;
            color: #065f46;
            border: 1px solid #a7f3d0;
        }

        .status-a { background: #ff6b6b; color: white; }
        .status-b { background: #4ecdc4; color: white; }
        .status-c { background: #45b7d1; color: white; }
        .status-d { background: #8b0000; color: white; }
        .status-g { background: #f9ca24; color: #2d3748; }
        .status-s { background: #10b981; color: white; }
        .status-q { background: #3b82f6; color: white; }
        .status-l { background: #ef4444; color: white; }

        /* Sale status badges (QUOTED, SOLD) */
        .sale-status-badge {
            padding: 4px 10px;
            border-radius: 12px;
            font-size: 10px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            white-space: nowrap;
        }
        .sale-status-quoted { 
            background: linear-gradient(135deg, #9333ea 0%, #ec4899 100%); 
            color: white; 
        }
        .sale-status-sold { 
            background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); 
            color: white; 
        }
        .sale-status-lost { 
            background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%); 
            color: white; 
        }

        .prospect-summary {
            display: flex;
            gap: 10px;
            margin-top: 3px;
            font-size: 12px;
            color: #718096;
            flex-wrap: wrap;
            align-items: center;
        }

        .prospect-summary > div {
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .assigned-badge {
            background: #e6fffa;
            color: #234e52;
            padding: 1px 7px;
            border-radius: 10px;
            font-size: 11px;
            font-weight: 600;
            border: 1px solid #81e6d9;
        }

        .prospect-details {
            display: none;
            margin-top: 10px;
            padding-top: 10px;
            border-top: 1px solid #e2e8f0;
        }

        .prospect-card.expanded .prospect-details {
            display: block;
        }

        .detail-item {
            font-size: 12px;
            display: inline-flex;
            align-items: baseline;
            gap: 5px;
            margin-right: 18px;
            margin-bottom: 4px;
        }

        .detail-label {
            font-weight: 600;
            color: #718096;
            font-size: 11px;
            text-transform: uppercase;
            white-space: nowrap;
        }

        .detail-value {
            color: #2d3748;
        }

        .fleet-intel-snippet {
            display: block;
            margin-top: 8px;
        }

        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
            padding-bottom: 10px;
            border-bottom: 2px solid #e2e8f0;
        }

        .header-logo-wrapper {
            flex: 1;
            display: flex;
            align-items: center;
            max-width: 60%;
            padding: 5px 0;
            overflow: visible;
        }

        .header-logo-img {
            height: 44px;
            display: flex;
            align-items: center;
        }
        .header-logo-img img {
            height: 38px;
            width: auto;
            display: block;
        }


        .user-info {
            display: flex;
            align-items: center;
            gap: 15px;
            flex-wrap: wrap;
        }

        .user-badge {
            background: linear-gradient(135deg, #9333ea 0%, #ec4899 100%);
            color: white;
            padding: 8px 16px;
            border-radius: 20px;
            font-weight: 600;
            font-size: 14px;
        }

        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 20px;
            margin-bottom: 30px;
        }

        .stat-card {
            background: linear-gradient(135deg, #fff 0%, #f7fafc 100%);
            padding: 25px;
            border-radius: 12px;
            border-left: 4px solid #9333ea;
            box-shadow: 0 4px 6px rgba(0,0,0,0.05);
        }

        .stat-number {
            font-size: 32px;
            font-weight: 700;
            color: #2d3748;
        }

        .stat-label {
            color: #718096;
            font-size: 14px;
            margin-top: 5px;
        }

        .stat-subtext {
            color: #a0aec0;
            font-size: 12px;
            margin-top: 3px;
        }

        .search-bar {
            margin-bottom: 20px;
        }

        .search-bar input {
            border-radius: 25px;
            padding: 15px 25px;
        }

        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.5);
            z-index: 1000;
        }

        .modal-content {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: var(--sc-modal-bg);
            padding: 28px;
            border-radius: var(--sc-radius-lg);
            max-width: 600px;
            width: 90%;
            max-height: 85vh;
            overflow-y: auto;
            box-shadow: 0 20px 60px rgba(0,0,0,0.15);
            border: 1px solid var(--sc-border);
        }

        .close {
            position: absolute;
            right: 15px;
            top: 15px;
            font-size: 28px;
            cursor: pointer;
            color: #718096;
        }

        .alert {
            padding: 15px;
            margin-bottom: 20px;
            border-radius: 8px;
            font-weight: 600;
        }

        .alert-success {
            background: #c6f6d5;
            color: #276749;
            border: 1px solid #9ae6b4;
        }

        .alert-error {
            background: #fed7d7;
            color: #c53030;
            border: 1px solid #fc8181;
        }

        .category-legend {
            background: #f8f9fa;
            border: 1px solid #dee2e6;
            border-radius: 8px;
            padding: 15px;
            margin-bottom: 20px;
        }

        .category-legend h4 {
            margin-bottom: 12px;
            color: #2d3748;
            text-align: left;
        }

        .legend-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 8px;
        }

        .legend-item {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 13px;
        }

        .legend-badge {
            padding: 4px 8px;
            border-radius: 12px;
            font-weight: 600;
            font-size: 11px;
            min-width: 20px;
            text-align: center;
        }

        .quick-actions {
            margin-top: 10px;
            display: flex;
            gap: 5px;
            flex-wrap: wrap;
        }

        .prospect-card.expanded .quick-actions {
            display: flex;
        }

        .prospect-card:not(.expanded) .quick-actions {
            display: none;
        }

        /* Activity/Notes Styles */
        .activity-section {
            background: #ffffff;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            padding: 10px 12px;
            margin-top: 8px;
            display: none;
        }

        .prospect-card.expanded .activity-section {
            display: block;
        }

        .activity-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
            padding-bottom: 8px;
            border-bottom: 1px solid #e2e8f0;
        }

        .activity-item {
            background: #f8f9fa;
            border-left: 4px solid #9333ea;
            padding: 12px;
            margin-bottom: 10px;
            border-radius: 0 8px 8px 0;
            position: relative;
        }

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

        .activity-meta {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
            font-size: 12px;
            color: #718096;
        }

        .activity-type {
            background: #e2e8f0;
            color: #4a5568;
            padding: 2px 8px;
            border-radius: 12px;
            font-weight: 600;
            text-transform: uppercase;
        }

        .activity-type.call { background: #c6f6d5; color: #276749; }
        .activity-type.email { background: #bee3f8; color: #2b6cb7; }
        .activity-type.meeting { background: #fbb6ce; color: #b83280; }
        .activity-type.note { background: #fed7aa; color: #c05621; }
        .activity-type.everconnect { background: #ddd6fe; color: #6b21a8; }

        .activity-content {
            color: #2d3748;
            margin-bottom: 8px;
            line-height: 1.4;
        }

        .follow-up-date {
            background: #fff5b7;
            color: #744210;
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 12px;
            font-weight: 600;
            display: inline-block;
            margin-top: 5px;
        }

        .overdue {
            background: #fed7d7;
            color: #c53030;
        }

        .due-today {
            background: #fef5e7;
            color: #744210;
        }

        .upcoming-followups {
            background: white;
            border: 2px solid #fed7aa;
            border-top: 4px solid #f97316;
            border-radius: 12px;
            padding: 16px;
            margin-bottom: 12px;
            box-shadow: 0 4px 16px rgba(249,115,22,0.1);
        }

        /* Container for follow-up grid */
        .followups-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
            gap: 10px;
            padding: 6px 0;
        }

        .followup-item {
            display: flex;
            flex-direction: column;
            padding: 15px;
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            border-left: 4px solid #4299e1;
            transition: transform 0.2s, box-shadow 0.2s;
            min-height: unset;
        }

        .followup-item:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        }

        .followup-item.overdue {
            border-left-color: #f56565;
        }

        .followup-item.due-today {
            border-left-color: #ed8936;
        }

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

        .prospect-info {
            flex: 1;
        }

        .prospect-info h4 {
            margin: 0;
            color: #2d3748;
        }

        .prospect-info p {
            margin: 2px 0 0 0;
            font-size: 14px;
            color: #718096;
        }

        .loading-spinner {
            display: inline-block;
            width: 16px;
            height: 16px;
            border: 2px solid #ffffff;
            border-radius: 50%;
            border-top-color: transparent;
            animation: spin 0.8s ease-in-out infinite;
            margin-right: 8px;
        }

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

        .login-hint {
            background: linear-gradient(135deg, #e6f7ff 0%, #f0f9ff 100%);
            border: 2px solid #91d5ff;
            border-radius: 16px;
            padding: 20px;
            margin-top: 25px;
            font-size: 14px;
            box-shadow: 0 4px 12px rgba(0, 149, 233, 0.1);
        }
        
        .login-hint h4 {
            margin-bottom: 12px;
            color: #0c4a6e;
            font-size: 15px;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .login-hint ul {
            margin: 8px 0 0 20px;
            padding: 0;
        }
        
        .login-hint li {
            color: #075985;
            margin: 8px 0;
            line-height: 1.6;
        }

        .login-hint strong {
            color: #0369a1;
        }

        .login-divider {
            display: flex;
            align-items: center;
            text-align: center;
            margin: 25px 0;
            color: #a0aec0;
            font-size: 13px;
            font-weight: 600;
        }

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

        .login-divider span {
            padding: 0 15px;
        }
        
            color: #718096;
        }

        .attachment-item {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: #e6f7ff;
            border: 1px solid #91d5ff;
            padding: 6px 12px;
            border-radius: 6px;
            margin: 4px;
            font-size: 12px;
            color: #0369a1;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .attachment-item:hover {
            background: #bae7ff;
            transform: translateY(-1px);
        }

        .attachment-preview {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 10px;
        }

        .attachment-preview-item {
            position: relative;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            background: #f0f9ff;
            border: 2px solid #bae7ff;
            padding: 8px 12px;
            border-radius: 8px;
            font-size: 13px;
        }

        .attachment-remove {
            cursor: pointer;
            color: #e53e3e;
            font-weight: bold;
            margin-left: 8px;
            font-size: 16px;
            line-height: 1;
        }

        .attachment-remove:hover {
            color: #c53030;
        }

        .attachment-icon {
            font-size: 18px;
        }

        .followup-quick-buttons {
            display: flex;
            gap: 5px;
            flex-wrap: wrap;
            margin-top: 10px;
        }

        .filter-section {
            background: #f7fafc;
            border: 2px solid #e2e8f0;
            border-radius: 12px;
            padding: 15px;
            margin-bottom: 20px;
        }

        .filter-row {
            display: flex;
            gap: 15px;
            align-items: center;
            flex-wrap: wrap;
        }

        .filter-group {
            display: flex;
            flex-direction: column;
            gap: 5px;
        }

        .filter-group label {
            font-size: 12px;
            font-weight: 600;
            color: #4a5568;
            margin-bottom: 0;
        }

        .filter-group select {
            padding: 8px 12px;
            font-size: 14px;
        }

        .expand-toggle {
            color: #c4b5fd;
            font-size: 10px;
            font-weight: 600;
            margin-top: 4px;
            display: block;
            letter-spacing: 0.3px;
        }

        /* ============================================ */
        /* RESPONSIVE DESIGN - TABLET & MOBILE */
        /* ============================================ */
        
        /* Tablet (768px and below) */
        @media (max-width: 768px) {
            .tabs {
                flex-wrap: nowrap;
                overflow-x: auto;
            }
            
            .header {
                flex-direction: column;
                gap: 15px;
            }
            
            .header-logo-wrapper {
                max-width: 100%;
            }
            
            .header-logo-img {
                height: 40px;
            }
            .header-logo-img img {
                height: 34px;
                width: auto;
            }
            
            .prospect-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 10px;
            }

            .activity-meta {
                flex-direction: column;
                align-items: flex-start;
                gap: 5px;
            }

            .followup-item {
                flex-direction: column;
                align-items: flex-start;
                gap: 10px;
            }

            .legend-grid {
                grid-template-columns: 1fr;
            }

            .login-container {
                margin: 40px auto;
                padding: 35px 30px;
                max-width: 95%;
            }
            
            .login-logo img {
                height: 58px;
                max-width: 95%;
            }

            .login-container h1 {
                font-size: 26px;
            }

            .login-subtitle {
                font-size: 14px;
            }
            
            /* Stats grid - 2 columns on tablet */
            .stats-grid {
                grid-template-columns: repeat(2, 1fr) !important;
                gap: 15px;
            }
            
            /* Filter section - stack vertically */
            .filter-section {
                flex-direction: column;
                gap: 10px;
            }
            
            .filter-section select,
            .filter-section input {
                width: 100% !important;
            }
            
            /* Buttons - full width */
            .btn-group {
                flex-wrap: wrap;
                gap: 10px;
            }
            
            .btn-group button {
                flex: 1 1 calc(50% - 5px);
                min-width: 120px;
            }
        }
        
        /* Mobile (480px and below) */
        @media (max-width: 480px) {
            /* Container padding */
            .container {
                padding: 10px;
            }
            
            /* Header - compact on mobile */
            .header {
                padding: 15px;
            }
            
            .header-logo-wrapper {
                max-width: 100%;
            }
            
            .header-logo-img {
                height: 36px;
            }
            .header-logo-img img {
                height: 30px;
                width: auto;
            }
            
            .header h1 {
                font-size: 20px;
            }
            
            .user-info {
                font-size: 12px;
            }
            
            /* Tabs - full width buttons */
            .tabs {
                gap: 5px;
            }
            
            .tab {
                padding: 12px 15px;
                font-size: 14px;
            }
            
            /* Stats - single column on phone */
            .stats-grid {
                grid-template-columns: 1fr !important;
                gap: 12px;
            }
            
            .stat-card {
                padding: 15px;
            }
            
            .stat-number {
                font-size: 28px;
            }
            
            .stat-label {
                font-size: 12px;
            }
            
            /* Tables - horizontal scroll */
            table {
                display: block;
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
                white-space: nowrap;
            }
            
            table thead  { display: table-header-group; }
            table tbody  { display: table-row-group; }
            table tr     { display: table-row; }
            table th,
            table td     { display: table-cell; }
            
            /* Prospect cards - compact — full overhaul below */
            .prospect-card {
                padding: 10px 12px 10px 36px;
                margin-bottom: 8px;
                border-radius: 10px;
                position: relative;
            }

            /* Smaller checkbox - tight top-left */
            .prospect-checkbox {
                width: 16px !important;
                height: 16px !important;
                top: 12px !important;
                left: 10px !important;
            }

            /* ═══════════════════════════════════════════════
               MOBILE PROSPECT CARD — Clean Aligned Layout
               ═══════════════════════════════════════════════ */

            /* Card: tighter padding, checkbox in far left */
            .prospect-card {
                padding: 10px 12px 10px 36px !important;
                margin-bottom: 6px !important;
                border-radius: 10px !important;
            }

            .prospect-checkbox {
                width: 16px !important;
                height: 16px !important;
                top: 13px !important;
                left: 10px !important;
            }

            /* ── ROW 1: Name left, status badges right (same line) ── */
            .prospect-card .prospect-header {
                display: flex !important;
                flex-direction: row !important;
                align-items: flex-start !important;
                justify-content: space-between !important;
                gap: 8px !important;
                margin-bottom: 3px !important;
                flex-wrap: nowrap !important;
            }

            /* Left side: name + company stacked */
            .prospect-card .prospect-header > div:first-child {
                flex: 1 1 0 !important;
                min-width: 0 !important;
            }

            .prospect-name {
                font-size: 14px !important;
                font-weight: 700 !important;
                white-space: nowrap !important;
                overflow: hidden !important;
                text-overflow: ellipsis !important;
                line-height: 1.3 !important;
                color: #1e293b !important;
            }

            .prospect-company {
                font-size: 11px !important;
                color: #718096 !important;
                white-space: nowrap !important;
                overflow: hidden !important;
                text-overflow: ellipsis !important;
                line-height: 1.3 !important;
                margin-top: 1px !important;
            }

            .prospect-source-badge {
                font-size: 9px !important;
                padding: 1px 6px !important;
                margin-top: 3px !important;
                display: inline-block !important;
            }

            /* Right side: status + contact badges stacked vertically — tight */
            .prospect-card .desktop-badge-cluster {
                display: none !important;
            }

            /* ── ROW 2: Inline badge row (category + contact + sale status) ── */
            .prospect-card .mobile-badge-row {
                display: flex !important;
                flex-direction: row !important;
                flex-wrap: wrap !important;
                align-items: center !important;
                gap: 4px !important;
                margin-bottom: 4px !important;
            }

            .status-badge {
                font-size: 10px !important;
                padding: 2px 8px !important;
                border-radius: 10px !important;
                letter-spacing: 0 !important;
            }

            .contact-status-badge {
                font-size: 10px !important;
                padding: 2px 7px !important;
                margin-left: 0 !important;
                border-radius: 10px !important;
            }

            .sale-status-badge {
                font-size: 9px !important;
                padding: 2px 7px !important;
                letter-spacing: 0 !important;
                border-radius: 10px !important;
            }

            /* ── ROW 3: Assigned rep badge — full width, compact ── */
            .assigned-badge {
                font-size: 10px !important;
                padding: 3px 8px !important;
                display: inline-block !important;
                margin-bottom: 4px !important;
                max-width: 100% !important;
                overflow: hidden !important;
                text-overflow: ellipsis !important;
                white-space: nowrap !important;
            }

            /* ── ROW 4: Phone + Email + Activities — 2-col grid ── */
            .prospect-summary {
                display: grid !important;
                grid-template-columns: 1fr 1fr !important;
                gap: 2px 6px !important;
                margin-top: 2px !important;
                font-size: 11px !important;
                color: #4a5568 !important;
            }

            .prospect-summary > div {
                display: flex !important;
                align-items: center !important;
                gap: 3px !important;
                white-space: nowrap !important;
                overflow: hidden !important;
                text-overflow: ellipsis !important;
                line-height: 1.6 !important;
                font-size: 11px !important;
            }

            /* Pending + primary contact span full width */
            .prospect-summary > div:has([style*="e53e3e"]),
            .prospect-summary > div[style*="e53e3e"],
            .prospect-summary > div:has([style*="7c3aed"]),
            .prospect-summary > div[style*="7c3aed"] {
                grid-column: 1 / -1 !important;
            }

            /* ── Expand toggle ── */
            .expand-toggle {
                font-size: 11px !important;
                display: block !important;
                margin-top: 5px !important;
                color: #9333ea !important;
                font-weight: 600 !important;
            }

            /* ══════════════════════════════════════════════════
               EXPANDED CARD — prevent all overflow/bleeding
               ══════════════════════════════════════════════════ */

            /* Details section: constrain to card width */
            .prospect-card.expanded .prospect-details {
                width: 100% !important;
                box-sizing: border-box !important;
                overflow: hidden !important;
            }

            /* Detail items: wrap properly, never overflow */
            .detail-item {
                display: flex !important;
                flex-direction: column !important;
                gap: 2px !important;
                margin-right: 0 !important;
                margin-bottom: 8px !important;
                width: 100% !important;
                max-width: 100% !important;
                box-sizing: border-box !important;
            }

            .detail-label {
                font-size: 10px !important;
                font-weight: 700 !important;
                color: #94a3b8 !important;
                text-transform: uppercase !important;
                letter-spacing: 0.5px !important;
            }

            .detail-value {
                font-size: 13px !important;
                color: #1e293b !important;
                word-break: break-word !important;
                white-space: normal !important;
            }

            /* Detail items in a 2-col grid */
            .prospect-card.expanded .prospect-details > .detail-item:not([style*="grid-column"]) {
                display: inline-flex !important;
                flex-direction: column !important;
                width: auto !important;
                margin-right: 16px !important;
                margin-bottom: 8px !important;
                vertical-align: top !important;
            }

            /* Fleet intel box: constrain and clip */
            .fleet-intel-snippet {
                width: 100% !important;
                box-sizing: border-box !important;
                overflow: hidden !important;
            }

            .fleet-intel-snippet > div {
                width: 100% !important;
                box-sizing: border-box !important;
                max-width: 100% !important;
                overflow: hidden !important;
            }

            /* Fleet intel inner flex rows — wrap, no overflow */
            .fleet-intel-snippet [style*="display:flex"],
            .fleet-intel-snippet [style*="display: flex"] {
                flex-wrap: wrap !important;
                max-width: 100% !important;
                overflow: hidden !important;
            }

            /* Fleet intel Refresh button — stays within card */
            .fleet-intel-snippet button {
                flex-shrink: 0 !important;
                white-space: nowrap !important;
                min-height: 36px !important;
                font-size: 12px !important;
                padding: 6px 12px !important;
            }

            /* Fleet intel notes text: wrap properly */
            .fleet-intel-snippet [style*="notes"],
            .fleet-intel-snippet p,
            .fleet-intel-snippet div > strong {
                word-break: break-word !important;
                white-space: normal !important;
                max-width: 100% !important;
            }

            /* Activity section: constrain to card */
            .activity-section {
                width: 100% !important;
                box-sizing: border-box !important;
                overflow: hidden !important;
                margin-top: 10px !important;
            }

            .activity-section .activity-header {
                display: flex !important;
                justify-content: space-between !important;
                align-items: center !important;
                gap: 8px !important;
                margin-bottom: 8px !important;
            }

            .activity-section .activity-header h4 {
                font-size: 13px !important;
                margin: 0 !important;
            }

            .activity-section .activity-header button {
                flex-shrink: 0 !important;
                font-size: 12px !important;
                padding: 6px 12px !important;
                min-height: 34px !important;
                white-space: nowrap !important;
            }

            /* Activity items: no horizontal overflow */
            .activity-item {
                width: 100% !important;
                box-sizing: border-box !important;
                overflow: hidden !important;
                padding: 8px 10px !important;
            }

            /* Activity text: wraps cleanly */
            .activity-item p,
            .activity-item div,
            .activity-item span {
                max-width: 100% !important;
                word-break: break-word !important;
                white-space: normal !important;
                overflow-wrap: break-word !important;
            }

            /* Notes section: constrained */
            .prospect-notes-section {
                width: 100% !important;
                box-sizing: border-box !important;
                overflow: hidden !important;
            }

            .prospect-notes-section div {
                word-break: break-word !important;
                white-space: normal !important;
                overflow-wrap: break-word !important;
            }

            /* Quick action buttons row at bottom */
            .prospect-card.expanded .quick-actions {
                display: flex !important;
                flex-wrap: wrap !important;
                gap: 6px !important;
                margin-top: 10px !important;
                width: 100% !important;
                box-sizing: border-box !important;
            }

            .prospect-card.expanded .quick-actions button {
                flex: 1 1 auto !important;
                min-width: 80px !important;
                font-size: 12px !important;
                padding: 8px 10px !important;
                min-height: 36px !important;
            }

            /* ── Select All container ── */
            .select-all-container {
                padding: 8px 12px !important;
                margin-bottom: 8px !important;
                gap: 8px !important;
            }

            .select-all-container input[type="checkbox"] {
                width: 16px !important;
                height: 16px !important;
            }

            .select-all-container label {
                font-size: 13px !important;
            }

            /* Tighter followup grid — single column on mobile */
            .followups-grid {
                grid-template-columns: 1fr !important;
                gap: 6px !important;
            }

            .followup-item {
                padding: 10px 12px !important;
                min-height: unset !important;
                gap: 6px !important;
            }

            /* Followup company name */
            .followup-item .company-name,
            .followup-item strong {
                font-size: 14px;
            }

            /* Done / Log buttons in followup cards */
            .followup-item button {
                min-height: 38px !important;
                padding: 8px 14px !important;
                font-size: 13px !important;
            }

            /* Section headers tighter */
            .section-header, .card-header {
                padding: 10px 12px !important;
            }

            /* Buttons - larger touch targets (exclude FAB and close buttons) */
            button:not(#voiceNoteFab button):not(.close-btn) {
                min-height: 44px;
                padding: 10px 16px;
                font-size: 14px;
            }

            /* FAB button — never let global button styles touch it */
            #voiceNoteFab button {
                min-height: unset !important;
                padding: 0 !important;
                font-size: 26px !important;
                width: 62px !important;
                height: 62px !important;
                border-radius: 50% !important;
                display: flex !important;
                align-items: center !important;
                justify-content: center !important;
                margin: 0 !important;
                touch-action: manipulation;
            }
            
            /* Forms - full width inputs */
            .form-group input,
            .form-group select,
            .form-group textarea {
                width: 100%;
                font-size: 16px; /* Prevents zoom on iOS */
                padding: 12px;
            }
            
            /* Modals - full screen on mobile */
            .modal-content {
                width: 95% !important;
                max-width: 95% !important;
                max-height: 90vh;
                overflow-y: auto;
                margin: 5vh auto;
            }
            
            /* Login screen - optimize for mobile */
            .login-container {
                margin: 20px auto;
                padding: 25px 20px;
                max-width: 100%;
            }
            
            .login-logo img {
                height: 52px;
                max-width: 98%;
            }
            
            .login-card {
                padding: 25px 20px;
            }
            
            .login-card h2 {
                font-size: 22px;
            }
            
            /* Category legend - 2 columns on mobile */
            .legend-item {
                font-size: 11px;
            }
            
            /* Activity items - compact */
            .activity-item {
                padding: 12px;
            }
            
            /* Filter dropdowns - stack */
            .filter-section {
                flex-direction: column;
            }
            
            .filter-section > div {
                width: 100%;
            }
            
            /* Export buttons - full width */
            .export-section button {
                width: 100%;
                margin-bottom: 10px;
            }
            
            /* Charts - responsive */
            canvas {
                max-width: 100% !important;
                height: auto !important;
            }
            
            /* Status badges - smaller */
            .status-badge {
                font-size: 11px;
                padding: 4px 8px;
            }
            
            /* Pending badge - adjust size */
            .pending-badge {
                font-size: 11px;
                padding: 3px 8px;
            }
            
            /* Search box - full width */
            .search-box {
                width: 100% !important;
            }
            
            /* Alert messages - adjust padding */
            .alert {
                padding: 12px;
                font-size: 14px;
            }
            
            /* Analytics filters - stack vertically */
            #analyticsRegionFilterContainer,
            #analyticsDistrictFilterContainer,
            #analyticsDealerFilterContainer {
                width: 100%;
            }
            
            /* Bulk action buttons - stack */
            .bulk-actions {
                flex-direction: column;
                gap: 8px;
            }
            
            .bulk-actions button {
                width: 100%;
            }
            
            /* Prospect info items - wrap better */
            .prospect-info {
                flex-direction: column;
                gap: 8px;
            }
            
            .prospect-info-item {
                font-size: 13px;
            }
            
            /* Activity type badges */
            .activity-type {
                font-size: 11px;
                padding: 3px 8px;
            }
            
            /* Navigation buttons */
            .nav-buttons {
                flex-direction: column;
                gap: 10px;
            }
            
            .nav-buttons button {
                width: 100%;
            }
        }
        
        /* Extra small phones (360px and below) */
        @media (max-width: 360px) {
            .header h1 {
                font-size: 18px;
            }
            
            .stat-number {
                font-size: 24px;
            }
            
            .tab {
                padding: 10px 12px;
                font-size: 13px;
            }
            
            button {
                padding: 10px 15px;
                font-size: 13px;
            }
            
            .prospect-card {
                padding: 10px;
            }
        }

        /* ============================================
           MOBILE FIXES — Voice Panel, Tabs, FAB
        ============================================ */

        /* Tabs: horizontal scroll on mobile so they don't wrap ugly */
        @media (max-width: 768px) {
            .tabs {
                flex-wrap: nowrap !important;
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
                scrollbar-width: none;
                padding-bottom: 2px;
                gap: 0;
            }
            .tabs::-webkit-scrollbar { display: none; }
            .tab {
                white-space: nowrap;
                flex-shrink: 0;
                padding: 9px 10px;
                font-size: 12px;
            }
        }

        /* Voice Note FAB + Panel — full mobile treatment */
        @media (max-width: 480px) {
            #voiceNoteFab {
                bottom: 16px !important;
                right: 16px !important;
                /* Must be BELOW sheet z-index (1300) so sheet buttons are always tappable */
                z-index: 1250 !important;
                /* Promote to own composite layer — no more sluggish repaints */
                will-change: transform;
                transform: translateZ(0);
            }

            /* Shrink the FAB button itself on mobile */
            #voiceNoteFab > button {
                width: 50px !important;
                height: 50px !important;
                font-size: 20px !important;
                box-shadow: 0 3px 12px rgba(249,115,22,0.4) !important;
            }

            #voiceNotePanel {
                /* Full-width bottom sheet on phones */
                width: 100% !important;
                right: 0 !important;
                left: 0 !important;
                bottom: 0 !important;
                top: auto !important;
                max-height: 80vh !important;
                overflow-y: auto !important;
                -webkit-overflow-scrolling: touch !important;
                border-radius: 20px 20px 0 0 !important;
                /* Promote to own composite layer — no more sluggish repaints */
                will-change: transform;
                transform: translateZ(0);
            }

            /* Tighten up panel padding on mobile */
            #voiceNotePanel > div:not(:first-child) {
                padding: 10px 12px !important;
            }

            /* Shrink the mic icon on mobile */
            #vnRecordStatus {
                padding: 8px !important;
            }
            #vnRecordStatus > div:first-child {
                font-size: 22px !important;
                margin-bottom: 2px !important;
            }

            /* Reduce textarea rows on mobile */
            #vnTranscript {
                font-size: 16px !important;
                rows: 2;
            }

            /* Voice panel buttons — keep side by side but smaller */
            #voiceNotePanel .vn-btn-row button {
                padding: 8px 6px !important;
                font-size: 12px !important;
            }

            /* Smart extract button — readable on small screens */
            #vnCreateContactBtn {
                font-size: 12px !important;
                padding: 9px 8px !important;
            }

            #vnLogActivityBtn {
                font-size: 12px !important;
                padding: 9px 8px !important;
            }

            /* Contact preview card text */
            #vnContactPreview {
                font-size: 11px !important;
            }

            /* Saved notes list — limit height so panel doesn't overflow */
            #vnNotesList {
                max-height: 120px;
                overflow-y: auto;
            }

            /* FAB button touch target */
            #voiceNoteFab button {
                width: 56px !important;
                height: 56px !important;
                font-size: 24px !important;
            }
        }

        /* Modals — full screen on mobile, scrollable */
        @media (max-width: 480px) {
            .modal-content {
                width: 100% !important;
                max-width: 100% !important;
                min-height: 100vh;
                margin: 0 !important;
                border-radius: 0 !important;
                overflow-y: auto;
            }

            .modal {
                padding: 0 !important;
                align-items: flex-start;
            }
        }

        /* Prevent horizontal page scroll on mobile */
        @media (max-width: 768px) {
            body {
                /* overflow-x:hidden omitted — breaks fixed elements */
            }
        }
        /* Prevent Leaflet tiles from escaping map container */
        #prospectMap .leaflet-pane,
        #prospectMap .leaflet-tile,
        #prospectMap .leaflet-tile-container,
        #prospectMap .leaflet-layer {
            position: absolute !important;
        }
        .leaflet-container {
            max-height: 500px;
            overflow: hidden !important;
        }
    
        /* ── Quick-call button: always visible on mobile, hover on desktop ── */
        @media (hover: none) {
            /* touch devices — always show */
            .call-now-btn { display:inline-block !important; }
        }
        @media (hover: hover) {
            /* mouse devices — show on hover */
            a:hover .call-now-btn { display:inline-block !important; }
        }

  .dd-tab { transition: color 0.15s, background 0.15s, border-color 0.15s; }
  .dd-tab:not(.active):hover { background:rgba(255,255,255,0.7) !important; color:#1e293b !important; }
  .dd-tab.active { background:white !important; margin-bottom:-2px; box-shadow:0 -2px 8px rgba(0,0,0,0.07); }
  .dd-tab[data-tab="unit"].active    { color:#1d4ed8 !important; border-bottom:3px solid #1d4ed8 !important; }
  .dd-tab[data-tab="pricing"].active { color:#16a34a !important; border-bottom:3px solid #16a34a !important; }
  .dd-tab[data-tab="trade"].active   { color:#9333ea !important; border-bottom:3px solid #9333ea !important; }
  .dd-tab[data-tab="fees"].active    { color:#ea580c !important; border-bottom:3px solid #ea580c !important; }
  .dd-tab[data-tab="finance"].active { color:#0891b2 !important; border-bottom:3px solid #0891b2 !important; }
  .dd-tab[data-tab="summary"].active { color:#db2777 !important; border-bottom:3px solid #db2777 !important; }
  .dd-field { display:flex; flex-direction:column; gap:5px; }
  .dd-field label { font-size:12px; font-weight:600; color:#374151; text-transform:uppercase; letter-spacing:0.5px; }
  .dd-field input, .dd-field select, .dd-field textarea {
    border:1px solid #d1d5db; border-radius:8px; padding:8px 10px;
    font-size:13px; color:#1f2937; background:#fff;
    transition:border-color 0.15s, box-shadow 0.15s;
  }
  .dd-field input:focus, .dd-field select:focus, .dd-field textarea:focus {
    outline:none; border-color:#2563eb; box-shadow:0 0 0 3px rgba(37,99,235,0.1);
  }
  .dd-money-input { position:relative; }
  .dd-money-input span { position:absolute; left:10px; top:50%; transform:translateY(-50%); color:#6b7280; font-size:13px; font-weight:600; pointer-events:none; }
  .dd-money-input input { padding-left:22px; width:100%; box-sizing:border-box; }
  .dd-summary-row { display:flex; justify-content:space-between; padding:8px 0; border-bottom:1px solid #f1f5f9; font-size:14px; }
  .dd-summary-row:last-child { border-bottom:none; }
  .dd-summary-section { background:#fff; border-radius:10px; border:1px solid #e2e8f0; padding:14px 16px; margin-bottom:14px; }
  .dd-summary-section h4 { font-size:11px; font-weight:700; color:#64748b; text-transform:uppercase; letter-spacing:1px; margin:0 0 10px; }
  .dd-total-row { display:flex; justify-content:space-between; padding:10px 0 0; margin-top:8px; border-top:2px solid #1d4ed8; font-size:16px; font-weight:700; color:#1e3a5f; }


        /* ═══════════════════════════════════════════════════════════
           MAP TAB — DESKTOP + MOBILE RESPONSIVE STYLES
           ═══════════════════════════════════════════════════════════ */

        .map-tab-wrapper { padding: 0 0 10px 0; }

        /* ── Desktop Controls Bar ── */
        .map-controls-desktop {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            align-items: center;
            padding: 12px 16px;
            background: #f8f9ff;
            border-radius: 10px;
            margin-bottom: 12px;
            border: 1px solid #e2e8f0;
        }
        .map-filter-label { font-size:13px; font-weight:600; color:#4a5568; }
        .map-select { font-size:13px; padding:5px 10px; border:1px solid #cbd5e0; border-radius:6px; background:white; }
        .map-btn-primary { font-size:11px; padding:4px 10px; border:1px solid #667eea; border-radius:6px; background:white; cursor:pointer; color:#667eea; font-weight:600; }
        .map-btn-admin { font-size:11px; padding:4px 10px; border:1px solid #cbd5e0; border-radius:6px; background:white; cursor:pointer; color:#718096; }
        .map-btn-admin-red { border-color:#fca5a5; color:#dc2626; }

        /* ── Mobile Top Bar (hidden on desktop) ── */
        .map-controls-mobile { display: none; }

        /* ── Route Panel ── */
        .map-route-panel {
            background: #fff;
            border: 1px solid #e2e8f0;
            border-radius: 10px;
            padding: 14px;
            margin-bottom: 12px;
        }

        /* ── Map + Cluster Wrapper ── */
        .map-and-cluster-wrapper { position: relative; width: 100%; }

        .prospect-map-container {
            height: 500px;
            max-height: 500px;
            width: 100%;
            position: relative;
            border-radius: 10px;
            border: 1px solid #e2e8f0;
            overflow: hidden;
            z-index: 0;
        }

        /* ── Desktop Cluster Panel ── */
        .cluster-panel-desktop {
            display: none;
            position: absolute;
            top: 0; right: 0;
            width: 280px;
            height: 500px;
            background: white;
            box-shadow: -4px 0 20px rgba(0,0,0,0.18);
            z-index: 800;
            border-radius: 0 10px 10px 0;
            overflow: hidden;
            flex-direction: column;
        }
        .cluster-panel-header {
            background: linear-gradient(135deg,#667eea,#764ba2);
            color: white;
            padding: 12px 14px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-shrink: 0;
        }
        .cluster-panel-footer {
            padding: 10px 12px;
            border-top: 1px solid #e2e8f0;
            background: #f8fafc;
            flex-shrink: 0;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        /* ── Mobile Route Bar ── */
        .mobile-route-bar {
            display: none;
            align-items: center;
            gap: 10px;
            padding: 10px 14px;
            background: linear-gradient(135deg,#2d3748,#4a5568);
            border-radius: 10px;
            margin-top: 8px;
        }

        /* ── Legend ── */
        .map-legend-bar {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
            margin-top: 10px;
            padding: 10px 14px;
            background: #f8f9ff;
            border-radius: 8px;
            border: 1px solid #e2e8f0;
        }
        .map-legend-item { font-size:12px; color:#555; }
        .map-legend-hint { font-size:12px; color:#555; margin-left:10px; font-style:italic; }

        /* ── Shared Bottom Sheet Styles ── */
        .map-sheet-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.45);
            z-index: 9100;
            backdrop-filter: blur(2px);
        }
        .map-bottom-sheet {
            position: fixed;
            bottom: 0; left: 0; right: 0;
            background: white;
            border-radius: 20px 20px 0 0;
            z-index: 9200;
            display: flex;
            flex-direction: column;
            max-height: 75vh;
            box-shadow: 0 -8px 32px rgba(0,0,0,0.2);
            animation: sheetSlideUp 0.28s cubic-bezier(0.34,1.2,0.64,1);
        }
        .map-bottom-sheet-tall { max-height: 82vh; }
        @keyframes sheetSlideUp {
            from { transform: translateY(100%); opacity: 0.5; }
            to   { transform: translateY(0);    opacity: 1;   }
        }
        .map-sheet-handle {
            width: 40px; height: 4px;
            background: #d1d5db;
            border-radius: 99px;
            margin: 10px auto 4px;
            flex-shrink: 0;
        }
        .map-sheet-title {
            font-size: 16px;
            font-weight: 700;
            color: #1e293b;
            padding: 8px 18px 12px;
            border-bottom: 1px solid #f1f5f9;
            flex-shrink: 0;
        }
        .map-sheet-body {
            overflow-y: auto;
            padding: 14px 16px;
            flex: 1;
            -webkit-overflow-scrolling: touch;
        }
        .map-sheet-footer {
            padding: 12px 16px;
            border-top: 1px solid #f1f5f9;
            display: flex;
            flex-shrink: 0;
        }
        .map-sheet-apply-btn {
            width: 100%;
            padding: 14px;
            background: linear-gradient(135deg,#667eea,#764ba2);
            color: white;
            border: none;
            border-radius: 12px;
            font-size: 15px;
            font-weight: 700;
            cursor: pointer;
        }
        .map-sheet-field { margin-bottom: 14px; }
        .map-sheet-label { display:block; font-size:12px; font-weight:700; color:#64748b; text-transform:uppercase; letter-spacing:0.5px; margin-bottom:6px; }
        .map-sheet-select { width:100%; padding:12px 14px; border:1.5px solid #e2e8f0; border-radius:10px; font-size:15px; color:#1e293b; background:white; appearance:auto; }
        .map-sheet-admin-section { background:#f8fafc; border:1px solid #e2e8f0; border-radius:10px; padding:12px; margin-top:8px; }
        .map-sheet-admin-label { font-size:11px; font-weight:700; color:#94a3b8; text-transform:uppercase; letter-spacing:0.5px; margin-bottom:8px; }
        .map-sheet-admin-btn { width:100%; padding:11px; background:white; color:#4a5568; border:1px solid #d1d5db; border-radius:8px; font-size:13px; font-weight:600; cursor:pointer; margin-bottom:6px; }
        .map-sheet-admin-btn-red { color:#dc2626; border-color:#fca5a5; }
        .cluster-sheet-header {
            background: linear-gradient(135deg,#667eea,#764ba2);
            color: white;
            padding: 12px 16px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            flex-shrink: 0;
        }

        /* ── Mobile Button Styles ── */
        .map-mobile-btn {
            display: flex;
            align-items: center;
            gap: 5px;
            padding: 8px 14px;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            border: none;
            white-space: nowrap;
        }
        .map-mobile-btn-filter { background:#667eea; color:white; }
        .map-mobile-btn-reset  { background:white; color:#667eea; border:1.5px solid #667eea; }

        /* ═══════════════════════════════════════════════════════════
           MOBILE OVERRIDES  (≤ 768px)
           ═══════════════════════════════════════════════════════════ */
        @media (max-width: 768px) {

            /* Hide desktop controls, show mobile bar */
            .map-controls-desktop { display: none; }
            .map-controls-mobile {
                display: flex;
                align-items: center;
                gap: 8px;
                padding: 10px 12px;
                background: #f8f9ff;
                border-radius: 10px;
                margin-bottom: 10px;
                border: 1px solid #e2e8f0;
            }

            /* Map fills screen height minus header + tabs + top bar */
            .prospect-map-container {
                height: calc(100vh - 260px);
                max-height: calc(100vh - 260px);
                min-height: 320px;
            }

            /* Desktop cluster panel OFF on mobile (use sheet instead) */
            .cluster-panel-desktop { display: none !important; }

            /* Mobile route bar — JS controls visibility via _mobileUpdateRouteBar() */
            .mobile-route-bar { display: none; }

            /* Desktop route panel hidden on mobile (use sheet instead) */
            .map-route-panel { display: none !important; }

            /* Legend — compact horizontal scroll on mobile */
            .map-legend-bar {
                flex-wrap: nowrap;
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
                gap: 14px;
                padding: 8px 12px;
            }
            .map-legend-item, .map-legend-hint { white-space: nowrap; }
        }

/* ============================================================
   MOBILE FIXES — Comprehensive phone/tablet improvements
   Added: Demo prep pass
   ============================================================ */

/* ── 1. Stats grids: 4-col → 2-col on tablet, 2-col on phone ── */
@media (max-width: 768px) {
    [style*="grid-template-columns:repeat(4,1fr)"],
    [style*="grid-template-columns: repeat(4, 1fr)"],
    #prospectStatsGrid,
    #dgStatTotal ~ div {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ── 2. Add Prospect form: 4-col → 2-col → 1-col ── */
@media (max-width: 768px) {
    #addProspectForm > div[style*="repeat(4"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
@media (max-width: 480px) {
    #addProspectForm > div[style*="repeat(4"],
    #addProspectForm > div[style*="repeat(2"] {
        grid-template-columns: 1fr !important;
    }
}

/* ── 3. Filter row: wrap on mobile ── */
@media (max-width: 768px) {
    .filter-row {
        flex-direction: column !important;
        gap: 10px !important;
    }
    .filter-group {
        width: 100% !important;
        min-width: unset !important;
    }
    .filter-group select,
    .filter-group input {
        width: 100% !important;
        min-width: unset !important;
        font-size: 16px !important; /* prevent iOS zoom */
    }
}

/* ── 4. Sales performance & analytics grids ── */
@media (max-width: 600px) {
    /* SP stats: sold/quoted/lost/win% → 2x2 */
    .sp-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        flex-wrap: wrap !important;
    }
    /* Analytics dash row → single col */
    .dash-row {
        grid-template-columns: 1fr !important;
    }
    /* Deal profit KPIs → 2x2 */
    .dp-kpis {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    .dp-kpi {
        flex: 1 1 calc(50% - 4px) !important;
        min-width: unset !important;
    }
}

/* ── 5. Tables: wrap in scrollable container ── */
@media (max-width: 768px) {
    /* Manage Team table */
    div[style*="min-width:860px"],
    table[style*="min-width:860px"] {
        min-width: unset !important;
        width: 100% !important;
    }
    /* All tables in reports / manage team — scrollable wrapper */
    /* Exclude inventory table: it has its own overflow-x:auto wrapper div */
    .tab-content table:not(.inv-no-block) {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        font-size: 12px !important;
    }

    /* Inventory table: must stay as a real table so tbody rows render */
    #inventoryTab table {
        display: table !important;
        width: 100% !important;
    }
    #inventoryTab thead  { display: table-header-group !important; }
    #inventoryTab tbody  { display: table-row-group !important; }
    #inventoryTab tr     { display: table-row !important; }
    #inventoryTab th,
    #inventoryTab td     { display: table-cell !important; white-space: nowrap; }
    /* Gross Profit by Rep table */
    #gpByRepTable {
        font-size: 12px !important;
    }
    #gpByRepTable th,
    #gpByRepTable td {
        padding: 8px 6px !important;
    }
}

/* ── 6. Report filter dropdowns → wrap ── */
@media (max-width: 768px) {
    /* Reports & DG reports filter bars */
    div[style*="min-width:150px"],
    div[style*="min-width:160px"],
    div[style*="min-width:180px"] {
        min-width: unset !important;
        width: 100% !important;
    }
    select[style*="min-width:150px"],
    select[style*="min-width:160px"],
    select[style*="min-width:180px"] {
        min-width: unset !important;
        width: 100% !important;
    }
    /* Report filter wrapper → column */
    #rptFilters,
    #dgRptFilters {
        flex-direction: column !important;
        gap: 8px !important;
    }
}

/* ── 7. Analytics section: charts side-by-side → stacked ── */
@media (max-width: 640px) {
    /* Prospect distribution + Activities by Type */
    #categoryChart {
        width: 160px !important;
        height: 160px !important;
    }
    #activityChart {
        width: 100% !important;
        max-width: 280px !important;
    }
    /* Sales rep performance table */
    #salesRepTableBody tr td {
        padding: 6px 4px !important;
        font-size: 12px !important;
    }
}

/* ── 8. Prospect contact matrix → scrollable ── */
@media (max-width: 640px) {
    #contactMatrix,
    #contactMatrixContainer {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* ── 9. Deal desk modal → full screen on phone ── */
@media (max-width: 480px) {
    #dealDeskModal .modal-content,
    #dealDeskOverlay > div {
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh !important;
        max-height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        overflow-y: auto !important;
    }
    /* Deal desk tabs → scrollable */
    .dd-tabs {
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
    }
    .dd-tabs::-webkit-scrollbar { display: none !important; }
    .dd-tab {
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        padding: 8px 10px !important;
        font-size: 12px !important;
    }
    /* Deal desk fields → single column */
    .dd-grid,
    div[style*="grid-template-columns: repeat(2"] {
        grid-template-columns: 1fr !important;
    }
    div[style*="grid-template-columns: repeat(3"] {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* ── 10. Inventory tab → cards wrap properly ── */
@media (max-width: 640px) {
    #inventoryGrid {
        grid-template-columns: 1fr !important;
    }
    div[style*="grid-template-columns: repeat(auto-fill, minmax(200px"] {
        grid-template-columns: 1fr !important;
    }
}

/* ── 11. Main container padding ── */
@media (max-width: 480px) {
    .main-container {
        padding: 15px 12px !important;
        border-radius: 10px !important;
    }
    /* Header: logo left, user right, stacked on very small */
    .header {
        gap: 10px !important;
        padding-bottom: 8px !important;
    }
    .user-badge {
        font-size: 12px !important;
        padding: 6px 12px !important;
    }
}

/* ── 12. Follow-ups tab: cards full width ── */
@media (max-width: 480px) {
    .followups-grid {
        grid-template-columns: 1fr !important;
    }
    .followup-item {
        padding: 12px !important;
    }
    /* Due date badge */
    .follow-up-date {
        font-size: 11px !important;
    }
}

/* ── 13. Bulk actions bar → stack on mobile ── */
@media (max-width: 480px) {
    .bulk-actions-bar {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
        padding: 12px !important;
    }
    .bulk-actions-buttons {
        width: 100% !important;
    }
    .bulk-actions-buttons button {
        flex: 1 !important;
        font-size: 12px !important;
        padding: 8px 4px !important;
        margin: 0 !important;
    }
}

/* ── 14. Analytics hierarchy filters → wrap ── */
@media (max-width: 640px) {
    #analyticsFiltersBar {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    #analyticsFiltersBar select,
    #analyticsFiltersBar input[type="date"] {
        width: 100% !important;
        font-size: 16px !important;
    }
    /* Date pickers row */
    #analyticsDateFrom,
    #analyticsDateTo {
        font-size: 16px !important; /* prevent iOS zoom */
    }
}

/* ── 15. iOS-specific: prevent input zoom ── */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    input[type="datetime-local"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px !important; /* iOS won't zoom if >= 16px */
    }
}

/* ── 16. Pagination controls → center and wrap ── */
@media (max-width: 480px) {
    #paginationControls {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 6px !important;
    }
    #paginationControls button {
        padding: 8px 12px !important;
        font-size: 13px !important;
        min-height: 40px !important;
    }
}

/* ── 17. Service Referrals table → scrollable ── */
@media (max-width: 640px) {
    #serviceReferralsContainer table,
    #serviceReferralsTable {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        white-space: nowrap !important;
        font-size: 12px !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE OVERHAUL v2 — Map, Analytics, Voice FAB performance
   ═══════════════════════════════════════════════════════════════════ */

/* ── Global performance: promote key layers ── */
#voiceNoteFab,
#voiceNotePanel,
.map-bottom-sheet,
.map-sheet-overlay,
#clusterSheet,
#mapFilterSheet,
#mobileRouteSheet,
#activeRouteModal {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* ══════════════════════════════════════════
   MAP TAB — Mobile Redesign (≤ 768px)
   ══════════════════════════════════════════ */
@media (max-width: 768px) {

    /* Map wrapper: no extra padding eating into viewport */
    .map-tab-wrapper {
        padding: 0 !important;
    }

    /* Map fills full available height */
    .prospect-map-container {
        height: calc(100svh - 220px) !important;
        max-height: none !important;
        min-height: 380px !important;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
    }

    /* Mobile top bar: tight, single row, scrollable */
    .map-controls-mobile {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        padding: 8px 12px !important;
        background: #fff !important;
        border-bottom: 1px solid #e2e8f0 !important;
        border-radius: 0 !important;
        margin-bottom: 0 !important;
        border-top: none !important;
        border-left: none !important;
        border-right: none !important;
        flex-shrink: 0 !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 100 !important;
    }
    .map-controls-mobile::-webkit-scrollbar { display: none; }

    /* Mobile filter button — pill style */
    .map-mobile-btn {
        flex-shrink: 0 !important;
        padding: 8px 16px !important;
        font-size: 13px !important;
        border-radius: 20px !important;
        white-space: nowrap !important;
        min-height: 36px !important;
    }
    .map-mobile-btn-filter {
        background: linear-gradient(135deg, #667eea, #764ba2) !important;
        color: white !important;
        border: none !important;
        font-weight: 700 !important;
    }
    .map-mobile-btn-reset {
        background: white !important;
        color: #764ba2 !important;
        border: 1.5px solid #764ba2 !important;
        font-weight: 600 !important;
    }

    /* Count label in mobile bar */
    #mapProspectCountMobile {
        font-size: 11px !important;
        color: #64748b !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        flex: 1 !important;
        min-width: 0 !important;
    }

    /* Mobile route bar — sticky above map */
    .mobile-route-bar {
        display: flex !important;
        position: sticky !important;
        bottom: 0 !important;
        z-index: 200 !important;
        left: 0 !important;
        right: 0 !important;
        margin: 0 !important;
        border-radius: 0 !important;
        background: linear-gradient(135deg, #1e3a5f, #2563eb) !important;
        padding: 10px 14px !important;
        gap: 10px !important;
        align-items: center !important;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.15) !important;
    }

    /* Map legend: tighter, no wrap */
    .map-legend-bar {
        padding: 6px 12px !important;
        gap: 10px !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
    }
    .map-legend-bar::-webkit-scrollbar { display: none; }
    .map-legend-item, .map-legend-hint {
        font-size: 11px !important;
        white-space: nowrap !important;
    }

    /* Route resume banner — full width */
    #routeResumeBanner {
        border-radius: 0 !important;
        margin: 0 !important;
    }

    /* Hierarchy filters bar (OEM/Admin) */
    #mapHierarchyFilters {
        border-radius: 0 !important;
        margin-bottom: 0 !important;
        padding: 8px 12px !important;
        gap: 8px !important;
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Bottom sheet: full-screen friendly heights */
    .map-bottom-sheet { max-height: 88vh !important; }
    .map-bottom-sheet-tall { max-height: 92vh !important; }

    /* Cluster sheet list items — larger tap targets */
    #clusterSheetList > div {
        min-height: 64px !important;
    }

    /* Route sheet stop cards */
    #mobileRouteStopsList > div {
        min-height: 60px !important;
    }

    /* Map popup — wider on mobile for easier tapping */
    .leaflet-popup-content-wrapper {
        max-width: calc(100vw - 48px) !important;
        min-width: 260px !important;
    }
    .leaflet-popup-content {
        width: auto !important;
        min-width: 240px !important;
        margin: 10px 12px !important;
    }

    /* Popup buttons — full width, min 44px tap targets */
    .leaflet-popup-content button {
        min-height: 44px !important;
        font-size: 13px !important;
    }

    /* Active Route Modal — full screen on mobile */
    #activeRouteModal {
        align-items: flex-end !important;
    }
    #activeRouteModal > div {
        width: 100% !important;
        max-width: 100% !important;
        height: 92vh !important;
        max-height: 92vh !important;
        margin: 0 !important;
        border-radius: 20px 20px 0 0 !important;
        overflow: hidden !important;
    }
    #activeRouteList {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        flex: 1 !important;
        padding-bottom: 20px !important;
    }

    /* Route stop action buttons — 44px tap targets */
    #activeRouteList button {
        min-height: 44px !important;
        font-size: 13px !important;
    }
}

/* ══════════════════════════════════════════
   ANALYTICS TAB — Mobile Redesign (≤ 768px)
   ══════════════════════════════════════════ */
@media (max-width: 768px) {

    /* Page title + action buttons row: stack on mobile */
    #analyticsTab > div:first-child {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
        margin-bottom: 10px !important;
    }
    #analyticsTab > div:first-child h2 {
        font-size: 17px !important;
        margin: 0 !important;
    }
    #analyticsTab > div:first-child > div {
        width: 100% !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
    }
    /* Action buttons: equal width, smaller */
    #fleetIntelAllBtn,
    #oemExportReportBtn {
        flex: 1 !important;
        font-size: 12px !important;
        padding: 9px 10px !important;
        text-align: center !important;
        justify-content: center !important;
        min-width: 0 !important;
    }

    /* Subheader paragraph — hide on mobile (saves vertical space) */
    #analyticsTab > p {
        display: none !important;
    }

    /* Hierarchy filters card — compact */
    #analyticsTab > div[style*="background: white"] {
        padding: 12px !important;
        margin-bottom: 12px !important;
    }
    #analyticsTab > div[style*="background: white"] h3 {
        font-size: 14px !important;
        margin-bottom: 10px !important;
    }
    /* Filter grid → 2 col → 1 col */
    #analyticsTab > div[style*="background: white"] > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
    #analyticsRegionFilterContainer,
    #analyticsDistrictFilterContainer,
    #analyticsDealerFilterContainer {
        grid-column: span 1 !important;
    }

    /* Current View indicator — compact */
    #analyticsViewIndicator {
        padding: 8px 10px !important;
        font-size: 12px !important;
        margin-top: 8px !important;
    }

    /* Dash row — force single column */
    .dash-row,
    .dash-row.has-conquest {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        margin-bottom: 12px !important;
    }

    /* Sales Performance panel — trim padding */
    .sp-panel {
        padding: 12px !important;
    }
    .sp-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }
    .sp-stat-num { font-size: 20px !important; }

    /* Conquest panel */
    .cq-dash-panel {
        padding: 12px !important;
    }
    .cq-dash-panel > div[style*="grid-template-columns"] {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .cq-dash-stat-num { font-size: 20px !important; }

    /* Deal Profit panel */
    .dp-panel { padding: 12px !important; }
    .dp-kpis {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }
    .dp-kpi-num { font-size: 16px !important; }

    /* Analytics content sections: no side padding */
    #analyticsContent {
        padding: 0 !important;
    }

    /* Analytics rep section */
    #analyticsRepSection {
        border-radius: 8px !important;
        overflow: hidden !important;
    }
    #analyticsRepSection table {
        font-size: 12px !important;
    }
    #analyticsRepSection th,
    #analyticsRepSection td {
        padding: 8px 8px !important;
        white-space: nowrap !important;
    }

    /* Charts: prevent overflow */
    #categoryChart { max-width: 100% !important; }
    canvas {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Conquest analytics panel */
    #conquestAnalyticsPanel {
        padding: 10px 12px !important;
        margin-bottom: 10px !important;
    }
    #conquestAnalyticsPanel div[style*="grid-template-columns: repeat(3"] {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
    }

    /* Stats summary cards */
    #analyticsContent > div:first-child {
        gap: 8px !important;
    }
}

/* Tiny phones: analytics 1-col filter grid */
@media (max-width: 480px) {
    #analyticsTab > div[style*="background: white"] > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    .sp-stats {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .dp-kpis {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ══════════════════════════════════════════
   PERFORMANCE: reduce repaints on mobile
   ══════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Leaflet tiles — GPU composite */
    .leaflet-tile-container,
    .leaflet-overlay-pane,
    .leaflet-marker-pane {
        will-change: transform;
    }

    /* Cluster markers */
    .leaflet-marker-icon,
    .leaflet-marker-shadow {
        will-change: transform;
        transform: translateZ(0);
    }

    /* Bottom sheets: GPU layer during animation */
    .map-bottom-sheet {
        will-change: transform;
        transform: translateZ(0);
    }
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE PROSPECT CARD — Global overflow guard
   Prevents ANY child element from bleeding outside card bounds
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Card itself is the clipping boundary */
    .prospect-card {
        overflow: hidden !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Every direct child respects card width */
    .prospect-card > * {
        max-width: 100% !important;
        box-sizing: border-box !important;
        min-width: 0 !important;
    }

    /* Prevent inline-style widths on fleet intel / detail boxes from overflowing */
    .prospect-card .fleet-intel-snippet,
    .prospect-card .prospect-details,
    .prospect-card .activity-section,
    .prospect-card .prospect-notes-section {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    /* All text inside expanded card wraps — no horizontal scroll */
    .prospect-card.expanded * {
        max-width: 100% !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
    }

    /* Inline-style flex containers inside cards — force wrap */
    .prospect-card [style*="display:flex"],
    .prospect-card [style*="display: flex"] {
        flex-wrap: wrap !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    /* Inline-style min-width overrides that push content wide */
    .prospect-card [style*="min-width:220px"],
    .prospect-card [style*="min-width: 220px"],
    .prospect-card [style*="min-width:280px"],
    .prospect-card [style*="min-width: 280px"] {
        min-width: 0 !important;
        width: 100% !important;
    }

    /* Detail items flow as wrapping inline-flex */
    .prospect-card .detail-item {
        display: inline-flex !important;
        flex-direction: column !important;
        gap: 1px !important;
        margin-right: 14px !important;
        margin-bottom: 8px !important;
        vertical-align: top !important;
        max-width: 100% !important;
    }

    /* Activity item: always full width, no bleed */
    .prospect-card .activity-item {
        width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        padding: 8px 0 !important;
    }

    /* Scrollable activity list stays in card */
    .prospect-card [style*="max-height: 200px"],
    .prospect-card [style*="max-height:200px"] {
        max-height: 200px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        width: 100% !important;
    }
}

        /* ── Consistent card component ───────────────────────────── */
        .sc-card {
            background: var(--sc-card-bg);
            border: 1px solid var(--sc-border);
            border-radius: var(--sc-radius-md);
            padding: 18px;
            box-shadow: var(--sc-shadow-sm);
            margin-bottom: 12px;
        }

        /* ── Cross-Team tab ──────────────────────────────────────── */
        .ct-handoff-card {
            background: var(--sc-card-bg);
            border: 1px solid var(--sc-border);
            border-radius: var(--sc-radius-md);
            padding: 16px 18px;
            box-shadow: var(--sc-shadow-sm);
            margin-bottom: 8px;
            transition: var(--sc-transition);
        }
        .ct-handoff-card:hover {
            box-shadow: var(--sc-shadow-md);
            transform: translateY(-1px);
        }

        /* ── OPS modal consistent inputs ─────────────────────────── */
        #addOpsModal input,
        #addOpsModal select,
        #addOpsModal textarea {
            border: 1.5px solid #334155;
            background: #0f172a;
            color: #f1f5f9;
        }
        #addOpsModal input:focus,
        #addOpsModal select:focus,
        #addOpsModal textarea:focus {
            border-color: var(--sc-purple-light);
            box-shadow: 0 0 0 3px rgba(168,85,247,0.15);
            outline: none;
        }
        #addOpsModal label {
            color: #cbd5e1;
            font-size: 12px;
        }

        /* ── Activity modal consistent ───────────────────────────── */
        #activityModal .modal-content {
            background: var(--sc-modal-bg);
        }
        #activityModal label {
            color: var(--sc-text-secondary);
        }
        #opsActivityBadge {
            background: rgba(99,102,241,0.08);
            border: 1px solid rgba(99,102,241,0.2);
            border-radius: var(--sc-radius-sm);
            padding: 8px 12px;
            font-size: 12px;
            font-weight: 600;
            color: #4f46e5;
            margin-bottom: 12px;
        }
        #opsActivityFields {
            background: #f8f7ff;
            border: 1px solid #e5e1ff;
            border-radius: var(--sc-radius-sm);
            padding: 14px;
            margin-top: 8px;
        }

        /* ── Handoff modal consistent ────────────────────────────── */
        #handoffModal > div {
            background: var(--sc-modal-bg);
            border: 1px solid var(--sc-border);
            color: var(--sc-text);
            box-shadow: 0 20px 60px rgba(0,0,0,0.15);
        }
        #handoffModal h2 {
            color: var(--sc-text);
        }
        #handoffModal textarea,
        #handoffModal select {
            background: var(--sc-input-bg);
            border: 1.5px solid var(--sc-border);
            color: var(--sc-text);
        }
        #handoffModal textarea:focus,
        #handoffModal select:focus {
            border-color: var(--sc-purple);
            box-shadow: 0 0 0 3px rgba(147,51,234,0.1);
            outline: none;
        }
        #handoffModal label,
        #handoffModal p {
            color: var(--sc-text-secondary);
        }

        /* ── Cross-Team filter buttons consistent ─────────────────── */
        #ctSegAll, #ctSegHandoff, #ctSegService {
            border-radius: var(--sc-radius-sm) !important;
            font-size: 13px !important;
            font-weight: 600 !important;
            padding: 7px 16px !important;
            transition: var(--sc-transition) !important;
            margin: 0 !important;
        }
        #ctStatusFilter {
            border: 1.5px solid var(--sc-border) !important;
            background: var(--sc-input-bg) !important;
            color: var(--sc-text) !important;
            border-radius: var(--sc-radius-sm) !important;
        }

        /* ── OPS Prospects tab ───────────────────────────────────── */
        #opsTab .sc-kpi-tile,
        #opsTab [style*="background:var(--card-bg"] {
            background: var(--sc-card-bg) !important;
            border: 1px solid var(--sc-border) !important;
        }

        /* ── Notification badge on tabs ──────────────────────────── */
        .ct-badge {
            display: inline-flex !important;
            align-items: center !important;
            justify-content: center !important;
            min-width: 18px !important;
            height: 18px !important;
            padding: 0 5px !important;
            background: #ef4444 !important;
            color: white !important;
            border-radius: 999px !important;
            font-size: 11px !important;
            font-weight: 700 !important;
            margin-left: 6px !important;
            vertical-align: middle !important;
            animation: ctBadgePop 0.3s ease-out;
        }
        @keyframes ctBadgePop {
            from { transform: scale(0); opacity: 0; }
            to   { transform: scale(1); opacity: 1; }
        }

        /* ── Dashboard section headers ───────────────────────────── */
        .dashboard-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 12px;
            margin-bottom: 16px;
        }
        .dashboard-header h2 {
            font-size: 22px;
            font-weight: 700;
            color: var(--sc-text);
            margin: 0;
        }

        /* ── Form group spacing ──────────────────────────────────── */
        .form-group {
            margin-bottom: 16px;
        }
        .form-group label {
            color: var(--sc-text-secondary);
            font-size: 12px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            margin-bottom: 4px;
        }

/* ── OPS Type Filter Pills ───────────────────────────────────── */
.ops-pill {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1.5px solid var(--sc-border);
    background: var(--sc-card-bg);
    color: var(--sc-text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--sc-transition);
    white-space: nowrap;
    margin: 0;
}
.ops-pill:hover {
    opacity: 0.8;
}
.ops-pill-active {
    background: linear-gradient(135deg, var(--sc-purple), var(--sc-pink)) !important;
    color: white !important;
    border-color: transparent !important;
}
