/* Core Variables */
:root {
    --primary-color: #4f46e5;
    /* Indigo */
    --primary-hover: #4338ca;
    --secondary-color: #64748b;
    /* Slate */
    --background-color: #f8fafc;
    /* Light Slate */
    --surface-color: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #0f172a;
    /* Slate 900 */
    --text-muted: #64748b;
    /* Slate 500 */
    --sidebar-bg: #1e293b;
    /* Slate 800 */
    --sidebar-text: #cbd5e1;
    /* Slate 300 */
    --sidebar-active: #334155;
    /* Slate 700 */

    /* Kanban Status Colors */
    --status-new: #3b82f6;
    /* Blue */
    --status-working: #eab308;
    /* Yellow */
    --status-qualified: #a855f7;
    /* Purple */
    --status-proposal: #f97316;
    /* Orange */
    --status-won: #22c55e;
    /* Green */
    --status-lost: #ef4444;
    /* Red */

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --transition-speed: 0.2s;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout Container */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 10;
}

/* Sidebar Collapse Button — floating circle on sidebar edge */
.sidebar-collapse-btn {
    position: absolute;
    top: 21px;
    left: 246px;  /* 260px sidebar width - 14px (half of 28px button) */
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--secondary-color);
    font-size: 0;  /* hide text, use icon only */
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 20;
    font-family: inherit;
}
.sidebar-collapse-btn:hover {
    background: var(--background-color);
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: scale(1.1);
}
.collapse-icon {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    transition: transform 0.3s ease;
}

/* Nav label transition for smooth collapse */
.nav-label {
    display: inline;
    opacity: 1;
    transition: opacity 0.2s ease 0.1s, width 0.3s ease;
    white-space: nowrap;
}

/* ── Collapsed State ──────────────────────────────────────────── */
.sidebar.sidebar-collapsed {
    width: 72px;
}

.sidebar.sidebar-collapsed .logo-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity 0.15s ease, width 0.25s ease;
}

.sidebar.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 0 8px;
}

.sidebar.sidebar-collapsed .sidebar-nav li a {
    justify-content: center;
    padding: 12px 0;
    border-left: 3px solid transparent;
    font-size: 1.2rem;
    position: relative;
}

.sidebar.sidebar-collapsed .nav-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
    display: inline-block;
    transition: opacity 0.1s ease, width 0.2s ease;
}

/* Collapsed sidebar tooltips */
.sidebar.sidebar-collapsed .sidebar-nav li a::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: #f1f5f9;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 100;
}
.sidebar.sidebar-collapsed .sidebar-nav li a::before {
    content: '';
    position: absolute;
    left: calc(100% + 4px);
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: #1e293b;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 100;
}
.sidebar.sidebar-collapsed .sidebar-nav li a:hover::after,
.sidebar.sidebar-collapsed .sidebar-nav li a:hover::before {
    opacity: 1;
}

/* Collapsed: active state uses background instead of border-left */
.sidebar.sidebar-collapsed .sidebar-nav li.active a {
    background-color: var(--sidebar-active);
    border-radius: 10px;
    margin: 0 10px;
    border-left-color: transparent;
}

/* Collapsed: user section */
.sidebar.sidebar-collapsed .sidebar-user-info,
.sidebar.sidebar-collapsed .sidebar-logout-btn {
    display: none;
}
.sidebar.sidebar-collapsed .sidebar-user-inner {
    justify-content: center;
    padding: 12px 0 !important;
}
.sidebar.sidebar-collapsed .sidebar-avatar {
    margin: 0;
}

/* Collapsed: collapse button repositions to 72px sidebar edge */
.sidebar.sidebar-collapsed ~ .sidebar-collapse-btn {
    left: 58px;  /* 72px sidebar width - 14px (half of 28px button) */
}

.sidebar-header {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.logo h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 0;
    overflow-y: auto;
    scrollbar-width: none;            /* Firefox */
    -ms-overflow-style: none;         /* IE/Edge */
}
.sidebar-nav::-webkit-scrollbar {
    display: none;                    /* Chrome/Safari */
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
    background-color: var(--sidebar-active);
    color: white;
}

.sidebar-nav li.active a {
    background-color: var(--sidebar-active);
    color: white;
    border-left-color: var(--primary-color);
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--sidebar-active);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Topbar */
.topbar {
    height: 70px;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    flex-shrink: 0;
    position: relative;
    z-index: 25;  /* Above sidebar-collapse-btn (z-index: 20) */
}

.search-bar input {
    width: 350px;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background-color: var(--background-color);
    font-size: 0.9rem;
    outline: none;
    transition: width var(--transition-speed) ease, border-color var(--transition-speed) ease;
    font-family: inherit;
}

.search-bar input:focus {
    width: 400px;
    border-color: var(--primary-color);
    background-color: var(--surface-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.topbar-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-speed) ease;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: var(--background-color);
    border-color: var(--secondary-color);
}

/* View Container */
.view-container {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    background-color: var(--background-color);
}

.page-header {
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 4px;
}

/* Dashboard Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-trend {
    font-size: 0.85rem;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.trend-up {
    color: var(--status-won);
}

.trend-down {
    color: var(--status-lost);
}

/* Stat card icon row */
.stat-icon-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 1.1rem;
    line-height: 1;
}

/* Responsive: stack stat cards on small screens */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .stat-value {
        font-size: 1.6rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}


/* Data Tables */
.table-container {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th {
    background-color: #f8fafc;
    padding: 16px 24px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-main);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: #f1f5f9;
    cursor: pointer;
}

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

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.badge-new {
    background-color: #dbeafe;
    color: #1e3a8a;
}

.badge-new::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #3b82f6;
    margin-right: 6px;
}

.badge-unassigned {
    background-color: #f1f5f9;
    color: #64748b;
}

.badge-unassigned::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #94a3b8;
    margin-right: 6px;
}

.badge-working {
    background-color: #fef08a;
    color: #854d0e;
}

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

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

.badge-meeting::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #22c55e;
    margin-right: 6px;
}

.badge-discovery {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-discovery::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #10b981;
    margin-right: 6px;
}

.badge-discovery-done {
    background-color: #a7f3d0;
    color: #047857;
}

.badge-discovery-done::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #059669;
    margin-right: 6px;
}

.badge-demo {
    background-color: #e0e7ff;
    color: #4338ca;
}

.badge-demo::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #6366f1;
    margin-right: 6px;
}

.badge-demo-done {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.badge-demo-done::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #3b82f6;
    margin-right: 6px;
}

.badge-completed {
    background-color: #bbf7d0;
    color: #166534;
}

.badge-completed::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #16a34a;
    margin-right: 6px;
}

.badge-lost {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-declined {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-declined::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #f59e0b;
    margin-right: 6px;
}

.badge-unreachable {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-unreachable::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #ef4444;
    margin-right: 6px;
}

/* ── Grouped Kanban Board (v6.0.0) ────────────────────────────────── */
.kanban-board-grouped {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-bottom: 32px;
}

.kanban-group {
    background: var(--bg-secondary, #f8fafc);
    border-radius: 14px;
    border: 1px solid var(--border-color, #e5e7eb);
    overflow: hidden;
}

.kanban-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--surface-color, #fff);
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    border-left: 4px solid #6366f1;
}

.kanban-group-label {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-primary, #18181b);
}

.kanban-group-count {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted, #71717a);
    background: var(--bg-secondary, #f1f5f9);
    padding: 3px 10px;
    border-radius: 20px;
}

.kanban-group-columns {
    display: flex;
    gap: 1px;
    overflow-x: auto;
    padding: 12px;
    background: var(--bg-secondary, #f1f5f9);
}

.kanban-group-columns .kanban-col {
    min-width: 180px;
    flex: 1;
    max-width: 260px;
}

.kanban-group-columns .kanban-col-header span:first-child {
    font-size: 0.78rem;
}

/* Animation Utils */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Kanban Board Container (Preview) */
.kanban-board {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 16px;
    height: calc(100vh - 220px);
}

.kanban-col {
    background: #f1f5f9;
    border-radius: var(--radius-md);
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.kanban-col-header {
    padding: 16px;
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 2px solid transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-col-count {
    background: var(--border-color);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.kanban-col.new .kanban-col-header {
    border-bottom-color: var(--status-new);
}

.kanban-col.working .kanban-col-header {
    border-bottom-color: var(--status-working);
}

.kanban-col.won .kanban-col-header {
    border-bottom-color: var(--status-won);
}

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

.k-card {
    background: var(--surface-color);
    padding: 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
}

.k-card:active {
    cursor: grabbing;
}

.k-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.k-card h4 {
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.k-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

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

.k-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.2s ease-in-out;
}

.modal-content {
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    position: relative;
    border: 1px solid var(--border-color);
}

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

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-modal {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-speed) ease;
}

.close-modal:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Form Styles */
.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-speed) ease;
    background-color: white;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* ── New Lead Form Grid ───────────────────────────────────── */
.new-lead-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}
.new-lead-grid .form-group {
    margin-bottom: 0;
}
@media (max-width: 560px) {
    .new-lead-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Call Outcome Grouped Picker ───────────────────────────── */
.call-outcome-picker {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px 4px;
    max-height: 320px;
    overflow-y: auto;
}
.outcome-group { padding: 2px 0; }
.outcome-group-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 6px 10px 2px;
    text-transform: uppercase;
}
.outcome-group-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 8px;
}
.outcome-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}
.outcome-item:hover { background: #f1f5f9; }
.outcome-item.selected { background: #eef2ff; outline: 1px solid var(--primary-color); }
.outcome-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.outcome-dot-check {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
}
.outcome-info { flex: 1; min-width: 0; }
.outcome-name { font-size: 0.85rem; font-weight: 500; color: var(--text-main); }
.outcome-desc { font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; }
.outcome-confirmed.selected {
    background: #f0fdf4;
    outline-color: #16a34a;
}


/* Settings Styles */
/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #cbd5e1;
    border-radius: 24px;
    transition: 0.3s;
}
.toggle-slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background-color: var(--primary-color, #6366f1); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 32px;
}

.settings-card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.settings-card h3 {
    margin-bottom: 8px;
    font-size: 1.1rem;
    font-weight: 600;
}

.settings-card p.text-muted {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.status-box {
    padding: 16px;
    border-radius: var(--radius-md);
    background: #f8fafc;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.status-box.connected {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-main);
}

.settings-select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.settings-select:focus {
    border-color: var(--primary-color);
}

/* Filter bar inputs */
.filter-input,
.filter-select {
    padding: 9px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-input:focus,
.filter-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Extra badge statuses */
.badge-qualified {
    background-color: #f3e8ff;
    color: #6b21a8;
}

.badge-proposal {
    background-color: #fff7ed;
    color: #9a3412;
}

.badge-lost {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ─── Lead Detail Page ──────────────────────────────────────────────────────── */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-bottom: 20px;
    transition: color 0.2s;
    font-family: inherit;
}

.back-btn:hover {
    color: var(--primary-color);
}

.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.detail-name {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.detail-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

.detail-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.info-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.info-card-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.info-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.info-field .field-value {
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 500;
    padding: 8px 0;
    border-bottom: 1px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s;
    display: block;
    min-height: 36px;
}

.info-field .field-value:hover {
    border-bottom-color: var(--border-color);
}

.info-field input,
.info-field select {
    width: 100%;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 8px 10px;
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-md);
    outline: none;
    font-family: inherit;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Right Panel */
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Timeline */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.timeline-item {
    display: flex;
    gap: 14px;
    padding-bottom: 20px;
    position: relative;
}

.timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 32px;
    width: 2px;
    bottom: 0;
    background: var(--border-color);
}

.timeline-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.timeline-content p {
    font-size: 0.85rem;
    color: var(--text-main);
    margin-bottom: 2px;
}

.timeline-content span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Notes */
.note-input-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.note-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.note-textarea:focus {
    border-color: var(--primary-color);
}

.note-item {
    background: #f8fafc;
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    position: relative;
}

.note-item p {
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.note-item .note-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.note-delete {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.2s;
}

.note-delete:hover {
    background: #fee2e2;
    color: var(--status-lost);
}

/* Tasks */
.task-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.task-input {
    flex: 1;
    padding: 9px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
}

.task-input:focus {
    border-color: var(--primary-color);
}

.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.task-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
    flex-shrink: 0;
}

.task-item span {
    flex: 1;
    font-size: 0.9rem;
    transition: color 0.2s, text-decoration 0.2s;
}

.task-item.done span {
    text-decoration: line-through;
    color: var(--text-muted);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: #fee2e2;
    color: var(--status-lost);
}

/* ─── SDR / Call-Log Additions ─────────────────────────────────────────────── */

/* Extra design token used by SDR dashboard outcome chips */
:root {
    --bg-secondary: #f1f5f9;
}

/* Call log entry — styled like a note but with a left accent */
.call-log-item {
    background: #f8fafc;
    border-radius: var(--radius-md);
    padding: 14px 14px 10px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary-color);
    position: relative;
}

.call-log-item .call-outcome-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.call-log-item .call-outcome-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.call-log-item .call-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
}

.call-log-item .call-notes-text {
    font-size: 0.85rem;
    color: var(--text-main);
    margin: 4px 0 0;
    line-height: 1.5;
}

.call-log-item .call-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Outcome colour coding */
.call-answered {
    border-left-color: #22c55e;
}

.call-no-answer {
    border-left-color: #ef4444;
}

.call-voicemail {
    border-left-color: #6366f1;
}

.call-callback {
    border-left-color: #f59e0b;
}

.call-wrong {
    border-left-color: #94a3b8;
}

.call-dnc {
    border-left-color: #0f172a;
}

/* Outcome chip in call modal select */
#call-outcome-select option {
    font-size: 0.95rem;
}

/* Priority queue row highlight — callbacks */
tr.priority-callback td:first-child {
    border-left: 3px solid #f59e0b;
}

/* Priority queue row highlight — new leads */
tr.priority-new td:first-child {
    border-left: 3px solid #4f46e5;
}

/* SDR dashboard outcome chip strip */
.outcome-chips {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding: 4px 0 8px;
}

.outcome-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    transition: box-shadow 0.2s;
}

.outcome-chip:hover {
    box-shadow: var(--shadow-md);
}

.outcome-chip .chip-icon {
    font-size: 1.2rem;
}

.outcome-chip .chip-count {
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1;
}

.outcome-chip .chip-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Call log modal phone display */
#call-modal-phone {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--primary-color);
    letter-spacing: 0.03em;
    margin-top: 4px;
}

/* Quick call button inside table — don't grow too wide */
.quick-call-btn {
    white-space: nowrap;
}

/* Unassign button in admin table */
.unassign-btn {
    white-space: nowrap;
    transition: all 0.2s;
}

.unassign-btn:hover {
    background: #fee2e2 !important;
}

/* Highlight callback rows in leads table */
.lead-row[data-status="Callback Scheduled"] {
    background: #fffbeb;
}

.lead-row[data-status="Callback Scheduled"]:hover {
    background: #fef3c7;
}

/* No-leads empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text-main);
}

.empty-state p {
    font-size: 0.9rem;
}

/* ── Responsive Design ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100% !important; /* Override collapsed width on mobile */
        height: auto;
        padding-bottom: 0px;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
    }

    .sidebar-collapse-btn {
        display: none; /* Hide collapse button on mobile */
    }

    .sidebar.sidebar-collapsed .nav-label {
        opacity: 1;
        width: auto;
        display: inline;
    }

    .sidebar.sidebar-collapsed .logo-text {
        opacity: 1;
        width: auto;
    }

    .sidebar-header {
        height: 60px;
        width: 100%;
        justify-content: space-between;
    }

    .sidebar-nav {
        width: 100%;
        overflow-x: auto;
    }

    .sidebar-nav ul {
        display: flex;
        flex-direction: row;
        min-width: max-content;
    }

    .sidebar-nav a {
        padding: 10px 16px;
    }

    #sidebar-user {
        width: 100%;
        display: none;
        /* Hide user info block on very strict mobile vertically */
    }

    .dash-grid,
    .dash-metric-grid,
    .two-col-layout {
        grid-template-columns: 1fr;
    }

    .kanban-board {
        flex-wrap: nowrap;
    }

    .kanban-col {
        min-width: 85vw;
        /* Make columns almost full width but indicate scrolling */
    }

    .table-container {
        overflow-x: auto;
    }

    .modal-content {
        width: 95%;
        margin: 10px auto;
        max-height: 90vh;
        overflow-y: auto;
    }

    .topbar {
        flex-direction: column;
        gap: 12px;
        height: auto;
        padding: 12px;
        align-items: flex-start;
    }

    .search-bar {
        width: 100%;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
    }
}

/* ── Pipeline Status Stepper ──────────────────────────────────────────────── */
.pipeline-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
}

.pipeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: transform 0.2s;
    padding: 4px 8px;
}

.pipeline-step:hover {
    transform: translateY(-2px);
}

.step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 700;
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
    background: white;
    color: var(--text-muted);
}

.step-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.step-connector {
    flex: 1;
    height: 3px;
    background: var(--border-color);
    min-width: 40px;
    transition: background 0.3s ease;
}

.step-connector-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 40px;
    margin: 0 -4px;
    margin-bottom: 22px;
    gap: 2px;
}

.step-connector-wrap .step-connector {
    width: 100%;
    min-width: unset;
    margin: 0;
    margin-bottom: 0;
}

.step-connector-time {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    padding: 1px 6px;
    background: #f1f5f9;
    border-radius: 8px;
    margin-top: 2px;
}

.step-connector-done {
    background: #22c55e;
}

.step-timestamp {
    font-size: 0.62rem;
    color: var(--text-muted);
    margin-top: -2px;
    white-space: nowrap;
}

/* Branch zone: wraps connector + terminal branch in a column */
.step-branch-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 40px;
    margin: 0 -4px;
    gap: 0;
}

.step-branch-zone > .step-connector {
    width: 100%;
    min-width: unset;
    margin: 0;
    margin-bottom: 0;
}

/* Inline terminal branch (drops below the connector) */
.terminal-branch-inline {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.terminal-branch-connector {
    width: 0;
    height: 22px;
    border-left: 2px dashed;
    opacity: 0.6;
}

.terminal-branch-card {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1.5px solid;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    font-size: 0.78rem;
    position: relative;
    z-index: 2;
}

/* Skipped step (when terminal outcome occurred) */
.step-skipped .step-circle {
    background: white;
    border-color: var(--border-color);
    color: var(--text-muted);
    opacity: 0.4;
}
.step-skipped .step-label {
    color: var(--text-muted);
    opacity: 0.4;
    text-decoration: line-through;
}

/* Done steps */
.step-done .step-circle {
    background: #22c55e;
    border-color: #22c55e;
    color: white;
}
.step-done .step-label {
    color: #15803d;
}
.step-done + .step-connector {
    background: #22c55e;
}

/* Active step */
.step-active .step-circle {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}
.step-active .step-label {
    color: var(--primary-color);
    font-weight: 700;
}

/* Future steps */
.step-future .step-circle {
    background: white;
    border-color: var(--border-color);
    color: var(--text-muted);
}
.step-future:hover .step-circle {
    border-color: var(--primary-color);
    color: var(--primary-color);
}
.step-future:hover .step-label {
    color: var(--primary-color);
}

/* Editable field hover */
.editable-field {
    transition: background 0.2s;
    padding: 2px 4px;
    border-radius: 4px;
    margin: -2px -4px;
}
.editable-field:hover {
    background: #f1f5f9;
}

/* Responsive stepper */
@media (max-width: 768px) {
    .pipeline-stepper {
        flex-wrap: wrap;
        gap: 4px;
    }
    .step-connector {
        min-width: 20px;
    }
    .step-label {
        font-size: 0.65rem;
    }
}

/* ── Pipeline V2 — Grouped Stage Pipeline ──────────────────────────────────── */
.pipeline-v2-card {
    padding: 20px 24px;
    margin-bottom: 20px;
}

/* Progress Summary Strip */
.pipeline-v2-progress-strip {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}
.pipeline-v2-progress-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
}
.pipeline-v2-progress-sublabel {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.pipeline-v2-progress-bar {
    flex: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}
.pipeline-v2-progress-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stage pills container */
.pipeline-v2 {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    width: 100%;
    margin-bottom: 4px;
}

/* Individual stage pill */
.pipeline-v2-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: transform 0.2s ease;
    padding: 4px 12px;
    flex: 1;
    max-width: 160px;
    position: relative;
}
.pipeline-v2-stage:hover {
    transform: translateY(-2px);
}

.pipeline-v2-stage-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    font-weight: 700;
    transition: all 0.3s ease;
    border: 2.5px solid var(--border-color);
    background: white;
    color: var(--text-muted);
    position: relative;
    z-index: 2;
}

.pipeline-v2-stage-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.pipeline-v2-stage-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
    margin-top: -2px;
}

/* Stage states */
.pipeline-v2-stage.completed .pipeline-v2-stage-circle {
    background: #22c55e;
    border-color: #22c55e;
    color: white;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.25);
}
.pipeline-v2-stage.completed .pipeline-v2-stage-label {
    color: #15803d;
    font-weight: 700;
}
.pipeline-v2-stage.completed .pipeline-v2-stage-badge {
    background: #dcfce7;
    color: #15803d;
}

.pipeline-v2-stage.active .pipeline-v2-stage-circle {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 0 0 5px rgba(79, 70, 229, 0.12);
    animation: stagePulse 2s ease-in-out infinite;
}
.pipeline-v2-stage.active .pipeline-v2-stage-label {
    color: var(--primary-color);
    font-weight: 700;
}
.pipeline-v2-stage.active .pipeline-v2-stage-badge {
    background: #eef2ff;
    color: var(--primary-color);
}

.pipeline-v2-stage.pending .pipeline-v2-stage-circle {
    background: white;
    border-color: #e2e8f0;
    color: #cbd5e1;
}
.pipeline-v2-stage.pending .pipeline-v2-stage-label {
    color: #94a3b8;
}
.pipeline-v2-stage.pending .pipeline-v2-stage-badge {
    background: #f1f5f9;
    color: #94a3b8;
}
.pipeline-v2-stage.pending:hover .pipeline-v2-stage-circle {
    border-color: #a5b4fc;
    color: #a5b4fc;
}

.pipeline-v2-stage.skipped .pipeline-v2-stage-circle {
    opacity: 0.35;
    border-color: var(--border-color);
}
.pipeline-v2-stage.skipped .pipeline-v2-stage-label {
    opacity: 0.35;
    text-decoration: line-through;
}

/* Connector between stages */
.pipeline-v2-connector {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 40px;
    margin-top: 19px; /* center with circle */
    gap: 4px;
}
.pipeline-v2-connector-line {
    width: 100%;
    height: 3px;
    background: #e2e8f0;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    transition: background 0.4s ease;
}
.pipeline-v2-connector.done .pipeline-v2-connector-line {
    background: #22c55e;
}
.pipeline-v2-connector.done .pipeline-v2-connector-line::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: connectorShine 2s ease-in-out;
}
.pipeline-v2-connector-time {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    padding: 1px 6px;
    background: #f1f5f9;
    border-radius: 8px;
}

/* Expandable stage panel */
.pipeline-v2-expand {
    margin-top: 12px;
    background: linear-gradient(135deg, #f8fafc, #fafbfe);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
    max-height: 0;
    opacity: 0;
    padding: 0 16px;
}
.pipeline-v2-expand.open {
    max-height: 500px;
    opacity: 1;
    padding: 14px 16px;
}
.pipeline-v2-expand-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Sub-steps inside expand panel */
.pipeline-v2-substeps {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.pipeline-v2-substep {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid transparent;
}
.pipeline-v2-substep:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
}
.pipeline-v2-substep.done {
    background: #f0fdf4;
    border-color: #bbf7d0;
    cursor: default;
}
.pipeline-v2-substep.active {
    background: #eef2ff;
    border-color: #a5b4fc;
    font-weight: 600;
}
.pipeline-v2-substep.future {
    color: var(--text-muted);
}
.pipeline-v2-substep-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid var(--border-color);
    background: white;
}
.pipeline-v2-substep.done .pipeline-v2-substep-dot {
    background: #22c55e;
    border-color: #22c55e;
}
.pipeline-v2-substep.active .pipeline-v2-substep-dot {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}
.pipeline-v2-substep-label {
    flex: 1;
    font-size: 0.82rem;
}
.pipeline-v2-substep-time {
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Discovery call entries */
.pipeline-v2-discovery-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    font-size: 0.82rem;
    margin-bottom: 4px;
}
.pipeline-v2-discovery-entry.pending-call {
    background: #eef2ff;
    border-color: #c7d2fe;
}
.pipeline-v2-discovery-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #16a34a;
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pipeline-v2-discovery-entry.pending-call .pipeline-v2-discovery-num {
    background: var(--primary-color);
}
.pipeline-v2-discovery-info {
    flex: 1;
}
.pipeline-v2-discovery-info-title {
    font-weight: 600;
    font-size: 0.8rem;
}
.pipeline-v2-discovery-info-time {
    font-size: 0.68rem;
    color: var(--text-muted);
}

/* Terminal branch (DQ/Completed) */
.pipeline-v2-terminal {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 12px;
}
.pipeline-v2-terminal-connector {
    width: 0;
    height: 20px;
    border-left: 2px dashed;
    opacity: 0.5;
}
.pipeline-v2-terminal-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    border: 1.5px solid;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    font-size: 0.82rem;
}
.pipeline-v2-terminal-card.dq {
    background: #fee2e2;
    border-color: rgba(239, 68, 68, 0.3);
}
.pipeline-v2-terminal-card.completed {
    background: #dcfce7;
    border-color: rgba(22, 163, 98, 0.3);
}

/* Animations */
@keyframes stagePulse {
    0%, 100% { box-shadow: 0 0 0 5px rgba(79, 70, 229, 0.12); }
    50% { box-shadow: 0 0 0 8px rgba(79, 70, 229, 0.06); }
}
@keyframes connectorShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Responsive */
@media (max-width: 768px) {
    .pipeline-v2 {
        gap: 0;
    }
    .pipeline-v2-stage {
        padding: 4px 6px;
    }
    .pipeline-v2-stage-circle {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }
    .pipeline-v2-stage-label {
        font-size: 0.68rem;
    }
    .pipeline-v2-connector {
        min-width: 20px;
    }
    .pipeline-v2-progress-strip {
        flex-wrap: wrap;
        gap: 6px;
    }
}
@media (max-width: 480px) {
    .pipeline-v2-stage-badge {
        display: none;
    }
    .pipeline-v2-stage-label {
        font-size: 0.62rem;
    }
}

/* ── AI Intelligence Cards ─────────────────────────────────────────────────── */
.intel-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    transition: box-shadow 0.2s;
}
.intel-card:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.intel-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.intel-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.intel-value {
    flex: 1;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--text-main);
    word-break: break-word;
}
.intel-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
}
.intel-card:hover .intel-actions {
    opacity: 1;
}
.intel-copy-btn {
    font-size: 0.7rem;
    padding: 3px 9px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s;
    white-space: nowrap;
}
.intel-copy-btn:hover {
    background: #f1f5f9;
    color: var(--text-main);
}
.intel-edit-btn {
    font-size: 0.78rem;
    padding: 3px 7px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s;
}
.intel-edit-btn:hover {
    background: #eef2ff;
    border-color: #a5b4fc;
}
.intel-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
}

/* Shimmer skeleton */
.research-shimmer {
    height: 52px;
    border-radius: 8px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e8ecf0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}



.research-section {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 8px;
    overflow: hidden;
    transition: border-color 0.3s;
}

.research-section-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}
.research-section-header:hover {
    background: #f8fafc;
}

.rsec-chevron {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.3s;
}
.research-section.open .rsec-chevron {
    transform: rotate(180deg);
}

.rsec-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
}

.research-section-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.3s ease;
    padding: 0 16px;
}
.research-section.open .research-section-body {
    max-height: 600px;
    padding: 0 16px 16px;
}

.rfield {
    margin-bottom: 14px;
}
.rfield-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}
.rfield-required {
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 4px;
    vertical-align: middle;
}
.rfield-input {
    width: 100%;
    padding: 9px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    transition: all 0.2s;
    background: #fafbfc;
}
.rfield-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
    background: white;
}

/* Research Chips */
.rchip {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    border: 1.5px solid var(--border-color);
    background: white;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}
.rchip:hover {
    border-color: #a5b4fc;
    color: var(--primary-color);
    background: #eef2ff;
}
.rchip.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ── User Guide Styles ───────────────────────────────────────────────── */
.guide-search-wrap {
    margin-bottom: 24px;
}
.guide-search-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--surface-color);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.guide-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.guide-section {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.guide-section:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.guide-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    user-select: none;
    transition: background 0.15s;
}
.guide-section-header:hover {
    background: #f8fafc;
}
.guide-chevron {
    transition: transform 0.3s ease;
    color: var(--text-muted);
    flex-shrink: 0;
}
.guide-section-body {
    padding: 0 24px 24px 24px;
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-main);
}
.guide-section-body h4 {
    font-size: 0.92rem;
    font-weight: 700;
    margin: 20px 0 10px 0;
    color: var(--text-main);
}
.guide-section-body h4:first-child {
    margin-top: 0;
}
.guide-section-body ul, .guide-section-body ol {
    padding-left: 20px;
    margin: 8px 0;
}
.guide-section-body li {
    margin-bottom: 6px;
}
.guide-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 0.85rem;
}
.guide-table th {
    background: #f1f5f9;
    font-weight: 700;
    text-align: left;
    padding: 10px 14px;
    border-bottom: 2px solid var(--border-color);
}
.guide-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}
.guide-table tr:last-child td {
    border-bottom: none;
}
.guide-table code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.82rem;
}
.guide-note {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    margin: 12px 0;
    font-size: 0.84rem;
    color: #1e40af;
}
.guide-tip {
    background: #f0fdf4;
    border-left: 4px solid #22c55e;
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    margin: 12px 0;
    font-size: 0.84rem;
    color: #15803d;
}
.guide-warning {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    margin: 12px 0;
    font-size: 0.84rem;
    color: #92400e;
}
.guide-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Metrics Dashboard ─────────────────────────────────────────────────── */
.metrics-dashboard {
    max-width: 1200px;
    margin: 0 auto;
}

.metrics-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.metrics-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.metrics-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.metrics-controls .dropdown { position: relative; }
.metrics-controls .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 10;
    min-width: 160px;
    overflow: hidden;
}
.metrics-controls .dropdown-menu a {
    display: block;
    padding: 10px 16px;
    font-size: 0.88rem;
    color: var(--text-main);
    text-decoration: none;
}
.metrics-controls .dropdown-menu a:hover {
    background: #f1f5f9;
}

.kpi-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.kpi-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s, box-shadow 0.15s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.kpi-value-sm {
    font-size: 1.1rem !important;
}

.kpi-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

.chart-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.chart-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-main);
}

.feature-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.feature-bar-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    width: 110px;
    flex-shrink: 0;
}

.feature-bar-track {
    flex: 1;
    height: 20px;
    background: #f1f5f9;
    border-radius: 6px;
    overflow: hidden;
}

.feature-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.6s ease;
}

.feature-bar-val {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    width: 50px;
    text-align: right;
    flex-shrink: 0;
}

.sdr-table-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 32px;
}

.sdr-table-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-main);
}

.sdr-table-card .table {
    width: 100%;
    border-collapse: collapse;
}

.sdr-table-card .table th {
    padding: 12px 16px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
    text-align: left;
}

.sdr-table-card .table td {
    padding: 12px 16px;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.sdr-table-card .table tbody tr:last-child td {
    border-bottom: none;
}

.sdr-table-card .table .text-center {
    text-align: center;
}

@media (max-width: 900px) {
    .charts-row { grid-template-columns: 1fr; }
    .kpi-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .kpi-cards { grid-template-columns: 1fr; }
    .metrics-header { flex-direction: column; }
}

/* Danger button */
.btn-danger {
    background: #ef4444;
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-danger:hover {
    background: #dc2626;
}

/* ── Lead Detail Tab System ──────────────────────────────────────────── */
.lead-tab-bar {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    margin: 0 -32px;
    padding: 0 32px;
}
.lead-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 14px 20px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    user-select: none;
}
.lead-tab:hover {
    color: var(--text-main);
    background: #f8fafc;
}
.lead-tab.active {
    color: var(--primary-color);
    font-weight: 600;
    border-bottom-color: var(--primary-color);
    background: #eef2ff;
}
.lead-tab .tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--primary-color);
    color: white;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Call Stats Cards ────────────────────────────────────────────────── */
.call-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.call-stat-card {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
}
.call-stat-card .stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.call-stat-card .stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 6px;
}
.call-stat-card .stat-number.green { color: #22c55e; }
.call-stat-card .stat-number.primary { color: var(--primary-color); }

/* ── Call Filter Pills ───────────────────────────────────────────────── */
.call-filters {
    display: flex;
    gap: 8px;
    align-items: center;
}
.call-filter-pill {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}
.call-filter-pill:hover { border-color: var(--primary-color); color: var(--primary-color); }
.call-filter-pill.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: 600;
}

/* ── Call Entry Cards ────────────────────────────────────────────────── */
.call-card {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
    transition: box-shadow 0.2s ease;
}
.call-card:hover { box-shadow: var(--shadow-sm); }
.call-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.call-card-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.call-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.call-status-dot.connected { background: #22c55e; }
.call-status-dot.missed { background: #ef4444; }
.call-status-dot.pending { background: #f59e0b; }
.call-provider-badge {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 500;
}
.call-provider-badge.aircall { background: #f0fdf4; color: #16a34a; }
.call-provider-badge.manual { background: #fef3c7; color: #d97706; }
.call-card-right {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.call-sdr-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.82rem;
}
.call-sdr-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}
.call-outcome-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.call-outcome-badge {
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}
.call-outcome-badge.interested { background: #dcfce7; color: #16a34a; }
.call-outcome-badge.no-answer { background: #fee2e2; color: #dc2626; }
.call-outcome-badge.callback { background: #fef9c3; color: #a16207; }
.call-outcome-badge.not-interested { background: #f1f5f9; color: #64748b; }
.call-notes {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ── Call Transcript ─────────────────────────────────────────────────── */
.call-transcript {
    background: #f9fafb;
    border-radius: 8px;
    padding: 14px;
    border: 1px solid var(--border-color);
    margin-top: 10px;
}
.call-transcript-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
}
.call-transcript-header .label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}
.call-transcript-header .toggle {
    font-size: 0.72rem;
    color: var(--primary-color);
    font-weight: 500;
}
.call-transcript-body { display: none; }
.call-transcript-body.open { display: block; }
.call-transcript-divider {
    height: 1px;
    background: var(--border-color);
    margin-bottom: 10px;
}
.transcript-line {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 0.75rem;
    line-height: 1.5;
}
.transcript-line .speaker {
    font-weight: 600;
    flex-shrink: 0;
}
.transcript-line .speaker.sdr { color: var(--primary-color); }
.transcript-line .speaker.lead { color: #16a34a; }
.transcript-line .text { color: var(--text-main); }

/* Empty state for call tab */
.calls-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.calls-empty .empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}
.calls-empty h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}
.calls-empty p {
    font-size: 0.85rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Email Tab — Split-Pane Redesign
   ═══════════════════════════════════════════════════════════════════════════ */

.email-split-pane {
    display: flex;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 12px;
    overflow: hidden;
    min-height: 480px;
    max-height: 600px;
    background: var(--bg-primary, #fff);
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */

.email-sidebar {
    width: 320px;
    min-width: 280px;
    border-right: 1px solid var(--border-color, #e5e7eb);
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary, #f9fafb);
}

.email-sidebar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-main, #111827);
}

.email-status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #22c55e;
    flex-shrink: 0;
}

.email-compose-btn {
    margin: 12px 16px 8px;
    padding: 10px 16px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: white;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.email-compose-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }

.email-search-wrap { padding: 0 16px 8px; }
.email-search-input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e5e7eb);
    font-size: 0.82rem;
    background: var(--bg-primary, #fff);
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.email-search-input:focus { border-color: var(--primary-color, #6366f1); }

.email-thread-list {
    flex: 1;
    overflow-y: auto;
}

.email-empty-sidebar {
    padding: 40px 16px;
    text-align: center;
    color: var(--text-muted, #9ca3af);
    font-size: 0.85rem;
}

.email-thread-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, #f3f4f6);
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}
.email-thread-item:hover { background: var(--bg-primary, #fff); }
.email-thread-item.active {
    background: var(--bg-primary, #fff);
    border-left-color: var(--primary-color, #6366f1);
}

.email-thread-contact { font-weight: 700; font-size: 0.85rem; color: var(--text-main, #111827); margin-bottom: 2px; }
.email-thread-subject { font-weight: 600; font-size: 0.8rem; color: var(--primary-color, #6366f1); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-thread-preview { font-size: 0.78rem; color: var(--text-muted, #9ca3af); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.email-thread-time { font-size: 0.7rem; color: var(--text-muted, #9ca3af); }

/* ── Main area ────────────────────────────────────────────────────────── */

.email-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.email-empty-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #9ca3af);
    padding: 40px;
}

.email-thread-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    gap: 12px;
}
.email-thread-title { font-size: 1rem; font-weight: 700; color: var(--text-main, #111827); }
.email-thread-meta { font-size: 0.78rem; color: var(--text-muted, #9ca3af); margin-top: 2px; }

.email-reply-toggle-btn {
    padding: 6px 14px;
    font-size: 0.82rem;
    white-space: nowrap;
    border-radius: 8px;
}

/* ── Messages (flat cards) ────────────────────────────────────────────── */

.email-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #fafbfc;
}

.email-bubble-wrap { display: flex; flex-direction: column; }
.email-bubble-wrap.outbound { align-items: flex-end; }
.email-bubble-wrap.inbound { align-items: flex-start; }

.email-bubble-meta {
    font-size: 0.75rem;
    color: var(--text-muted, #6b7280);
    margin-bottom: 6px;
    padding: 0 2px;
    font-weight: 500;
}

.email-bubble {
    max-width: 75%;
    min-width: 200px;
    width: fit-content;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.6;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid var(--border-color, #e5e7eb);
    transition: box-shadow 0.2s;
}
.email-bubble:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Outbound: light indigo card with indigo left-border */
.email-bubble.outbound {
    background: #f5f3ff;
    color: var(--text-main, #1f2937);
    border-left: 3px solid #6366f1;
    border-color: #e0e0ff;
    border-left-color: #6366f1;
}

/* Inbound: white card with gray left-border */
.email-bubble.inbound {
    background: #ffffff;
    color: var(--text-main, #1f2937);
    border-left: 3px solid #d1d5db;
}

/* ── Quoted text toggle ──────────────────────────────────────────────── */
.email-quoted-toggle {
    display: inline-block;
    margin-top: 10px;
    padding: 3px 14px;
    border-radius: 10px;
    font-size: 0.88rem;
    letter-spacing: 2px;
    color: var(--text-muted, #9ca3af);
    background: rgba(0,0,0,0.04);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    line-height: 1;
}
.email-quoted-toggle:hover {
    background: rgba(99,102,241,0.08);
    color: var(--primary-color, #6366f1);
}
.email-quoted-text {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0,0,0,0.06);
    font-size: 0.78rem;
    color: var(--text-muted, #9ca3af);
    white-space: pre-wrap;
    line-height: 1.4;
}

/* ── Email Open Tracking Badges ──────────────────────────────────────── */

.email-tracking-badge {
    font-size: 0.72rem;
    font-weight: 500;
    padding: 4px 6px;
    margin-top: 6px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    line-height: 1;
    border-radius: 6px;
}
.email-tracking-badge.opened {
    color: #16a34a;
    font-weight: 600;
    background: #f0fdf4;
}
.email-tracking-badge.sent {
    color: var(--text-muted, #9ca3af);
    background: #f9fafb;
}

/* CSS-only eye icon */
.tracking-icon-eye {
    display: inline-block;
    width: 14px;
    height: 10px;
    position: relative;
    flex-shrink: 0;
}
.tracking-icon-eye::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 1.5px solid #16a34a;
    border-radius: 75% / 100%;
}
.tracking-icon-eye::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background: #16a34a;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

/* ── Reply composer ───────────────────────────────────────────────────── */

.email-reply-composer {
    border-top: 1px solid var(--border-color, #e5e7eb);
    padding: 16px 20px;
    background: var(--bg-primary, #fff);
}

.email-reply-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    font-size: 0.85rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
    background: var(--bg-primary, #fff);
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.email-reply-textarea:focus { border-color: var(--primary-color, #6366f1); }

.email-reply-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}
.email-reply-left-actions { display: flex; gap: 8px; }

.email-attach-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    font-size: 0.82rem;
    color: var(--text-muted, #6b7280);
    cursor: pointer;
    background: var(--bg-primary, #fff);
    transition: all 0.15s;
}
.email-attach-btn:hover { border-color: var(--primary-color, #6366f1); color: var(--primary-color, #6366f1); }

.email-send-btn {
    padding: 8px 18px !important;
    border-radius: 10px !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    background: linear-gradient(135deg, #6366f1, #818cf8) !important;
    border: none !important;
}
.email-send-btn:hover { filter: brightness(1.08); }

/* ── Attachment chips ─────────────────────────────────────────────────── */

.email-attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.email-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--border-color, #d1d5db);
    border-radius: 20px;
    font-size: 0.78rem;
    background: var(--bg-primary, #fff);
    color: var(--text-main, #374151);
}
.email-attachment-icon { font-size: 0.9rem; }
.email-attachment-name { font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-attachment-size { color: var(--text-muted, #9ca3af); }
.email-attachment-remove {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted, #9ca3af); font-size: 1rem; padding: 0 2px;
    transition: color 0.15s;
}
.email-attachment-remove:hover { color: #ef4444; }

/* ── Compose form ─────────────────────────────────────────────────────── */

.email-compose-form {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.email-compose-field { display: flex; flex-direction: column; gap: 6px; }
.email-compose-label { font-size: 0.72rem; text-transform: uppercase; font-weight: 700; color: var(--text-muted, #9ca3af); letter-spacing: 0.5px; }
.email-compose-subject {
    padding: 10px 12px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    outline: none;
    background: var(--bg-primary, #fff);
    transition: border-color 0.2s;
}
.email-compose-subject:focus { border-color: var(--primary-color, #6366f1); }

/* ── Received attachment download chips ──────────────────────────────── */
.email-received-attachments {
    margin-top: 8px;
    max-width: 75%;
}
.email-attachment-download {
    cursor: pointer;
    transition: all 0.2s;
    border-color: var(--primary-color, #6366f1) !important;
    background: #f5f3ff !important;
}
.email-attachment-download:hover {
    background: #ede9fe !important;
    box-shadow: 0 2px 6px rgba(99,102,241,0.15);
    transform: translateY(-1px);
}
.email-attachment-dl-icon {
    font-size: 0.82rem;
    color: var(--primary-color, #6366f1);
    margin-left: 2px;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .email-split-pane { flex-direction: column; max-height: none; }
    .email-sidebar { width: 100%; min-width: auto; border-right: none; border-bottom: 1px solid var(--border-color); max-height: 250px; }
    .email-bubble { max-width: 90%; }
    .email-received-attachments { max-width: 90%; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SDR Settings Page
   ═══════════════════════════════════════════════════════════════════════════ */

.sdr-settings-card {
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.sdr-settings-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.04); }

.sdr-settings-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
}

.sdr-settings-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.sdr-settings-info { flex: 1; }
.sdr-settings-title { font-size: 0.95rem; font-weight: 700; color: var(--text-main, #111827); }
.sdr-settings-desc { font-size: 0.82rem; color: var(--text-muted, #9ca3af); margin-top: 2px; }

.sdr-settings-status { flex-shrink: 0; }

.sdr-settings-card-body {
    border-top: 1px solid var(--border-color, #f3f4f6);
}

/* Toggle (read-only visual) */
.sdr-toggle {
    display: inline-flex;
    width: 44px; height: 24px;
    border-radius: 12px;
    background: #d1d5db;
    padding: 2px;
    cursor: default;
    transition: background 0.2s;
    position: relative;
}
.sdr-toggle.on { background: #22c55e; }
.sdr-toggle-knob {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: transform 0.2s;
}
.sdr-toggle.on .sdr-toggle-knob { transform: translateX(20px); }

.sdr-badge.disabled {
    font-size: 0.78rem;
    font-weight: 600;
    color: #9ca3af;
    border: 1px solid #d1d5db;
    padding: 4px 12px;
    border-radius: 6px;
    white-space: nowrap;
}

/* Connected row */
.sdr-connected-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
}

.sdr-connected-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #22c55e;
    flex-shrink: 0;
}

.sdr-connected-email {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
    color: #059669;
}

.sdr-disconnect-btn {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    transition: opacity 0.15s;
}
.sdr-disconnect-btn:hover { opacity: 0.7; text-decoration: underline; }

.sdr-connect-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
}

/* ── Task Notification Bell & Panel ──────────────────────────────────── */
.task-bell-btn {
    position: relative;
    padding: 8px 10px !important;
    border-radius: 10px !important;
    font-size: 0;
    line-height: 1;
    transition: all 0.2s ease;
}
.task-bell-btn:hover {
    background: var(--background-color) !important;
    transform: scale(1.05);
}
.task-bell-btn.has-tasks {
    animation: bellPulse 2s ease-in-out infinite;
}
.task-bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    animation: badgeBounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bellPulse {
    0%, 100% { transform: scale(1); }
    10% { transform: scale(1.08) rotate(-3deg); }
    20% { transform: scale(1) rotate(3deg); }
    30% { transform: scale(1); }
}
@keyframes badgeBounce {
    0% { transform: scale(0); }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.task-notif-panel {
    position: fixed;
    top: 60px;
    right: 24px;
    width: 380px;
    max-height: 520px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 9990;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: panelSlideIn 0.25s ease;
}
@keyframes panelSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.task-notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    background: var(--background-color);
}
.task-notif-body {
    flex: 1;
    overflow-y: auto;
    max-height: 440px;
}
.task-notif-item {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s ease;
}
.task-notif-item:hover {
    background: var(--background-color);
}
.task-notif-item:last-child {
    border-bottom: none;
}
.task-notif-item-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 4px;
}
.task-notif-title {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-main);
    flex: 1;
    line-height: 1.3;
}
.task-notif-time {
    font-size: 0.72rem;
    color: #ef4444;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    background: #fef2f2;
    padding: 2px 8px;
    border-radius: 6px;
}
.task-notif-lead {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.task-notif-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}
.task-notif-actions .btn-sm {
    padding: 4px 10px !important;
    font-size: 0.72rem !important;
    border-radius: 6px;
}

@media (max-width: 480px) {
    .task-notif-panel {
        right: 8px;
        left: 8px;
        width: auto;
    }
}

/* ── Lead Deprioritization (V22) ─────────────────────────────────────────── */

/* Amber info banner shown at top of My Leads */
.priority-info-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.82rem;
    color: #92400e;
    line-height: 1.4;
}
.priority-info-banner span.pi-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Priority badge chips shown in the lead table */
.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
    vertical-align: middle;
}
.priority-badge-high {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
.priority-badge-medium {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}
.priority-badge-low {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

/* Row styling tiers */
.lead-row-high {
    /* No special treatment — default full-opacity */
    opacity: 1;
}
.lead-row-medium td {
    background-color: #fffdf5 !important;
}
.lead-row-medium {
    border-left: 3px solid #f59e0b !important;
}
.lead-row-deprioritized td {
    opacity: 0.55;
    background-color: #f8fafc !important;
}
/* Note preview row matches lead row */
.note-preview-row-medium td {
    background-color: #fffdf7 !important;
}
.note-preview-row-deprioritized td {
    opacity: 0.55;
    background-color: #f8fafc !important;
}

/* Re-prioritize button — shown on deprioritized & medium rows */
.reprioritize-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid #6366f1;
    border-radius: 6px;
    background: #eef2ff;
    color: #4338ca;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
    margin-top: 4px;
}
.reprioritize-btn:hover {
    background: #e0e7ff;
    transform: translateY(-1px);
}
.reprioritize-btn:active {
    transform: translateY(0);
}
/* ═══════════════════════════════════════════════════════════
   Analytics Hub — styles
   ═══════════════════════════════════════════════════════════ */

/* Shimmer skeleton animation */
.analytics-shimmer {
    background: linear-gradient(90deg, var(--surface-color, #f1f5f9) 25%, var(--border-color, #e2e8f0) 50%, var(--surface-color, #f1f5f9) 75%);
    background-size: 200% 100%;
    animation: analyticsShimmer 1.4s infinite;
    border-radius: 6px;
}
@keyframes analyticsShimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}

/* Hub wrapper */
.analytics-hub { padding: 24px; max-width: 1400px; }

/* Header */
.analytics-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.analytics-title  { font-size: 1.5rem; font-weight: 700; color: var(--text-color); margin: 0 0 4px; }
.analytics-subtitle { font-size: 0.85rem; color: var(--text-muted); margin: 0; }
.analytics-header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* Filter bar */
.analytics-filter-bar   { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; padding: 16px; background: var(--surface-color, #f8fafc); border: 1px solid var(--border-color); border-radius: 12px; margin-bottom: 20px; }
.analytics-filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.analytics-filter-group.analytics-filter-custom-range { flex-direction: row; align-items: center; gap: 8px; }
.analytics-filter-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.analytics-filter-input, .analytics-filter-select { padding: 6px 10px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 0.85rem; color: var(--text-color); background: var(--card-bg, #fff); min-width: 130px; cursor: pointer; }
.analytics-filter-input:focus, .analytics-filter-select:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }

/* Preset pills */
.analytics-preset-pills { display: flex; gap: 4px; }
.analytics-preset-pill { padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border-color); background: var(--card-bg, #fff); font-size: 0.8rem; font-weight: 600; cursor: pointer; color: var(--text-muted); transition: all 0.15s; }
.analytics-preset-pill:hover { background: var(--primary-light, #eef2ff); color: var(--primary-color); border-color: var(--primary-color); }
.analytics-preset-pill.active { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }

/* Tabs */
.analytics-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border-color); margin-bottom: 20px; }
.analytics-tab  { padding: 10px 20px; border: none; background: none; cursor: pointer; font-size: 0.875rem; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; border-radius: 8px 8px 0 0; }
.analytics-tab:hover  { color: var(--text-color); background: var(--surface-color, #f8fafc); }
.analytics-tab.active { color: var(--primary-color); border-bottom-color: var(--primary-color); background: var(--primary-light, #eef2ff); }

/* KPI cards */
.analytics-kpi-grid  { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 14px; margin-bottom: 20px; }
.analytics-kpi-card  { background: var(--card-bg, #fff); border: 1px solid var(--border-color); border-radius: 14px; padding: 18px; position: relative; transition: box-shadow 0.2s; }
.analytics-kpi-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
.analytics-kpi-top   { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.analytics-kpi-icon  { font-size: 1.1rem; }
.analytics-kpi-label { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); flex: 1; }
.analytics-kpi-value { font-size: 1.75rem; font-weight: 800; color: var(--text-color); line-height: 1.1; margin-bottom: 4px; }
.analytics-kpi-sub   { font-size: 0.76rem; color: var(--text-muted); }

/* KPI accent colours (left border) */
.analytics-kpi-blue    { border-left: 3px solid #3b82f6; }
.analytics-kpi-violet  { border-left: 3px solid #8b5cf6; }
.analytics-kpi-sky     { border-left: 3px solid #0ea5e9; }
.analytics-kpi-indigo  { border-left: 3px solid #6366f1; }
.analytics-kpi-green   { border-left: 3px solid #10b981; }
.analytics-kpi-amber   { border-left: 3px solid #f59e0b; }
.analytics-kpi-emerald { border-left: 3px solid #059669; }
.analytics-kpi-slate   { border-left: 3px solid #94a3b8; }
.analytics-kpi-red     { border-left: 3px solid #dc2626; }

/* ── Insight Strip ──────────────────────────────────────────────────────────── */
.analytics-insight-strip {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: var(--surface-color, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px; padding: 10px 16px; margin-bottom: 14px;
    font-size: 0.82rem;
}
.analytics-insight-label {
    font-weight: 700; color: var(--text-muted, #64748b); white-space: nowrap; font-size: 0.78rem;
}
.analytics-insight-pills { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.analytics-insight-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 500;
    border: 1px solid transparent;
}
.analytics-insight-warn { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.analytics-insight-good { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.analytics-insight-info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.analytics-insight-summary {
    font-size: 0.78rem; color: var(--text-muted); font-style: italic;
    display: flex; align-items: center; gap: 6px;
}
.analytics-insight-ai-tag {
    background: #7c3aed; color: #fff; font-size: 0.65rem; font-weight: 700;
    padding: 1px 5px; border-radius: 4px; font-style: normal; letter-spacing: 0.03em;
}

/* ── Funnel Flow Row ────────────────────────────────────────────────────────── */
.analytics-funnel-flow-row {
    display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
    padding: 10px 16px; background: var(--surface-color, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0); border-radius: 10px;
    margin-bottom: 14px; font-size: 0.82rem;
}
.af-funnel-step  { font-weight: 600; color: var(--text-primary, #1e293b); }
.af-funnel-arrow { color: var(--text-muted, #94a3b8); font-size: 0.85rem; padding: 0 2px; }
.af-funnel-rate  {
    background: #e0f2fe; color: #0369a1; border-radius: 999px;
    padding: 1px 8px; font-size: 0.74rem; font-weight: 600;
}

/* ── Activity Feed Toggle Row ───────────────────────────────────────────────── */
.analytics-activity-toggle-row {
    display: flex; justify-content: center; padding: 20px 0 8px;
}
.analytics-activity-toggle-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 22px; border-radius: 9999px; font-size: 0.84rem; font-weight: 600;
    cursor: pointer; border: 1.5px dashed var(--border-color, #cbd5e1);
    background: transparent; color: var(--text-muted, #64748b);
    transition: all 0.2s ease;
}
.analytics-activity-toggle-btn:hover {
    border-color: var(--primary-color, #3b82f6);
    color: var(--primary-color, #3b82f6);
    background: rgba(59,130,246,0.05);
}
.analytics-activity-toggle-btn.open {
    border-style: solid; border-color: var(--primary-color, #3b82f6);
    color: var(--primary-color, #3b82f6); background: rgba(59,130,246,0.06);
}

/* Research breakdown inside KPI card */
.analytics-research-breakdown  { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
.analytics-research-row        { display: flex; align-items: center; gap: 6px; }
.analytics-research-label      { font-size: 0.72rem; color: var(--text-muted); width: 90px; flex-shrink: 0; }
.analytics-research-bar-track  { flex: 1; height: 5px; background: var(--border-color); border-radius: 3px; overflow: hidden; }
.analytics-research-bar-fill   { height: 100%; background: linear-gradient(90deg, #8b5cf6, #6366f1); border-radius: 3px; transition: width 0.5s ease; }
.analytics-research-pct        { font-size: 0.72rem; font-weight: 600; color: var(--text-color); width: 34px; text-align: right; }

/* Tooltip hint */
.analytics-tooltip { font-size: 0.75rem; color: var(--text-muted); cursor: help; margin-left: 2px; }

/* Charts row */
.analytics-charts-row   { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; margin-bottom: 20px; }
.analytics-chart-card   { background: var(--card-bg, #fff); border: 1px solid var(--border-color); border-radius: 14px; padding: 20px; min-height: 300px; }
.analytics-chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.analytics-chart-title  { font-size: 0.9rem; font-weight: 700; color: var(--text-color); }
.analytics-chart-placeholder { height: 220px; border-radius: 8px; }
.analytics-badge        { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 10px; font-size: 0.7rem; font-weight: 600; background: var(--primary-light, #eef2ff); color: var(--primary-color); margin-left: 6px; text-transform: capitalize; }
.analytics-legend       { display: flex; align-items: center; gap: 10px; font-size: 0.75rem; color: var(--text-muted); }
.analytics-legend-dot   { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* Email funnel */
.analytics-email-stage       { padding: 10px 0; border-bottom: 1px solid var(--border-color); }
.analytics-email-stage:last-child { border-bottom: none; }
.analytics-email-stage-label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.analytics-email-funnel-row  { display: flex; align-items: center; gap: 12px; }
.analytics-email-stat        { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.analytics-email-stat-num    { font-size: 1.1rem; font-weight: 700; color: var(--text-color); }
.analytics-email-stat-label  { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; }
.analytics-funnel-arrow      { color: var(--text-muted); font-size: 1rem; }
.analytics-email-reply-total { margin-top: 14px; font-size: 0.82rem; color: var(--text-muted); padding-top: 10px; border-top: 1px solid var(--border-color); }

/* SDR table card */
.analytics-sdr-card    { background: var(--card-bg, #fff); border: 1px solid var(--border-color); border-radius: 14px; padding: 20px; }
.analytics-sdr-header  { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.analytics-inactive-toggle { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-muted); cursor: pointer; }
.analytics-table-wrap  { overflow-x: auto; }
.analytics-table       { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.analytics-table thead { background: var(--surface-color, #f8fafc); }
.analytics-table th    { padding: 10px 12px; text-align: left; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); border-bottom: 1px solid var(--border-color); white-space: nowrap; }
.analytics-table td    { padding: 10px 12px; border-bottom: 1px solid var(--border-color); color: var(--text-color); }
.analytics-table tbody tr:hover { background: var(--surface-color, #f8fafc); }
.analytics-table tbody tr:last-child td { border-bottom: none; }
.analytics-sortable    { cursor: pointer; user-select: none; }
.analytics-sortable:hover { color: var(--primary-color); }
.analytics-sdr-inactive td { opacity: 0.55; }
/* When checkbox is unchecked, the table-wrap gets sdr-hide-inactive — hides inactive rows */
.sdr-hide-inactive .analytics-sdr-inactive { display: none; }
.analytics-inactive-badge  { display: inline-flex; padding: 1px 6px; border-radius: 8px; font-size: 0.68rem; font-weight: 600; background: var(--surface-color, #f1f5f9); color: var(--text-muted); margin-left: 6px; }
.analytics-empty-row   { text-align: center; padding: 32px; color: var(--text-muted); font-style: italic; }

/* Pagination */
.analytics-pagination      { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }
.analytics-pagination-info { font-size: 0.82rem; color: var(--text-muted); }

/* Error card */
.analytics-error-card  { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; gap: 8px; text-align: center; }
.analytics-error-icon  { font-size: 2rem; }
.analytics-error-title { font-weight: 600; color: var(--text-color); margin: 0; }
.analytics-error-sub   { font-size: 0.82rem; color: var(--text-muted); margin: 0; }

/* Responsive */
@media (max-width: 900px) {
    .analytics-charts-row { grid-template-columns: 1fr; }
    .analytics-kpi-grid   { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .analytics-kpi-grid { grid-template-columns: 1fr; }
    .analytics-hub      { padding: 12px; }
}

/* ── Step Pills ─────────────────────────────────────────────────────────────── */
.analytics-step-pills {
    display: flex; align-items: center; gap: 0; margin-bottom: 12px; overflow-x: auto;
}
.analytics-step-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 20px; font-size: 0.78rem; font-weight: 600;
    border: 1.5px solid var(--border-color); background: var(--surface-color);
    color: var(--text-muted); cursor: default; white-space: nowrap;
    transition: all 0.15s ease;
}
.analytics-step-pill .step-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 50%; font-size: 0.7rem; font-weight: 700;
    background: var(--border-color); color: var(--text-muted);
}
.analytics-step-pill.active {
    background: #eef2ff; border-color: var(--primary-color); color: var(--primary-color);
}
.analytics-step-pill.active .step-num {
    background: var(--primary-color); color: #fff;
}
.analytics-step-pill.completed {
    background: #f0fdf4; border-color: #10b981; color: #065f46;
}
.analytics-step-pill.completed .step-num {
    background: #10b981; color: #fff;
}
.analytics-step-pill.locked {
    opacity: 0.5; cursor: not-allowed;
}
.analytics-step-chevron {
    color: var(--text-muted); font-size: 0.75rem; padding: 0 4px; flex-shrink: 0;
}

/* ── Hierarchical Filter Row ────────────────────────────────────────────────── */
.analytics-filter-row {
    display: grid; grid-template-columns: 180px 1fr 1fr auto; gap: 12px;
    align-items: end; padding: 16px; background: var(--surface-color);
    border: 1px solid var(--border-color); border-radius: 12px; margin-bottom: 10px;
}
.analytics-filter-row-bottom {
    padding: 12px 16px 14px; background: var(--surface-color);
    border: 1px solid var(--border-color); border-top: none;
    border-radius: 0 0 12px 12px; margin-top: -12px;
    margin-bottom: 10px;
}
.analytics-filter-refine-row {
    display: flex; align-items: center; gap: 8px;
}
.analytics-filter-locked .analytics-filter-label {
    color: var(--text-muted); opacity: 0.6;
}
.analytics-filter-locked .analytics-filter-input,
.analytics-filter-locked .analytics-filter-select {
    opacity: 0.45; cursor: not-allowed; pointer-events: none;
    background: var(--background-color);
}
/* Tooltip for locked filter clicks */
.analytics-filter-lock-hint {
    font-size: 0.74rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px;
    padding: 4px 0; min-height: 22px;
}

/* ── View Mode Toggle (Single / All Batches) ────────────────────────────────── */
.analytics-view-toggle {
    display: inline-flex; border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden;
    flex-shrink: 0;
}
.analytics-view-toggle-btn {
    padding: 7px 14px; font-size: 0.82rem; font-weight: 600; border: none; cursor: pointer;
    background: var(--surface-color); color: var(--text-muted); transition: all 0.15s;
    font-family: inherit;
}
.analytics-view-toggle-btn:not(:last-child) { border-right: 1px solid var(--border-color); }
.analytics-view-toggle-btn.active {
    background: var(--primary-color); color: #fff;
}
.analytics-view-toggle-btn:hover:not(.active) { background: var(--background-color); color: var(--text-main); }

/* ── Breadcrumb Trail ───────────────────────────────────────────────────────── */
.analytics-breadcrumb {
    display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
    padding: 8px 16px; background: var(--background-color);
    border: 1px solid var(--border-color); border-radius: 8px;
    margin-bottom: 12px; font-size: 0.82rem; min-height: 34px;
}
.analytics-breadcrumb-segment {
    font-weight: 600; color: var(--text-main);
}
.analytics-breadcrumb-sep {
    color: var(--text-muted); font-size: 0.75rem;
}
.analytics-breadcrumb-empty {
    color: var(--text-muted); font-style: italic; font-size: 0.8rem;
}

/* ── Insight Bar (unified rule pills + AI rec) ──────────────────────────────── */
.analytics-insight-bar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 10px 16px; background: var(--surface-color);
    border: 1px solid var(--border-color); border-radius: 10px;
    margin-bottom: 14px; font-size: 0.82rem; min-height: 42px;
}
.analytics-insight-rule-pills { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.analytics-ai-rec-wrap {
    display: flex; align-items: center; gap: 8px;
    border-left: 1px solid var(--border-color); padding-left: 12px; flex-shrink: 0;
    max-width: 340px;
}
.analytics-ai-rec-tag {
    background: #7c3aed; color: #fff; font-size: 0.63rem; font-weight: 700;
    padding: 2px 5px; border-radius: 4px; letter-spacing: 0.04em;
    white-space: nowrap; flex-shrink: 0;
}
.analytics-ai-rec-text {
    font-size: 0.8rem; color: var(--text-muted); font-style: italic;
}
.analytics-ai-rec-skeleton {
    height: 14px; width: 180px; border-radius: 6px;
    background: linear-gradient(90deg, var(--surface-color) 25%, var(--border-color) 50%, var(--surface-color) 75%);
    background-size: 200% 100%; animation: analyticsShimmer 1.4s infinite;
}

/* ── Funnel Strip (improved) ────────────────────────────────────────────────── */
.analytics-funnel-strip {
    display: flex; align-items: center; gap: 2px; flex-wrap: nowrap;
    padding: 12px 16px; background: var(--surface-color);
    border: 1px solid var(--border-color); border-radius: 10px;
    margin-bottom: 14px; font-size: 0.85rem; overflow-x: auto;
}
.analytics-funnel-stage-value {
    font-weight: 800; color: var(--text-main); font-size: 0.95rem; white-space: nowrap;
}
.analytics-funnel-stage-label {
    font-size: 0.74rem; color: var(--text-muted); font-weight: 500;
}
.analytics-funnel-stage-block { display: flex; flex-direction: column; gap: 1px; }
.analytics-funnel-arrow { color: var(--text-muted); padding: 0 4px; font-size: 0.9rem; flex-shrink: 0; }
.analytics-funnel-conv-pill {
    background: #dcfce7; color: #166534; border-radius: 999px;
    padding: 2px 9px; font-size: 0.75rem; font-weight: 700;
    white-space: nowrap; flex-shrink: 0;
}

/* ── KPI Grid — 6 column fixed ──────────────────────────────────────────────── */
.analytics-kpi-grid-6 {
    display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 16px;
}
@media (max-width: 1200px) {
    .analytics-kpi-grid-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
    .analytics-kpi-grid-6 { grid-template-columns: repeat(2, 1fr); }
}

/* ── Bottom Panels (trend left + SDR table right) ───────────────────────────── */
.analytics-bottom-panels {
    display: grid; grid-template-columns: 3fr 2fr; gap: 14px; margin-bottom: 16px;
    align-items: start; /* panels are independently sized — no stretching */
}
.analytics-bottom-panels > * { min-width: 0; }
@media (max-width: 900px) {
    .analytics-bottom-panels { grid-template-columns: 1fr; }
}
.analytics-trend-panel {
    background: var(--surface-color); border: 1px solid var(--border-color);
    border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 10px;
    overflow: hidden; min-width: 0;
}
.analytics-sdr-panel {
    background: var(--surface-color); border: 1px solid var(--border-color);
    border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 0;
    overflow: hidden; max-height: 440px;
}
.analytics-sdr-panel .analytics-table-wrap {
    flex: 1; overflow-y: auto; overflow-x: auto; scrollbar-width: thin; margin-top: 8px;
}
.analytics-sdr-panel .analytics-table { width: 100%; }


/* ── SDR Picker (All SDRs + search + chip) ──────────────────────────────────── */
.analytics-sdr-picker {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-shrink: 0;
}

/* Keep old pill style for the All SDRs button */
.analytics-sdr-pill {
    padding: 4px 14px; border-radius: 999px; border: 1.5px solid var(--border-color);
    background: var(--surface-color); font-size: 0.78rem; font-weight: 600;
    cursor: pointer; color: var(--text-muted); transition: all 0.12s; white-space: nowrap;
    flex-shrink: 0; font-family: inherit;
}
.analytics-sdr-pill:hover { border-color: var(--primary-color); color: var(--primary-color); }
.analytics-sdr-pill.active {
    background: var(--primary-color); color: #fff; border-color: var(--primary-color);
}

/* Selected SDR chip */
.analytics-sdr-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px 4px 14px; border-radius: 999px;
    background: #eef2ff; border: 1.5px solid var(--primary-color);
    font-size: 0.78rem; font-weight: 600; color: var(--primary-color);
    white-space: nowrap;
}
.analytics-sdr-chip-remove {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 50%; border: none;
    background: var(--primary-color); color: #fff; font-size: 0.6rem;
    cursor: pointer; padding: 0; line-height: 1; font-family: inherit;
    flex-shrink: 0; transition: opacity 0.12s;
}
.analytics-sdr-chip-remove:hover { opacity: 0.75; }

/* Search input wrapper (relative for dropdown) */
.analytics-sdr-search-wrap {
    position: relative; flex-shrink: 0;
}
.analytics-sdr-search-input {
    height: 30px; padding: 0 12px; border-radius: 8px;
    border: 1.5px solid var(--border-color); background: var(--surface-color);
    font-size: 0.78rem; color: var(--text-main); font-family: inherit;
    outline: none; width: 170px; transition: border-color 0.15s;
}
.analytics-sdr-search-input:focus {
    border-color: var(--primary-color);
}
.analytics-sdr-search-input::placeholder { color: var(--text-muted); }

/* Dropdown list */
.analytics-sdr-dropdown {
    display: none; position: absolute; top: calc(100% + 4px); left: 0;
    background: var(--surface-color); border: 1px solid var(--border-color);
    border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    z-index: 200; min-width: 200px; max-height: 220px; overflow-y: auto;
    padding: 4px;
    scrollbar-width: thin;
}
.analytics-sdr-dropdown.open { display: block; }
.analytics-sdr-dropdown-item {
    display: block; width: 100%; text-align: left;
    padding: 8px 12px; border: none; background: transparent;
    font-size: 0.82rem; color: var(--text-main); cursor: pointer;
    border-radius: 6px; font-family: inherit; transition: background 0.1s;
}
.analytics-sdr-dropdown-item:hover { background: var(--background-color); }
.analytics-sdr-dropdown-item.selected {
    background: #eef2ff; color: var(--primary-color); font-weight: 600;
}
.analytics-sdr-dropdown-empty {
    padding: 12px; font-size: 0.8rem; color: var(--text-muted); text-align: center;
}


/* ── Metric Toggle Row ──────────────────────────────────────────────────────── */
.analytics-metric-toggle-row {
    display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0;
}
.analytics-metric-toggle {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 999px; border: 1.5px solid var(--border-color);
    background: var(--surface-color); font-size: 0.76rem; font-weight: 600;
    cursor: pointer; color: var(--text-main); transition: all 0.12s; font-family: inherit;
}
.analytics-metric-toggle.off {
    opacity: 0.4; text-decoration: line-through;
}
.analytics-metric-toggle:hover { filter: brightness(0.96); }
.analytics-metric-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.analytics-metric-dot-blue   { background: #3b82f6; }
.analytics-metric-dot-green  { background: #10b981; }
.analytics-metric-dot-purple { background: #8b5cf6; }
.analytics-metric-dot-red    { background: #ef4444; }
.analytics-metric-dot-sky    { background: #0ea5e9; }

/* ── Connect % Badge ────────────────────────────────────────────────────────── */
.analytics-connect-badge {
    display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
    font-size: 0.75rem; font-weight: 700;
}
.analytics-connect-badge-green { background: #dcfce7; color: #166534; }
.analytics-connect-badge-amber { background: #fef3c7; color: #92400e; }

/* Batch context label above SDR table */
.analytics-sdr-context-label {
    font-size: 0.76rem; color: var(--text-muted); font-weight: 500;
    padding: 4px 0; border-bottom: 1px solid var(--border-color); margin-bottom: 4px;
}

/* ── All Batches Comparison Table ───────────────────────────────────────────── */
.analytics-batch-table-wrap {
    background: var(--surface-color); border: 1px solid var(--border-color);
    border-radius: 14px; padding: 18px; margin-bottom: 16px;
}
.analytics-batch-table-header {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.analytics-batch-table {
    width: 100%; border-collapse: collapse; font-size: 0.83rem;
}
.analytics-batch-table thead { background: var(--background-color); }
.analytics-batch-table th {
    padding: 10px 12px; text-align: left; font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted);
    border-bottom: 1px solid var(--border-color); white-space: nowrap;
}
.analytics-batch-table td {
    padding: 10px 12px; border-bottom: 1px solid var(--border-color); color: var(--text-main);
}
.analytics-batch-table tbody tr:hover { background: var(--background-color); }
.analytics-batch-table .analytics-batch-totals-row td {
    font-weight: 700; border-top: 2px solid var(--border-color);
    border-bottom: none; background: var(--background-color);
}
.analytics-batch-source-label {
    display: inline-flex; align-items: center; gap: 5px; font-weight: 600;
}

/* Empty state nudge */
.analytics-empty-nudge {
    text-align: center; padding: 24px 16px; color: var(--text-muted); font-size: 0.85rem;
}
.analytics-empty-nudge b { color: var(--text-main); }

/* ── Pagination controls ─────────────────────────────────────────────────────── */
.analytics-pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; padding: 10px 0 2px; flex-shrink: 0;
    border-top: 1px solid var(--border-color); margin-top: 4px;
}
.analytics-page-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 8px;
    border: 1.5px solid var(--border-color); background: var(--surface-color);
    font-size: 1rem; color: var(--text-main); cursor: pointer;
    font-family: inherit; transition: all 0.12s;
}
.analytics-page-btn:hover:not(:disabled) {
    border-color: var(--primary-color); color: var(--primary-color); background: #eef2ff;
}
.analytics-page-btn:disabled {
    opacity: 0.35; cursor: not-allowed;
}
.analytics-pagination-info {
    font-size: 0.8rem; color: var(--text-muted); font-weight: 600;
    min-width: 50px; text-align: center;
}

/* ── Skeleton loader animation (global) ─────────────────────────────── */
@keyframes skeletonPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

/* ── In-Browser Dialer Widget (Conversive/LiveKit) ────────────────────── */
#dialer-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 320px;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.08);
    z-index: 10000;
    padding: 0;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: 'Inter', sans-serif;
    overflow: hidden;
}

#dialer-widget.dialer-widget-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Header: status dot + lead info + timer */
.dw-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px 12px;
    cursor: grab;
    user-select: none;
}

.dw-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.3s;
}

.dw-status-dot.connecting {
    background: #fbbf24;
    animation: dw-pulse 1.5s ease-in-out infinite;
}

.dw-status-dot.active {
    background: #34d399;
    animation: dw-pulse 2s ease-in-out infinite;
}

.dw-status-dot.ended {
    background: #ef4444;
    animation: none;
}

@keyframes dw-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
    50%      { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
}

.dw-info {
    flex: 1;
    min-width: 0;
}

.dw-lead-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dw-phone {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.55);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.dw-timer {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: #a5b4fc;
    letter-spacing: 0.05em;
    flex-shrink: 0;
    min-width: 52px;
    text-align: right;
}

/* Controls row */
.dw-controls {
    display: flex;
    gap: 8px;
    padding: 0 18px 14px;
    justify-content: center;
}

.dw-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 16px;
    border: none;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    flex: 1;
}

.dw-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: translateY(-1px);
}

.dw-btn:active {
    transform: translateY(0);
}

.dw-btn.dw-btn-active {
    background: rgba(251, 191, 36, 0.25);
    color: #fbbf24;
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.3);
}

.dw-btn-hangup {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #fca5a5 !important;
}

.dw-btn-hangup:hover {
    background: rgba(239, 68, 68, 0.4) !important;
    color: #fff !important;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

/* Recording badge */
.dw-recording-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    padding: 8px 0;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.dw-rec-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
    animation: dw-rec-blink 1.5s ease-in-out infinite;
}

@keyframes dw-rec-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.2; }
}

/* Responsive: move widget to full-width on small screens */
@media (max-width: 480px) {
    #dialer-widget {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        border-radius: 20px 20px 0 0;
    }
}

/* Provider badge for Conversive in call cards */
.call-provider-badge.conversive {
    background: linear-gradient(135deg, #312e81, #4338ca);
    color: #c7d2fe;
    font-weight: 600;
}

/* ── Call Mode Selector Modal ─────────────────────────────────────────────── */
#call-mode-selector {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}
#call-mode-selector.cms-visible {
    opacity: 1;
}
.cms-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
}
.cms-card {
    position: relative;
    background: var(--card-bg, #fff);
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
    padding: 28px;
    width: 380px;
    max-width: 90vw;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#call-mode-selector.cms-visible .cms-card {
    transform: scale(1) translateY(0);
}
.cms-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}
.cms-icon {
    font-size: 2rem;
}
.cms-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color, #1e293b);
}
.cms-phone {
    font-size: 0.85rem;
    color: var(--text-muted, #64748b);
    font-weight: 500;
    letter-spacing: 0.02em;
}
.cms-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
}
.cms-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.cms-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border: 2px solid var(--border-color, #e2e8f0);
    border-radius: 14px;
    background: var(--surface-color, #f8fafc);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-family: inherit;
}
.cms-option:hover {
    border-color: var(--primary-color, #6366f1);
    background: var(--primary-light, #eef2ff);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.12);
}
.cms-option:active {
    transform: translateY(0);
}
.cms-opt-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}
.cms-opt-text strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-color, #1e293b);
    margin-bottom: 2px;
}
.cms-opt-text small {
    font-size: 0.78rem;
    color: var(--text-muted, #64748b);
    font-weight: 400;
}
.cms-cancel {
    display: block;
    width: 100%;
    padding: 10px;
    border: none;
    background: transparent;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.15s;
    font-family: inherit;
}
.cms-cancel:hover {
    background: var(--surface-color, #f1f5f9);
    color: var(--text-color, #1e293b);
}

/* ── Dialer Widget Additions (Mode badge & End summary) ───────────────────── */
.dw-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 7px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    margin-left: 6px;
    vertical-align: middle;
}
.dw-mode-browser {
    background: rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
}
.dw-mode-bridge {
    background: rgba(52, 211, 153, 0.2);
    color: #6ee7b7;
}

.dw-end-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
}
.dw-end-icon {
    font-size: 1.2rem;
}
.dw-end-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
}
