/* Dashboard styles complementarios */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.stat-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2563eb;
    font-size: 18px;
}

.stat-icon i {
    color: white;
}

/* Sección de estadísticas de administración */
.admin-stats-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #e5e7eb;
}

.admin-stats-section h3 {
    margin-bottom: 1rem;
    color: #64748b;
    font-size: 1.1rem;
    font-weight: 600;
}

.quick-actions .actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
}

/* Dashboard Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 2rem;
}

.dashboard-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Dashboard Cards */
.dashboard-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dashboard-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f3f4f6;
}

.dashboard-card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dashboard-card-header h3 i {
    color: #3b82f6;
}

.view-all-link {
    color: #3b82f6;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
}

.view-all-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* Leads List */
.leads-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.lead-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
    cursor: pointer;
}

.lead-item:hover {
    background: #f3f4f6;
    border-color: #3b82f6;
    transform: translateX(4px);
}

.lead-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

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

.lead-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.lead-header strong {
    color: #1f2937;
    font-size: 0.95rem;
}

.lead-email {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0.25rem 0;
}

.lead-phone {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lead-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.lead-tags .tag {
    background: #e0e7ff;
    color: #4338ca;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-new {
    background: #dbeafe;
    color: #1e40af;
}

.status-contacted {
    background: #fef3c7;
    color: #92400e;
}

.status-qualified {
    background: #d1fae5;
    color: #065f46;
}

.status-other {
    background: #f3f4f6;
    color: #374151;
}

.lead-actions {
    display: flex;
    align-items: center;
}

.btn-icon {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #f3f4f6;
    color: #3b82f6;
}

/* Emails List */
.emails-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.email-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
    cursor: pointer;
}

.email-item:hover {
    background: #f3f4f6;
    border-color: #3b82f6;
}

.email-item.unread {
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
    font-weight: 500;
}

.email-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e0e7ff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3b82f6;
    flex-shrink: 0;
}

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

.email-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.email-header strong {
    color: #1f2937;
    font-size: 0.95rem;
}

.email-subject {
    color: #1f2937;
    font-weight: 500;
    margin: 0.25rem 0;
    font-size: 0.875rem;
}

.email-preview {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0.25rem 0;
    line-height: 1.4;
}

.email-date {
    color: #9ca3af;
    font-size: 0.75rem;
    margin-top: 0.5rem;
    display: block;
}

.unread-badge {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b82f6;
    display: inline-block;
    margin-left: 0.5rem;
}

/* WhatsApp List */
.whatsapp-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.whatsapp-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
    cursor: pointer;
}

.whatsapp-item:hover {
    background: #f0fdf4;
    border-color: #25d366;
}

.whatsapp-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    font-size: 1.25rem;
}

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

.whatsapp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.whatsapp-header strong {
    color: #1f2937;
    font-size: 0.95rem;
}

.whatsapp-message {
    color: #1f2937;
    font-size: 0.875rem;
    margin: 0.25rem 0;
    line-height: 1.4;
}

.whatsapp-instance {
    color: #6b7280;
    font-size: 0.75rem;
    display: block;
    margin-top: 0.25rem;
}

.whatsapp-date {
    color: #9ca3af;
    font-size: 0.75rem;
    margin-top: 0.5rem;
    display: block;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    background: #ef4444;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.loading-placeholder {
    text-align: center;
    padding: 2rem;
    color: #9ca3af;
    font-style: italic;
}

.no-data {
    text-align: center;
    padding: 2rem;
    color: #9ca3af;
    font-size: 0.875rem;
}

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

/* Dark Mode */
body.dark-mode .dashboard-card,
html.dark-mode .dashboard-card {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .dashboard-card-header,
html.dark-mode .dashboard-card-header {
    border-bottom-color: #334155;
}

body.dark-mode .dashboard-card-header h3,
html.dark-mode .dashboard-card-header h3 {
    color: #f1f5f9;
}

body.dark-mode .lead-item,
html.dark-mode .lead-item,
body.dark-mode .email-item,
html.dark-mode .email-item,
body.dark-mode .whatsapp-item,
html.dark-mode .whatsapp-item {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .lead-item:hover,
html.dark-mode .lead-item:hover,
body.dark-mode .email-item:hover,
html.dark-mode .email-item:hover,
body.dark-mode .whatsapp-item:hover,
html.dark-mode .whatsapp-item:hover {
    background: #334155;
}

body.dark-mode .lead-header strong,
html.dark-mode .lead-header strong,
body.dark-mode .email-header strong,
html.dark-mode .email-header strong,
body.dark-mode .whatsapp-header strong,
html.dark-mode .whatsapp-header strong {
    color: #f1f5f9;
}

body.dark-mode .lead-email,
html.dark-mode .lead-email,
body.dark-mode .lead-phone,
html.dark-mode .lead-phone,
body.dark-mode .email-preview,
html.dark-mode .email-preview,
body.dark-mode .whatsapp-message,
html.dark-mode .whatsapp-message {
    color: #cbd5e1;
}

body.dark-mode .email-item.unread,
html.dark-mode .email-item.unread {
    background: #1e3a8a;
    border-left-color: #60a5fa;
}


/* Leads/Clientes Summary */
.leads-clients-summary {
    margin-bottom: 1rem;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.summary-stat {
    text-align: center;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
}

.summary-stat .stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: #3b82f6;
    margin-bottom: 0.25rem;
}

.summary-stat .stat-label {
    display: block;
    font-size: 0.875rem;
    color: #6b7280;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Kanban Board */
.dashboard-kanban-card {
    min-height: 500px;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.kanban-column {
    background: #f9fafb;
    border-radius: 8px;
    padding: 1rem;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.kanban-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e5e7eb;
}

.kanban-column-header h4 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
    text-transform: uppercase;
}

.kanban-count {
    background: #e5e7eb;
    color: #6b7280;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.kanban-items {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.kanban-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.75rem;
    cursor: move;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.kanban-item:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.kanban-item.dragging {
    opacity: 0.5;
}

.kanban-item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.5rem;
}

.kanban-item-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: #1f2937;
    margin: 0;
    flex: 1;
}

.kanban-item-actions {
    display: flex;
    gap: 0.25rem;
}

.kanban-item-action {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: #6b7280;
    font-size: 0.75rem;
    transition: color 0.2s;
}

.kanban-item-action:hover {
    color: #3b82f6;
}

.kanban-item-body {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.kanban-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #9ca3af;
}

.kanban-item-priority {
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
}

.kanban-item-priority.high {
    background: #fee2e2;
    color: #dc2626;
}

.kanban-item-priority.medium {
    background: #fef3c7;
    color: #d97706;
}

.kanban-item-priority.low {
    background: #d1fae5;
    color: #059669;
}

.kanban-item-assigned {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.kanban-item-assigned img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

/* Notifications List */
.notifications-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-item {
    padding: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    gap: 0.75rem;
    transition: background 0.2s;
}

.notification-item:hover {
    background: #f9fafb;
}

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

.notification-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon.info {
    background: #dbeafe;
    color: #3b82f6;
}

.notification-icon.success {
    background: #d1fae5;
    color: #059669;
}

.notification-icon.warning {
    background: #fef3c7;
    color: #d97706;
}

.notification-icon.error {
    background: #fee2e2;
    color: #dc2626;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: #1f2937;
    margin: 0 0 0.25rem 0;
}

.notification-message {
    font-size: 0.75rem;
    color: #6b7280;
    margin: 0;
}

.notification-time {
    font-size: 0.625rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

/* Activity List Improvements */
.activity-list {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    padding: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    gap: 0.75rem;
}

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

/* Activity item types */
.activity-item.activity-prospect {
    border-left: 3px solid #667eea;
}

.activity-item.activity-task {
    border-left: 3px solid #f093fb;
}

.activity-item.activity-sale {
    border-left: 3px solid #4facfe;
}

.activity-item.activity-invoice {
    border-left: 3px solid #43e97b;
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.activity-amount {
    font-weight: 600;
    color: #10b981;
    font-size: 0.9rem;
}

.activity-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.badge-chatwoot {
    background: linear-gradient(135deg, #a8caba 0%, #5d4e75 100%);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.badge-stage {
    background: #e0e7ff;
    color: #4338ca;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Distribution Lists */
.distribution-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.distribution-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.distribution-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}

.distribution-label i {
    color: #6b7280;
}

.distribution-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.distribution-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.distribution-fill.priority-high {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.distribution-fill.priority-medium {
    background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

.distribution-fill.priority-low {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.distribution-value {
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 500;
}

.priority-high {
    color: #ef4444;
}

.priority-medium {
    color: #f59e0b;
}

.priority-low {
    color: #10b981;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #f3f4f6;
    color: #3b82f6;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: #1f2937;
    margin: 0 0 0.25rem 0;
}

.activity-description {
    font-size: 0.75rem;
    color: #6b7280;
    margin: 0;
}

.activity-time {
    font-size: 0.625rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .kanban-board {
        grid-template-columns: 1fr;
    }
    
    .summary-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .summary-stats {
        grid-template-columns: 1fr;
    }
    
    .kanban-column {
        min-height: 300px;
    }
}

.kanban-empty {
    text-align: center;
    padding: 2rem;
    color: #9ca3af;
    font-size: 0.875rem;
}

.kanban-item-due.overdue {
    color: #dc2626;
    font-weight: 600;
}

.kanban-item-due.today {
    color: #d97706;
    font-weight: 600;
}

.drag-over {
    background: #eff6ff !important;
    border: 2px dashed #3b82f6 !important;
}

/* Tasks Section Styles */
.task-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
}

.tasks-view {
    margin-top: 1.5rem;
}

.products-view {
    margin-top: 1.5rem;
}

.products-kanban-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(220px, 1fr));
    gap: 1rem;
}

.products-kanban-column {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.75rem;
    min-height: 520px;
    display: flex;
    flex-direction: column;
}

.products-kanban-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.products-kanban-column-header h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #374151;
}

.products-kanban-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
}

.product-kanban-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    cursor: grab;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

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

.products-kanban-column.drag-over {
    border-color: #3b82f6;
    background: #eff6ff;
}

.product-kanban-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.product-kanban-meta {
    font-size: 0.82rem;
    color: #4b5563;
    display: grid;
    gap: 0.25rem;
    margin-bottom: 0.65rem;
}

.product-kanban-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

@media (max-width: 1200px) {
    .products-kanban-board {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }
}

@media (max-width: 700px) {
    .products-kanban-board {
        grid-template-columns: 1fr;
    }
}

.kanban-board-full {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    min-height: 600px;
}

.kanban-board-full .kanban-column {
    min-height: 600px;
}

.status-badge.status-todo {
    background: #e5e7eb;
    color: #374151;
}

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

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

/* Task Detail Modal Styles */
.task-detail-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.task-detail-tabs .tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    color: #6b7280;
    font-weight: 500;
    transition: all 0.2s;
}

.task-detail-tabs .tab-btn:hover {
    color: #3b82f6;
}

.task-detail-tabs .tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.task-detail-tab-content {
    display: none;
}

.task-detail-tab-content.active {
    display: block;
}

.task-detail-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-row {
    display: flex;
    align-items: start;
    gap: 1rem;
    padding: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}

.info-row label {
    font-weight: 600;
    color: #374151;
    min-width: 150px;
}

.info-row span,
.info-row div {
    flex: 1;
    color: #6b7280;
}

.task-description {
    white-space: pre-wrap;
    line-height: 1.6;
}

/* Comments Section */
.comments-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comments-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comment-item {
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.comment-header strong {
    color: #1f2937;
}

.comment-time {
    font-size: 0.75rem;
    color: #9ca3af;
}

.comment-body {
    color: #374151;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 2px solid #e5e7eb;
}

.comment-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-family: inherit;
    resize: vertical;
}

/* Attachments Section */
.attachments-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.upload-area {
    padding: 1rem;
    background: #f9fafb;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    text-align: center;
}

.attachments-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.attachment-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 8px;
    color: #6b7280;
    font-size: 1.5rem;
}

.attachment-info {
    flex: 1;
}

.attachment-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.attachment-meta {
    font-size: 0.75rem;
    color: #6b7280;
}

.attachment-actions {
    display: flex;
    gap: 0.5rem;
}

/* History Section */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 500px;
    overflow-y: auto;
}

.history-item {
    padding: 1rem;
    background: #f9fafb;
    border-left: 3px solid #3b82f6;
    border-radius: 6px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.history-action {
    font-weight: 600;
    color: #1f2937;
}

.history-time {
    font-size: 0.75rem;
    color: #9ca3af;
}

.history-changes {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.history-change {
    font-size: 0.875rem;
    color: #6b7280;
    padding-left: 1rem;
}

.kanban-item-meta {
    font-size: 0.625rem;
    color: #9ca3af;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.5rem;
}

/* Chatwoot Conversations Styles */
.chatwoot-conversations-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

.conversation-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border: none;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
}

.conversation-tab:hover {
    background: #f3f4f6;
    color: #374151;
}

.conversation-tab.active {
    background: white;
    color: #1f2937;
    font-weight: 600;
    border-bottom: 2px solid #3b82f6;
    margin-bottom: -2px;
}

.conversation-count {
    background: #e5e7eb;
    color: #6b7280;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 1.5rem;
    text-align: center;
}

.conversation-tab.active .conversation-count {
    background: #3b82f6;
    color: white;
}

.chatwoot-conversations-list {
    max-height: 400px;
    overflow-y: auto;
}

.chatwoot-conversation-item {
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    gap: 1rem;
    align-items: start;
}

.chatwoot-conversation-item:hover {
    background: #f9fafb;
}

.chatwoot-conversation-item.unread {
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
}

.conversation-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1f93ff 0%, #0d6efd 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.conversation-content {
    flex: 1;
    min-width: 0;
}

.conversation-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.conversation-contact {
    flex: 1;
    color: #1f2937;
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-unread-badge {
    background: #ef4444;
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 1.25rem;
    text-align: center;
}

.conversation-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.conversation-preview {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0.25rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chatwoot-conversation-item.unread .conversation-preview {
    color: #374151;
    font-weight: 500;
}

.conversation-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

.conversation-time {
    flex: 1;
}

.conversation-assignee {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.chatwoot-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: #6b7280;
}

.chatwoot-empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #d1d5db;
    display: block;
}

.chatwoot-empty-state p {
    margin: 0.5rem 0;
    font-weight: 500;
    color: #374151;
}

.chatwoot-empty-state small {
    display: block;
    margin-top: 0.5rem;
    color: #9ca3af;
}

/* ===== Drag-and-Drop Reorder Mode ===== */

/* Toggle button for reorder mode */
.reorder-toggle-btn {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    color: #6b7280;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.reorder-toggle-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.reorder-toggle-btn.active {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #2563eb;
}

/* Sidebar reorder mode */
.app-sidebar.reorder-mode .app-side-link {
    cursor: grab;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    border: 1px dashed transparent;
}

.app-sidebar.reorder-mode .app-side-link:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.app-sidebar.reorder-mode .app-side-link:active {
    cursor: grabbing;
}

.app-sidebar.reorder-mode .app-side-link.dragging {
    opacity: 0.4;
    transform: scale(0.95);
    background: #dbeafe;
}

.app-sidebar.reorder-mode .app-side-link.drag-over-above {
    border-top: 2px solid #3b82f6 !important;
}

.app-sidebar.reorder-mode .app-side-link.drag-over-below {
    border-bottom: 2px solid #3b82f6 !important;
}

/* Dashboard reorder mode */
.dashboard-reorder-mode .dashboard-card {
    cursor: grab;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    border: 1px dashed transparent;
}

.dashboard-reorder-mode .dashboard-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.dashboard-reorder-mode .dashboard-card:active {
    cursor: grabbing;
}

.dashboard-reorder-mode .dashboard-card.dragging {
    opacity: 0.4;
    transform: scale(0.97);
    background: #dbeafe;
}

.dashboard-reorder-mode .dashboard-card.drag-over {
    border: 2px dashed #3b82f6 !important;
    background: #eff6ff !important;
}

/* Sidebar reorder header */
.sidebar-reorder-header {
    display: flex;
    justify-content: flex-end;
    padding: 0 4px 8px 4px;
}

/* Dashboard reorder header */
.dashboard-reorder-actions {
    display: inline-flex;
    margin-left: 12px;
}

/* Dark mode support */
body.dark-mode .reorder-toggle-btn,
html.dark-mode .reorder-toggle-btn {
    border-color: #4b5563;
    color: #9ca3af;
}

body.dark-mode .reorder-toggle-btn:hover,
html.dark-mode .reorder-toggle-btn:hover {
    background: #374151;
    color: #d1d5db;
}

body.dark-mode .reorder-toggle-btn.active,
html.dark-mode .reorder-toggle-btn.active {
    background: #1e3a5f;
    border-color: #3b82f6;
    color: #60a5fa;
}

body.dark-mode .app-sidebar.reorder-mode .app-side-link.dragging,
html.dark-mode .app-sidebar.reorder-mode .app-side-link.dragging {
    background: #1e3a5f;
}

body.dark-mode .dashboard-reorder-mode .dashboard-card.dragging,
html.dark-mode .dashboard-reorder-mode .dashboard-card.dragging {
    background: #1e3a5f;
}

body.dark-mode .dashboard-reorder-mode .dashboard-card.drag-over,
html.dark-mode .dashboard-reorder-mode .dashboard-card.drag-over {
    background: #1e293b !important;
}

/* ========== NUEVO DASHBOARD 2024 ========== */

/* KPI Cards */
.dash-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.kpi-card {
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.kpi-blue   { background: linear-gradient(135deg,#3b82f6,#1d4ed8); }
.kpi-purple { background: linear-gradient(135deg,#8b5cf6,#6d28d9); }
.kpi-green  { background: linear-gradient(135deg,#10b981,#047857); }
.kpi-orange { background: linear-gradient(135deg,#f59e0b,#d97706); }
.kpi-red    { background: linear-gradient(135deg,#ef4444,#b91c1c); }
.kpi-teal   { background: linear-gradient(135deg,#06b6d4,#0e7490); }
.kpi-icon { font-size: 26px; opacity: 0.9; }
.kpi-body { flex:1; min-width:0; }
.kpi-value { font-size: 26px; font-weight: 700; line-height: 1; color: #ffffff !important; text-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.kpi-label { font-size: 13px; opacity: 1; margin-top: 2px; color: #ffffff !important; }
.kpi-sub   { font-size: 11px; opacity: 1; margin-top: 4px; color: #ffffff !important; }
.kpi-card .kpi-icon,
.kpi-card .kpi-icon i,
.kpi-card .kpi-body,
.kpi-card .kpi-body * {
    color: #ffffff !important;
}

/* Quick actions */
.dash-quick-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.qaction-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    transition: all .15s;
}
.qaction-btn:hover { background: #f3f4f6; border-color: #9ca3af; }
.qaction-btn i { color: #6366f1; }

/* Main grid */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

.dash-col { display: flex; flex-direction: column; gap: 20px; }

.dash-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.dash-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.dash-card-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 7px;
}
.dash-card-header h3 i { color: #6366f1; }
.dash-link {
    font-size: 12px;
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
}

/* Distribution bars */
.dist-list { display: flex; flex-direction: column; gap: 8px; }
.dist-item {}
.dist-label { display: flex; justify-content: space-between; font-size: 12px; color: #374151; margin-bottom: 3px; }
.dist-count { font-weight: 600; }
.dist-bar { height: 6px; background: #f3f4f6; border-radius: 3px; overflow: hidden; }
.dist-fill { height: 100%; border-radius: 3px; transition: width .4s ease; }

/* Agent table */
.agent-table-wrap { overflow-x: auto; }

/* User stats row */
.user-stats-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}
.user-stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}
.ust-value { font-size: 24px; font-weight: 700; color: #111827; }
.ust-label { font-size: 11px; color: #6b7280; margin-top: 2px; }

/* Small tables */
.data-table-sm td, .data-table-sm th { padding: 6px 8px; font-size: 12px; }

/* Empty state */
.empty-state-sm { text-align: center; color: #9ca3af; font-size: 13px; padding: 16px; }

/* Dark mode */
body.dark-mode .dash-card { background: #1f2937; border-color: #374151; }
body.dark-mode .dash-card-header h3 { color: #f9fafb; }
body.dark-mode .qaction-btn { background: #1f2937; border-color: #374151; color: #f9fafb; }
body.dark-mode .qaction-btn:hover { background: #374151; }
body.dark-mode .dist-label { color: #d1d5db; }
body.dark-mode .dist-bar { background: #374151; }
body.dark-mode .ust-value { color: #f9fafb; }
body.dark-mode .user-stat-box .ust-label { color: #9ca3af; }
