:root {
    --crm-primary: #4f46e5;
    --crm-primary-light: #818cf8;
    --crm-secondary: #0ea5e9;
    --crm-accent: #f472b6;
    --crm-success: #10b981;
    --crm-warning: #f59e0b;
    /* Paleta Dinámica Suave */
    --crm-bg: #f5f7ff;
    --crm-panel: #ffffff;
    --crm-surface: rgba(255, 255, 255, 0.85);
    --crm-border: rgba(79, 70, 229, 0.08);
    --glass-blur: blur(15px);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --nav-grad: linear-gradient(135deg, #4f46e5 0%, #0ea5e9 100%);
    
    /* Premium Shadows & Transitions */
    --crm-shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --crm-shadow-md: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    --crm-shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --crm-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--crm-bg);
    background-image:
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(14, 165, 233, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(244, 114, 182, 0.03) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    margin: 0;
    min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: #1e1b4b;
}

/* Header Dinámico */
.modern-header {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--crm-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 15px 0 0 0;
}

.nav-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 40px;
}

/* Navbar Estilo Salesforce Pro */
.nav-links {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 10px 0;
    margin-top: 5px;
}

.nav-links::-webkit-scrollbar {
    display: none;
}

.nav-item {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    position: relative;
    z-index: 10;
}

.nav-item i {
    font-size: 19px;
    transition: transform 0.3s ease;
}

.nav-item:hover {
    color: var(--crm-primary);
    background: rgba(79, 70, 229, 0.05);
    transform: translateY(-1px);
}

.nav-item:hover i {
    transform: scale(1.1);
}

.nav-item.active {
    color: white;
    background: var(--nav-grad);
    box-shadow: 0 8px 16px -4px rgba(79, 70, 229, 0.3);
}

.nav-item.active i {
    color: white;
}

/* Global Search / Omnisearch Styles */
.search-container {
    position: relative;
    width: 300px;
    transition: var(--crm-transition);
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper i {
    position: absolute;
    left: 12px;
    color: var(--text-secondary);
}

.omnisearch-input {
    width: 100%;
    padding: 8px 12px 8px 35px;
    border-radius: 20px;
    border: 1px solid var(--crm-border);
    background: rgba(0,0,0,0.03);
    font-size: 0.85rem;
    transition: var(--crm-transition);
}

.omnisearch-input:focus {
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    border-color: var(--crm-primary);
    width: 400px;
}

.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--crm-shadow-lg);
    border: 1px solid var(--crm-border);
    margin-top: 10px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 2000;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.2s;
}

.search-result-item:hover {
    background: #f8fafc;
}

.search-result-item i {
    font-size: 1.2rem;
    color: var(--crm-primary);
}

/* Animations for Waiting Status */
@keyframes pulse-soft {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(13, 202, 240, 0.4); }
    70% { transform: scale(1.02); box-shadow: 0 0 0 10px rgba(13, 202, 240, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(13, 202, 240, 0); }
}

.pulse-badge {
    animation: pulse-soft 2s infinite;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Timeline Styles */
.crm-timeline {
    position: relative;
    padding-left: 30px;
}

.crm-timeline::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--crm-border);
}

.timeline-item {
    position: relative;
    margin-bottom: 25px;
}

.timeline-marker {
    position: absolute;
    left: -30px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--crm-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-marker i {
    font-size: 10px;
    color: var(--crm-primary);
}

.timeline-content {
    background: #fff;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--crm-border);
    box-shadow: var(--crm-shadow-sm);
    transition: var(--crm-transition);
}

.timeline-content:hover {
    transform: translateX(5px);
    box-shadow: var(--crm-shadow-md);
}

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

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

/* Hover to open dropdowns on Desktop */
@media (min-width: 992px) {
    .dropdown:hover > .dropdown-menu {
        display: block;
        animation: dropdownFadeIn 0.2s ease-out;
    }
    /* Bridge the gap for smoother hover */
    .dropdown-menu::before {
        content: '';
        position: absolute;
        top: -10px;
        left: 0;
        right: 0;
        height: 10px;
        background: transparent;
    }
}

.nav-more-dropdown .dropdown-item {
    border-radius: 10px;
    padding: 10px 15px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.nav-more-dropdown .dropdown-item i {
    font-size: 16px;
    opacity: 0.7;
}

.nav-more-dropdown .dropdown-item:hover {
    background: rgba(79, 70, 229, 0.05);
    color: var(--crm-primary);
    transform: translateX(4px);
}

.nav-more-dropdown .dropdown-item:hover i {
    opacity: 1;
    color: var(--crm-primary);
}

/* Menú de Usuario */
.user-menu-btn {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: var(--text-primary);
    padding: 8px 18px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    border: none;
}

.user-menu-btn:hover {
    background: #f8fafc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Área de Contenido */
.main-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 40px;
    animation: fadeInSlide 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

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

/* Tarjetas Dinámicas con Color Suave */
.crm-card {
    background: #ffffff;
    border: 1px solid var(--crm-border);
    border-radius: 28px;
    padding: 35px;
    box-shadow: var(--crm-shadow-sm);
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    transition: var(--crm-transition);
}

.crm-card:hover {
    box-shadow: var(--crm-shadow-md);
    transform: translateY(-5px);
    border-color: rgba(79, 70, 229, 0.2);
}

.crm-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--nav-grad);
    opacity: 0.1;
    transition: var(--crm-transition);
}

.crm-card:hover::after {
    opacity: 1;
}

.crm-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: var(--nav-grad);
    opacity: 0.1;
}

/* Controles de Formulario */
.form-control,
.form-select {
    background: #fcfdfe !important;
    border: 1px solid #edf2f7 !important;
    color: var(--text-primary) !important;
    border-radius: 16px;
    padding: 12px 18px;
    transition: all 0.2s ease;
}

.form-control:focus {
    background: #ffffff !important;
    border-color: var(--crm-primary) !important;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1) !important;
}

/* Botones Neon Suave */
.btn-premium {
    background: var(--nav-grad);
    border: none;
    color: white;
    border-radius: 16px;
    padding: 12px 30px;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.3);
}

.btn-premium:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 15px 25px -5px rgba(79, 70, 229, 0.4);
    color: white;
}

/* Smart Tables & Avatars */
.avatar-circle {
    width: 38px;
    height: 38px;
    background: var(--nav-grad);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.2);
}

.table.smart-table {
    border-spacing: 0 10px;
    border-collapse: separate;
}

.smart-table tr {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.smart-table td {
    background: #ffffff;
    border: 1px solid var(--crm-border) !important;
    border-style: solid none !important;
    padding: 16px 20px;
}

.smart-table td:first-child {
    border-left: 1px solid var(--crm-border) !important;
    border-radius: 16px 0 0 16px;
}

.smart-table td:last-child {
    border-right: 1px solid var(--crm-border) !important;
    border-radius: 0 16px 16px 0;
}

.smart-table tr:hover td {
    background-color: #f8faff;
    border-color: rgba(79, 70, 229, 0.2) !important;
    transform: scale(1.01);
    box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.05);
}

.badge-futuristic {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}

.badge-futuristic.status-converted {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.2);
}

.badge-futuristic.status-pending {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.2);
}

/* Action Buttons */
.btn-action {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.btn-action-view {
    background: #f1f5f9;
    color: #475569;
}

.btn-action-view:hover {
    background: #e2e8f0;
    color: var(--crm-primary);
}

/* Badges y Otros */
.badge {
    padding: 6px 14px;
    border-radius: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.bg-info {
    background-color: rgba(14, 165, 233, 0.1) !important;
    color: #0ea5e9 !important;
}

.bg-success {
    background-color: rgba(16, 185, 129, 0.1) !important;
    color: #10b981 !important;
}

/* =====================================================
   TOAST NOTIFICATION SYSTEM — Premium
   ===================================================== */
.crm-toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.crm-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 16px;
    min-width: 320px;
    max-width: 420px;
    pointer-events: all;
    box-shadow: 0 20px 40px -8px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04);
    backdrop-filter: blur(12px);
    animation: toastSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    position: relative;
    overflow: hidden;
}

.crm-toast::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
}

.crm-toast.toast-success {
    background: rgba(240, 253, 244, 0.97);
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.crm-toast.toast-success::before { background: #10b981; }

.crm-toast.toast-error {
    background: rgba(254, 242, 242, 0.97);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.crm-toast.toast-error::before { background: #ef4444; }

.crm-toast.toast-warning {
    background: rgba(255, 251, 235, 0.97);
    border: 1px solid rgba(245, 158, 11, 0.2);
}
.crm-toast.toast-warning::before { background: #f59e0b; }

.crm-toast.toast-info {
    background: rgba(239, 246, 255, 0.97);
    border: 1px solid rgba(99, 102, 241, 0.2);
}
.crm-toast.toast-info::before { background: #6366f1; }

.crm-toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.toast-success .crm-toast-icon { background: rgba(16,185,129,0.15); color: #059669; }
.toast-error   .crm-toast-icon { background: rgba(239,68,68,0.15);  color: #dc2626; }
.toast-warning .crm-toast-icon { background: rgba(245,158,11,0.15); color: #d97706; }
.toast-info    .crm-toast-icon { background: rgba(99,102,241,0.15); color: #6366f1; }

.crm-toast-body { flex: 1; }
.crm-toast-title {
    font-weight: 700;
    font-size: 0.88rem;
    margin-bottom: 2px;
    color: #1e293b;
}
.crm-toast-msg {
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.4;
}

.crm-toast-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px;
    font-size: 1rem;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
    align-self: flex-start;
}
.crm-toast-close:hover { color: #475569; background: rgba(0,0,0,0.06); }

.crm-toast-progress {
    position: absolute;
    bottom: 0; left: 0;
    height: 3px;
    border-radius: 0 0 0 16px;
    animation: toastProgress linear forwards;
}
.toast-success .crm-toast-progress { background: #10b981; }
.toast-error   .crm-toast-progress { background: #ef4444; }
.toast-warning .crm-toast-progress { background: #f59e0b; }
.toast-info    .crm-toast-progress { background: #6366f1; }

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(40px) scale(0.95); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastSlideOut {
    from { opacity: 1; transform: translateX(0) scale(1); max-height: 200px; margin-bottom: 0; }
    to   { opacity: 0; transform: translateX(40px) scale(0.9); max-height: 0; margin-bottom: -10px; }
}
@keyframes toastProgress {
    from { width: 100%; }
    to   { width: 0%; }
}
.crm-toast.removing {
    animation: toastSlideOut 0.35s ease forwards;
}

/* =====================================================
   LEAD STATUS ROW COLORS — Border izquierdo por estado
   ===================================================== */
.lead-row-new td:first-child       { border-left: 4px solid #6366f1 !important; }
.lead-row-scheduled td:first-child { border-left: 4px solid #0ea5e9 !important; }
.lead-row-waiting td:first-child   { border-left: 4px solid #f59e0b !important; }
.lead-row-converted td:first-child { border-left: 4px solid #10b981 !important; }
.lead-row-noshow td:first-child    { border-left: 4px solid #ef4444 !important; }

.lead-row-waiting td { background-color: rgba(245,158,11,0.025) !important; }
.lead-row-noshow td  { background-color: rgba(239,68,68,0.025)  !important; }
.lead-row-converted td { background-color: rgba(16,185,129,0.025) !important; }

/* Stats Cards */
.stat-card-leads {
    background: #fff;
    border-radius: 20px;
    padding: 20px 24px;
    border: 1.5px solid #f1f5f9;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}
.stat-card-leads:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px -8px rgba(0,0,0,0.1);
}
.stat-card-leads .stat-value {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 2rem;
    line-height: 1;
    margin: 8px 0 4px;
}
.stat-card-leads .stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #94a3b8;
}
.stat-card-leads .stat-icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
}
.stat-card-leads .stat-trend {
    font-size: 0.75rem;
    font-weight: 600;
    display: flex; align-items: center; gap: 3px;
}
.stat-card-leads::after {
    content: '';
    position: absolute;
    bottom: -20px; right: -20px;
    width: 80px; height: 80px;
    border-radius: 50%;
    opacity: 0.05;
}
.stat-purple::after { background: #6366f1; }
.stat-blue::after   { background: #0ea5e9; }
.stat-amber::after  { background: #f59e0b; }
.stat-green::after  { background: #10b981; }