/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #764ba2;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
}

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

.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray-500);
    font-size: 16px;
}

/* Login Page */
.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 420px;
}

.login-box h1 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 10px;
    font-size: 32px;
    font-weight: 700;
}

.subtitle {
    text-align: center;
    color: var(--gray-600);
    margin-bottom: 30px;
    font-size: 14px;
}

/* Form Elements */
input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    margin: 8px 0;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* Buttons */
button {
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

button:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--success);
    padding: 10px 20px;
}

.btn-primary:hover {
    background: #059669;
}

.btn-secondary {
    background: var(--gray-500);
    padding: 10px 20px;
}

.btn-secondary:hover {
    background: var(--gray-600);
}

.btn-danger {
    background: var(--danger);
    padding: 10px 20px;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-logout {
    background: var(--danger);
}

.btn-logout:hover {
    background: #dc2626;
}

/* Dashboard */
#dashboard {
    background: var(--gray-100);
    min-height: 100vh;
}

/* Header */
header {
    background: white;
    padding: 16px 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

header h1 {
    color: var(--primary);
    font-size: 24px;
    font-weight: 700;
}

.user-greeting {
    color: var(--gray-600);
    font-size: 14px;
}

nav {
    display: flex;
    gap: 12px;
    align-items: center;
}

.nav-btn {
    background: transparent;
    color: var(--gray-600);
    padding: 8px 16px;
    font-size: 14px;
}

.nav-btn:hover {
    background: var(--gray-100);
    color: var(--gray-800);
    transform: none;
    box-shadow: none;
}

.nav-btn.active {
    background: var(--primary);
    color: white;
}

/* Main Content */
main {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Toolbar */
.toolbar {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#search {
    flex: 1;
    min-width: 200px;
    margin: 0;
}

#filter-status, #filter-assigned {
    width: auto;
    min-width: 180px;
    margin: 0;
}

/* Table */
#leads-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--gray-50);
}

th, td {
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-200);
}

th {
    font-weight: 600;
    color: var(--gray-700);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    font-size: 14px;
}

tbody tr {
    transition: background 0.15s;
}

tbody tr:hover {
    background: var(--gray-50);
}

tbody tr:last-child td {
    border-bottom: none;
}

.table-actions {
    display: flex;
    gap: 8px;
}

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

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.status-new { background: #dbeafe; color: #1e40af; }
.status-contacted { background: #fef3c7; color: #92400e; }
.status-qualified { background: #d1fae5; color: #065f46; }
.status-proposal { background: #e9d5ff; color: #6b21a8; }
.status-won { background: #bbf7d0; color: #14532d; }
.status-lost { background: #fecaca; color: #7f1d1d; }

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: white;
    padding: 0;
    border-radius: 12px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h2 {
    margin: 0;
    color: var(--gray-800);
    font-size: 20px;
}

.close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: var(--gray-400);
    line-height: 1;
    transition: color 0.2s;
}

.close:hover {
    color: var(--gray-700);
}

#lead-form {
    padding: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-700);
    font-size: 13px;
}

.form-group input,
.form-group select,
.form-group textarea {
    margin: 0;
}

.form-actions {
    display: flex;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

.form-actions button {
    width: auto;
}

/* Error Messages */
.error {
    color: var(--danger);
    margin-top: 16px;
    text-align: center;
    font-size: 14px;
    padding: 8px;
    background: #fee2e2;
    border-radius: 6px;
}

.error:empty {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar > * {
        width: 100%;
    }

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

    header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    nav {
        width: 100%;
        flex-wrap: wrap;
    }

    .nav-btn {
        flex: 1;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 10px 8px;
    }

    .login-box {
        padding: 30px 20px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* Activities Timeline */
.modal-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid var(--gray-200);
}

.modal-section h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--gray-700);
}

.timeline {
    position: relative;
    padding-left: 40px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gray-200);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-icon {
    position: absolute;
    left: -30px;
    top: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    z-index: 1;
}

.timeline-icon.lead-created { background: var(--success); }
.timeline-icon.status-changed { background: var(--primary); }
.timeline-icon.lead-assigned { background: var(--warning); }
.timeline-icon.lead-unassigned { background: var(--gray-400); }
.timeline-icon.note-added { background: var(--secondary); }
.timeline-icon.default { background: var(--gray-400); }

.timeline-content {
    background: var(--gray-50);
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 3px solid var(--gray-300);
}

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

.timeline-user {
    font-weight: 600;
    color: var(--gray-700);
    font-size: 14px;
}

.timeline-time {
    font-size: 12px;
    color: var(--gray-500);
}

.timeline-description {
    color: var(--gray-600);
    font-size: 14px;
    line-height: 1.5;
}

.timeline-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
    font-style: italic;
}

/* Dashboard & KPIs */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-800);
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.chart-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-card h3 {
    font-size: 16px;
    color: var(--gray-700);
    margin-bottom: 20px;
    font-weight: 600;
}

.chart-container {
    position: relative;
    height: 300px;
}

.chart-container canvas {
    max-height: 300px;
}

/* Dashboard Widget */
.dashboard-widget {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.dashboard-widget h3 {
    font-size: 16px;
    color: var(--gray-700);
    margin-bottom: 20px;
    font-weight: 600;
}

.activities-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    display: flex;
    align-items: start;
    gap: 12px;
    padding: 12px;
    background: var(--gray-50);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.activity-details {
    flex: 1;
}

.activity-text {
    font-size: 14px;
    color: var(--gray-700);
    margin-bottom: 4px;
}

.activity-meta {
    font-size: 12px;
    color: var(--gray-500);
}

.activities-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
    font-style: italic;
}

/* Quick Filters */
.quick-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.quick-filter-btn {
    padding: 8px 16px;
    border: 2px solid var(--gray-200);
    background: white;
    color: var(--gray-700);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quick-filter-btn:hover {
    border-color: var(--primary);
    background: var(--gray-50);
    transform: translateY(-1px);
}

.quick-filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Bulk Actions Bar */
.bulk-actions-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.bulk-actions-info {
    color: white;
    font-weight: 600;
    font-size: 15px;
}

.bulk-actions-info span {
    font-size: 18px;
    font-weight: 700;
}

.bulk-actions-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.bulk-actions-buttons select {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: white;
    color: var(--gray-700);
    font-size: 13px;
    cursor: pointer;
    min-width: 150px;
}

.btn-danger-small,
.btn-secondary-small {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger-small {
    background: var(--danger);
    color: white;
}

.btn-danger-small:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-secondary-small {
    background: white;
    color: var(--gray-700);
}

.btn-secondary-small:hover {
    background: var(--gray-100);
}

/* Checkbox Styling */
#select-all-leads,
.lead-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Selected Row Highlight */
tr.selected {
    background: rgba(102, 126, 234, 0.08) !important;
}

tr.selected:hover {
    background: rgba(102, 126, 234, 0.12) !important;
}

/* Tasks Section */
.task-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--gray-200);
}

.task-tab {
    padding: 12px 24px;
    border: none;
    background: none;
    color: var(--gray-600);
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    position: relative;
    top: 2px;
}

.task-tab:hover {
    color: var(--primary);
}

.task-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

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

.task-stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    text-align: center;
    border-left: 4px solid var(--primary);
}

.task-stat-card.overdue {
    border-left-color: var(--danger);
}

.task-stat-card.completed {
    border-left-color: var(--success);
}

.task-stat-number {
    font-size: 36px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.task-stat-label {
    font-size: 14px;
    color: var(--gray-600);
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-card {
    background: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid var(--primary);
}

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

.task-card.completed {
    opacity: 0.7;
    border-left-color: var(--success);
}

.task-card.overdue {
    border-left-color: var(--danger);
    background: #fef2f2;
}

.task-checkbox-container {
    display: flex;
    align-items: center;
}

.task-checkbox {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--success);
}

.task-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.task-content {
    flex: 1;
}

.task-title {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.task-card.completed .task-title {
    text-decoration: line-through;
    color: var(--gray-500);
}

.task-description {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--gray-500);
}

.task-due-date {
    display: flex;
    align-items: center;
    gap: 6px;
}

.task-due-date.overdue {
    color: var(--danger);
    font-weight: 600;
}

.task-lead-link {
    color: var(--primary);
    text-decoration: none;
}

.task-lead-link:hover {
    text-decoration: underline;
}

.task-actions {
    display: flex;
    gap: 8px;
}

.task-action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.task-action-btn.delete {
    background: var(--danger);
    color: white;
}

.task-action-btn.delete:hover {
    background: #dc2626;
}

/* Task Form in Modal */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.task-form {
    background: var(--gray-50);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.form-row select,
.form-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
}

.form-row textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
}

.lead-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lead-task-item {
    background: var(--gray-50);
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 3px solid var(--primary);
}

.lead-task-item.completed {
    opacity: 0.6;
    border-left-color: var(--success);
}

.lead-task-item.overdue {
    border-left-color: var(--danger);
    background: #fef2f2;
}

.tasks-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
    font-style: italic;
}
/* ============================================================================
   Email Section Styles
   ============================================================================ */

.email-form {
    background: var(--gray-50);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    margin-bottom: 24px;
}

.email-form input[type="email"],
.email-form input[type="text"],
.email-form textarea,
.email-form select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.email-form input:focus,
.email-form textarea:focus,
.email-form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.email-form textarea {
    resize: vertical;
    min-height: 150px;
}

.email-form .form-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.email-form .form-row input,
.email-form .form-row select {
    margin-bottom: 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--gray-700);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

/* Email History */
.email-history {
    margin-top: 24px;
}

.email-history h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--gray-700);
}

#email-history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.email-history-item {
    background: white;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    transition: box-shadow 0.2s;
}

.email-history-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.email-history-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.email-history-subject {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 15px;
}

.email-history-date {
    font-size: 13px;
    color: var(--gray-500);
    white-space: nowrap;
}

.email-history-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.email-history-to {
    display: flex;
    align-items: center;
    gap: 4px;
}

.email-history-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.email-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.email-status-badge.sent {
    background: #dcfce7;
    color: #166534;
}

.email-status-badge.opened {
    background: #dbeafe;
    color: #1e40af;
}

.email-status-badge.clicked {
    background: #fce7f3;
    color: #9f1239;
}

.email-status-badge.failed {
    background: #fee2e2;
    color: #991b1b;
}

.email-history-body {
    font-size: 14px;
    color: var(--gray-600);
    line-height: 1.5;
    max-height: 100px;
    overflow: hidden;
    position: relative;
}

.email-history-body.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, transparent, white);
}

.email-expand-btn {
    margin-top: 8px;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.email-expand-btn:hover {
    color: var(--primary-dark);
}

.email-history-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
    font-style: italic;
}

/* Email tracking indicators */
.tracking-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
}

.tracking-indicator.opened {
    color: var(--primary);
}

.tracking-indicator.clicked {
    color: var(--secondary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .email-form .form-row {
        flex-direction: column;
    }

    .email-history-header {
        flex-direction: column;
        gap: 4px;
    }

    .email-history-meta {
        flex-direction: column;
        gap: 4px;
    }
}
/* ============================================================================
   Lead Scoring Styles
   ============================================================================ */

.lead-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
}

.lead-score.hot {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.lead-score.warm {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.lead-score.cold {
    background: var(--gray-200);
    color: var(--gray-600);
}

.hot-lead-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.hot-lead-badge::before {
    content: '🔥';
    font-size: 12px;
}

.lead-row.hot-lead {
    background: rgba(239, 68, 68, 0.02) !important;
}

.lead-row.hot-lead:hover {
    background: rgba(239, 68, 68, 0.05) !important;
}

/* Score indicator in modal */
.lead-score-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    margin-bottom: 20px;
}

.lead-score-display .score-label {
    font-size: 14px;
    color: var(--gray-600);
    font-weight: 500;
}

.lead-score-display .score-value {
    font-size: 24px;
    font-weight: 700;
    min-width: 60px;
    text-align: center;
    padding: 8px 16px;
    border-radius: 12px;
}

.lead-score-display .score-value.hot {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.lead-score-display .score-value.warm {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.lead-score-display .score-value.cold {
    background: var(--gray-200);
    color: var(--gray-700);
}

.score-breakdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    font-size: 13px;
}

.score-breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--gray-100);
}

.score-breakdown-item:last-child {
    border-bottom: none;
}

.score-breakdown-label {
    color: var(--gray-600);
}

.score-breakdown-points {
    font-weight: 600;
    color: var(--primary);
}

.score-breakdown-points.positive {
    color: var(--success);
}

.score-breakdown-points.negative {
    color: var(--danger);
}
/* ============================================================================
   Workflows Section Styles
   ============================================================================ */

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

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-800);
}

/* Workflows List */
.workflows-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.workflow-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-left: 4px solid var(--primary);
    transition: box-shadow 0.2s, transform 0.2s;
}

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

.workflow-card.inactive {
    opacity: 0.6;
    border-left-color: var(--gray-300);
}

.workflow-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.workflow-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.workflow-description {
    font-size: 14px;
    color: var(--gray-600);
}

.workflow-badges {
    display: flex;
    gap: 8px;
    align-items: center;
}

.workflow-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.workflow-badge.active {
    background: #dcfce7;
    color: #166534;
}

.workflow-badge.inactive {
    background: var(--gray-200);
    color: var(--gray-600);
}

.workflow-badge.priority-high {
    background: #fee2e2;
    color: #991b1b;
}

.workflow-meta {
    display: flex;
    gap: 24px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--gray-600);
}

.workflow-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.workflow-trigger {
    background: var(--gray-50);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.workflow-trigger-title {
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.workflow-trigger-value {
    font-size: 14px;
    color: var(--gray-700);
}

.workflow-action {
    background: var(--primary);
    color: white;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.workflow-action-title {
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
    opacity: 0.9;
    margin-bottom: 4px;
}

.workflow-action-value {
    font-size: 14px;
}

.workflow-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    border-top: 1px solid var(--gray-200);
    padding-top: 12px;
}

.workflow-actions button {
    padding: 6px 12px;
    font-size: 13px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.workflow-actions .btn-toggle {
    background: var(--gray-200);
    color: var(--gray-700);
}

.workflow-actions .btn-toggle:hover {
    background: var(--gray-300);
}

.workflow-actions .btn-toggle.active {
    background: var(--success);
    color: white;
}

.workflow-actions .btn-delete {
    background: var(--danger);
    color: white;
}

.workflow-actions .btn-delete:hover {
    background: #dc2626;
}

.workflow-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.workflow-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* Workflow type icons */
.workflow-type-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 16px;
}

.workflow-type-icon.status-change {
    background: #dbeafe;
}

.workflow-type-icon.email-event {
    background: #fce7f3;
}

.workflow-type-icon.score-threshold {
    background: #fef3c7;
}

.workflow-type-icon.time-based {
    background: #e0e7ff;
}

/* Responsive */
@media (max-width: 768px) {
    .workflow-stats {
        grid-template-columns: 1fr;
    }

    .workflow-header {
        flex-direction: column;
        gap: 12px;
    }

    .workflow-meta {
        flex-direction: column;
        gap: 8px;
    }

    .workflow-actions {
        flex-direction: column;
    }

    .workflow-actions button {
        width: 100%;
    }
}
/* ============================================================================
   Comments Section Styles
   ============================================================================ */

.comment-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
}

/* Comment Form */
.comment-form {
    background: var(--gray-50);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    margin-bottom: 24px;
}

.comment-form-header {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 12px;
}

.comment-form-header select {
    padding: 6px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

#comment-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
}

#comment-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.comment-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

/* Comments List */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comment-item {
    background: white;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    transition: box-shadow 0.2s;
}

.comment-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.comment-item.important {
    border-left: 4px solid var(--warning);
    background: #fffbeb;
}

.comment-item.discussion {
    border-left: 4px solid var(--primary);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.comment-author-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-author-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.comment-author-details {
    display: flex;
    flex-direction: column;
}

.comment-author-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-800);
}

.comment-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 12px;
    color: var(--gray-500);
}

.comment-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.comment-type-badge.note {
    background: var(--gray-100);
    color: var(--gray-600);
}

.comment-type-badge.discussion {
    background: #dbeafe;
    color: #1e40af;
}

.comment-type-badge.important {
    background: #fef3c7;
    color: #92400e;
}

.comment-internal-badge {
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.comment-actions {
    display: flex;
    gap: 8px;
}

.comment-action-btn {
    background: none;
    border: none;
    padding: 4px 8px;
    font-size: 12px;
    color: var(--gray-500);
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.comment-action-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.comment-content {
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-700);
    margin-bottom: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

.comment-content .mention {
    background: #dbeafe;
    color: #1e40af;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 500;
}

.comment-edited {
    font-size: 11px;
    color: var(--gray-400);
    font-style: italic;
}

/* Comment Reactions */
.comment-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.reaction-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--gray-100);
    border-radius: 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.reaction-item:hover {
    background: var(--gray-200);
}

.reaction-item.user-reacted {
    background: #dbeafe;
    border-color: var(--primary);
}

.reaction-emoji {
    font-size: 16px;
}

.reaction-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
}

.add-reaction-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--gray-100);
    border: 1px dashed var(--gray-300);
    border-radius: 12px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.add-reaction-btn:hover {
    background: var(--gray-200);
    border-color: var(--gray-400);
}

/* Reaction Picker */
.reaction-picker {
    position: absolute;
    background: white;
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 4px;
    z-index: 10;
}

.reaction-picker-emoji {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.reaction-picker-emoji:hover {
    background: var(--gray-100);
}

/* Empty State */
.comments-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
}

.comments-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .comment-form-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .comment-header {
        flex-direction: column;
        gap: 8px;
    }

    .comment-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ==================== Team & Assignment Styles ==================== */

/* Team Tabs */
.team-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 0;
}

.team-tab {
    background: none;
    border: none;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.team-tab:hover {
    color: var(--primary);
}

.team-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

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

.team-tab-content.hidden {
    display: none;
}

/* Lead Pool Header */
.pool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pool-info {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-700);
}

.pool-count {
    color: var(--primary);
    font-size: 28px;
    font-weight: 700;
}

.pool-actions {
    display: flex;
    gap: 12px;
}

/* Pool Leads Grid */
.pool-leads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.pool-lead-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
    border: 2px solid transparent;
}

.pool-lead-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
    border-color: var(--primary);
}

.pool-lead-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.pool-lead-title {
    flex: 1;
}

.pool-lead-company {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.pool-lead-contact {
    font-size: 14px;
    color: var(--gray-600);
}

.pool-lead-score {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.pool-lead-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.pool-lead-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-600);
}

.pool-lead-info-item strong {
    color: var(--gray-700);
}

.pool-lead-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.pool-lead-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--gray-100);
    color: var(--gray-700);
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}

.pool-lead-source {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--gray-100);
    color: var(--gray-700);
    border-radius: 16px;
    font-size: 12px;
}

.pool-lead-actions {
    display: flex;
    gap: 8px;
}

.btn-claim {
    flex: 1;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-claim:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-view-details {
    padding: 10px 16px;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-view-details:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

/* Team Stats Grid */
.team-stats-grid {
    display: grid;
    gap: 20px;
}

.team-member-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.team-member-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.team-member-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.team-member-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 20px;
}

.team-member-details h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.team-member-username {
    font-size: 14px;
    color: var(--gray-500);
}

.team-member-load {
    text-align: right;
}

.load-indicator {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.load-label {
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.team-member-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.stat-box {
    text-align: center;
    padding: 12px;
    background: var(--gray-50);
    border-radius: 8px;
}

.stat-box-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.stat-box-label {
    font-size: 11px;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.team-member-progress {
    margin-top: 16px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Assignment Widget */
.assignment-widget {
    background: var(--gray-50);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.assignment-current {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.assignment-icon {
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.assignment-info {
    flex: 1;
}

.assignment-label {
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.assignment-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
}

.assignment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
}

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

/* Assignment History Timeline */
.assignment-history-timeline {
    position: relative;
    padding-left: 40px;
}

.assignment-history-item {
    position: relative;
    padding-bottom: 24px;
}

.assignment-history-item:last-child {
    padding-bottom: 0;
}

.assignment-history-item::before {
    content: '';
    position: absolute;
    left: -32px;
    top: 8px;
    width: 16px;
    height: 16px;
    background: var(--primary);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--primary);
}

.assignment-history-item::after {
    content: '';
    position: absolute;
    left: -25px;
    top: 24px;
    width: 2px;
    height: calc(100% - 16px);
    background: var(--gray-200);
}

.assignment-history-item:last-child::after {
    display: none;
}

.assignment-history-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.assignment-history-action {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.assignment-history-users {
    font-size: 14px;
    color: var(--gray-600);
}

.assignment-history-time {
    font-size: 12px;
    color: var(--gray-500);
}

.assignment-history-reason {
    font-size: 13px;
    color: var(--gray-600);
    padding: 8px 12px;
    background: var(--gray-50);
    border-radius: 6px;
    margin-top: 8px;
}

.assignment-type-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--gray-200);
    color: var(--gray-700);
    border-radius: 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 8px;
}

.assignment-type-badge.auto {
    background: #dbeafe;
    color: #1e40af;
}

.assignment-type-badge.claim {
    background: #d1fae5;
    color: #065f46;
}

.assignment-type-badge.transfer {
    background: #fef3c7;
    color: #92400e;
}

.assignment-type-badge.unassign {
    background: #fee2e2;
    color: #991b1b;
}

/* Modal Small Variant */
.modal-small .modal-content {
    max-width: 500px;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 20px;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--gray-600);
    font-size: 14px;
}

/* Responsive for Team Section */
@media (max-width: 768px) {
    .pool-leads-grid {
        grid-template-columns: 1fr;
    }

    .team-member-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .pool-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .pool-actions {
        width: 100%;
    }

    .pool-actions button {
        flex: 1;
    }
}

/* ==================== Pipeline & Kanban Board Styles ==================== */

/* Pipeline Controls */
.pipeline-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.pipeline-controls select,
.pipeline-controls input {
    margin: 0;
}

.pipeline-controls input[type="search"] {
    min-width: 300px;
}

/* Pipeline Stats */
.pipeline-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.pipeline-stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

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

.pipeline-stat-card .stat-icon {
    font-size: 32px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
    border-radius: 12px;
}

.pipeline-stat-card .stat-content {
    flex: 1;
}

.pipeline-stat-card .stat-label {
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.pipeline-stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-800);
}

/* Kanban Board */
.kanban-board {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 20px;
    min-height: 600px;
}

.kanban-column {
    flex: 0 0 320px;
    background: var(--gray-50);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 400px);
}

.kanban-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 3px solid;
}

.kanban-column-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stage-color-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.kanban-column-title h3 {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-700);
    margin: 0;
}

.kanban-column-count {
    background: white;
    color: var(--gray-700);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.kanban-column-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.kanban-column-meta-item {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--gray-600);
}

.kanban-column-meta-item strong {
    color: var(--gray-800);
    font-weight: 600;
}

.kanban-column-cards {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Kanban Card */
.kanban-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: grab;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

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

.kanban-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.kanban-card.drag-over {
    border-left-color: var(--primary);
    background: var(--gray-50);
}

.kanban-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.kanban-card-company {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.kanban-card-contact {
    font-size: 13px;
    color: var(--gray-600);
}

.kanban-card-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.kanban-card-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.kanban-card-info-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--gray-600);
}

.kanban-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-card-assigned {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kanban-card-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: 600;
}

.kanban-card-assigned-name {
    font-size: 12px;
    color: var(--gray-700);
}

.kanban-card-probability {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--gray-100);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-700);
}

.kanban-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.kanban-card-actions button {
    flex: 1;
    padding: 6px 12px;
    font-size: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-edit-deal {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-edit-deal:hover {
    background: var(--gray-200);
}

.btn-view-lead {
    background: var(--primary);
    color: white;
}

.btn-view-lead:hover {
    background: var(--primary-dark);
}

/* Drag & Drop States */
.kanban-column.drag-over {
    background: #e0e7ff;
    border: 2px dashed var(--primary);
}

.kanban-column-cards.empty {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kanban-empty-state {
    text-align: center;
    color: var(--gray-400);
    font-size: 13px;
    padding: 20px;
}

/* Deal Modal */
.probability-display {
    text-align: center;
    margin-top: 8px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

#deal-probability {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #ef4444 0%, #f59e0b 50%, #10b981 100%);
    -webkit-appearance: none;
    appearance: none;
}

#deal-probability::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#deal-probability::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Responsive */
@media (max-width: 1024px) {
    .kanban-board {
        flex-direction: column;
    }

    .kanban-column {
        flex: 1 1 auto;
        max-height: none;
    }

    .kanban-column-cards {
        max-height: 400px;
    }

    .pipeline-controls {
        flex-wrap: wrap;
    }

    .pipeline-controls input[type="search"] {
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .pipeline-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .kanban-column {
        flex: 0 0 280px;
    }
}
