    * { margin: 0; padding: 0; box-sizing: border-box; }
    body {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
      background: linear-gradient(135deg, #050508 0%, #0a0a12 50%, #080810 100%);
      min-height: 100vh;
      color: #e5e7eb;
      display: flex;
    }

    /* Dashboard Container - must be flex for child flex items to work */
    #dashboardContainer {
      display: flex;
      width: 100%;
      min-height: 100vh;
    }

    /* Sidebar Styles */
    .sidebar {
      width: 240px;
      background: linear-gradient(180deg, #0c0c14 0%, #08080e 100%);
      border-right: 1px solid rgba(104, 28, 235, 0.1);
      display: flex;
      flex-direction: column;
      position: fixed;
      top: 0;
      left: 0;
      height: 100vh;
      z-index: 100;
      box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    }
    .sidebar-logo {
      padding: 20px;
      border-bottom: 1px solid rgba(104, 28, 235, 0.15);
      display: flex;
      align-items: center;
      gap: 12px;
      background: linear-gradient(180deg, rgba(104, 28, 235, 0.05) 0%, transparent 100%);
    }
    .sidebar-logo img { width: 36px; height: 36px; filter: drop-shadow(0 2px 8px rgba(104, 28, 235, 0.3)); border-radius: 8px; }
    .sidebar-logo-text {
      font-size: 18px; font-weight: 700;
      background: linear-gradient(135deg, #8b5cf6, #a78bfa, #c4b5fd);
      -webkit-background-clip: text; -webkit-text-fill-color: transparent;
      text-shadow: 0 0 30px rgba(139, 92, 246, 0.3);
    }
    .sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
    .sidebar-section { margin-bottom: 24px; }
    .sidebar-section-title {
      font-size: 10px; font-weight: 600; color: #6b7280;
      text-transform: uppercase; letter-spacing: 1px;
      padding: 0 12px; margin-bottom: 8px;
    }
    .sidebar-item {
      display: flex; align-items: center; gap: 12px;
      padding: 12px; border-radius: 10px;
      color: #9ca3af; font-size: 14px; font-weight: 500;
      cursor: pointer; transition: all 0.2s ease;
      margin-bottom: 4px; position: relative;
    }
    .sidebar-item:hover { background: rgba(104, 28, 235, 0.1); color: #e5e7eb; }
    .sidebar-item.active {
      background: linear-gradient(135deg, rgba(104, 28, 235, 0.2), rgba(139, 92, 246, 0.15));
      color: #c4b5fd;
      border-left: 3px solid #8b5cf6;
      margin-left: -3px;
      box-shadow: 0 0 20px rgba(104, 28, 235, 0.1);
    }
    .sidebar-item svg { width: 20px; height: 20px; flex-shrink: 0; }
    .sidebar-item .badge {
      position: absolute; right: 12px;
      background: #8b5cf6; color: white;
      font-size: 10px; font-weight: 600;
      padding: 2px 8px; border-radius: 10px;
    }
    .sidebar-item .badge.green { background: #8b5cf6; }
    .sidebar-footer {
      padding: 16px;
      border-top: 1px solid rgba(104, 28, 235, 0.12);
      background: linear-gradient(180deg, transparent 0%, rgba(104, 28, 235, 0.03) 100%);
    }
    .sidebar-user {
      display: flex; align-items: center; gap: 12px;
      padding: 12px; border-radius: 12px;
      background: linear-gradient(135deg, rgba(104, 28, 235, 0.08), rgba(139, 92, 246, 0.05));
      border: 1px solid rgba(104, 28, 235, 0.1);
      margin-bottom: 12px;
    }
    .sidebar-user-avatar {
      width: 36px; height: 36px; border-radius: 8px;
      background: linear-gradient(135deg, #681CEB, #4c1d95);
      display: flex; align-items: center; justify-content: center;
      font-weight: 600; font-size: 14px;
    }
    .sidebar-user-info { flex: 1; overflow: hidden; }
    .sidebar-user-name { font-size: 13px; font-weight: 600; color: #f3f4f6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .sidebar-user-role { font-size: 11px; color: #6b7280; }
    .sidebar-logout {
      display: flex; align-items: center; justify-content: center; gap: 8px;
      width: 100%; padding: 10px;
      background: rgba(107, 114, 128, 0.1); border: 1px solid rgba(107, 114, 128, 0.2);
      border-radius: 10px; color: #9ca3af; font-size: 13px; font-weight: 500;
      cursor: pointer; transition: all 0.2s ease;
    }
    .sidebar-logout:hover { background: rgba(168, 85, 247, 0.1); border-color: rgba(168, 85, 247, 0.3); color: #c084fc; }
    .sidebar-logout svg { width: 16px; height: 16px; }

    /* Tier Usage Indicator */
    .tier-indicator {
      padding: 14px;
      margin-bottom: 12px;
      background: linear-gradient(135deg, rgba(104, 28, 235, 0.05), rgba(10, 10, 18, 0.5));
      border-radius: 12px;
      border: 1px solid rgba(104, 28, 235, 0.12);
    }
    .tier-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 4px 10px;
      border-radius: 6px;
      font-size: 11px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin-bottom: 10px;
    }
    .tier-badge.starter { background: rgba(107, 114, 128, 0.15); color: #9ca3af; border: 1px solid rgba(107, 114, 128, 0.2); }
    .tier-badge.pro { background: linear-gradient(135deg, rgba(104, 28, 235, 0.2), rgba(139, 92, 246, 0.15)); color: #a78bfa; border: 1px solid rgba(104, 28, 235, 0.3); }
    .tier-badge.business { background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(167, 139, 250, 0.15)); color: #c4b5fd; border: 1px solid rgba(139, 92, 246, 0.3); }
    .tier-badge.unlimited { background: linear-gradient(135deg, rgba(167, 139, 250, 0.25), rgba(196, 181, 253, 0.2)); color: #e9d5ff; border: 1px solid rgba(167, 139, 250, 0.4); box-shadow: 0 0 12px rgba(167, 139, 250, 0.2); }
    .tier-usage-label {
      display: flex;
      justify-content: space-between;
      font-size: 11px;
      color: #6b7280;
      margin-bottom: 6px;
    }
    .tier-usage-bar {
      height: 6px;
      background: rgba(255,255,255,0.1);
      border-radius: 3px;
      overflow: hidden;
    }
    .tier-usage-fill {
      height: 100%;
      background: linear-gradient(90deg, #8b5cf6, #a78bfa);
      border-radius: 3px;
      transition: width 0.3s ease;
      box-shadow: 0 0 8px rgba(139, 92, 246, 0.3);
    }
    .tier-usage-fill.warning { background: linear-gradient(90deg, #c084fc, #a78bfa); }
    .tier-usage-fill.critical { background: linear-gradient(90deg, #e879f9, #c084fc); }
    .tier-upgrade-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      width: 100%;
      padding: 8px;
      margin-top: 10px;
      background: linear-gradient(135deg, rgba(104, 28, 235, 0.2), rgba(104, 28, 235, 0.1));
      border: 1px solid rgba(104, 28, 235, 0.3);
      border-radius: 6px;
      color: #a78bfa;
      font-size: 11px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .tier-upgrade-btn:hover { background: rgba(104, 28, 235, 0.3); }

    /* Feature Locked Styles */
    .feature-locked {
      position: relative;
      pointer-events: none;
    }
    .feature-locked::after {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(10, 10, 10, 0.7);
      border-radius: inherit;
      z-index: 10;
    }
    .feature-locked-overlay {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      z-index: 11;
      text-align: center;
      padding: 20px;
      background: rgba(0, 0, 0, 0.9);
      border: 1px solid rgba(104, 28, 235, 0.3);
      border-radius: 12px;
      pointer-events: auto;
    }
    .feature-locked-icon {
      font-size: 32px;
      margin-bottom: 8px;
    }
    .feature-locked-title {
      font-size: 14px;
      font-weight: 600;
      color: #f3f4f6;
      margin-bottom: 4px;
    }
    .feature-locked-desc {
      font-size: 12px;
      color: #9ca3af;
      margin-bottom: 12px;
    }
    .feature-locked-btn {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 8px 16px;
      background: linear-gradient(135deg, #681CEB, #4c1d95);
      border: none;
      border-radius: 6px;
      color: white;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .feature-locked-btn:hover {
      transform: scale(1.05);
      box-shadow: 0 4px 15px rgba(104, 28, 235, 0.4);
    }
    .checkbox-locked {
      opacity: 0.5;
      pointer-events: none;
    }
    .checkbox-locked-wrapper {
      position: relative;
    }
    .checkbox-locked-badge {
      position: absolute;
      right: 8px;
      top: 8px;
      font-size: 9px;
      padding: 2px 6px;
      background: rgba(104, 28, 235, 0.3);
      color: #a78bfa;
      border-radius: 4px;
      font-weight: 600;
      letter-spacing: 0.3px;
    }
    .feature-card-lockable {
      position: relative;
    }
    .sidebar-item.locked {
      opacity: 0.5;
      cursor: not-allowed;
    }
    .sidebar-item.locked::after {
      content: '🔒';
      position: absolute;
      right: 12px;
      font-size: 12px;
    }
    .input-locked {
      opacity: 0.5;
      pointer-events: none;
      background: rgba(255,255,255,0.02) !important;
    }
    .section-locked-banner {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 12px 16px;
      background: linear-gradient(135deg, rgba(104, 28, 235, 0.1), rgba(104, 28, 235, 0.05));
      border: 1px solid rgba(104, 28, 235, 0.2);
      border-radius: 8px;
      margin-bottom: 16px;
    }
    .section-locked-banner-icon {
      font-size: 20px;
    }
    .section-locked-banner-text {
      flex: 1;
    }
    .section-locked-banner-title {
      font-size: 13px;
      font-weight: 600;
      color: #a78bfa;
    }
    .section-locked-banner-desc {
      font-size: 11px;
      color: #9ca3af;
    }
    .section-locked-banner-btn {
      padding: 6px 12px;
      background: rgba(104, 28, 235, 0.2);
      border: 1px solid rgba(104, 28, 235, 0.3);
      border-radius: 6px;
      color: #a78bfa;
      font-size: 11px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .section-locked-banner-btn:hover {
      background: rgba(104, 28, 235, 0.3);
    }

    .tier-warning {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-top: 8px;
      padding: 6px 8px;
      background: rgba(239, 68, 68, 0.1);
      border: 1px solid rgba(239, 68, 68, 0.2);
      border-radius: 6px;
      font-size: 10px;
      color: #9ca3af;
    }

    /* Main Content Area */
    .main-content {
      flex: 1;
      margin-left: 240px;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }
    .main-header {
      padding: 20px 32px;
      border-bottom: 1px solid rgba(104, 28, 235, 0.1);
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: linear-gradient(180deg, rgba(10, 10, 18, 0.95) 0%, rgba(8, 8, 14, 0.9) 100%);
      backdrop-filter: blur(10px);
    }
    .main-header-title h1 {
      font-size: 24px; font-weight: 700; color: #f3f4f6; margin-bottom: 4px;
      background: linear-gradient(135deg, #f3f4f6, #d1d5db);
      -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    }
    .main-header-title p { font-size: 14px; color: #9ca3af; }
    .main-header-actions { display: flex; align-items: center; gap: 12px; }
    .main-body { flex: 1; padding: 24px 32px; overflow-y: auto; width: 100%; box-sizing: border-box; }

    .container { max-width: 1400px; margin: 0 auto; padding: 24px; }
    .header {
      display: none; /* Hide old header */
    }
    .logo { display: flex; align-items: center; gap: 12px; }
    .logo svg { width: 40px; height: 40px; }
    .logo-text {
      font-size: 24px; font-weight: 700;
      background: linear-gradient(135deg, #681CEB, #a78bfa);
      -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    }
    .header-right { display: flex; align-items: center; gap: 16px; }
    .status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #6b7280; }
    .status-dot { width: 8px; height: 8px; border-radius: 50%; background: #8b5cf6; }
    .status-dot.connected { background: #8b5cf6; animation: pulse 2s infinite; }
    @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
    .refresh-btn {
      display: flex; align-items: center; gap: 8px; padding: 10px 20px;
      background: linear-gradient(135deg, rgba(104, 28, 235, 0.15), rgba(139, 92, 246, 0.1));
      border: 1px solid rgba(104, 28, 235, 0.25);
      border-radius: 10px; color: #a78bfa; font-size: 14px; font-weight: 500; cursor: pointer;
      transition: all 0.2s ease;
      box-shadow: 0 2px 8px rgba(104, 28, 235, 0.1);
    }
    .refresh-btn:hover {
      background: linear-gradient(135deg, rgba(104, 28, 235, 0.25), rgba(139, 92, 246, 0.2));
      border-color: rgba(104, 28, 235, 0.4);
      box-shadow: 0 4px 16px rgba(104, 28, 235, 0.2);
      transform: translateY(-1px);
    }
    .tabs { display: none; /* Hide old tabs */ }
    .tab-btn {
      padding: 10px 20px; background: rgba(15, 15, 25, 0.5); border: 1px solid rgba(104, 28, 235, 0.1);
      border-radius: 10px; color: #9ca3af; font-size: 14px; font-weight: 500; cursor: pointer; position: relative;
      transition: all 0.2s ease;
    }
    .tab-btn:hover { background: rgba(104, 28, 235, 0.1); border-color: rgba(104, 28, 235, 0.2); color: #c4b5fd; }
    .tab-btn.active {
      background: linear-gradient(135deg, rgba(104, 28, 235, 0.2), rgba(139, 92, 246, 0.15));
      border-color: rgba(104, 28, 235, 0.4);
      color: #a78bfa;
      box-shadow: 0 0 20px rgba(104, 28, 235, 0.15);
    }
    .tab-btn .badge-count {
      position: absolute; top: -6px; right: -6px; background: #8b5cf6; color: white;
      font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 10px; min-width: 18px;
    }
    .tab-content { display: none; width: 100%; box-sizing: border-box; }
    .tab-content.active { display: block; width: 100%; box-sizing: border-box; }
    .stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 24px; width: 100%; box-sizing: border-box; }
    .stat-card {
      background: linear-gradient(145deg, rgba(15, 15, 25, 0.9) 0%, rgba(10, 10, 18, 0.95) 100%);
      border: 1px solid rgba(104, 28, 235, 0.12);
      border-radius: 16px; padding: 20px; position: relative;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.03);
      transition: all 0.3s ease;
    }
    .stat-card:hover {
      border-color: rgba(104, 28, 235, 0.4);
      box-shadow: 0 8px 32px rgba(104, 28, 235, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.05);
      transform: translateY(-2px);
    }
    .stat-card-icon {
      position: absolute; top: 16px; right: 16px;
      width: 36px; height: 36px; border-radius: 10px;
      display: flex; align-items: center; justify-content: center;
      background: linear-gradient(135deg, rgba(104, 28, 235, 0.2), rgba(139, 92, 246, 0.15));
      color: #a78bfa;
      box-shadow: 0 2px 8px rgba(104, 28, 235, 0.2);
    }
    .stat-card-icon.warning { background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(139, 92, 246, 0.15)); color: #c084fc; }
    .stat-card-icon.success { background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(104, 28, 235, 0.15)); color: #a78bfa; }
    .stat-card-icon.info { background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(104, 28, 235, 0.15)); color: #a5b4fc; }
    .stat-label { font-size: 12px; color: #6b7280; margin-bottom: 8px; }
    .stat-value {
      font-size: 32px; font-weight: 700; color: #f3f4f6; margin-bottom: 4px;
    }
    .stat-value.warning { color: #c084fc; }
    .stat-value.success { color: #a78bfa; }
    .stat-sub { font-size: 12px; color: #6b7280; }
    .live-chat-container { display: grid; grid-template-columns: 320px 1fr; gap: 20px; height: calc(100vh - 180px); min-height: 500px; width: 100%; box-sizing: border-box; }
    .conversations-list {
      background: linear-gradient(145deg, rgba(15, 15, 25, 0.9) 0%, rgba(10, 10, 18, 0.95) 100%);
      border: 1px solid rgba(104, 28, 235, 0.12);
      border-radius: 16px; display: flex; flex-direction: column; overflow: hidden;
      box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    }
    .conversations-header { padding: 16px; border-bottom: 1px solid rgba(104, 28, 235, 0.1); }
    .conversations-header h3 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
    .rating-filter-btn {
      padding: 5px 10px; font-size: 11px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.1);
      background: transparent; color: #9ca3af; cursor: pointer; transition: all 0.2s ease;
    }
    .rating-filter-btn:hover { background: rgba(255,255,255,0.05); }
    .rating-filter-btn.active { background: rgba(104, 28, 235, 0.2); border-color: rgba(104, 28, 235, 0.3); color: #a78bfa; }
    .search-input {
      width: 100%; padding: 10px 12px; background: rgba(10, 10, 18, 0.5);
      border: 1px solid rgba(104, 28, 235, 0.15); border-radius: 10px; color: #e5e7eb; font-size: 13px;
      transition: all 0.2s ease;
    }
    .search-input:focus { outline: none; border-color: rgba(139, 92, 246, 0.5); box-shadow: 0 0 16px rgba(139, 92, 246, 0.15); }
    .conversations-scroll { flex: 1; overflow-y: auto; }
    .conversation-item { padding: 14px 16px; border-bottom: 1px solid rgba(104, 28, 235, 0.06); cursor: pointer; transition: all 0.2s ease; }
    .conversation-item:hover { background: rgba(104, 28, 235, 0.08); }
    .conversation-item.active { background: linear-gradient(90deg, rgba(104, 28, 235, 0.2), rgba(139, 92, 246, 0.1)); border-left: 3px solid #8b5cf6; }
    .conversation-item.human-request { border-left: 3px solid #a78bfa; background: rgba(167, 139, 250, 0.05); }
    .conversation-item.human-unread { border-left: 3px solid #fbbf24; background: rgba(251, 191, 36, 0.06); }
    .conv-name.unread { font-weight: 700; color: #fff; }
    .conv-preview.unread { color: #d1d5db; }
    .conv-badge.unread-count { background: rgba(251, 191, 36, 0.2); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.3); }
    .conv-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
    .conv-name { font-size: 14px; font-weight: 500; color: #f3f4f6; }
    .conv-time { font-size: 11px; color: #6b7280; }
    .conv-preview { font-size: 12px; color: #9ca3af; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .conv-badges { display: flex; gap: 6px; margin-top: 6px; }
    .conv-badge { font-size: 10px; padding: 2px 8px; border-radius: 4px; font-weight: 500; }
    .conv-badge.human { background: rgba(168, 85, 247, 0.25); color: #c4b5fd; border: 1px solid rgba(168, 85, 247, 0.3); font-size: 11px; }
    .conv-badge.ai { background: rgba(104, 28, 235, 0.2); color: #a78bfa; }
    .conv-badge.resolved { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
    .conv-badge.rating-up { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
    .conv-badge.rating-down { background: rgba(192, 132, 252, 0.2); color: #c084fc; }
    .rating-icon { display: inline-flex; align-items: center; gap: 3px; }
    .pulse-dot { display:inline-block;width:8px;height:8px;border-radius:50%;background:#a855f7;margin-right:6px;animation:pulse-glow 1.5s infinite; }
    @keyframes pulse-glow { 0%,100%{opacity:1;box-shadow:0 0 4px #a855f7;} 50%{opacity:0.4;box-shadow:0 0 8px #a855f7;} }
    .mode-badge-ai { font-size:9px;padding:1px 6px;border-radius:4px;background:rgba(34,197,94,0.15);color:#22c55e;margin-left:6px; }
    .mode-badge-human { font-size:9px;padding:1px 6px;border-radius:4px;background:rgba(168,85,247,0.2);color:#a855f7;margin-left:6px; }
    .transition-marker { text-align:center;padding:8px 0;color:#6b7280;font-size:11px;font-style:italic; }
    .chat-panel {
      background: linear-gradient(145deg, rgba(15, 15, 25, 0.9) 0%, rgba(10, 10, 18, 0.95) 100%);
      border: 1px solid rgba(104, 28, 235, 0.12);
      border-radius: 16px; display: flex; flex-direction: column; overflow: hidden;
      box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    }
    .chat-header { padding: 16px 20px; border-bottom: 1px solid rgba(104, 28, 235, 0.1); display: flex; justify-content: space-between; align-items: center; }
    .chat-user-info { display: flex; align-items: center; gap: 12px; }
    .chat-avatar {
      width: 40px; height: 40px; border-radius: 10px;
      background: linear-gradient(135deg, #681CEB, #4c1d95);
      display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 16px;
    }
    .chat-user-name { font-size: 15px; font-weight: 600; }
    .chat-user-email { font-size: 12px; color: #6b7280; }
    .chat-status-badge { padding: 6px 12px; border-radius: 6px; font-size: 12px; font-weight: 500; }
    .chat-status-badge.human { background: rgba(167, 139, 250, 0.2); color: #c4b5fd; border: 1px solid rgba(167, 139, 250, 0.3); }
    .chat-status-badge.ai { background: rgba(104, 28, 235, 0.2); color: #a78bfa; }
    .chat-rating-badge { padding: 6px 12px; border-radius: 6px; font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 6px; margin-left: 8px; }
    .chat-rating-badge.up { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
    .chat-rating-badge.down { background: rgba(192, 132, 252, 0.2); color: #c084fc; }
    .chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
    .chat-message { display: flex; gap: 10px; max-width: 80%; }
    .chat-message.user, .chat-message.admin { align-self: flex-end; flex-direction: row-reverse; }
    .msg-avatar { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 14px; }
    .msg-avatar.user { background: linear-gradient(135deg, #681CEB, #4c1d95); }
    .msg-avatar.ai { background: rgba(104, 28, 235, 0.2); }
    .msg-avatar.admin { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
    .msg-content { padding: 12px 16px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
    .chat-message.ai .msg-content { background: rgba(255,255,255,0.05); border-radius: 12px 12px 12px 4px; }
    .chat-message.user .msg-content { background: linear-gradient(135deg, #681CEB, #4c1d95); border-radius: 12px 12px 4px 12px; }
    .chat-message.admin .msg-content { background: linear-gradient(135deg, #8b5cf6, #6d28d9); border-radius: 12px 12px 4px 12px; }
    .msg-time { font-size: 10px; color: #6b7280; margin-top: 4px; }
    .chat-input-area { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08); display: flex; gap: 12px; }
    .chat-input {
      flex: 1; padding: 12px 16px; background: rgba(0,0,0,0.3);
      border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; color: #f3f4f6; font-size: 14px; resize: none;
    }
    .chat-input:focus { outline: none; border-color: rgba(104, 28, 235, 0.5); }
    .send-btn {
      padding: 12px 24px; background: linear-gradient(135deg, #7c3aed, #6d28d9);
      border: none; border-radius: 12px; color: white; font-size: 14px; font-weight: 600; cursor: pointer;
      display: flex; align-items: center; gap: 8px;
      box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
      transition: all 0.2s ease;
    }
    .send-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4); background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
    .send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
    .no-chat-selected { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #6b7280; }
    .no-chat-selected svg { width: 64px; height: 64px; margin-bottom: 16px; opacity: 0.3; }
    .charts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 24px; width: 100%; box-sizing: border-box; }
    .chart-card {
      background: linear-gradient(145deg, rgba(15, 15, 25, 0.9) 0%, rgba(10, 10, 18, 0.95) 100%);
      border: 1px solid rgba(104, 28, 235, 0.12);
      border-radius: 16px; padding: 24px;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
      transition: all 0.3s ease;
    }
    .chart-card:hover {
      border-color: rgba(104, 28, 235, 0.25);
      box-shadow: 0 8px 32px rgba(104, 28, 235, 0.1);
    }
    .chart-title { font-size: 14px; font-weight: 600; margin-bottom: 16px; }
    .chart-container { position: relative; height: 220px; }
    .loading { display: flex; align-items: center; justify-content: center; padding: 40px; color: #9ca3af; }
    .spinner { width: 24px; height: 24px; border: 3px solid rgba(139, 92, 246, 0.2); border-top-color: #8b5cf6; border-radius: 50%; animation: spin 1s linear infinite; margin-right: 12px; box-shadow: 0 0 10px rgba(139, 92, 246, 0.2); }
    @keyframes spin { to { transform: rotate(360deg); } }
    @keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
    @keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

    /* Team/Employee styles */
    .team-container { width: 100%; box-sizing: border-box; }
    .team-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
    .team-header h2 { font-size: 20px; font-weight: 600; }
    .online-indicator { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: rgba(139, 92, 246, 0.1); border: 1px solid rgba(139, 92, 246, 0.3); border-radius: 10px; }
    .online-indicator .dot { width: 10px; height: 10px; background: #8b5cf6; border-radius: 50%; animation: pulse 2s infinite; box-shadow: 0 0 8px rgba(139, 92, 246, 0.5); }
    .online-indicator.offline { background: rgba(107, 114, 128, 0.1); border-color: rgba(107, 114, 128, 0.3); }
    .online-indicator.offline .dot { background: #6b7280; animation: none; box-shadow: none; }
    .add-employee-btn {
      display: flex; align-items: center; gap: 8px; padding: 12px 24px;
      background: linear-gradient(135deg, #7c3aed, #6d28d9, #5b21b6);
      border: none;
      border-radius: 12px; color: white; font-size: 14px; font-weight: 600; cursor: pointer;
      box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35);
      transition: all 0.3s ease;
    }
    .add-employee-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 24px rgba(124, 58, 237, 0.45);
      background: linear-gradient(135deg, #8b5cf6, #7c3aed, #6d28d9);
    }
    .employee-list { display: flex; flex-direction: column; gap: 12px; width: 100%; }
    .employee-card {
      display: flex; align-items: center; justify-content: space-between;
      background: linear-gradient(145deg, rgba(15, 15, 25, 0.9) 0%, rgba(10, 10, 18, 0.95) 100%);
      border: 1px solid rgba(104, 28, 235, 0.1);
      border-radius: 14px; padding: 18px 22px;
      transition: all 0.3s ease;
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    }
    .employee-card:hover {
      border-color: rgba(104, 28, 235, 0.35);
      box-shadow: 0 4px 20px rgba(104, 28, 235, 0.12);
      transform: translateY(-1px);
    }
    .employee-info { display: flex; align-items: center; gap: 14px; }
    .employee-avatar {
      width: 44px; height: 44px; border-radius: 10px;
      background: linear-gradient(135deg, #681CEB, #4c1d95);
      display: flex; align-items: center; justify-content: center;
      font-weight: 600; font-size: 18px; color: white;
    }
    .employee-details { display: flex; flex-direction: column; gap: 2px; }
    .employee-name { font-size: 15px; font-weight: 600; }
    .employee-role { font-size: 12px; color: #9ca3af; }
    .employee-actions { display: flex; align-items: center; gap: 12px; }
    .status-toggle {
      position: relative; width: 52px; height: 28px;
      background: rgba(107, 114, 128, 0.3); border-radius: 14px; cursor: pointer; transition: all 0.3s ease;
    }
    .status-toggle.online { background: linear-gradient(135deg, rgba(139, 92, 246, 0.6), rgba(124, 58, 237, 0.5)); box-shadow: 0 0 12px rgba(139, 92, 246, 0.3); }
    .status-toggle::after {
      content: ''; position: absolute; top: 3px; left: 3px;
      width: 22px; height: 22px; background: white; border-radius: 50%; transition: transform 0.3s;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    .status-toggle.online::after { transform: translateX(24px); }
    .status-label { font-size: 12px; color: #9ca3af; min-width: 50px; }
    .status-label.online { color: #e5e7eb; }
    .delete-btn {
      padding: 8px; background: rgba(168, 85, 247, 0.1); border: 1px solid rgba(168, 85, 247, 0.25);
      border-radius: 8px; color: #c084fc; cursor: pointer; transition: all 0.2s ease;
    }
    .delete-btn:hover { background: rgba(168, 85, 247, 0.2); border-color: rgba(168, 85, 247, 0.4); }

    /* Add employee modal */
    .modal-overlay {
      display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7);
      align-items: center; justify-content: center; z-index: 1000;
    }
    .modal-overlay.active { display: flex; }
    .modal {
      background: linear-gradient(145deg, #12121e 0%, #0c0c14 100%);
      border: 1px solid rgba(104, 28, 235, 0.2);
      border-radius: 20px; padding: 28px; width: 420px; max-width: 90%;
      box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(104, 28, 235, 0.1);
    }
    .modal-content {
      background: #111827;
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 16px; padding: 24px; max-width: 90%;
      box-shadow: 0 25px 60px rgba(0,0,0,0.5);
    }
    .modal h3 { font-size: 18px; font-weight: 600; margin-bottom: 20px; }
    .modal-input {
      width: 100%; padding: 12px 16px; background: rgba(0,0,0,0.3);
      border: 1px solid rgba(255,255,255,0.1); border-radius: 8px;
      color: #f3f4f6; font-size: 14px; margin-bottom: 12px;
    }
    .modal-input:focus { outline: none; border-color: rgba(104, 28, 235, 0.5); }
    .modal-actions { display: flex; gap: 12px; margin-top: 20px; }
    .modal-btn {
      flex: 1; padding: 12px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer;
    }
    .modal-btn.cancel { background: rgba(107, 114, 128, 0.2); border: 1px solid rgba(107, 114, 128, 0.3); color: #9ca3af; }
    .modal-btn.save { background: linear-gradient(135deg, #681CEB, #4c1d95); border: none; color: white; }

    /* KB Type Selection Cards */
    .kb-type-card:hover {
      border-color: rgba(139,92,246,0.5) !important;
      background: rgba(139,92,246,0.15) !important;
      transform: translateY(-2px);
    }
    .kb-type-card.selected {
      border-color: #8b5cf6 !important;
      background: rgba(139,92,246,0.2) !important;
    }

    /* KB Item Cards */
    .kb-item:hover {
      background: rgba(139,92,246,0.08);
      border-color: rgba(139,92,246,0.25);
    }

    /* =====================================================
       PREMIUM n8n-STYLE WORKFLOW CANVAS EDITOR
       ===================================================== */

    /* Work in Progress Banner */
    .wip-banner {
      background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(245, 158, 11, 0.1) 100%);
      border: 1px solid rgba(251, 191, 36, 0.3);
      border-radius: 12px;
      margin: 12px 16px;
      padding: 0;
      animation: wipSlideIn 0.3s ease-out;
    }
    @keyframes wipSlideIn {
      from { opacity: 0; transform: translateY(-10px); }
      to { opacity: 1; transform: translateY(0); }
    }
    .wip-content {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 16px;
    }
    .wip-icon {
      font-size: 24px;
      flex-shrink: 0;
    }
    .wip-text {
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .wip-text strong {
      color: #c4b5fd;
      font-size: 14px;
    }
    .wip-text span {
      color: #9ca3af;
      font-size: 12px;
    }
    .wip-close {
      background: rgba(255,255,255,0.1);
      border: none;
      border-radius: 6px;
      width: 28px;
      height: 28px;
      color: #9ca3af;
      font-size: 18px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.15s ease;
      flex-shrink: 0;
    }
    .wip-close:hover {
      background: rgba(255,255,255,0.2);
      color: white;
    }

    .workflow-container {
      display: flex;
      height: calc(100vh - 220px);
      min-height: 600px;
      gap: 0;
      position: relative;
      width: 100%;
      box-sizing: border-box;
    }

    /* ===== SIDEBAR - Node Palette ===== */
    .workflow-sidebar {
      width: 240px;
      background: linear-gradient(180deg, rgba(20,20,35,0.98) 0%, rgba(15,15,25,0.98) 100%);
      border: 1px solid rgba(255,255,255,0.06);
      border-radius: 16px 0 0 16px;
      display: flex;
      flex-direction: column;
      flex-shrink: 0;
      backdrop-filter: blur(20px);
    }
    .sidebar-header {
      padding: 16px;
      border-bottom: 1px solid rgba(255,255,255,0.06);
      background: linear-gradient(180deg, rgba(104,28,235,0.08) 0%, transparent 100%);
    }
    .sidebar-header h3 {
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: #a78bfa;
      margin-bottom: 4px;
    }
    .sidebar-header p { font-size: 10px; color: #6b7280; margin-bottom: 12px; }
    .sidebar-add-btn {
      width: 100%;
      padding: 10px 14px;
      background: linear-gradient(135deg, #681CEB, #4c1d95);
      border: none;
      border-radius: 8px;
      color: white;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      transition: all 0.2s ease;
    }
    .sidebar-add-btn:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(104, 28, 235, 0.4);
    }
    .sidebar-add-btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
      transform: none;
    }
    .sidebar-add-btn svg { width: 14px; height: 14px; }
    .sidebar-section-label {
      font-size: 10px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: #4b5563;
      padding: 12px 16px 6px;
      margin-top: 8px;
    }
    .sidebar-nodes {
      flex: 1;
      overflow-y: auto;
      padding: 8px 12px 16px;
    }
    .sidebar-nodes::-webkit-scrollbar { width: 4px; }
    .sidebar-nodes::-webkit-scrollbar-thumb { background: rgba(104,28,235,0.3); border-radius: 2px; }
    .sidebar-node {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 14px;
      background: rgba(255,255,255,0.02);
      border: 1px solid rgba(255,255,255,0.04);
      border-radius: 10px;
      margin-bottom: 6px;
      cursor: grab;
      transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .sidebar-node:hover {
      background: rgba(104, 28, 235, 0.12);
      border-color: rgba(104, 28, 235, 0.25);
      transform: translateX(4px);
      box-shadow: 0 4px 12px rgba(104, 28, 235, 0.15);
    }
    .sidebar-node:active { cursor: grabbing; transform: scale(0.98); }
    .sidebar-node.dragging { opacity: 0.4; }
    .sidebar-node-icon {
      width: 32px;
      height: 32px;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 15px;
      box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }
    .sidebar-node-info { flex: 1; }
    .sidebar-node-title { font-size: 12px; font-weight: 600; color: #e5e7eb; }
    .sidebar-node-desc { font-size: 10px; color: #6b7280; margin-top: 2px; }

    /* Palette categories */
    .palette-category { margin-bottom: 16px; }
    .palette-category-title {
      font-size: 10px;
      font-weight: 600;
      color: #6b7280;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      padding: 8px 0 6px 0;
      border-bottom: 1px solid rgba(255,255,255,0.06);
      margin-bottom: 8px;
    }

    /* ===== CANVAS WRAPPER ===== */
    .workflow-canvas-wrapper {
      flex: 1;
      position: relative;
      overflow: hidden;
      border: 1px solid rgba(255,255,255,0.06);
      border-left: none;
      border-radius: 0 16px 16px 0;
      background: #08080f;
    }

    /* ===== MAIN CANVAS ===== */
    .workflow-canvas {
      position: absolute;
      width: 4000px;
      height: 3000px;
      background-color: #0a0a12;
      background-image:
        radial-gradient(circle, rgba(104,28,235,0.08) 1px, transparent 1px),
        linear-gradient(rgba(104,28,235,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(104,28,235,0.03) 1px, transparent 1px);
      background-size: 20px 20px, 100px 100px, 100px 100px;
      cursor: grab;
      transform-origin: 0 0;
      will-change: transform;
      /* GPU optimization */
      backface-visibility: hidden;
      -webkit-backface-visibility: hidden;
    }
    .workflow-canvas.dragging-canvas { cursor: grabbing; }
    .workflow-canvas.connecting { cursor: crosshair; }
    /* Disable ALL transitions and animations on nodes during canvas pan to prevent flicker */
    .workflow-canvas.dragging-canvas .canvas-node,
    .workflow-canvas.dragging-canvas .canvas-node *,
    .workflow-canvas.dragging-canvas .node-box,
    .workflow-canvas.dragging-canvas .node-status-dot {
      transition: none !important;
      animation: none !important;
    }

    /* ===== FLOATING TOOLBAR (Pill Style) - FIXED POSITION ===== */
    .canvas-toolbar {
      position: absolute;
      top: 20px;
      left: 50%;
      transform: translateX(-50%);
      display: flex;
      gap: 4px;
      padding: 6px 10px;
      background: rgba(13, 13, 21, 0.98);
      border: 1px solid rgba(104, 28, 235, 0.2);
      border-radius: 12px;
      backdrop-filter: blur(20px);
      box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.03) inset;
      z-index: 1000;
      pointer-events: auto;
    }
    .toolbar-btn {
      padding: 8px 12px;
      background: rgba(255,255,255,0.03);
      border: 1px solid rgba(255,255,255,0.06);
      border-radius: 8px;
      color: #9ca3af;
      font-size: 11px;
      font-weight: 500;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 6px;
      transition: all 0.15s ease;
      white-space: nowrap;
    }
    .toolbar-btn:hover {
      background: rgba(104, 28, 235, 0.15);
      border-color: rgba(104, 28, 235, 0.3);
      color: #f3f4f6;
    }
    .toolbar-btn.active {
      background: linear-gradient(135deg, #681CEB, #4c1d95);
      border-color: #681CEB;
      color: white;
      box-shadow: 0 4px 12px rgba(104, 28, 235, 0.4);
    }
    .toolbar-btn.admin {
      background: rgba(34, 197, 94, 0.1);
      border-color: rgba(34, 197, 94, 0.2);
      color: #4ade80;
    }
    .toolbar-btn.admin:hover {
      background: rgba(139, 92, 246, 0.2);
      border-color: rgba(34, 197, 94, 0.4);
    }
    .toolbar-btn.admin.active {
      background: linear-gradient(135deg, #7c3aed, #5b21b6);
      border-color: #a78bfa;
      color: white;
    }
    .toolbar-btn.danger {
      background: rgba(239, 68, 68, 0.1);
      border-color: rgba(239, 68, 68, 0.2);
      color: #f87171;
    }
    .toolbar-btn.danger:hover {
      background: rgba(192, 132, 252, 0.2);
      border-color: rgba(239, 68, 68, 0.4);
    }
    .toolbar-btn.request {
      background: rgba(251, 191, 36, 0.1);
      border-color: rgba(251, 191, 36, 0.2);
      color: #c4b5fd;
    }
    .toolbar-btn.request:hover {
      background: rgba(251, 191, 36, 0.2);
      border-color: rgba(251, 191, 36, 0.4);
    }
    .toolbar-btn:disabled {
      opacity: 0.4;
      cursor: not-allowed;
    }
    .toolbar-divider {
      width: 1px;
      background: rgba(255,255,255,0.08);
      margin: 4px 4px;
    }

    /* Client-only view (non-admin) - center the Request Changes button */
    .canvas-toolbar.client-view {
      gap: 0;
    }
    .canvas-toolbar.client-view .toolbar-btn.request {
      padding: 10px 20px;
      font-size: 12px;
    }

    /* Hide sidebar when in client view */
    .workflow-container.client-view .workflow-sidebar {
      display: none;
    }
    .workflow-container.client-view .workflow-canvas-wrapper {
      margin-left: 0;
    }

    /* ===== SECTION LABELS ON CANVAS ===== */
    .canvas-section-label {
      position: absolute;
      font-size: 11px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 2px;
      color: rgba(104,28,235,0.4);
      pointer-events: none;
      z-index: 1;
    }

    /* ===== CANVAS NODES - n8n Style (Compact Icon-Centric) ===== */
    .canvas-node {
      position: absolute;
      cursor: move;
      user-select: none;
      z-index: 10;
      display: flex;
      flex-direction: column;
      align-items: center;
      width: 80px;
      /* GPU layer promotion to prevent flicker during canvas pan */
      transform: translateZ(0);
      will-change: transform;
      backface-visibility: hidden;
      contain: layout style;
      isolation: isolate;
    }
    .canvas-node:hover { transform: translateZ(0) translateY(-2px); }
    .canvas-node:hover .node-box {
      border-color: rgba(104, 28, 235, 0.6);
      box-shadow: 0 8px 24px rgba(104, 28, 235, 0.3);
    }
    .canvas-node.selected .node-box {
      border-color: #681CEB;
      box-shadow: 0 0 0 3px rgba(104, 28, 235, 0.3), 0 8px 24px rgba(104, 28, 235, 0.3);
    }
    .canvas-node.dragging {
      z-index: 1000;
      transform: translateZ(0) scale(1.05);
    }

    /* Node Box - The main visual element (solid bg to prevent flicker) */
    .node-box {
      width: 64px;
      height: 64px;
      border-radius: 16px;
      /* Solid background instead of backdrop-filter to prevent flicker during pan */
      background: linear-gradient(145deg, #2a2a3d 0%, #1e1e2d 100%);
      border: 2px solid rgba(255,255,255,0.1);
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
      box-shadow:
        0 4px 16px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.1);
      /* No transitions during normal state to prevent flicker */
    }
    .node-box::before {
      content: '';
      position: absolute;
      top: 0;
      left: 12px;
      right: 12px;
      height: 3px;
      border-radius: 0 0 3px 3px;
      background: var(--node-accent-color, #681CEB);
      opacity: 0.8;
    }
    .canvas-node.multi-selected .node-box {
      border-color: #a78bfa;
      box-shadow:
        0 8px 24px rgba(0,0,0,0.5),
        0 0 0 3px rgba(167, 139, 250, 0.3);
    }

    /* Node accent colors by type */
    .canvas-node[data-node-type="webhook"] { --node-accent-color: #a78bfa; }
    .canvas-node[data-node-type="guardrails"] { --node-accent-color: #a78bfa; }
    .canvas-node[data-node-type="ai-agent"] { --node-accent-color: #8b5cf6; }
    .canvas-node[data-node-type="memory"] { --node-accent-color: #ec4899; }
    .canvas-node[data-node-type="pinecone"] { --node-accent-color: #a78bfa; }
    .canvas-node[data-node-type="supabase-vector"] { --node-accent-color: #a78bfa; }
    .canvas-node[data-node-type="response"] { --node-accent-color: #818cf8; }
    .canvas-node[data-node-type="code"] { --node-accent-color: #64748b; }
    .canvas-node[data-node-type="human-check"] { --node-accent-color: #f472b6; }
    .canvas-node[data-node-type="detector"] { --node-accent-color: #a78bfa; }
    .canvas-node[data-node-type="formatter"] { --node-accent-color: #818cf8; }
    .canvas-node[data-node-type="google-sheets"] { --node-accent-color: #a78bfa; }
    .canvas-node[data-node-type="workers-workflow"] { --node-accent-color: #c4b5fd; }
    .canvas-node[data-node-type="follow-up-agent"] { --node-accent-color: #c084fc; }
    .canvas-node[data-node-type="openai-model"] { --node-accent-color: #8b5cf6; }
    .canvas-node[data-node-type="embeddings"] { --node-accent-color: #a78bfa; }

    /* Node Icon */
    .node-icon {
      width: 36px;
      height: 36px;
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
    }
    .node-icon.webhook { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }
    .node-icon.guardrails { background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%); }
    .node-icon.ai { background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%); }
    .node-icon.vector { background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%); }
    .node-icon.code { background: linear-gradient(135deg, #64748b 0%, #475569 100%); }
    .node-icon.memory { background: linear-gradient(135deg, #ec4899 0%, #db2777 100%); }
    .node-icon.logic { background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%); }
    .node-icon.data { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }

    /* Node Label - Below the box */
    .node-label {
      margin-top: 8px;
      text-align: center;
      max-width: 100px;
    }
    .node-title {
      font-size: 11px;
      font-weight: 600;
      color: #e5e7eb;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .node-subtitle {
      font-size: 9px;
      color: #6b7280;
      margin-top: 2px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    /* Node status indicator - small dot (static glow to prevent flicker) */
    .node-status-dot {
      position: absolute;
      top: -4px;
      right: -4px;
      width: 12px;
      height: 12px;
      border-radius: 50%;
      background: #8b5cf6;
      border: 2px solid #1e1e2d;
      box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
      /* No animation by default - prevents constant repaints during pan */
    }
    .node-status-dot.idle {
      background: #6b7280;
      box-shadow: none;
    }
    .node-status-dot.running {
      background: #a78bfa;
      box-shadow: 0 0 12px rgba(251, 191, 36, 0.8);
      animation: executingPulse 0.8s ease-in-out infinite;
    }
    .node-status-dot.error {
      background: #8b5cf6;
      box-shadow: 0 0 12px rgba(239, 68, 68, 0.8);
    }
    @keyframes executingPulse {
      0%, 100% { transform: scale(1); opacity: 1; }
      50% { transform: scale(1.2); opacity: 0.8; }
    }

    /* Execution success/error animations */
    .canvas-node.execution-success .node-box {
      animation: successPulse 0.5s ease-out;
    }
    .canvas-node.execution-error .node-box {
      animation: errorShake 0.5s ease-out;
    }
    @keyframes successPulse {
      0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
      100% { box-shadow: 0 0 0 20px rgba(34, 197, 94, 0); }
    }
    @keyframes errorShake {
      0%, 100% { transform: translateX(0); }
      20%, 60% { transform: translateX(-4px); }
      40%, 80% { transform: translateX(4px); }
    }

    /* Box Selection */
    .selection-box {
      position: absolute;
      border: 2px dashed #681CEB;
      background: rgba(104, 28, 235, 0.1);
      border-radius: 4px;
      pointer-events: none;
      z-index: 1000;
    }

    /* Node Groups */
    .node-group {
      position: absolute;
      border: 2px dashed rgba(104, 28, 235, 0.5);
      border-radius: 16px;
      background: rgba(104, 28, 235, 0.03);
      z-index: 1;
      pointer-events: none;
    }
    .group-header {
      position: absolute;
      top: -32px;
      left: 0;
      right: 0;
      height: 28px;
      padding: 4px 12px;
      border-radius: 8px 8px 0 0;
      display: flex;
      justify-content: space-between;
      align-items: center;
      pointer-events: auto;
      background: rgba(104, 28, 235, 0.15);
    }
    .group-name {
      font-size: 12px;
      font-weight: 600;
      color: #a78bfa;
    }
    .group-actions {
      display: flex;
      gap: 4px;
    }
    .group-btn {
      width: 20px;
      height: 20px;
      border-radius: 4px;
      background: rgba(255,255,255,0.1);
      border: none;
      color: #a78bfa;
      cursor: pointer;
      font-size: 12px;
    }
    .group-btn:hover {
      background: rgba(104, 28, 235, 0.3);
    }

    /* Node highlight for search */
    .canvas-node.highlight-flash .node-box {
      animation: highlightFlash 1s ease-out;
    }
    @keyframes highlightFlash {
      0%, 100% { box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
      50% { box-shadow: 0 0 40px rgba(104, 28, 235, 0.8), 0 0 60px rgba(104, 28, 235, 0.4); }
    }

    /* ===== CONNECTION PORTS - n8n Style (Small Circles) ===== */
    .node-ports {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      z-index: 20;
    }
    .node-ports.input { left: -6px; }
    .node-ports.output { right: -6px; }
    .node-port {
      width: 12px;
      height: 12px;
      border-radius: 50%;
      background: #3f3f5a;
      border: 2px solid #1e1e2d;
      cursor: crosshair;
      transition: all 0.15s ease;
    }
    .node-port:hover {
      background: #681CEB;
      transform: scale(1.5);
      box-shadow: 0 0 12px rgba(104, 28, 235, 0.6);
    }
    .node-port.connected {
      background: #a78bfa;
    }

    /* ===== ADD NODE BUTTON ===== */
    .node-add-btn {
      position: absolute;
      right: -28px;
      top: 50%;
      transform: translateY(-50%);
      width: 24px;
      height: 24px;
      border-radius: 6px;
      background: rgba(104, 28, 235, 0.2);
      border: 1px dashed rgba(104, 28, 235, 0.4);
      color: #a78bfa;
      font-size: 16px;
      font-weight: 400;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      transition: all 0.2s ease;
    }
    .canvas-node:hover .node-add-btn { opacity: 1; }
    .node-add-btn:hover {
      background: #681CEB;
      border: 1px solid #681CEB;
      color: white;
      transform: translateY(-50%) scale(1.1);
      box-shadow: 0 4px 12px rgba(104, 28, 235, 0.4);
    }

    /* ===== SVG CONNECTIONS - Enhanced Animated ===== */
    .connections-svg {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
      z-index: 5;
      overflow: visible;
    }
    .connection-group {
      pointer-events: auto;
      cursor: pointer;
    }
    .connection-line {
      fill: none;
      stroke: url(#connectionGradient);
      stroke-width: 2.5;
      pointer-events: none;
      filter: drop-shadow(0 2px 4px rgba(104,28,235,0.3));
      transition: stroke-width 0.2s ease, filter 0.2s ease;
    }
    .connection-line.hovered,
    .connection-group:hover .connection-line {
      stroke-width: 4;
      filter: drop-shadow(0 4px 12px rgba(104,28,235,0.6));
    }
    .connection-line.selected {
      stroke-width: 4;
      stroke: #a78bfa;
      filter: drop-shadow(0 4px 16px rgba(167,139,250,0.6));
    }
    .connection-line.temp {
      stroke: rgba(104, 28, 235, 0.5);
      stroke-dasharray: 8 4;
      animation: connectionDash 0.5s linear infinite;
      pointer-events: none;
    }
    @keyframes connectionDash {
      to { stroke-dashoffset: -12; }
    }

    /* Animated particle flow on connections */
    .connection-flow {
      fill: none;
      stroke: rgba(167, 139, 250, 0.9);
      stroke-width: 4;
      stroke-linecap: round;
      stroke-dasharray: 6 30;
      animation: flowAnimation 1.5s linear infinite;
      pointer-events: none;
    }
    @keyframes flowAnimation {
      to { stroke-dashoffset: -36; }
    }

    /* Connection arrow marker */
    .connection-arrow {
      fill: #a78bfa;
    }

    /* Compatible/Incompatible port indicators */
    .node-port.compatible {
      background: #8b5cf6 !important;
      transform: scale(1.5);
      box-shadow: 0 0 16px rgba(34, 197, 94, 0.9);
      animation: pulsePort 0.8s ease-in-out infinite;
    }
    @keyframes pulsePort {
      0%, 100% { transform: scale(1.5); }
      50% { transform: scale(1.8); }
    }
    @keyframes typingBounce {
      0%, 60%, 100% { transform: translateY(0); }
      30% { transform: translateY(-4px); }
    }
    .node-port.incompatible {
      background: #8b5cf6;
      opacity: 0.5;
    }

    /* Connecting mode - dim nodes not being targeted */
    .workflow-canvas.connecting .canvas-node:not(:hover) .node-box {
      opacity: 0.7;
    }

    /* ===== CONTEXT MENU ===== */
    .context-menu {
      position: fixed;
      background: linear-gradient(180deg, rgba(25,25,40,0.98) 0%, rgba(15,15,25,0.98) 100%);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 12px;
      padding: 8px 0;
      min-width: 180px;
      backdrop-filter: blur(20px);
      box-shadow: 0 16px 48px rgba(0,0,0,0.5);
      z-index: 10000;
      display: none;
    }
    .context-menu.active { display: block; }
    .context-menu-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 16px;
      font-size: 13px;
      color: #d1d5db;
      cursor: pointer;
      transition: all 0.15s ease;
    }
    .context-menu-item:hover {
      background: rgba(104, 28, 235, 0.15);
      color: #f3f4f6;
    }
    .context-menu-item.danger { color: #f87171; }
    .context-menu-item.danger:hover { background: rgba(239, 68, 68, 0.15); }
    .context-menu-divider {
      height: 1px;
      background: rgba(255,255,255,0.08);
      margin: 6px 0;
    }
    .context-menu-item svg { width: 16px; height: 16px; opacity: 0.7; }

    /* ===== ADD NODE DROPDOWN ===== */
    .add-node-dropdown {
      position: fixed;
      background: linear-gradient(180deg, rgba(25,25,40,0.98) 0%, rgba(15,15,25,0.98) 100%);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 16px;
      padding: 12px;
      width: 220px;
      backdrop-filter: blur(20px);
      box-shadow: 0 20px 60px rgba(0,0,0,0.5);
      z-index: 10000;
      display: none;
    }
    .add-node-dropdown.active { display: block; }
    .add-node-dropdown-title {
      font-size: 11px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: #6b7280;
      padding: 4px 8px 12px;
    }
    .add-node-option {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 12px;
      border-radius: 10px;
      font-size: 13px;
      color: #d1d5db;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .add-node-option:hover {
      background: rgba(104, 28, 235, 0.15);
      color: #f3f4f6;
      transform: translateX(4px);
    }
    .add-node-option-icon {
      width: 28px;
      height: 28px;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
    }

    /* ===== ZOOM CONTROLS - FIXED IN CORNER ===== */
    .zoom-controls {
      position: absolute;
      bottom: 20px;
      left: 20px;
      display: flex;
      align-items: center;
      gap: 2px;
      padding: 6px;
      background: rgba(15,15,25,0.95);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 12px;
      backdrop-filter: blur(20px);
      box-shadow: 0 4px 16px rgba(0,0,0,0.4);
      z-index: 1000;
      pointer-events: auto;
    }
    .zoom-btn {
      width: 36px;
      height: 36px;
      background: transparent;
      border: none;
      border-radius: 8px;
      color: #9ca3af;
      font-size: 18px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s ease;
    }
    .zoom-btn:hover {
      background: rgba(104, 28, 235, 0.2);
      color: #a78bfa;
    }
    .zoom-level {
      padding: 8px 14px;
      color: #6b7280;
      font-size: 12px;
      font-weight: 500;
      min-width: 60px;
      text-align: center;
    }

    /* ===== MINI MAP - FIXED IN CORNER (Enhanced) ===== */
    .canvas-minimap {
      position: absolute;
      bottom: 20px;
      right: 20px;
      width: 200px;
      height: 140px;
      background: rgba(15,15,25,0.95);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 12px;
      backdrop-filter: blur(20px);
      box-shadow:
        0 4px 16px rgba(0,0,0,0.4),
        0 0 0 1px rgba(104, 28, 235, 0.2);
      z-index: 1000;
      overflow: hidden;
      pointer-events: auto;
      cursor: pointer;
    }
    .minimap-viewport {
      position: absolute;
      border: 2px solid #681CEB;
      background: rgba(104, 28, 235, 0.2);
      border-radius: 4px;
      cursor: move;
      box-shadow: 0 0 12px rgba(104, 28, 235, 0.4);
      transition: all 0.1s ease;
    }
    .minimap-viewport:hover {
      border-color: #a78bfa;
      background: rgba(104, 28, 235, 0.3);
    }
    .minimap-nodes {
      position: absolute;
      inset: 8px;
      pointer-events: none;
    }
    .minimap-node {
      position: absolute;
      width: 10px;
      height: 8px;
      background: linear-gradient(135deg, #681CEB, #a78bfa);
      border-radius: 2px;
      box-shadow: 0 0 6px rgba(104, 28, 235, 0.5);
      transition: transform 0.2s ease;
    }
    .minimap-node.selected {
      transform: scale(1.5);
      box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
      z-index: 10;
    }
    .minimap-connections {
      position: absolute;
      inset: 8px;
      pointer-events: none;
    }
    .minimap-connection {
      stroke: rgba(104, 28, 235, 0.4);
      stroke-width: 1;
    }

    /* ===== NODE SEARCH MODAL ===== */
    .node-search-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.6);
      backdrop-filter: blur(4px);
      z-index: 10000;
      display: flex;
      justify-content: center;
      padding-top: 100px;
    }
    .node-search-modal {
      width: 500px;
      max-width: 90%;
      background: linear-gradient(180deg, rgba(25,25,40,0.98) 0%, rgba(15,15,25,0.98) 100%);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 16px;
      backdrop-filter: blur(20px);
      box-shadow: 0 24px 64px rgba(0,0,0,0.5);
      overflow: hidden;
      max-height: 400px;
    }
    .node-search-input {
      width: 100%;
      padding: 16px 20px;
      background: transparent;
      border: none;
      border-bottom: 1px solid rgba(255,255,255,0.1);
      color: white;
      font-size: 16px;
      outline: none;
    }
    .node-search-input::placeholder {
      color: #6b7280;
    }
    .node-search-results {
      max-height: 300px;
      overflow-y: auto;
    }
    .search-result {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 20px;
      cursor: pointer;
      transition: background 0.15s ease;
    }
    .search-result:hover {
      background: rgba(104, 28, 235, 0.2);
    }
    .search-result .node-icon {
      width: 32px;
      height: 32px;
      font-size: 16px;
    }
    .search-result-info {
      flex: 1;
    }
    .search-result-title {
      font-size: 14px;
      font-weight: 500;
      color: #e5e7eb;
    }
    .search-result-type {
      font-size: 11px;
      color: #6b7280;
    }
    .search-no-results {
      padding: 24px;
      text-align: center;
      color: #6b7280;
    }

    /* Keyboard shortcut hints */
    .keyboard-hint {
      display: inline-flex;
      align-items: center;
      padding: 2px 6px;
      background: rgba(255,255,255,0.1);
      border-radius: 4px;
      font-size: 11px;
      font-family: monospace;
      color: #9ca3af;
      margin-left: 8px;
    }

    /* Node settings panel */
    .node-panel {
      background: #1a1a2e; border: 1px solid rgba(255,255,255,0.1);
      border-radius: 16px; padding: 24px; width: 500px; max-width: 95%; max-height: 80vh; overflow-y: auto;
    }
    .node-panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
    .node-panel-title { display: flex; align-items: center; gap: 12px; }
    .node-panel-title h3 { font-size: 18px; font-weight: 600; }
    .node-panel-close {
      background: rgba(255,255,255,0.1); border: none; border-radius: 8px;
      width: 32px; height: 32px; color: #9ca3af; cursor: pointer; font-size: 18px;
    }
    .node-panel-close:hover { background: rgba(255,255,255,0.2); }
    .node-setting {
      background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.08);
      border-radius: 10px; padding: 16px; margin-bottom: 12px;
      transition: border-color 0.2s;
    }
    .node-setting.has-custom-value {
      border-color: rgba(104, 28, 235, 0.3);
      background: rgba(104, 28, 235, 0.05);
    }
    .node-setting-header {
      display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
    }
    .node-setting-label { font-size: 11px; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.5px; }
    .custom-badge {
      font-size: 10px; padding: 2px 8px; background: rgba(104, 28, 235, 0.2);
      color: #a855f7; border-radius: 10px; font-weight: 500;
    }
    .node-setting-value { font-size: 14px; color: #f3f4f6; }
    .node-setting-value.textarea-value {
      font-style: italic; white-space: pre-wrap; line-height: 1.5;
    }
    .using-default-badge {
      font-size: 10px; color: #6b7280; margin-top: 8px; font-style: italic;
    }
    .node-setting-input {
      width: 100%; padding: 10px 12px; background: rgba(0,0,0,0.3);
      border: 1px solid rgba(255,255,255,0.15); border-radius: 6px;
      color: #f3f4f6; font-size: 14px; box-sizing: border-box;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .node-setting-input::placeholder { color: #6b7280; }
    .node-setting-input:focus { outline: none; border-color: rgba(104, 28, 235, 0.6); box-shadow: 0 0 0 3px rgba(104, 28, 235, 0.15); }
    .node-setting-input.textarea {
      min-height: 80px; resize: vertical; font-family: inherit;
    }
    .node-setting-slider { display: flex; align-items: center; gap: 12px; }
    .node-setting-slider input[type="range"] { flex: 1; accent-color: #681CEB; }
    .slider-value { min-width: 40px; text-align: right; font-size: 14px; font-weight: 500; color: #f3f4f6; }
    .node-setting-default-hint {
      font-size: 11px; color: #6b7280; margin-top: 8px;
    }
    .node-setting-default {
      margin-top: 10px; padding: 10px 12px; background: rgba(255,255,255,0.03);
      border: 1px dashed rgba(255,255,255,0.1); border-radius: 6px;
    }
    .node-setting-default.clickable {
      cursor: pointer; transition: all 0.2s;
    }
    .node-setting-default.clickable:hover {
      background: rgba(104, 28, 235, 0.1); border-color: rgba(104, 28, 235, 0.3);
    }
    .node-setting-default .default-header {
      display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;
    }
    .node-setting-default .default-label {
      font-size: 10px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px;
    }
    .node-setting-default .use-default-btn {
      font-size: 11px; color: #a855f7; font-weight: 500; opacity: 0;
      transition: opacity 0.2s;
    }
    .node-setting-default.clickable:hover .use-default-btn { opacity: 1; }
    .node-setting-default .default-preview {
      font-size: 12px; color: #9ca3af; line-height: 1.4;
      word-break: break-word; white-space: pre-wrap;
    }
    .edit-mode-banner {
      color: #a855f7; font-size: 12px; margin-bottom: 16px; padding: 12px 14px;
      background: rgba(168,85,247,0.1); border-radius: 8px;
      border: 1px solid rgba(168,85,247,0.2);
    }
    .edit-mode-banner .edit-mode-title {
      display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px;
    }
    .edit-mode-banner .edit-mode-hint {
      color: #9ca3af; font-size: 11px;
    }

    /* ===== NEW CONFIG FIELD STYLES ===== */
    .config-field {
      margin-bottom: 16px;
    }
    .config-field-label {
      display: block;
      font-size: 12px;
      font-weight: 600;
      color: #e5e7eb;
      margin-bottom: 6px;
    }
    .config-field-desc {
      font-size: 11px;
      color: #6b7280;
      margin-bottom: 8px;
    }
    .config-field-info {
      font-size: 13px;
      color: #9ca3af;
      padding: 8px 12px;
      background: rgba(0,0,0,0.2);
      border-radius: 6px;
    }
    .config-field-input,
    .config-field-textarea,
    .config-field-select {
      width: 100%;
      padding: 10px 12px;
      font-size: 13px;
      color: #e5e7eb;
      background: rgba(17,24,39,0.8);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 8px;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .config-field-input:focus,
    .config-field-textarea:focus,
    .config-field-select:focus {
      outline: none;
      border-color: rgba(104, 28, 235, 0.6);
      box-shadow: 0 0 0 3px rgba(104, 28, 235, 0.15);
    }
    .config-field-input::placeholder,
    .config-field-textarea::placeholder {
      color: #6b7280;
    }
    .config-field-textarea {
      min-height: 100px;
      resize: vertical;
      font-family: inherit;
    }
    .config-field-select {
      cursor: pointer;
      appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 10px center;
      background-size: 16px;
      padding-right: 36px;
    }
    .config-field-slider {
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .config-field-slider input[type="range"] {
      flex: 1;
      accent-color: #681CEB;
    }
    .config-field-checkbox {
      display: flex;
      align-items: center;
      gap: 10px;
      cursor: pointer;
      padding: 8px 0;
    }
    .config-field-checkbox input[type="checkbox"] {
      width: 18px;
      height: 18px;
      accent-color: #681CEB;
      cursor: pointer;
    }
    .config-field-checkbox .checkbox-label {
      font-size: 13px;
      color: #e5e7eb;
    }
    .config-field-keyvalue {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-bottom: 8px;
    }
    .kv-row {
      display: flex;
      gap: 8px;
      align-items: center;
    }
    .kv-row .kv-key,
    .kv-row .kv-value {
      flex: 1;
      padding: 8px 10px;
      font-size: 12px;
      color: #e5e7eb;
      background: rgba(17,24,39,0.8);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 6px;
    }
    .kv-row .kv-key { flex: 0.4; }
    .kv-row .kv-value { flex: 0.6; }
    .kv-row .kv-remove {
      width: 28px;
      height: 28px;
      padding: 0;
      font-size: 16px;
      color: #c084fc;
      background: rgba(168,85,247,0.1);
      border: none;
      border-radius: 6px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .kv-row .kv-remove:hover {
      background: rgba(168,85,247,0.2);
    }
    .config-btn-add {
      padding: 6px 12px;
      font-size: 12px;
      color: #a855f7;
      background: rgba(168,85,247,0.1);
      border: 1px solid rgba(168,85,247,0.3);
      border-radius: 6px;
      cursor: pointer;
      align-self: flex-start;
    }
    .config-btn-add:hover {
      background: rgba(168,85,247,0.2);
    }

    .request-change-btn {
      width: 100%; padding: 14px; margin-top: 20px;
      background: linear-gradient(135deg, #8b5cf6, #7c3aed); border: none;
      border-radius: 10px; color: white; font-size: 14px; font-weight: 600; cursor: pointer;
      display: flex; align-items: center; justify-content: center; gap: 8px;
    }
    .request-change-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3); }
    .request-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.1); }
    .request-form textarea {
      width: 100%; min-height: 100px; padding: 12px; background: rgba(0,0,0,0.3);
      border: 1px solid rgba(255,255,255,0.1); border-radius: 8px;
      color: #f3f4f6; font-size: 14px; resize: vertical; margin-bottom: 12px;
    }
    .request-form textarea:focus { outline: none; border-color: rgba(104, 28, 235, 0.5); }
    .submit-request-btn {
      width: 100%; padding: 12px;
      background: linear-gradient(135deg, #7c3aed, #5b21b6); border: none;
      border-radius: 8px; color: white; font-size: 14px; font-weight: 500; cursor: pointer;
    }

    @media (max-width: 900px) {
      .live-chat-container { grid-template-columns: 1fr; height: auto; }
      .conversations-list { max-height: 300px; }
      .chat-panel { min-height: 500px; }
      .charts-grid { grid-template-columns: 1fr; }
    }

    /* ===== LOGIN PAGE ===== */
    .login-screen {
      position: fixed;
      inset: 0;
      background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #0f0f1a 100%);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 10000;
    }
    .login-screen.hidden { display: none; }

    .login-container {
      width: 100%;
      max-width: 420px;
      padding: 24px;
    }

    .login-card {
      background: linear-gradient(145deg, rgba(30,30,50,0.9) 0%, rgba(20,20,35,0.95) 100%);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 24px;
      padding: 40px;
      backdrop-filter: blur(20px);
      box-shadow: 0 24px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05) inset;
    }

    .login-logo {
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-bottom: 32px;
    }
    .login-logo svg { width: 64px; height: 64px; margin-bottom: 16px; }
    .login-logo-text {
      font-size: 24px;
      font-weight: 700;
      background: linear-gradient(135deg, #681CEB, #a78bfa);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }
    .login-logo-subtitle {
      font-size: 13px;
      color: #6b7280;
      margin-top: 4px;
    }

    .login-form { display: flex; flex-direction: column; gap: 16px; }

    .login-field { display: flex; flex-direction: column; gap: 6px; }
    .login-field label {
      font-size: 12px;
      font-weight: 500;
      color: #9ca3af;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    .login-field input {
      padding: 14px 16px;
      background: rgba(0,0,0,0.3);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 12px;
      color: #f3f4f6;
      font-size: 15px;
      transition: all 0.2s ease;
    }
    .login-field input:focus {
      outline: none;
      border-color: rgba(104, 28, 235, 0.5);
      box-shadow: 0 0 0 3px rgba(104, 28, 235, 0.1);
    }
    .login-field input::placeholder { color: #4b5563; }

    .login-btn {
      padding: 16px;
      background: linear-gradient(135deg, #681CEB, #4c1d95);
      border: none;
      border-radius: 12px;
      color: white;
      font-size: 15px;
      font-weight: 600;
      cursor: pointer;
      margin-top: 8px;
      transition: all 0.2s ease;
    }
    .login-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 24px rgba(104, 28, 235, 0.4);
    }
    .login-btn:disabled {
      opacity: 0.6;
      cursor: not-allowed;
      transform: none;
    }

    .login-error {
      background: rgba(239, 68, 68, 0.1);
      border: 1px solid rgba(239, 68, 68, 0.3);
      border-radius: 10px;
      padding: 12px 16px;
      color: #f87171;
      font-size: 13px;
      display: none;
    }
    .login-error.show { display: block; }

    /* Auth toggle tabs */
    .auth-tabs {
      display: flex;
      margin-bottom: 28px;
      border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .auth-tab {
      flex: 1;
      padding: 12px 0;
      text-align: center;
      font-size: 14px;
      font-weight: 500;
      color: #6b7280;
      cursor: pointer;
      border-bottom: 2px solid transparent;
      transition: all 0.2s ease;
      background: none;
      border-top: none;
      border-left: none;
      border-right: none;
    }
    .auth-tab:hover {
      color: #9ca3af;
    }
    .auth-tab.active {
      color: #a78bfa;
      border-bottom-color: #681CEB;
    }

    /* Signup form (hidden by default) */
    #signupForm { display: none; }
    #signupForm.active { display: flex; }
    #loginForm.hidden-form { display: none; }

    /* User badge in header */
    .user-badge {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 8px 14px 8px 10px;
      background: rgba(255,255,255,0.05);
      border: 1px solid rgba(255,255,255,0.1);
      border-radius: 10px;
    }
    .user-avatar {
      width: 32px;
      height: 32px;
      border-radius: 8px;
      background: linear-gradient(135deg, #681CEB, #4c1d95);
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 600;
      font-size: 14px;
      color: white;
    }
    .user-info { display: flex; flex-direction: column; }
    .user-name { font-size: 13px; font-weight: 500; color: #f3f4f6; }
    .user-role { font-size: 10px; color: #6b7280; }

    .logout-btn {
      padding: 8px 14px;
      background: rgba(239, 68, 68, 0.1);
      border: 1px solid rgba(239, 68, 68, 0.2);
      border-radius: 8px;
      color: #f87171;
      font-size: 12px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .logout-btn:hover {
      background: rgba(192, 132, 252, 0.2);
      border-color: rgba(239, 68, 68, 0.4);
    }

    /* Dropdown/Select styling for better visibility */
    select {
      background-color: #1a1a2e !important;
      color: #f3f4f6 !important;
    }
    select option {
      background-color: #1a1a2e;
      color: #f3f4f6;
      padding: 10px 12px;
    }
    select option:hover,
    select option:focus,
    select option:checked {
      background-color: #681CEB;
      color: white;
    }
    select optgroup {
      background-color: #0f0f1a;
      color: #a78bfa;
      font-weight: 600;
      font-style: normal;
      padding: 8px 12px;
    }
    select optgroup option {
      background-color: #1a1a2e;
      color: #f3f4f6;
      font-weight: 400;
      padding-left: 16px;
    }

    /* Security Toggle Switch Styles */
    .security-toggle input:checked + .security-toggle-slider {
      background: linear-gradient(135deg, #22c55e, #16a34a);
    }
    .security-toggle-slider:before {
      position: absolute;
      content: "";
      height: 20px;
      width: 20px;
      left: 4px;
      bottom: 4px;
      background-color: white;
      border-radius: 50%;
      transition: 0.3s;
      box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }
    .security-toggle input:checked + .security-toggle-slider:before {
      transform: translateX(24px);
    }
    .security-toggle input:focus + .security-toggle-slider {
      box-shadow: 0 0 0 3px rgba(139,92,246,0.3);
    }
  @keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
  @keyframes toastOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

    /* ===== Enhanced Stat Cards ===== */
    .stat-trend {
      font-size: 12px; color: #6b7280; margin-top: 8px;
      display: flex; align-items: center; gap: 4px;
    }
    .trend-up { color: #22c55e; font-weight: 600; }
    .trend-down { color: #ef4444; font-weight: 600; }
    .trend-neutral { color: #6b7280; }

    /* ===== Conversion Funnel ===== */
    .analytics-funnel-card {
      background: linear-gradient(145deg, rgba(15, 15, 25, 0.9) 0%, rgba(10, 10, 18, 0.95) 100%);
      border: 1px solid rgba(104, 28, 235, 0.12);
      border-radius: 16px; padding: 24px; margin-bottom: 24px;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
    .funnel-container {
      display: flex; align-items: center; gap: 12px; width: 100%;
    }
    .funnel-step {
      flex: 1; display: flex; flex-direction: column; gap: 10px;
    }
    .funnel-bar {
      height: 48px; border-radius: 10px; overflow: hidden;
      background: rgba(255,255,255,0.03); position: relative;
    }
    .funnel-bar-fill {
      height: 100%; border-radius: 10px;
      transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
      position: relative; overflow: hidden;
    }
    .funnel-bar-fill::after {
      content: ''; position: absolute; inset: 0;
      background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.08) 50%, transparent 100%);
      animation: funnel-shimmer 2.5s ease-in-out infinite;
    }
    @keyframes funnel-shimmer {
      0% { transform: translateX(-100%); }
      100% { transform: translateX(100%); }
    }
    .funnel-fill-1 {
      background: linear-gradient(135deg, #681CEB 0%, #8b5cf6 100%);
      width: 0%;
    }
    .funnel-fill-2 {
      background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
      width: 0%;
    }
    .funnel-fill-3 {
      background: linear-gradient(135deg, #a78bfa 0%, #c4b5fd 100%);
      width: 0%;
    }
    .funnel-step-info {
      display: flex; justify-content: space-between; align-items: baseline;
    }
    .funnel-step-label { font-size: 12px; color: #9ca3af; font-weight: 500; }
    .funnel-step-value { font-size: 20px; font-weight: 700; color: #f3f4f6; }
    .funnel-arrow {
      display: flex; flex-direction: column; align-items: center; gap: 4px;
      flex-shrink: 0; padding: 0 4px;
    }
    .funnel-conversion-rate {
      font-size: 11px; font-weight: 600; color: #a78bfa;
      background: rgba(104, 28, 235, 0.15); padding: 2px 8px; border-radius: 10px;
      white-space: nowrap;
    }

    /* ===== Performance Insights ===== */
    .analytics-insights-grid {
      display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-bottom: 24px;
      width: 100%; box-sizing: border-box;
    }
    .insights-metrics {
      display: flex; flex-direction: column; gap: 16px;
    }
    .insight-metric {
      display: flex; align-items: center; gap: 14px;
      padding: 12px 14px; border-radius: 12px;
      background: rgba(255,255,255,0.02);
      border: 1px solid rgba(255,255,255,0.04);
      transition: all 0.2s ease;
    }
    .insight-metric:hover {
      background: rgba(104, 28, 235, 0.06);
      border-color: rgba(104, 28, 235, 0.15);
    }
    .insight-metric-icon {
      width: 36px; height: 36px; border-radius: 10px;
      display: flex; align-items: center; justify-content: center; flex-shrink: 0;
      background: linear-gradient(135deg, rgba(104, 28, 235, 0.2), rgba(139, 92, 246, 0.15));
      color: #a78bfa;
    }
    .insight-metric-icon.warning { color: #c084fc; background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(139, 92, 246, 0.15)); }
    .insight-metric-icon.success { color: #22c55e; background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(22, 163, 74, 0.1)); }
    .insight-metric-value { font-size: 18px; font-weight: 700; color: #f3f4f6; }
    .insight-metric-label { font-size: 11px; color: #6b7280; margin-top: 2px; }

    /* ===== Recent Activity Feed ===== */
    .recent-activity-feed {
      max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 0;
    }
    .activity-item {
      display: flex; align-items: center; gap: 12px;
      padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.04);
      transition: background 0.15s ease;
    }
    .activity-item:last-child { border-bottom: none; }
    .activity-item:hover { background: rgba(104, 28, 235, 0.05); }
    .activity-dot {
      width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
    }
    .activity-dot.page-view { background: #681CEB; }
    .activity-dot.widget-open { background: #8b5cf6; }
    .activity-dot.conversation { background: #a78bfa; }
    .activity-text { font-size: 12px; color: #d1d5db; flex: 1; }
    .activity-text strong { color: #f3f4f6; font-weight: 600; }
    .activity-time { font-size: 11px; color: #6b7280; white-space: nowrap; }

    /* ===== Analytics Responsive ===== */
    @media (max-width: 1100px) {
      .analytics-insights-grid { grid-template-columns: 1fr 1fr; }
    }
    @media (max-width: 768px) {
      .analytics-insights-grid { grid-template-columns: 1fr; }
      .funnel-container { flex-direction: column; }
      .funnel-arrow { flex-direction: row; padding: 4px 0; }
      .funnel-arrow svg { transform: rotate(90deg); }
    }

    /* ===== Ticket Tab Buttons ===== */
    .ticket-tab-btn {
      padding: 6px 14px; background: transparent; border: 1px solid rgba(255,255,255,0.08);
      border-radius: 8px; color: #6b7280; font-size: 13px; cursor: pointer; transition: all 0.2s;
    }
    .ticket-tab-btn:hover { color: #d1d5db; border-color: rgba(255,255,255,0.15); }
    .ticket-tab-btn.active { background: rgba(139,92,246,0.15); border-color: rgba(139,92,246,0.4); color: #a78bfa; }

    /* ===== Ticket Row ===== */
    .ticket-row {
      display: flex; align-items: center; gap: 12px; padding: 12px 14px;
      border-radius: 10px; cursor: pointer; transition: background 0.15s;
      border: 1px solid transparent;
    }
    .ticket-row:hover { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.06); }
    .ticket-row.vip-row { border-color: rgba(139,92,246,0.25); background: rgba(139,92,246,0.04); }
    .ticket-priority-badge {
      flex-shrink: 0; padding: 2px 8px; border-radius: 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    }
    .ticket-priority-badge.vip { background: rgba(139,92,246,0.2); color: #a78bfa; }
    .ticket-priority-badge.priority { background: rgba(245,158,11,0.2); color: #fbbf24; }
    .ticket-priority-badge.standard { background: rgba(107,114,128,0.2); color: #9ca3af; }
    .ticket-sentiment-dot {
      flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%;
    }

    .widget-shape-card:hover,
    .widget-color-card:hover {
      border-color: rgba(104, 28, 235, 0.4) !important;
      background: rgba(255, 255, 255, 0.06) !important;
    }
