/* ==========================================================================
   CRM CSS - Pipeline, Kanban, Timeline, Actividades, Detail Layout
   ========================================================================== */

/* Vista Toggle CRM */
.crm-view-toggle {
    display: flex;
    background: #e9ecef;
    border-radius: 8px;
    padding: 4px;
}

.crm-view-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.crm-view-btn.active {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.crm-view-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.5);
}

/* Kanban Board */
.crm-kanban-container {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 20px 0;
    min-height: 500px;
}

.crm-kanban-column {
    min-width: 280px;
    max-width: 280px;
    background: var(--color-gray-100);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 300px);
}

.crm-kanban-header {
    padding: 12px 16px;
    background: #fff;
    border-radius: 8px 8px 0 0;
    border-bottom: 3px solid var(--stage-color, var(--color-brand));
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
}

.crm-kanban-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-gray-800);
}

.crm-kanban-count {
    background: #e9ecef;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.crm-kanban-value {
    font-size: 11px;
    color: var(--color-success);
    font-weight: 600;
    margin-left: 8px;
}

.crm-kanban-cards {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    min-height: 100px;
}

.crm-kanban-cards.drag-over {
    background: #e3f2fd;
}

/* Kanban Card */
.crm-kanban-card {
    background: white;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    cursor: grab;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

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

.crm-kanban-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: rotate(3deg);
}

.crm-kanban-card.won {
    border-left-color: var(--color-success);
    background: linear-gradient(to right, #f0fff4, white);
}

.crm-kanban-card.lost {
    border-left-color: var(--color-danger);
    background: linear-gradient(to right, #fff5f5, white);
    opacity: 0.7;
}

/* Tarjeta estancada */
.crm-kanban-card.stagnant {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe0e0 100%);
    border-left-color: #dc3545;
}

.crm-kanban-card.stagnant:hover {
    background: linear-gradient(135deg, #fff0f0 0%, #ffd6d6 100%);
}

/* Fila superior de la tarjeta (titulo + icono actividad) */
.crm-kanban-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.crm-kanban-card-top .crm-kanban-card-title {
    flex: 1;
}

/* Indicador de actividad */
.crm-activity-indicator {
    flex-shrink: 0;
    font-size: 14px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    line-height: 1;
}

.crm-activity-indicator.activity-none {
    color: #f0ad4e;
    font-size: 16px;
}

.crm-activity-indicator.activity-future {
    color: #999;
    font-size: 12px;
}

.crm-activity-indicator.activity-today {
    color: #28a745;
    font-size: 12px;
}

.crm-activity-indicator.activity-overdue {
    color: #dc3545;
    font-size: 12px;
}

.crm-kanban-card-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-gray-800);
    font-size: 14px;
    cursor: pointer;
}

.crm-kanban-card-title:hover {
    color: var(--color-brand);
}

.crm-kanban-card-account {
    font-size: 12px;
    color: var(--color-gray-600);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.crm-kanban-card-canal {
    font-size: 11px;
    color: #1565c0;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.crm-kanban-card-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-success);
}

.crm-kanban-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.crm-kanban-card-date {
    font-size: 11px;
    color: var(--color-gray-500);
}

.crm-kanban-card-probability {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e9ecef;
}

/* Tabla CRM */
.crm-table-container {
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-top: 20px;
}

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

.crm-table th {
    background: var(--color-gray-100);
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--color-gray-800);
    border-bottom: 2px solid var(--color-gray-300);
    font-size: 13px;
}

.crm-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.crm-table tr:hover {
    background: var(--color-gray-100);
}

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

.crm-table-actions button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.crm-table-actions .btn-edit {
    background: #e3f2fd;
    color: #1976d2;
}

.crm-table-actions .btn-delete {
    background: #ffebee;
    color: #d32f2f;
}

.crm-table-actions button:hover {
    transform: scale(1.05);
}

/* Badge de estado CRM */
.crm-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.crm-status-badge.open {
    background: #e3f2fd;
    color: #1976d2;
}

.crm-status-badge.won {
    background: #e8f5e9;
    color: #2e7d32;
}

.crm-status-badge.lost {
    background: #ffebee;
    color: #c62828;
}

/* Badge de canal */
.crm-canal-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Header badges container */
.opportunity-header-badges {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Detail Layout */
.crm-detail-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
}

@media (max-width: 1200px) {
    .crm-detail-layout {
        grid-template-columns: 1fr;
    }
}

.crm-detail-main {
    display: flex;
    flex-direction: column;
}

.crm-detail-card {
    background: white;
    border-radius: 10px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.crm-detail-card h3 {
    margin: 0 0 20px 0;
    color: var(--color-gray-800);
    font-size: 18px;
    border-bottom: 2px solid var(--color-brand);
    padding-bottom: 10px;
}

.crm-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.crm-detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.crm-detail-label {
    font-size: 12px;
    color: var(--color-gray-600);
    text-transform: uppercase;
    font-weight: 600;
}

.crm-detail-value {
    font-size: 16px;
    color: var(--color-gray-800);
}

.crm-detail-value.large {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-success);
}

.crm-detail-actions {
    display: flex;
    gap: 12px;
    margin-top: 15px;
}

.crm-detail-actions button {
    flex: 1;
}

/* Propiedades de Cuenta en Detalle Oportunidad */
.crm-account-properties-card {
    border-left: 4px solid var(--color-primary);
}

.crm-properties-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin: -24px -24px 0 -24px;
    padding: 20px 24px;
    background: var(--color-gray-100);
    border-radius: 10px 10px 0 0;
    transition: background 0.2s;
}

.crm-properties-header:hover {
    background: #f0f0f0;
}

.crm-properties-header h3 {
    margin: 0;
    border: none;
    padding: 0;
    font-size: 16px;
}

.crm-properties-toggle {
    font-size: 12px;
    color: var(--color-gray-600);
    transition: transform 0.2s;
}

.crm-properties-content {
    padding-top: 20px;
    transition: all 0.3s ease;
}

.crm-properties-content.collapsed {
    display: none;
}

.crm-properties-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.crm-property-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.crm-property-item.crm-property-full {
    grid-column: 1 / -1;
}

.crm-property-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.crm-property-value {
    font-size: 15px;
    color: var(--color-gray-800);
    font-weight: 500;
}

.crm-property-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.crm-problem-tag {
    display: inline-block;
    padding: 5px 12px;
    background: var(--color-warning-light);
    color: #856404;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
}

/* Timeline */
.crm-detail-sidebar {
    display: flex;
    flex-direction: column;
}

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

.crm-timeline-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--color-gray-800);
}

.crm-timeline {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    max-height: calc(100vh - 350px);
    overflow-y: auto;
}

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

.crm-timeline-item {
    display: flex;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid #eee;
    transition: all 0.3s ease;
}

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

/* Columna del icono + dot de estado */
.crm-timeline-icon-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.crm-timeline-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
    transition: all 0.2s;
}

.crm-timeline-icon.note { background: #e3f2fd; }
.crm-timeline-icon.call { background: #fff3e0; }
.crm-timeline-icon.email { background: #e8f5e9; }
.crm-timeline-icon.meeting { background: #fce4ec; }
.crm-timeline-icon.task { background: #f3e5f5; }

/* Indicadores de color en el icono del timeline */
.crm-timeline-icon.activity-overdue-tl {
    box-shadow: 0 0 0 3px #dc3545;
}

.crm-timeline-icon.activity-today-tl {
    box-shadow: 0 0 0 3px #28a745;
}

.crm-timeline-icon.activity-future-tl {
    box-shadow: 0 0 0 3px #adb5bd;
}

.crm-timeline-icon.activity-completed {
    box-shadow: none;
    opacity: 0.6;
}

.crm-timeline-icon.editable {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.crm-timeline-icon.editable:hover {
    transform: scale(1.1);
}

/* Dot de estado debajo del icono */
.crm-timeline-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
}

.crm-timeline-status-dot.dot-red {
    background: #dc3545;
}

.crm-timeline-status-dot.dot-green {
    background: #28a745;
}

.crm-timeline-status-dot.dot-gray {
    background: #adb5bd;
}

.crm-timeline-status-dot.dot-warning {
    background: #f0ad4e;
}

.crm-timeline-status-dot.completed {
    background: #28a745;
    color: white;
    font-weight: 700;
    width: 16px;
    height: 16px;
    font-size: 10px;
}

/* Items completados */
.crm-timeline-item.timeline-completed {
    opacity: 0.6;
}

.crm-timeline-item.timeline-completed .crm-timeline-title {
    text-decoration: line-through;
    color: var(--color-gray-500);
}

.crm-timeline-item.timeline-completed .crm-timeline-text {
    color: var(--color-gray-500);
}

/* Items con actividad vencida */
.crm-timeline-item.activity-overdue-tl {
    background: #fff5f5;
    margin: 0 -16px;
    padding: 16px;
    border-radius: 8px;
}

/* Items con actividad para hoy */
.crm-timeline-item.activity-today-tl {
    background: #f0fff4;
    margin: 0 -16px;
    padding: 16px;
    border-radius: 8px;
}

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

.crm-timeline-content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
    gap: 10px;
}

.crm-timeline-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    flex-shrink: 0;
}

.crm-timeline-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-gray-800);
}

.crm-timeline-date {
    font-size: 11px;
    color: var(--color-gray-500);
    white-space: nowrap;
}

/* Fecha de vencimiento */
.crm-timeline-due {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    padding: 2px 8px;
    border-radius: 10px;
}

.crm-timeline-due.dot-red {
    background: #ffebee;
    color: #c62828;
}

.crm-timeline-due.dot-green {
    background: #e8f5e9;
    color: #2e7d32;
}

.crm-timeline-due.dot-gray {
    background: #f5f5f5;
    color: #666;
}

.crm-timeline-due.completed {
    background: #e8f5e9;
    color: #999;
    text-decoration: line-through;
}

.crm-timeline-author {
    font-size: 12px;
    color: var(--color-gray-600);
    margin-bottom: 6px;
}

.crm-timeline-text {
    font-size: 13px;
    color: var(--color-gray-700);
    line-height: 1.5;
    word-wrap: break-word;
}

/* Acciones del timeline (checkbox) */
.crm-timeline-actions {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #e0e0e0;
}

.crm-timeline-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    user-select: none;
}

.crm-timeline-checkbox.pending {
    background: #fff3cd;
    color: #856404;
}

.crm-timeline-checkbox.pending:hover {
    background: #ffe69c;
}

.crm-timeline-checkbox.completed {
    background: #d4edda;
    color: #155724;
}

.crm-timeline-checkbox.completed:hover {
    background: #c3e6cb;
}

.crm-timeline-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #28a745;
}

.crm-timeline-check-label {
    line-height: 1;
}

/* Contactos de Cuenta (pestaña en modal) */
.crm-contactos-cuenta-lista {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.crm-contactos-empty {
    text-align: center;
    padding: 30px 20px;
    color: #888;
}

.crm-contactos-empty p {
    margin: 4px 0;
}

.crm-contacto-cuenta-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #1976d2;
    border-radius: 8px;
    padding: 14px 16px;
    transition: all 0.2s;
}

.crm-contacto-cuenta-card:hover {
    border-left-color: #0d47a1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

.crm-contacto-cuenta-nombre {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.crm-contacto-cuenta-icon {
    font-size: 18px;
}

.crm-contacto-badge.primary {
    background: #e3f2fd;
    color: #1565c0;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.crm-contacto-cuenta-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #666;
    flex-wrap: wrap;
}

.crm-contacto-cuenta-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.crm-contacto-cuenta-notas {
    margin-top: 8px;
    font-size: 13px;
    color: #888;
    font-style: italic;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

/* Estadisticas CRM */
.crm-stats-filters {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.crm-stats-filters .filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.crm-stats-filters .filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-gray-600);
    white-space: nowrap;
}

.crm-stats-filters .filter-group select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    min-width: 160px;
}

.crm-stats-kpis {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.crm-stats-kpi-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-top: 4px solid #ccc;
}

.crm-stats-kpi-card.blue { border-top-color: #1976d2; }
.crm-stats-kpi-card.green { border-top-color: #388e3c; }
.crm-stats-kpi-card.red { border-top-color: #d32f2f; }
.crm-stats-kpi-card.purple { border-top-color: #7b1fa2; }
.crm-stats-kpi-card.orange { border-top-color: #f57c00; }
.crm-stats-kpi-card.teal { border-top-color: #00897b; }

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

.crm-stats-kpi-label {
    font-size: 13px;
    color: var(--color-gray-600);
    font-weight: 500;
}

.crm-stats-charts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

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

.crm-stats-chart-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-gray-800);
    margin: 0 0 16px 0;
}

.crm-stats-chart-container {
    position: relative;
    height: 280px;
}

/* Responsive estadisticas */
@media (max-width: 1200px) {
    .crm-stats-kpis {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .crm-stats-kpis {
        grid-template-columns: repeat(2, 1fr);
    }
    .crm-stats-charts {
        grid-template-columns: 1fr;
    }
    .crm-stats-kpi-value {
        font-size: 22px;
    }
}

/* Cuenta Colaborador - Boton y resultados de busqueda */
.btn-colaborador {
    background: #1565c0 !important;
}

.btn-colaborador:hover {
    background: #0d47a1 !important;
}

.crm-colaborador-resultados {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 12px;
}

.crm-colaborador-empty {
    text-align: center;
    padding: 20px;
    color: #888;
    margin: 0;
}

.crm-colaborador-lista {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.crm-colaborador-card {
    padding: 14px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.crm-colaborador-card:hover:not(.disabled) {
    border-color: #1565c0;
    background: #f0f7ff;
}

.crm-colaborador-card.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.crm-colaborador-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.crm-colaborador-card-header strong {
    font-size: 15px;
}

.crm-colaborador-card-meta {
    display: flex;
    gap: 20px;
    margin-top: 6px;
    font-size: 13px;
    color: #666;
    flex-wrap: wrap;
}

.crm-colaborador-badge.imported {
    background: #fff3cd;
    color: #856404;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

/* Actividades pendientes - Tabs de filtro temporal */
.crm-actividades-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.crm-actividades-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-gray-600);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.crm-actividades-tab:hover {
    color: var(--color-gray-800);
    background: var(--color-gray-50, #f5f5f5);
}

.crm-actividades-tab.active {
    color: #1976d2;
    border-bottom-color: #1976d2;
    font-weight: 600;
}

/* Actividades pendientes */
.crm-actividades-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

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

.crm-actividad-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.crm-actividad-card.vencida {
    border-left: 4px solid var(--color-danger);
}

.crm-actividad-card.hoy {
    border-left: 4px solid var(--color-warning);
}

.crm-actividad-card.completada {
    opacity: 0.6;
    background: var(--color-gray-100);
}

.crm-actividad-card.pendiente {
    border-left: 4px solid #1976d2;
}

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

.crm-actividad-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.crm-actividad-icon.task { background: #f3e5f5; }
.crm-actividad-icon.meeting { background: #fce4ec; }

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

.crm-actividad-titulo {
    font-weight: 600;
    font-size: 15px;
    color: var(--color-gray-800);
    margin-bottom: 4px;
}

.crm-actividad-card.completada .crm-actividad-titulo {
    text-decoration: line-through;
    color: var(--color-gray-500);
}

.crm-actividad-meta {
    font-size: 13px;
    color: var(--color-gray-600);
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.crm-actividad-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.crm-actividad-fecha {
    font-size: 13px;
    color: var(--color-gray-600);
    white-space: nowrap;
    text-align: right;
}

.crm-actividad-fecha.vencida {
    color: var(--color-danger);
    font-weight: 600;
}

.crm-actividad-fecha.hoy {
    color: var(--color-warning);
    font-weight: 600;
}

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

.crm-actividad-actions button {
    padding: 6px 12px;
    font-size: 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.crm-actividades-empty p {
    margin: 0;
    font-size: 16px;
}

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

.crm-actividad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.crm-actividad-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--color-gray-800);
}

.crm-actividad-title.completada {
    text-decoration: line-through;
    color: var(--color-gray-500);
}

.crm-actividad-estado {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.crm-actividad-estado.pendiente {
    background: #e3f2fd;
    color: #1976d2;
}

.crm-actividad-estado.hoy {
    background: #fff8e1;
    color: #f57f17;
}

.crm-actividad-estado.vencida {
    background: #ffebee;
    color: #c62828;
}

.crm-actividad-estado.completada {
    background: #e8f5e9;
    color: #2e7d32;
}

.crm-actividad-descripcion {
    font-size: 13px;
    color: var(--color-gray-600);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-actividad-oportunidad:hover {
    text-decoration: underline;
}

/* Status badge grande */
#page-crm-oportunidad-detalle .header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.opportunity-status-badge {
    flex-shrink: 0;
}

.opportunity-status-badge .crm-status-badge {
    font-size: 14px;
    padding: 8px 16px;
}

/* ==========================================================================
   CANALES - Gestión de canales y alianzas
   ========================================================================== */

/* Badge de fase para tabla de canales */
.crm-fase-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    text-transform: capitalize;
}

/* Badge de conteo */
.crm-count-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #e9ecef;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s;
}

.crm-count-badge:hover {
    background: #dee2e6;
}

/* Empty state para canales */
.crm-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.crm-empty-state p {
    color: #6c757d;
    margin-bottom: 20px;
    font-size: 16px;
}

/* ==========================================================================
   PROPIEDADES DE CUENTA - En detalle de oportunidad
   ========================================================================== */

/* Tarjeta de propiedades */
.crm-account-properties-card {
    border-left: 4px solid #667eea;
}

.crm-properties-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin: -24px -24px 0 -24px;
    padding: 20px 24px;
    background: #f8f9fa;
    border-radius: 10px 10px 0 0;
    transition: background 0.2s;
}

.crm-properties-header:hover {
    background: #f0f0f0;
}

.crm-properties-header h3 {
    margin: 0;
    border: none;
    padding: 0;
    font-size: 16px;
}

.crm-properties-toggle {
    font-size: 12px;
    color: #666;
    transition: transform 0.2s;
}

.crm-properties-content {
    padding-top: 20px;
    transition: all 0.3s ease;
}

.crm-properties-content.collapsed {
    display: none;
}

.crm-properties-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.crm-property-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.crm-property-item.crm-property-full {
    grid-column: 1 / -1;
}

.crm-property-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.crm-property-value {
    font-size: 15px;
    color: #333;
    font-weight: 500;
}

.crm-property-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.crm-problem-tag {
    display: inline-block;
    padding: 5px 12px;
    background: #fff3cd;
    color: #856404;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
}

/* ==========================================================================
   MODAL TABS - Pestañas en modales
   ========================================================================== */

.crm-modal-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 24px;
    background: #fafafa;
}

.crm-modal-tab {
    padding: 14px 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    position: relative;
    transition: all 0.2s;
}

.crm-modal-tab:hover {
    color: var(--color-brand);
}

.crm-modal-tab.active {
    color: var(--color-brand);
}

.crm-modal-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--color-brand);
    border-radius: 3px 3px 0 0;
}

.crm-tab-content {
    display: none;
}

.crm-tab-content.active {
    display: block;
}

/* Estilos para propiedades en formulario */
.crm-properties-intro {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.crm-properties-intro p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.crm-form-help {
    display: block;
    font-size: 12px;
    color: #888;
    margin-top: 5px;
}

.crm-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 0;
}

.crm-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    transition: background 0.2s;
}

.crm-checkbox-item:hover {
    background: #f0f0f0;
}

.crm-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.crm-checkbox-item span {
    font-size: 14px;
    color: #333;
}

/* Modal large */
.crm-modal-content.crm-modal-large {
    max-width: 750px;
}

/* ==========================================================================
   PESTAÑA CANAL EN MODAL DE CUENTA
   ========================================================================== */

.crm-canal-tab-header {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 20px;
}

.crm-canal-selector {
    display: flex;
    gap: 10px;
    align-items: center;
}

.crm-canal-selector select {
    flex: 1;
    min-width: 200px;
}

.crm-canal-selector .btn-small {
    white-space: nowrap;
    padding: 10px 15px;
    font-size: 13px;
}

.crm-canal-properties {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e0e0e0;
}

.crm-canal-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
}

.crm-empty-canal {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px dashed #dee2e6;
}

.crm-empty-canal p {
    margin: 0 0 10px 0;
    color: #495057;
}

.crm-empty-canal .text-muted {
    color: #6c757d;
    font-size: 14px;
}

/* Botón success para crear canal */
.btn-success {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-success:hover {
    background: #218838;
}

/* Mejoras responsive */
@media (max-width: 768px) {
    .crm-kanban-container {
        flex-direction: column;
    }

    .crm-kanban-column {
        min-width: 100%;
        max-width: 100%;
    }

    .crm-properties-grid {
        grid-template-columns: 1fr;
    }

    .crm-canal-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .crm-canal-selector select {
        min-width: 100%;
    }
}
