/* CONTENEDOR DE SCROLL */
.contenedor-tabla {
    flex-grow: 1; 
    overflow-y: auto;
    overflow-x: auto; 
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(0, 0, 0, 0.3);
    position: relative;
    border-radius: 4px;
    margin-bottom: 5px; /* Espacio mínimo antes del pie */
}

.tabla-crm {
    width: 100%;
    border-collapse: separate; 
    border-spacing: 0;
}

/* ENCABEZADOS STICKY */
.tabla-crm thead th {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: #1a252f !important;
    color: #ffffff;
    font-size: clamp(9px, 1vw, 12px) !important;
    padding: clamp(8px, 1.2vh, 15px) !important;
    box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.2), 
                0 2px 5px rgba(0,0,0,0.5); 
    text-align: left;
}

/* CELDAS Y FILAS */
.tabla-crm td {
    padding: clamp(6px, 1vh, 12px) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background-color: rgba(40, 40, 40, 0.4);
    color: white;
    font-size: clamp(10px, 1.1vw, 13px) !important;
}

.tabla-crm tr:hover td {
    background-color: rgba(255, 255, 255, 0.95) !important;
    color: #000000 !important;
    transition: background-color 0.1s ease;
}

/* ESTADOS ESPECIALES (Transparente/Colores) */
.my-transparent-table tr.cantada td { background-color: red !important; color: yellow !important; }
.my-transparent-table tr.caidas td { background-color: black !important; color: white !important; text-decoration: line-through; }
.my-transparent-table tr.entregado td { background-color: rgba(60, 60, 60, 1) !important; color: white !important; }

/* SCROLLBAR PERSONALIZADA */
.contenedor-tabla::-webkit-scrollbar { width: 8px; height: 8px; }
.contenedor-tabla::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); }
.contenedor-tabla::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 10px; }
.contenedor-tabla::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.4); }

/* Añade esto a tu tabla.css */
.tabla-crm thead th.sortable {
    cursor: pointer;
    transition: background-color 0.2s;
    user-select: none; /* Evita seleccionar texto al hacer clic rápido */
}

.tabla-crm thead th.sortable:hover {
    background-color: #2c3e50 !important; /* Un poco más claro que el fondo original */
}

/* Icono pequeño para indicar ordenación */
.icon-sort::after {
    content: ' ↕';
    font-size: 0.8em;
    opacity: 0.5;
}