:root {
  --bg-color: #0b0e14;
  --bg-secondary: rgba(18, 22, 31, 0.7);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-orange: #f97316;
  --glass-bg: rgba(25, 30, 42, 0.5);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --radius: 16px;
  --radius-sm: 8px;
  --sidebar-w: 260px;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Outfit', sans-serif; }

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
}

.layout { display: flex; height: 100vh; overflow: hidden; }

.sidebar { width: var(--sidebar-w); flex-shrink: 0; background: var(--bg-secondary); border-right: 1px solid var(--glass-border); padding: 24px; display: flex; flex-direction: column; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); z-index: 10; }
.logo { display: flex; align-items: center; gap: 12px; margin-bottom: 48px; padding-left: 12px; }
.logo-icon { font-size: 24px; }
.logo-text { font-size: 24px; font-weight: 700; background: linear-gradient(135deg, #fff, #94a3b8); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.nav-menu { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: transparent; border: none; border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer; font-size: 15px; font-weight: 500; text-align: left; transition: all 0.3s ease; }
.nav-item:hover, .nav-item.active { color: var(--text-primary); background: rgba(255,255,255,0.06); }
.nav-item.active { box-shadow: inset 3px 0 0 var(--accent-blue); background: rgba(59, 130, 246, 0.1); }

.main-content { flex: 1; padding: 32px 48px; overflow-y: auto; overflow-x: hidden; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; }
.page-title { font-size: 28px; font-weight: 600; }

.user-profile { display: flex; align-items: center; gap: 16px; background: var(--glass-bg); padding: 8px 20px 8px 12px; border-radius: 40px; border: 1px solid var(--glass-border); cursor: pointer; transition: background 0.3s; }
.user-profile:hover { background: rgba(255,255,255,0.08); }
.user-info { display: flex; flex-direction: column; align-items: flex-end; }
.user-name { font-weight: 600; font-size: 14px; }
.user-role { font-size: 12px; color: var(--text-secondary); }

.avatar-lg { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,0.1); }
.avatar-md { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.avatar-xs { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.shrink-0 { flex-shrink: 0; }
.avatar-placeholder { width: 48px; height: 48px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple)); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 20px; color: #fff;}
.avatar-placeholder-xs { width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple)); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 10px; color: #fff;}
.avatar-sm-wrap { display: flex; align-items: center; gap: 8px; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; display: inline-block; vertical-align: middle; }

/* Glass */
.glass { background: var(--glass-bg); border: 1px solid var(--glass-border); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-radius: var(--radius); box-shadow: var(--glass-shadow); }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; margin-bottom: 32px; }
.stat-card { padding: 24px; position: relative; overflow: hidden; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.stat-card:hover { transform: translateY(-4px); box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent); }
.stat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.stat-title { color: var(--text-secondary); font-size: 14px; font-weight: 500; }
.stat-badge { font-size: 12px; background: rgba(255,255,255,0.1); padding: 2px 8px; border-radius: 20px; color: #fff; }
.stat-value { font-size: 36px; font-weight: 700; display: flex; align-items: baseline; gap: 6px; }
.stat-unit { font-size: 14px; color: var(--text-secondary); font-weight: 400; }
.glow-blue::after { content:''; position:absolute; bottom:-10px; right:-10px; width:80px; height:80px; background:var(--accent-blue); filter:blur(50px); opacity:0.3; pointer-events:none;}
.glow-purple::after { content:''; position:absolute; bottom:-10px; right:-10px; width:80px; height:80px; background:var(--accent-purple); filter:blur(50px); opacity:0.3; pointer-events:none;}
.glow-orange::after { content:''; position:absolute; bottom:-10px; right:-10px; width:80px; height:80px; background:var(--accent-orange); filter:blur(50px); opacity:0.2; pointer-events:none;}

/* Panels */
.content-wrapper { display: grid; gap: 24px; }
@media (min-width: 1200px) { .content-wrapper { grid-template-columns: 1.2fr 1fr; } }
.panel { padding: 24px; display: flex; flex-direction: column; }
.panel-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.panel-header h2 { font-size: 20px; font-weight: 600; }
.empty-state { align-items: center; justify-content: center; text-align: center; padding: 64px 24px; gap: 16px; }
.empty-icon { font-size: 48px; margin-bottom: 8px; }

/* Connections */
.connections-list { display: flex; flex-direction: column; gap: 16px; }
.connection-item { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); border-radius: var(--radius-sm); transition: all 0.3s ease; flex-wrap: wrap; }
.connection-item:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.1); }
.connection-info { flex: 1; min-width: 180px; display: flex; flex-direction: column; }
.connection-name { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.connection-profession { font-size: 14px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.connection-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.btn { padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; border: none; font-family: inherit; display: inline-flex; align-items: center; justify-content: center; }
.btn-primary { background: linear-gradient(135deg, var(--accent-blue), #2563eb); color: white; }
.btn-primary:hover { box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4); transform: translateY(-1px); }
.btn-secondary { background: rgba(255,255,255,0.1); color: white; border: 1px solid rgba(255,255,255,0.05); }
.btn-secondary:hover { background: rgba(255,255,255,0.15); }
.btn-outline { background: transparent; border: 1px solid rgba(255,255,255,0.2); color: white; }
.btn-outline:hover { border-color: rgba(255,255,255,0.5); }
.btn-success { background: linear-gradient(135deg, #10b981, #059669) !important; color: white !important; border: none !important; }
.w-full { width: 100%; }

/* Integrations Grid */
.integration-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; width: 100%; }
.btn-integration { padding: 16px; border-radius: var(--radius-sm); border: 1px solid var(--glass-border); background: rgba(255,255,255,0.03); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; cursor: pointer; transition: 0.3s ease; }
.btn-integration:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
.btn-fb:hover { background: rgba(24, 119, 242, 0.15); border-color: #1877f2; }
.btn-li:hover { background: rgba(10, 102, 194, 0.15); border-color: #0a66c2; }
.btn-phone:hover { background: rgba(34, 197, 94, 0.15); border-color: #22c55e; }
.btn-manual:hover { background: rgba(255, 255, 255, 0.1); border-color: #fff; }
.integration-icon { font-size: 28px; }
.integration-text { font-weight: 500; font-size: 14px; }

/* Services Grid */
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.service-cover-img { width: 100%; height: 150px; object-fit: cover; border-radius: var(--radius-sm); margin-bottom: 2px; }
.service-card { background: rgba(255,255,255,0.02); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); padding: 20px; display: flex; flex-direction: column; gap: 12px; transition: 0.3s; }
.service-card:hover { border-color: rgba(255,255,255,0.15); background: rgba(255,255,255,0.04); }
.service-title { font-size: 18px; font-weight: 600; color: #fff; }
.service-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }
.service-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.tag { padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 500; background: rgba(255,255,255,0.08); color: var(--text-primary); }
.tag-price { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.tag-reward { background: rgba(249, 115, 22, 0.15); color: #fb923c; }

/* Table */
.table-responsive { width: 100%; overflow-x: auto; }
.referrals-table { width: 100%; border-collapse: collapse; min-width: 400px; }
.referrals-table th, .referrals-table td { padding: 16px 12px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.05); }
.referrals-table th { color: var(--text-secondary); font-weight: 500; font-size: 14px; }
.referrals-table td { font-size: 15px; }

.badge { padding: 4px 12px; border-radius: 40px; font-size: 12px; font-weight: 500; }
.badge.info { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge.success { background: rgba(34, 197, 94, 0.15); color: #4ade80; }

.view-section { display: none; animation: fadeIn 0.4s ease forwards; }
.view-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Modals */
.modal { border: none; background: transparent; margin: auto; max-width: 500px; width: 90%; color: #fff; }
.modal::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.glass-modal { padding: 0; border-radius: var(--radius); background: var(--glass-bg); border: 1px solid var(--glass-border); box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); }
.modal-content { display: flex; flex-direction: column; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 24px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.modal-header h2 { font-size: 20px; font-weight: 600; }
.close-btn { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 20px; padding: 4px; }
.close-btn:hover { color: #fff; }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-desc { color: var(--text-secondary); font-size: 14px; margin-bottom: 8px; }
.modal-body label { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.modal-body input, .modal-body textarea, .modal-body select { background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.1); padding: 12px 16px; border-radius: var(--radius-sm); color: #fff; font-family: inherit; font-size: 15px; outline: none; transition: border-color 0.2s; }
.modal-body input:focus, .modal-body textarea:focus, .modal-body select:focus { border-color: var(--accent-blue); }
.modal-body textarea { min-height: 80px; resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 16px; }

.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column-reverse; gap: 8px; z-index: 9999; }
.toast { background: linear-gradient(135deg, var(--accent-blue), #2563eb); color: white; padding: 12px 24px; border-radius: var(--radius-sm); font-weight: 500; font-size: 14px; box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3); opacity: 0; transform: scale(0.9) translateY(20px); transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); pointer-events: none; }
.toast.show { opacity: 1; transform: scale(1) translateY(0); }

/* MOBILE RESPONSIVENESS (<= 800px) */
@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; padding: 16px; border-right: none; border-bottom: 1px solid var(--glass-border); flex-direction: row; justify-content: space-between; align-items: center; }
  .logo { margin-bottom: 0; }
  .sidebar-footer { display: none; }
  
  .nav-menu { position: fixed; bottom: 0; left: 0; right: 0; flex-direction: row; justify-content: space-around; background: rgba(18, 22, 31, 0.95); border-top: 1px solid var(--glass-border); padding: 12px 0; z-index: 100; backdrop-filter: blur(20px); margin: 0; }
  .nav-item { flex-direction: column; gap: 4px; font-size: 11px; padding: 8px 12px; border-radius: var(--radius-sm); }
  .nav-item svg { width: 22px; height: 22px; }
  .nav-item.active { box-shadow: 0 -3px 0 var(--accent-blue) inset; }

  .main-content { padding: 24px 16px; margin-bottom: 76px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
  .stats-grid { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
  .connection-item { flex-direction: column; align-items: flex-start; }
  .connection-actions { width: 100%; }
  .connection-actions .btn { flex: 1; text-align: center; }
  .integration-grid { grid-template-columns: 1fr 1fr; }
}
