/* Diferenciacion visual de tramos dentro de una cadena enlazada por turnoANTERIOR. */

.cadena-con-grupos {
    position: relative;
}

.cadena-con-grupos .timeline {
    gap: 0;
}

.cadena-con-grupos .timeline-item {
    transition: background 0.2s ease, border-color 0.2s ease;
}

.cadena-con-grupos .timeline-item::after {
    content: "";
    position: absolute;
    left: 10px;
    top: 28px;
    bottom: -2px;
    width: 3px;
    border-radius: 999px;
    opacity: 0.62;
}

.cadena-con-grupos .timeline-item:last-child::after {
    bottom: 10px;
}

.cambio-turno-separador {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 14px;
    align-items: center;
    margin: 8px 0 12px;
    list-style: none;
}

.cambio-turno-separador::before {
    content: "";
    width: 22px;
    height: 22px;
    border-radius: 50%;
    margin-left: 0;
    border: 4px solid currentColor;
    background: #ffffff;
    box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.9);
}

.cambio-turno-contenido {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    padding: 8px 12px;
    border: 1px solid currentColor;
    border-radius: 999px;
    background: #ffffff;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.cambio-turno-contenido span {
    color: #64748b;
    font-weight: 700;
}

.cambio-turno-contenido strong {
    color: #0f172a;
    letter-spacing: 0.02em;
}

.cambio-turno-contenido small {
    color: #64748b;
    font-weight: 700;
}

.cadena-menu-ruta-color {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    margin-top: 8px;
}

.cadena-menu-ruta-color .ruta-chip,
.ruta-turnos-relacionados .ruta-chip {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 8px;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
}

.cadena-menu-ruta-color .ruta-flecha,
.ruta-turnos-relacionados .ruta-separador {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 900;
}

.cadena-menu-item.tiene-tramos {
    border-left-width: 5px;
}

.grupo-turno-0 .timeline-contenido,
.timeline-item.grupo-turno-0 .timeline-contenido {
    border-color: #93c5fd;
    background: #eff6ff;
}

.grupo-turno-0 .timeline-punto,
.timeline-item.grupo-turno-0 .timeline-punto {
    background: #2563eb;
    border-color: #bfdbfe;
}

.timeline-item.grupo-turno-0::after,
.cambio-turno-separador.grupo-turno-0 {
    color: #2563eb;
}

.grupo-turno-1 .timeline-contenido,
.timeline-item.grupo-turno-1 .timeline-contenido {
    border-color: #fdba74;
    background: #fff7ed;
}

.grupo-turno-1 .timeline-punto,
.timeline-item.grupo-turno-1 .timeline-punto {
    background: #ea580c;
    border-color: #fed7aa;
}

.timeline-item.grupo-turno-1::after,
.cambio-turno-separador.grupo-turno-1 {
    color: #ea580c;
}

.grupo-turno-2 .timeline-contenido,
.timeline-item.grupo-turno-2 .timeline-contenido {
    border-color: #c4b5fd;
    background: #f5f3ff;
}

.grupo-turno-2 .timeline-punto,
.timeline-item.grupo-turno-2 .timeline-punto {
    background: #7c3aed;
    border-color: #ddd6fe;
}

.timeline-item.grupo-turno-2::after,
.cambio-turno-separador.grupo-turno-2 {
    color: #7c3aed;
}

.grupo-turno-3 .timeline-contenido,
.timeline-item.grupo-turno-3 .timeline-contenido {
    border-color: #86efac;
    background: #f0fdf4;
}

.grupo-turno-3 .timeline-punto,
.timeline-item.grupo-turno-3 .timeline-punto {
    background: #16a34a;
    border-color: #bbf7d0;
}

.timeline-item.grupo-turno-3::after,
.cambio-turno-separador.grupo-turno-3 {
    color: #16a34a;
}

.grupo-turno-4 .timeline-contenido,
.timeline-item.grupo-turno-4 .timeline-contenido {
    border-color: #f9a8d4;
    background: #fdf2f8;
}

.grupo-turno-4 .timeline-punto,
.timeline-item.grupo-turno-4 .timeline-punto {
    background: #db2777;
    border-color: #fbcfe8;
}

.timeline-item.grupo-turno-4::after,
.cambio-turno-separador.grupo-turno-4 {
    color: #db2777;
}

.grupo-turno-5 .timeline-contenido,
.timeline-item.grupo-turno-5 .timeline-contenido {
    border-color: #fcd34d;
    background: #fffbeb;
}

.grupo-turno-5 .timeline-punto,
.timeline-item.grupo-turno-5 .timeline-punto {
    background: #d97706;
    border-color: #fde68a;
}

.timeline-item.grupo-turno-5::after,
.cambio-turno-separador.grupo-turno-5 {
    color: #d97706;
}

.grupo-turno-0.ruta-chip { color: #2563eb; background: #eff6ff; }
.grupo-turno-1.ruta-chip { color: #ea580c; background: #fff7ed; }
.grupo-turno-2.ruta-chip { color: #7c3aed; background: #f5f3ff; }
.grupo-turno-3.ruta-chip { color: #16a34a; background: #f0fdf4; }
.grupo-turno-4.ruta-chip { color: #db2777; background: #fdf2f8; }
.grupo-turno-5.ruta-chip { color: #d97706; background: #fffbeb; }

.timeline-contenido-doble {
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(360px, 1.1fr);
    gap: 18px;
    align-items: stretch;
}

.evento-principal {
    min-width: 0;
}

.evento-contexto {
    align-self: stretch;
    min-width: 340px;
    padding: 14px 16px;
    border-left: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.52);
    border-radius: 12px;
}

.evento-contexto h4 {
    margin: 0 0 10px;
    color: #334155;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.evento-contexto-fila {
    display: grid;
    grid-template-columns: minmax(120px, 0.42fr) minmax(0, 0.58fr);
    gap: 12px;
    padding: 5px 0;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    font-size: 13px;
}

.evento-contexto-fila:first-of-type {
    border-top: 0;
}

.evento-contexto-fila span {
    color: #64748b;
    font-weight: 700;
}

.evento-contexto-fila strong {
    color: #0f172a;
    font-weight: 800;
    line-height: 1.35;
}

.evento-contexto-fila.sin-dato strong {
    color: #b45309;
}

.evento-contexto-fuente {
    margin-top: 8px;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
}

.evento-fecha {
    font-variant-numeric: tabular-nums;
}

@media (max-width: 1180px) {
    .timeline-contenido-doble {
        grid-template-columns: minmax(0, 1fr);
    }

    .evento-contexto {
        min-width: 0;
        border-left: 0;
        border-top: 1px solid rgba(15, 23, 42, 0.08);
    }
}

@media (max-width: 700px) {
    .cambio-turno-contenido {
        border-radius: 14px;
    }

    .evento-contexto-fila {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}
