:root {
    /* Color Palette - Deep Space / Glass */
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --surface-glass: rgba(30, 41, 59, 0.7);
    --surface-glass-hover: rgba(51, 65, 85, 0.8);
    --border-glass: rgba(255, 255, 255, 0.1);
    
    --primary: #6366f1; /* Indigo */
    --primary-glow: rgba(99, 102, 241, 0.5);
    --accent: #ec4899; /* Pink/Purple */
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Typo */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Effects */
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --backdrop-blur: blur(12px);
    --radius-lg: 16px;
    --radius-md: 12px;
}

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

body {
    background: var(--bg-gradient);
    color: var(--text-main);
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
    line-height: 1.6;
}

/* --- Layout --- */
#app { height: 100%; display: flex; flex-direction: column; }

.view.hidden { display: none !important; }

/* Login */
.login-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #312e81 0%, transparent 40%),
                radial-gradient(circle at bottom left, #831843 0%, transparent 40%);
}
.login-container form {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--border-glass);
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    width: 100%;
    max-width: 420px;
}
.login-container h1 { font-family: var(--font-heading); margin-bottom: 2rem; text-align: center; font-weight: 700; font-size: 2rem; }

.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; color: var(--text-muted); font-size: 0.9rem; }
.form-group input {
    width: 100%;
    padding: 1rem;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    transition: all 0.2s;
}
.form-group input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: white;
    border: none;
    padding: 1rem;
    width: 100%;
    border-radius: 8px;
    font-weight: 600;
    font-family: var(--font-heading);
    cursor: pointer;
    box-shadow: 0 4px 15px var(--primary-glow);
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px var(--primary-glow); }

/* --- Dashboard --- */
.main-wrapper { display: flex; height: 100vh; }

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-glass);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
}
.logo { font-family: var(--font-heading); font-weight: 700; font-size: 1.5rem; margin-bottom: 3rem; background: linear-gradient(to right, #fff, #94a3b8); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.nav-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 1rem;
    text-align: left;
    cursor: pointer;
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}
.nav-btn:hover { background: rgba(255,255,255,0.05); color: white; }
.nav-btn.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.2) 0%, transparent 100%);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

/* Main Content */
.content-area {
    flex: 1;
    padding: 2rem 3rem;
    overflow-y: auto;
    position: relative;
}
/* Top Header in Content */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}
.page-title { font-family: var(--font-heading); font-size: 2rem; font-weight: 600; }
.user-profile { display: flex; align-items: center; gap: 1rem; }
.level-badge {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* --- Cards & Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.glass-card {
    background: var(--surface-glass);
    backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: transform 0.2s;
}
.glass-card:hover { transform: translateY(-5px); border-color: rgba(255,255,255,0.2); }

.stat-value { font-size: 2.5rem; font-weight: 700; font-family: var(--font-heading); color: white; margin: 0.5rem 0; }
.stat-label { color: var(--text-muted); font-size: 0.9rem; letter-spacing: 0.5px; text-transform: uppercase; }

/* Leads List */
.leads-table-container {
    background: var(--surface-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.lead-item {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}
.lead-item:hover { background: rgba(255,255,255,0.03); }
.lead-info h4 { font-family: var(--font-heading); font-size: 1.1rem; margin-bottom: 0.25rem; }
.lead-meta { color: var(--text-muted); font-size: 0.85rem; }

/* Status Badges */
.badge { padding: 0.35rem 0.75rem; border-radius: 8px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-new { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-contacted { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-completed { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }

/* Source Badges */
.badge-ai { background: rgba(236, 72, 153, 0.2); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.3); font-size: 0.65rem; padding: 2px 6px; margin-left: 4px; vertical-align: middle; }
.badge-manual { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); font-size: 0.65rem; padding: 2px 6px; margin-left: 4px; vertical-align: middle; }

/* Buttons */
.btn-glass {
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--border-glass);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-glass:hover { background: rgba(255,255,255,0.2); }

/* Utilities */
.hidden { display: none !important; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal {
    background: #1e293b;
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 2rem;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    position: relative;
    margin: auto;
}
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}
.modal-close:hover { color: white; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.animate-in { animation: fadeIn 0.4s ease-out forwards; }

/* Tab Logic */
.tab-content { display: none; }
.tab-content.active { display: block; }
